all repos — mgba @ 14100f19d15a7360c42bde4eaf69ec1e5c6ae4b1

mGBA Game Boy Advance Emulator

Implement LSL(2)
Jeffrey Pfau jeffrey@endrift.com
Sat, 20 Apr 2013 18:03:48 -0700
commit

14100f19d15a7360c42bde4eaf69ec1e5c6ae4b1

parent

0bfb77106bf5f9d92b72089e8c3c639320fe2cab

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

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

@@ -196,7 +196,23 @@ BODY;)

DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(AND, cpu->gprs[rd] = cpu->gprs[rd] & cpu->gprs[rn]; THUMB_NEUTRAL_S( , , cpu->gprs[rd])) DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(EOR, cpu->gprs[rd] = cpu->gprs[rd] ^ cpu->gprs[rn]; THUMB_NEUTRAL_S( , , cpu->gprs[rd])) -DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(LSL2, ARM_STUB) +DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(LSL2, + int rs = cpu->gprs[rn] & 0xFF; + if (rs) { + if (rs < 32) { + cpu->cpsr.c = cpu->gprs[rd] & (1 << (32 - rs)); + cpu->gprs[rd] <<= rs; + } else { + if (rs > 32) { + cpu->cpsr.c = 0; + } else { + cpu->cpsr.c = cpu->gprs[rd] & 0x00000001; + } + cpu->gprs[rd] = 0; + } + } + THUMB_NEUTRAL_S( , , cpu->gprs[rd])) + DEFINE_DATA_FORM_5_INSTRUCTION_THUMB(LSR2, int rs = cpu->gprs[rn] & 0xFF; if (rs) {