mirror of https://github.com/mgba-emu/mgba.git
LR35902: Implement LD (a16), SP and ADD SP, r8
This commit is contained in:
parent
781f3f76f1
commit
2322e942c4
|
@ -18,7 +18,7 @@
|
|||
DECLARE_INSTRUCTION_LR35902(EMITTER, DECB), \
|
||||
DECLARE_INSTRUCTION_LR35902(EMITTER, LDB_), \
|
||||
DECLARE_INSTRUCTION_LR35902(EMITTER, RLCA_), \
|
||||
DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \
|
||||
DECLARE_INSTRUCTION_LR35902(EMITTER, LDISP), \
|
||||
DECLARE_INSTRUCTION_LR35902(EMITTER, ADDHL_BC), \
|
||||
DECLARE_INSTRUCTION_LR35902(EMITTER, LDA_BC), \
|
||||
DECLARE_INSTRUCTION_LR35902(EMITTER, DECBC), \
|
||||
|
@ -242,7 +242,7 @@
|
|||
DECLARE_INSTRUCTION_LR35902(EMITTER, PUSHHL), \
|
||||
DECLARE_INSTRUCTION_LR35902(EMITTER, AND), \
|
||||
DECLARE_INSTRUCTION_LR35902(EMITTER, RST20), \
|
||||
DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \
|
||||
DECLARE_INSTRUCTION_LR35902(EMITTER, ADDSP), \
|
||||
DECLARE_INSTRUCTION_LR35902(EMITTER, JPHL), \
|
||||
DECLARE_INSTRUCTION_LR35902(EMITTER, LDIA), \
|
||||
DECLARE_INSTRUCTION_LR35902(EMITTER, STUB), \
|
||||
|
|
|
@ -310,6 +310,24 @@ DEFINE_ALU_INSTRUCTION_LR35902(ADC);
|
|||
DEFINE_ALU_INSTRUCTION_LR35902(SUB);
|
||||
DEFINE_ALU_INSTRUCTION_LR35902(SBC);
|
||||
|
||||
DEFINE_INSTRUCTION_LR35902(ADDSPFinish,
|
||||
cpu->sp = cpu->index;
|
||||
cpu->executionState = LR35902_CORE_STALL;)
|
||||
|
||||
DEFINE_INSTRUCTION_LR35902(ADDSPDelay,
|
||||
int diff = cpu->sp + (int8_t) cpu->bus;
|
||||
cpu->index = diff;
|
||||
cpu->executionState = LR35902_CORE_OP2;
|
||||
cpu->instruction = _LR35902InstructionADDSPFinish;
|
||||
cpu->f.z = 0;
|
||||
cpu->f.n = 0;
|
||||
cpu->f.c = !!(diff & 0xFFFF0000);
|
||||
/* Figure out h flag*/)
|
||||
|
||||
DEFINE_INSTRUCTION_LR35902(ADDSP,
|
||||
cpu->executionState = LR35902_CORE_READ_PC;
|
||||
cpu->instruction = _LR35902InstructionADDSPDelay;)
|
||||
|
||||
DEFINE_INSTRUCTION_LR35902(LDBCDelay, \
|
||||
cpu->c = cpu->bus; \
|
||||
cpu->executionState = LR35902_CORE_READ_PC; \
|
||||
|
@ -445,6 +463,27 @@ DEFINE_INSTRUCTION_LR35902(LDIOA, \
|
|||
cpu->executionState = LR35902_CORE_READ_PC; \
|
||||
cpu->instruction = _LR35902InstructionLDIOADelay;)
|
||||
|
||||
DEFINE_INSTRUCTION_LR35902(LDISPStoreH,
|
||||
++cpu->index;
|
||||
cpu->bus = cpu->sp >> 8;
|
||||
cpu->executionState = LR35902_CORE_MEMORY_STORE;
|
||||
cpu->instruction = _LR35902InstructionNOP;)
|
||||
|
||||
DEFINE_INSTRUCTION_LR35902(LDISPStoreL,
|
||||
cpu->index |= cpu->bus << 8;
|
||||
cpu->bus = cpu->sp;
|
||||
cpu->executionState = LR35902_CORE_MEMORY_STORE;
|
||||
cpu->instruction = _LR35902InstructionLDISPStoreH;)
|
||||
|
||||
DEFINE_INSTRUCTION_LR35902(LDISPReadAddr,
|
||||
cpu->index = cpu->bus;
|
||||
cpu->executionState = LR35902_CORE_READ_PC;
|
||||
cpu->instruction = _LR35902InstructionLDISPStoreL;)
|
||||
|
||||
DEFINE_INSTRUCTION_LR35902(LDISP,
|
||||
cpu->executionState = LR35902_CORE_READ_PC;
|
||||
cpu->instruction = _LR35902InstructionLDISPReadAddr;)
|
||||
|
||||
#define DEFINE_INCDEC_WIDE_INSTRUCTION_LR35902(REG) \
|
||||
DEFINE_INSTRUCTION_LR35902(INC ## REG, \
|
||||
uint16_t reg = LR35902Read ## REG (cpu); \
|
||||
|
|
Loading…
Reference in New Issue