simplify arm branch exchange logic

This commit is contained in:
Matthew Berry 2021-05-09 23:48:23 -07:00
parent bdda6b0509
commit 8b6f300f67

View file

@ -1,13 +1,9 @@
module GBA module GBA
module ARM module ARM
def arm_branch_exchange(instr : Word) : Nil def arm_branch_exchange(instr : Word) : Nil
rn = bits(instr, 0..3) address = @r[bits(instr, 0..3)]
if bit?(@r[rn], 0) @cpsr.thumb = bit?(address, 0)
@cpsr.thumb = true set_reg(15, address)
set_reg(15, @r[rn])
else
set_reg(15, @r[rn])
end
end end
end end
end end