arm fix negative branch offset

This commit is contained in:
Matthew Berry 2020-10-09 20:17:51 -07:00
parent cf156829e5
commit 71235e4b2a

View file

@ -2,8 +2,7 @@ module ARM
def arm_branch(instr : Word) : Nil
link = bit?(instr, 24)
offset = instr & 0xFFFFFF
offset = (~offset &+ 1).to_i32 if bit?(offset, 23) # negative
offset <<= 2
offset = (offset << 8).to_i32! >> 6
@r[14] = @r[15] - 4 if link
@r[15] &+= offset
clear_pipeline