Difference between revisions of "Processor Status Register"

From NES Hacker Wiki
Jump to: navigation, search
 
Line 3: Line 3:
 
As [[Instruction|instructions]] are executed, they have the possibility of altering flags based on the [[opcode]]. These alterations can either Change, Ignore, Set, or Clear a flag.
 
As [[Instruction|instructions]] are executed, they have the possibility of altering flags based on the [[opcode]]. These alterations can either Change, Ignore, Set, or Clear a flag.
  
* '''Change''' - This flag will either be set or cleared based on the operand.
+
{| class="wikitable" |
* '''Ignore''' - This flag will not change.
+
! Status !! Icon !! Description
* '''Set''' - This flag will always be set to on, that is, have a value of 1.
+
|-
* '''Clear''' - This flag will always be set to off, that is, have a value of 0.
+
| '''Change''' || [[Image:Status-Change.png]] || This flag will either be set or cleared based on the operand.
 +
|-
 +
| '''Ignore''' || [[Image:Status-Ignore.png]] || This flag will not change.
 +
|-
 +
| '''Set''' || [[Image:Status-Set.png]] || This flag will always be set to on, that is, have a value of 1.
 +
|-
 +
| '''Clear''' || [[Image:Status-Clear.png]] || This flag will always be set to off, that is, have a value of 0.
 +
|}
  
 
{| class="wikitable" |
 
{| class="wikitable" |

Latest revision as of 23:31, 4 June 2018

The Processor Status Register (P) is a 1 byte register with each bit representing a flag. These flags are used to indicate whether something has or has not occurred based on the result of an instruction.

As instructions are executed, they have the possibility of altering flags based on the opcode. These alterations can either Change, Ignore, Set, or Clear a flag.

Status Icon Description
Change Status-Change.png This flag will either be set or cleared based on the operand.
Ignore Status-Ignore.png This flag will not change.
Set Status-Set.png This flag will always be set to on, that is, have a value of 1.
Clear Status-Clear.png This flag will always be set to off, that is, have a value of 0.
Bit # Flag
7 N - Negative Flag
6 V - Overflow Flag
5 1 - Always 1 Flag
4 B - Break Flag
3 D - Decimal Flag
2 I - Interrupt Flag
1 Z - Zero Flag
0 C - Carry Flag