diff --git a/src/crab/thumb/load_address.cr b/src/crab/thumb/load_address.cr index da96640..1ff9473 100644 --- a/src/crab/thumb/load_address.cr +++ b/src/crab/thumb/load_address.cr @@ -2,7 +2,7 @@ module THUMB def thumb_load_address(instr : Word) : Nil source = bit?(instr, 11) rd = bits(instr, 8..10) - word = bits(instr, 0..8) + word = bits(instr, 0..7) imm = word << 2 # Where the PC is used as the source register (SP = 0), bit 1 of the PC is always read as 0. set_reg(rd, (source ? @r[13] : @r[15] & ~2) &+ imm)