The command line now recognizes 6502 Registers. Namely,
A, the Accumulator,
X, the 1st Index Register,
Y, the 2nd Index Register,
PC, the Program Counter,
S, the Stack Pointer, and
P, the Processor Status Register (Flags).
You can set a Register to a hex Value, Symbol, or Expression. (See the section Calculator for more examples of using expressions.) The syntax is:
Command |
Effect |
R r [=] #### |
Set Register to (a byte) Value, Symbol, or Address, or Expression. |
R A ## |
Set Accumulator to (a byte) Value |
R X ## |
Set Register X to (a byte) Value |
R Y ## |
Set Register Y to (a byte) Value |
R PC #### |
Set PC to (a full 16-bit) Address (Value) |
R S ## |
Set Stack Register to (an 8-Bit) Offset |
R P ## |
Set Processor Status Register (flags) to (a byte) Value |
Notes:
Since A refers to the Accumulator, you need to
prefix the hex number A with either:
i) a zero '0', or
ii) the hash '#' symbol (same as 6502 immediate
symbol.)
You can prefix a symbol with the dollar sign '$' to tell the parser it is a symbol Address instead of a Value.
If a symbol is not defined, the expression will be the corresponding hex Value, if possible.
Hex Values may be ambiguous, if their corresponding symbol is defined. To avoid confusion, don’t define symbols such as the popular $DEAD, $BEEF, $C0DE, $CAFE, etc. An example is given with A1.
Examples:
Input |
Effect |
R PC FA62 |
Set Program Counter to Value $FA62 (RESET) |
R PC RESET + 1 |
Set Program Counter to Address $FA63 (RESET+1) |
R X 2 |
Set Register to Value 2 |
R Y 3 |
Set Register to Value 3 |
R S 1FE |
Set Stack Pointer to depth of one (Stack grows down from $01FF) |
R S FF |
Set Stack Pointer to top of stack (Empty) |
R A 0A |
Set Accumulator to hex Value 0A |
R A #A |
Set Accumulator to hex Value 0A |
R X A |
Set Register X to Accumulator’s Value |
R A A1 |
If the symbol A1 exists, sets Accumulator to the Address
of the symbol A1 |
R A $A1 |
If the symbol A1 exists, sets the Accumulator to the Address
of symbol A1 |
R A #A1 |
Sets Accumulator to the hex value A1 |