CPU status flag behavior

From NESdev Wiki
Revision as of 06:45, 11 June 2009 by Banshaku (talk | contribs) (Created page with '== Status Flag Behavior == The status register doesn't implement bits 4 and 5. The only way to test those bits would be to push the status on the stack, but any time the status ...')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Status Flag Behavior

The status register doesn't implement bits 4 and 5. The only way to test those bits would be to push the status on the stack, but any time the status is pushed on the stack, those bits are set to fixed values, as described below.

When an IRQ or NMI occurs, the current status with bit 4 clear and bit 5 set is pushed on the stack, then the I flag is set.

PHP and BRK push the current status with bits 4 and 5 set on the stack; BRK then sets the I flag.

RTI and PLP set the status to the byte popped off the stack.