gbdev / gb-opcodes

https://gbdev.io/gb-opcodes/optables/
Creative Commons Zero v1.0 Universal
24 stars 10 forks source link

Correct Rotate `A` register instructions Z flag #12

Closed 64kramsystem closed 3 years ago

64kramsystem commented 3 years ago

According to the GameBoy CPU Manual (but this is also verifiable by comparing with the general-register counterparts, e.g. RLC r), when performing a rotation (through carry or not) on the A register, the Z flag is set according to the result.

Instructions: RRA, RLA, RRCA, RLCA.

Closes #13.

64kramsystem commented 3 years ago

Updated with other instructions, since I've found that the issue is present in the entire Rotate register A family.

AntonioND commented 3 years ago

The GB manual is wrong, the 2 byte instructions work in a different way than the 1 byte instructions.

That manual has lots of errata like that one, you shouldn't use it.

avivace commented 3 years ago

As mentioned, you shouldn't use the "GameBoy CPU Manual" as source as it's inaccurate in many opcode descriptions.