fix thumb add not setting value, rename var in thumb multiple load/store

This commit is contained in:
Matthew Berry 2020-09-30 22:03:33 -07:00
parent 4194dfb6fd
commit 843fb155df
2 changed files with 3 additions and 3 deletions

View file

@ -7,7 +7,7 @@ module THUMB
case op
when 0b00 then res = @r[rd] = offset
when 0b01 then res = sub(@r[rd], offset, true)
when 0b10 then res = add(@r[rd], offset, true)
when 0b10 then res = @r[rd] = add(@r[rd], offset, true)
when 0b11 then res = @r[rd] = sub(@r[rd], offset, true)
else raise "Invalid move/compare/add/subtract op: #{op}"
end

View file

@ -1,10 +1,10 @@
module THUMB
def thumb_multiple_load_store(instr : Word) : Nil
load_from_memory = bit?(instr, 11)
load = bit?(instr, 11)
rb = bits(instr, 8..10)
list = bits(instr, 0..7)
address = @r[rb]
if load_from_memory # ldmia
if load # ldmia
8.times do |idx|
if bit?(list, idx)
@r[idx] = @gba.bus.read_word(address)