Implement ASR(1)

This commit is contained in:
Jeffrey Pfau 2013-04-16 23:22:01 -07:00
parent 8c03c20019
commit 6b07dd33af
1 changed files with 13 additions and 1 deletions

View File

@ -127,7 +127,19 @@ DEFINE_IMMEDIATE_5_INSTRUCTION_THUMB(LSR1,
}
THUMB_NEUTRAL_S( , , cpu->gprs[rd]);)
DEFINE_IMMEDIATE_5_INSTRUCTION_THUMB(ASR1, ARM_STUB)
DEFINE_IMMEDIATE_5_INSTRUCTION_THUMB(ASR1,
if (!immediate) {
cpu->cpsr.c = ARM_SIGN(cpu->gprs[rm]);
if (cpu->cpsr.c) {
cpu->gprs[rd] = 0xFFFFFFFF;
} else {
cpu->gprs[rd] = 0;
}
} else {
cpu->cpsr.c = cpu->gprs[rm] & (1 << (immediate - 1));
cpu->gprs[rd] = cpu->gprs[rm] >> immediate;
}
THUMB_NEUTRAL_S( , , cpu->gprs[rd]);)
DEFINE_IMMEDIATE_5_INSTRUCTION_THUMB(LDR1, cpu->gprs[rd] = cpu->memory->load32(cpu->memory, cpu->gprs[rm] + immediate * 4))
DEFINE_IMMEDIATE_5_INSTRUCTION_THUMB(LDRB1, cpu->gprs[rd] = cpu->memory->loadU8(cpu->memory, cpu->gprs[rm] + immediate))