thumb move shifted register (- carry flag)

diverges from armwrestler here bc of carry flag
This commit is contained in:
Matthew Berry 2020-09-27 17:00:21 -07:00
parent eb5d932579
commit 55589ea0b0
2 changed files with 18 additions and 1 deletions

View file

@ -0,0 +1,17 @@
module THUMB
def thumb_move_shifted_register(instr : Word) : Nil
# todo carry flags (currently first divergence on armwrestler)
op = bits(instr, 11..12)
offset = bits(instr, 6..10)
rs = bits(instr, 3..5)
rd = bits(instr, 0..2)
@r[rd] = case op
when 0b00 then @r[rs] << offset
when 0b01 then @r[rs] >> offset
when 0b10 then @r[rs] // (2 ** offset)
else raise "Invalid shifted register op: #{op}"
end
@cpsr.zero = @r[rd] == 0
@cpsr.negative = bit?(@r[rd], 31)
end
end

View file

@ -43,7 +43,7 @@ module THUMB
elsif idx & 0b11111100 == 0b00011000 elsif idx & 0b11111100 == 0b00011000
# add/subtract # add/subtract
elsif idx & 0b11100000 == 0b00000000 elsif idx & 0b11100000 == 0b00000000
# move shifted register lut[idx] = ->thumb_move_shifted_register(Word)
end end
end end
lut lut