Skip to content

Commit

Permalink
stay on HALT until an interrupt happens
Browse files Browse the repository at this point in the history
  • Loading branch information
skyfloogle committed Dec 14, 2024
1 parent 3989be8 commit d9276d0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion source/3ds/drc_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1380,7 +1380,7 @@ static int drc_translateBlock(void) {
reg2_modified = true;
break;
case V810_OP_HALT: // halt
HALT(inst_cache[i].PC + 2);
HALT(inst_cache[i].PC);
break;
case V810_OP_BSTR:
MOV_I(2, 31, 0);
Expand Down
5 changes: 5 additions & 0 deletions source/common/v810_cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,11 @@ bool v810_int(WORD iNum, WORD PC) {
if((v810_state->S_REG[PSW] & PSW_ID)) return false; // Interupt disabled
if(iNum < ((v810_state->S_REG[PSW] & PSW_IA)>>16)) return false; // Interupt to low on the chain

// if an interrupt happened, skip a HALT instruction if we're on one
if ((mem_rhword(PC) >> 10) == V810_OP_HALT) {
PC += 2;
}

//Ready to Generate the Interupts
v810_state->S_REG[EIPC] = PC;
v810_state->S_REG[EIPSW] = v810_state->S_REG[PSW];
Expand Down

0 comments on commit d9276d0

Please sign in to comment.