all repos — mgba @ 3e57e4604688894f710f8ac81091054e613b9803

mGBA Game Boy Advance Emulator

Implement ADD(2)
Jeffrey Pfau jeffrey@endrift.com
Fri, 12 Apr 2013 21:48:19 -0700
commit

3e57e4604688894f710f8ac81091054e613b9803

parent

b5182915d75c1d4ef055d0ab040356e4836bc7ea

1 files changed, 11 insertions(+), 1 deletions(-)

jump to
M src/isa-thumb.csrc/isa-thumb.c

@@ -16,6 +16,12 @@

// Instruction definitions // Beware pre-processor insanity +#define THUMB_ADDITION_S(M, N, D) \ + cpu->cpsr.n = ARM_SIGN(D); \ + cpu->cpsr.z = !(D); \ + cpu->cpsr.c = ARM_CARRY_FROM(M, N, D); \ + cpu->cpsr.v = ARM_V_ADDITION(M, N, D); \ + #define THUMB_NEUTRAL_S(M, N, D) \ cpu->cpsr.n = ARM_SIGN(D); \ cpu->cpsr.z = !(D);

@@ -133,7 +139,11 @@

#define DEFINE_DATA_FORM_3_INSTRUCTION_THUMB(NAME, BODY) \ COUNT_3(DEFINE_DATA_FORM_3_INSTRUCTION_EX_THUMB, NAME ## _R, BODY) -DEFINE_DATA_FORM_3_INSTRUCTION_THUMB(ADD2, ARM_STUB) +DEFINE_DATA_FORM_3_INSTRUCTION_THUMB(ADD2, \ + int d = cpu->gprs[rd]; \ + cpu->gprs[rd] = d + immediate; \ + THUMB_ADDITION_S(d, immediate, cpu->gprs[rd])) + DEFINE_DATA_FORM_3_INSTRUCTION_THUMB(CMP1, ARM_STUB) DEFINE_DATA_FORM_3_INSTRUCTION_THUMB(MOV1, cpu->gprs[rd] = immediate; THUMB_NEUTRAL_S(, , cpu->gprs[rd])) DEFINE_DATA_FORM_3_INSTRUCTION_THUMB(SUB2, ARM_STUB)