mirror of
https://github.com/mattrberry/crab.git
synced 2025-01-15 03:40:56 +01:00
fix thumb long branch link weird sign logic
This commit is contained in:
parent
a5ebfd603c
commit
c589e8f6ef
1 changed files with 5 additions and 4 deletions
|
@ -3,12 +3,13 @@ module THUMB
|
|||
second_instr = bit?(instr, 11)
|
||||
offset = bits(instr, 0..10)
|
||||
if second_instr
|
||||
@r[14] &+= (offset << 1)
|
||||
@r[15], @r[14] = @r[14], @r[15] - 1
|
||||
temp = @r[15] &- 2
|
||||
@r[15] = @r[14] &+ (offset << 1)
|
||||
@r[14] = temp | 1
|
||||
clear_pipeline
|
||||
else
|
||||
offset = (offset << 5).to_i16! >> 5 # todo make this just bit math
|
||||
@r[14] = @r[15] &+ (offset << 12)
|
||||
offset = (offset << 5).to_i16! >> 5
|
||||
@r[14] = @r[15] &+ (offset.to_u32 << 12)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue