OneLoneCoder / olcNES

NES Emulator, and Tutorial Video Code
1.36k stars 229 forks source link

PHP instruction execution fix #29

Closed mr-mocap closed 3 years ago

mr-mocap commented 4 years ago

After the PHP instruction is executed, bits 4 & 5 are supposed to be set on the byte pushed onto the stack. Instead, bits 5 & 6 are. If you look at the way the status flags are represented for those 2 bits (1 << 4) & (1 << 5), it is possible that an oversight was made in the implementation of the instruction originally. In addition, the status register should remain unchanged. The U (unused) bit is changed, which isn't really an issue since nothing is supposed to reference it (it is UNUSED, after all).

For reference: https://wiki.nesdev.com/w/index.php/Status_flags https://www.masswerk.at/6502/6502_instruction_set.html#LSR

mr-mocap commented 3 years ago

Well, it looks like I misunderstood. The bits are correct. It was my understanding that was in error. This pull request can be closed without further action.