mirror of
https://github.com/mattrberry/crab.git
synced 2025-02-05 08:45:50 +01:00
arm fix negative branch offset
This commit is contained in:
parent
cf156829e5
commit
71235e4b2a
1 changed files with 1 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue