asr simply return the word if the shift is 0

This commit is contained in:
Matthew Berry 2020-10-18 11:38:56 -07:00
parent c6a1db4f6c
commit e64b17aea4

View file

@ -103,7 +103,7 @@ class CPU
# Arithmetic shift right # Arithmetic shift right
def asr(word : Word, bits : Int, set_conditions : Bool) : Word def asr(word : Word, bits : Int, set_conditions : Bool) : Word
log "asr - word:#{hex_str word}, bits:#{bits}" log "asr - word:#{hex_str word}, bits:#{bits}"
bits = 32 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 | (0xFFFFFFFF_u32 &* (word >> 31)) << (32 - bits) word >> bits | (0xFFFFFFFF_u32 &* (word >> 31)) << (32 - bits)
end end