all repos — mgba @ 9f77c323757a3ac8c26867ceb57512cd9773325f

mGBA Game Boy Advance Emulator

Implement ADD(1)
Jeffrey Pfau jeffrey@endrift.com
Fri, 12 Apr 2013 22:17:37 -0700
commit

9f77c323757a3ac8c26867ceb57512cd9773325f

parent

d7ddbee448e2bdcc8f2e28ceb6fb73a262654834

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

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

@@ -122,12 +122,18 @@

#define DEFINE_DATA_FORM_2_INSTRUCTION_EX_THUMB(NAME, IMMEDIATE, BODY) \ DEFINE_INSTRUCTION_THUMB(NAME, \ int immediate = IMMEDIATE; \ + int rd = opcode & 0x0007; \ + int rn = (opcode >> 3) & 0x0007; \ BODY;) #define DEFINE_DATA_FORM_2_INSTRUCTION_THUMB(NAME, BODY) \ COUNT_3(DEFINE_DATA_FORM_2_INSTRUCTION_EX_THUMB, NAME ## 1_, BODY) -DEFINE_DATA_FORM_2_INSTRUCTION_THUMB(ADD, ARM_STUB) +DEFINE_DATA_FORM_2_INSTRUCTION_THUMB(ADD, \ + int n = cpu->gprs[rn]; \ + cpu->gprs[rd] = n + immediate; \ + THUMB_ADDITION_S(n, immediate, cpu->gprs[rd])) + DEFINE_DATA_FORM_2_INSTRUCTION_THUMB(SUB, ARM_STUB) #define DEFINE_DATA_FORM_3_INSTRUCTION_EX_THUMB(NAME, RD, BODY) \