Skip to content

Commit

Permalink
Fixed opcodes 2A and 3A
Browse files Browse the repository at this point in the history
- They used to set the zero flag, which is not accurate
- They incremented/subtracted the a register instead
of the hl register
  • Loading branch information
velllu committed Nov 24, 2023
1 parent 7059443 commit 47ff050
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/cpu/opcodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,13 +325,13 @@ impl GameBoy {
0x6E => { self.load_ram_into_r(self.registers.get_hl(), OneByteRegister::L); (1, 2) },
0x7E => { self.load_ram_into_r(self.registers.get_hl(), OneByteRegister::A); (1, 2) },
0x2A => {
self.load_ram_into_r(self.registers.get_hl(), OneByteRegister::A);
self.increment_r(OneByteRegister::A, Operator::Inc, 1);
self.registers.a = self.bus[self.registers.get_hl()];
self.registers.increment_hl(1, Operator::Inc);
(1, 2)
},
0x3A => {
self.load_ram_into_r(self.registers.get_hl(), OneByteRegister::A);
self.increment_r(OneByteRegister::A, Operator::Sub, 1);
self.registers.a = self.bus[self.registers.get_hl()];
self.registers.increment_hl(1, Operator::Sub);
(1, 2)
},

Expand Down

0 comments on commit 47ff050

Please sign in to comment.