fix: only add +4 to rn register when dealing with r15

This commit is contained in:
Rekai Nyangadzayi Musuka 2022-07-13 02:53:21 -03:00
parent 6da9e965bb
commit 348df3dbe4
1 changed files with 1 additions and 1 deletions

View File

@ -15,7 +15,7 @@ pub fn halfAndSignedDataTransfer(comptime P: bool, comptime U: bool, comptime I:
const rm = opcode & 0xF;
const imm_offset_high = opcode >> 8 & 0xF;
const base = cpu.r[rn] + if (!L) 4 else @as(u32, 0);
const base = cpu.r[rn] + if (!L and rn == 0xF) 4 else @as(u32, 0);
const offset = if (I) imm_offset_high << 4 | rm else cpu.r[rm];
const modified_base = if (U) base +% offset else base -% offset;