CPU status flag behavior: Difference between revisions

From NESdev Wiki
Jump to navigationJump to search
m (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 ...')
 
Line 1: Line 1:
== 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.
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.



Revision as of 06:58, 11 June 2009

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.