COMMODORE PLUS/4 WORLD
  Home  Search  Games  Tapes  Covers  Cheats  Maps  Software  New Stuff 
 Hall Of Fame  Game Endings  Features  Solutions  Remakes  Publications  Magazines  Effects  Top List 
 Members  Groups  Plus/4 Encyclopedia  Hardware  Tools  Options  Forum 
Login
Plus/4 EncyclopediaFirstBackNextLast

6502 Registers
Category
Reference/6502 Programming/Assembly

Topic
6502 registers

The 6502 series microprocessors have the following registers:

- 1 8-bit accumulator (AC) register for arithmetic and binary operations
- 2 8-bit index registers (XR, YR) for memory addressing
- 1 16-bit program counter register (PC) that holds the address of the current instruction
- 1 16-bit stack pointer register (SP) which show the current address for the LIFO stack. The stack size is actually 256 bytes because the MSB of the SP is always $01 and only the LSB is modifiable with TXS instruction.
- 1 8-bit status register (SR) with 1 unused bit (bit 5), 2 control bits (I, D) and 5 status bits (N, V, B, Z, C). Conditional jumps are based on these status bits.


Status register:

Bit 7 - Negative
Type: status

Shows the sign of the last arithmetic (or BIT operation's result).
1 - result is negative (result bit 7 is on)
0 - result is positive (result bit 7 is off)

Conditional jumps:
BPL, BMI


Bit 6 - Overflow
Type: status

Shows the overflow from bit 6 to 7 on the last arithmetic (or BIT operation's result.
1 - overflow occured
0 - no overflow

Conditional jumps:
BVC, BVS


Bit 5 - Unused
Type: unused

This bit is unused, value is always one.


Bit 4 - Break
Type: status

This bit shows the cause of the last processor interrupt. It's value is valid inside an interrupt routine only.

1 - BRK instruction caused the interrupt.
0 - Hardware interrupt occured.


Bit 3 - Decimal mode
Type: control

This bit controls the behaviour of the arithmetic operations ADC and SBC (BCD or binary mode).

1 - BCD(Binary coded decimal) mode is set ($09+$01=$10)
0 - Binary mode is set ($09+$01=$0A)

This flag can be set by:
CLD, SED


Bit 2 - Interrupt disable
Type: control

This bits state enables or disables hardware interrupts.

1 - Hardware interrupts are disabled, only BRK can cause interrupt. Interrupts occur after the next CLI.
0 - All interrupts are enabled, interrupts occur after processing the actual instruction in progress.

This flag can be set by:
CLI, SEI


Bit 1 - Zero
Type: status

Shows that the result of the last arithmetic or binary statement was zero or not.

1 - Result is zero.
0 - Result is non zero.

Conditional jumps:
BNE, BEQ


Bit 0 - Carry
Type: status

Shows that the remainder of the last arithmetic statement's result or stores the rolled out bit after ASL, LSR, ROL, ROR

1 - Result is more than $FF on ADC, INX, INY statement, or less than $00 on SBC, DEX, DEY or rolled out bit is 1.
0 - No carry took place on the above statements, or rolled out bit is zero.

This flag can be set by:
CLC, SEC

Conditional jumps:
BCC, BCS



Keywords
6502, register, registers, AC, XR, YR, PC, SP, SR, N, V, B, D, I, Z, C 

See Also
6502 Opcodes 



Copyright © Plus/4 World Team, 2001-2014