diff --git a/src/crab/cpu.cr b/src/crab/cpu.cr index cec0b27..19e2491 100644 --- a/src/crab/cpu.cr +++ b/src/crab/cpu.cr @@ -103,7 +103,7 @@ class CPU # Arithmetic shift right def asr(word : Word, bits : Int, set_conditions : Bool) : Word 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 word >> bits | (0xFFFFFFFF_u32 &* (word >> 31)) << (32 - bits) end