diff --git a/src/cpu/opcodes.rs b/src/cpu/opcodes.rs index f13b724..1f75175 100644 --- a/src/cpu/opcodes.rs +++ b/src/cpu/opcodes.rs @@ -134,16 +134,14 @@ impl GameBoy { // Bitwise operation functions impl GameBoy { fn bitwise_operation_r(&mut self, register: OneByteRegister, operation: BitwiseOperation) { - let register_a = *self.registers.get_r(OneByteRegister::A); - let register = self.registers.get_r(register); + let register = *self.registers.get_r(register); let result = match operation { - BitwiseOperation::Or => *register | register_a, - BitwiseOperation::Xor => *register ^ register_a, + BitwiseOperation::Or => register | self.registers.a, + BitwiseOperation::Xor => register ^ self.registers.a, }; - *register = result; - + self.registers.a = result; self.flags.update_zero_flag(result); } }