Quantcast
Channel: nesdev.org
Viewing all articles
Browse latest Browse all 746

How does the PLA instruction work exactly?

$
0
0
Hi, sorry if this is a noob question but this is my first time developing an emulator/working with the NES.

I am currently writing the CPU part of the emulator and am using the nestest rom to do so, and comparing this log (http://www.qmtpro.com/~nes/misc/nestest.log) to my own, but there is one part I don't really understand:

Code:

C7E7  08        PHP                             A:00 X:00 Y:00 P:6F SP:FB PPU:  1,214 CYC:185C7E8  68        PLA                             A:00 X:00 Y:00 P:6F SP:FA PPU:  1,223 CYC:188C7E9  29 EF     AND #$EF                        A:7F X:00 Y:00 P:6D SP:FB PPU:  1,235 CYC:192
In this code we push P (6F) to stack, and then pop it and put it inside A. So why does A become 7F and not 6F? I also looked at this resource (http://www.zimmers.net/anonftp/pub/cbm/ ... data/64doc) to check for correctness but couldn't find the reason why A becomes 7F. Thanks in advance for any help :D

Statistics: Posted by LeonUPazz — Sat Jun 08, 2024 6:47 am — Replies 4 — Views 154



Viewing all articles
Browse latest Browse all 746

Trending Articles