thumb load address

This commit is contained in:
Matthew Berry 2020-10-11 13:33:04 -07:00
parent e8de35e27e
commit f9c8ae7668
2 changed files with 10 additions and 1 deletions

View 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

View file

@ -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