From 8ec8645ca2f617b8f467a7c1d290185bcfd643cd Mon Sep 17 00:00:00 2001 From: Matthew Berry Date: Wed, 4 Nov 2020 22:32:37 -0800 Subject: [PATCH] thumb laod address fix word bits selection --- src/crab/thumb/load_address.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)