thumb pc relative load

This commit is contained in:
Matthew Berry 2020-09-27 16:58:22 -07:00
parent cbc140b7c4
commit eb5d932579
2 changed files with 8 additions and 1 deletions

View file

@ -0,0 +1,7 @@
module THUMB
def thumb_pc_relative_load(instr : Word) : Nil
imm = bits(instr, 0..7)
rd = bits(instr, 8..10)
@r[rd] = @gba.bus.read_word((@r[15] & ~2) + (imm << 2))
end
end

View file

@ -33,7 +33,7 @@ module THUMB
elsif idx & 0b11110010 == 0b01010000
# load/store with register offset
elsif idx & 0b11111000 == 0b01001000
# pc-relative load
lut[idx] = ->thumb_pc_relative_load(Word)
elsif idx & 0b11111100 == 0b01000100
# hi register operations / branch exchange
elsif idx & 0b11111100 == 0b01000000