all repos — mgba @ 21ee7946f1bb5c4f5bfe7caac642cfeeb487e742

mGBA Game Boy Advance Emulator

Implement LSL(1)
Jeffrey Pfau jeffrey@endrift.com
Fri, 12 Apr 2013 20:00:14 -0700
commit

21ee7946f1bb5c4f5bfe7caac642cfeeb487e742

parent

71c68fe79f380fa6e1a33809752d5a912dca75c6

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

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

@@ -76,12 +76,22 @@

#define DEFINE_IMMEDIATE_5_INSTRUCTION_EX_THUMB(NAME, IMMEDIATE, BODY) \ DEFINE_INSTRUCTION_THUMB(NAME, \ int immediate = IMMEDIATE; \ + int rd = opcode & 0x0007; \ + int rm = (opcode >> 3) & 0x0007; \ BODY;) #define DEFINE_IMMEDIATE_5_INSTRUCTION_THUMB(NAME, BODY) \ COUNT_5(DEFINE_IMMEDIATE_5_INSTRUCTION_EX_THUMB, NAME ## _, BODY) -DEFINE_IMMEDIATE_5_INSTRUCTION_THUMB(LSL1, ARM_STUB) +DEFINE_IMMEDIATE_5_INSTRUCTION_THUMB(LSL1, \ + if (!immediate) { \ + cpu->gprs[rd] = cpu->gprs[rm]; \ + } else { \ + cpu->cpsr.c = cpu->gprs[rm] & (1 << (32 - immediate)); \ + cpu->gprs[rd] = cpu->gprs[rm] << immediate; \ + } \ + THUMB_NEUTRAL_S( , , cpu->gprs[rd]);) + DEFINE_IMMEDIATE_5_INSTRUCTION_THUMB(LSR1, ARM_STUB) DEFINE_IMMEDIATE_5_INSTRUCTION_THUMB(ASR1, ARM_STUB)