In this week I learned what is the 6502 architecture. During the code I wonder about this. t
The 6502 handles data in its resisters, each of which holds one byte of data. there are a total of three general use and two special purpose resisters.
* purpose resisters
A (accumulator) - Handles all arithmetic and logic. the real heart of the system.
X and Y - General purpose registers with limited abilities.
S - Stack pointer
P - Processor status. Holds the result of tests and flags.
The processor status is not directly accessible by any 6502 instruction. Instead, there exist numerous instructions that test the bits of the processor status register. The flags within the register are
bit -> 7 0
+---+---+---+---+---+---+---+---+
| N | V | | B | D | I | Z | C | <-- flag, 0/1 = reset/set
+---+---+---+---+---+---+---+---+
N - Negative. Set if bit 7 of accumulator is set
V - Overflow. Set if the addition of two like-signed numbers or the subtraction of two unlike-singed numbers produces result greater than +127 or less than -128
B - BRK command. Set if an interrupt caused by a BRK, reset if caused by an external interrupt.
D - Decimal mode. Set if desimal mode active.
I - IRQ disable. Set if maskable interrupts are disabled.
Z -Zero. Set if the result if the last operation was zero
C - Carry. The carry flag is set if the last operation caused an overflow from bit 7 of the result or an underflow from bit 0. This condition is set duriong arithmetic, comparison and during logical shifts.
No comments:
Post a Comment