mirror of
https://github.com/mattrberry/crab.git
synced 2024-12-31 10:23:42 +01:00
thumb load address
This commit is contained in:
parent
e8de35e27e
commit
f9c8ae7668
2 changed files with 10 additions and 1 deletions
9
src/crab/thumb/load_address.cr
Normal file
9
src/crab/thumb/load_address.cr
Normal file
|
@ -0,0 +1,9 @@
|
|||
module THUMB
|
||||
def thumb_load_address(instr : Word) : Nil
|
||||
source = bit?(instr, 11)
|
||||
rd = bits(instr, 8..10)
|
||||
word = bits(instr, 0..8)
|
||||
imm = word << 2
|
||||
@r[rd] = (source ? @r[13] : @r[15]) &+ imm
|
||||
end
|
||||
end
|
|
@ -21,7 +21,7 @@ module THUMB
|
|||
elsif idx & 0b11111111 == 0b10110000
|
||||
lut[idx] = ->thumb_add_offset_to_stack_pointer(Word)
|
||||
elsif idx & 0b11110000 == 0b10100000
|
||||
# load address
|
||||
lut[idx] = ->thumb_load_address(Word)
|
||||
elsif idx & 0b11110000 == 0b10010000
|
||||
lut[idx] = ->thumb_sp_relative_load_store(Word)
|
||||
elsif idx & 0b11110000 == 0b10000000
|
||||
|
|
Loading…
Reference in a new issue