mirror of
https://github.com/mattrberry/crab.git
synced 2025-01-29 20:35:13 +01:00
thumb add offset to stack pointer
This commit is contained in:
parent
7228a50427
commit
f1058e3450
2 changed files with 12 additions and 1 deletions
11
src/crab/thumb/add_offset_to_stack_pointer.cr
Normal file
11
src/crab/thumb/add_offset_to_stack_pointer.cr
Normal file
|
@ -0,0 +1,11 @@
|
|||
module THUMB
|
||||
def thumb_add_offset_to_stack_pointer(instr : Word) : Nil
|
||||
sign = bit?(instr, 7)
|
||||
offset = bits(instr, 0..6)
|
||||
if sign # negative
|
||||
@r[13] &-= (offset << 2)
|
||||
else # positive
|
||||
@r[13] &+= (offset << 2)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -19,7 +19,7 @@ module THUMB
|
|||
elsif idx & 0b11110110 == 0b10110100
|
||||
lut[idx] = ->thumb_push_pop_registers(Word)
|
||||
elsif idx & 0b11111111 == 0b10110000
|
||||
# add offset to stack pointer
|
||||
lut[idx] = ->thumb_add_offset_to_stack_pointer(Word)
|
||||
elsif idx & 0b11110000 == 0b10100000
|
||||
# load address
|
||||
elsif idx & 0b11110000 == 0b10010000
|
||||
|
|
Loading…
Add table
Reference in a new issue