ror &= 31

This commit is contained in:
Matthew Berry 2020-10-18 11:53:30 -07:00
parent e64b17aea4
commit 860fc64b11

View file

@ -111,6 +111,7 @@ class CPU
# Rotate right # Rotate right
def ror(word : Word, bits : Int, set_conditions : Bool) : Word def ror(word : Word, bits : Int, set_conditions : Bool) : Word
log "ror - word:#{hex_str word}, bits:#{bits}" log "ror - word:#{hex_str word}, bits:#{bits}"
bits &= 31
return word if bits == 0 return word if bits == 0
@cpsr.carry = bit?(word, bits - 1) if set_conditions @cpsr.carry = bit?(word, bits - 1) if set_conditions
word >> bits | word << (32 - bits) word >> bits | word << (32 - bits)