mirror of
https://github.com/Lime3DS/Lime3DS
synced 2024-12-26 09:02:44 -06:00
dyncom: Fix ADC overflow flag setting
This commit is contained in:
parent
b33380ca59
commit
d2a05bbbc6
1 changed files with 12 additions and 8 deletions
|
@ -4005,10 +4005,14 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
|
||||||
{
|
{
|
||||||
adc_inst *inst_cream = (adc_inst *)inst_base->component;
|
adc_inst *inst_cream = (adc_inst *)inst_base->component;
|
||||||
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
|
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
|
||||||
lop = RN;
|
u32 left = RN;
|
||||||
unsigned int sht_op = SHIFTER_OPERAND;
|
u32 right = SHIFTER_OPERAND;
|
||||||
rop = SHIFTER_OPERAND + cpu->CFlag;
|
|
||||||
RD = dst = lop + rop;
|
u64 unsigned_sum = (left + right + cpu->CFlag);
|
||||||
|
s64 signed_sum = (s64)(s32)left + (s64)(s32)right + (s64)cpu->CFlag;
|
||||||
|
u32 result = (unsigned_sum & 0xFFFFFFFF);
|
||||||
|
|
||||||
|
RD = result;
|
||||||
if (inst_cream->S && (inst_cream->Rd == 15)) {
|
if (inst_cream->S && (inst_cream->Rd == 15)) {
|
||||||
if (CurrentModeHasSPSR) {
|
if (CurrentModeHasSPSR) {
|
||||||
cpu->Cpsr = cpu->Spsr_copy;
|
cpu->Cpsr = cpu->Spsr_copy;
|
||||||
|
@ -4016,10 +4020,10 @@ unsigned InterpreterMainLoop(ARMul_State* state) {
|
||||||
LOAD_NZCVT;
|
LOAD_NZCVT;
|
||||||
}
|
}
|
||||||
} else if (inst_cream->S) {
|
} else if (inst_cream->S) {
|
||||||
UPDATE_NFLAG(dst);
|
UPDATE_NFLAG(result);
|
||||||
UPDATE_ZFLAG(dst);
|
UPDATE_ZFLAG(result);
|
||||||
UPDATE_CFLAG_CARRY_FROM_ADD(lop, sht_op, cpu->CFlag);
|
UPDATE_CFLAG_CARRY_FROM_ADD(left, right, cpu->CFlag);
|
||||||
UPDATE_VFLAG((int)dst, (int)lop, (int)rop);
|
cpu->VFlag = ((s64)(s32)result != signed_sum);
|
||||||
}
|
}
|
||||||
if (inst_cream->Rd == 15) {
|
if (inst_cream->Rd == 15) {
|
||||||
INC_PC(sizeof(adc_inst));
|
INC_PC(sizeof(adc_inst));
|
||||||
|
|
Loading…
Reference in a new issue