LR35902: Fix RST timing

This commit is contained in:
Jeffrey Pfau 2016-01-27 21:44:23 -08:00
parent da62e772a4
commit b9e6ac954d
1 changed files with 8 additions and 6 deletions

View File

@ -741,18 +741,20 @@ DEFINE_INSTRUCTION_LR35902(HALT, cpu->irqh.halt(cpu));
#define DEFINE_RST_INSTRUCTION_LR35902(VEC) \ #define DEFINE_RST_INSTRUCTION_LR35902(VEC) \
DEFINE_INSTRUCTION_LR35902(RST ## VEC ## UpdateSPL, \ DEFINE_INSTRUCTION_LR35902(RST ## VEC ## UpdateSPL, \
--cpu->sp; \
cpu->index = cpu->sp; \
cpu->bus = cpu->pc; \
cpu->pc = 0x ## VEC; \ cpu->pc = 0x ## VEC; \
cpu->executionState = LR35902_CORE_STALL;) \ cpu->executionState = LR35902_CORE_MEMORY_STORE; \
cpu->instruction = _LR35902InstructionNOP;) \
DEFINE_INSTRUCTION_LR35902(RST ## VEC ## UpdateSPH, \ DEFINE_INSTRUCTION_LR35902(RST ## VEC ## UpdateSPH, \
cpu->index = cpu->sp + 1; \ --cpu->sp;\
cpu->index = cpu->sp; \
cpu->bus = cpu->pc >> 8; \ cpu->bus = cpu->pc >> 8; \
cpu->executionState = LR35902_CORE_MEMORY_STORE; \ cpu->executionState = LR35902_CORE_MEMORY_STORE; \
cpu->instruction = _LR35902InstructionRST ## VEC ## UpdateSPL;) \ cpu->instruction = _LR35902InstructionRST ## VEC ## UpdateSPL;) \
DEFINE_INSTRUCTION_LR35902(RST ## VEC, \ DEFINE_INSTRUCTION_LR35902(RST ## VEC, \
cpu->sp -= 2; /* TODO: Atomic incrementing? */ \ cpu->executionState = LR35902_CORE_OP2; \
cpu->index = cpu->sp; \
cpu->bus = cpu->pc; \
cpu->executionState = LR35902_CORE_MEMORY_STORE; \
cpu->instruction = _LR35902InstructionRST ## VEC ## UpdateSPH;) cpu->instruction = _LR35902InstructionRST ## VEC ## UpdateSPH;)
DEFINE_RST_INSTRUCTION_LR35902(00); DEFINE_RST_INSTRUCTION_LR35902(00);