Commands
The following 6502 Assembler Commands can be used in this similator. The address modes that have been implemented are also listed together with the resulting machine code value.
|
Command
|
Detail
|
Operator
|
Address Mode
|
Machine Code
|
|
ADC
|
Immediate
|
$69
|
Add with carry. A = A + M + C (Mod 256). Flags initially cleared.
- Carry flag set if (A + M + C) is greater than 255
- Negative flag is set if result is greater than 127
- Overflow flag set if result of actual calculation caused an overflow.
- Zero flag is set if result is 0.
|
Zero-Page
|
$65
|
|
|
Offset-X
|
$75
|
|
|
AND
|
Immediate
|
$29
|
Logical And. A = A AND M. (0011 AND 0101 = 0001)
- Negative flag is set if result is greater than 127 and cleared otherwise
- Zero flag is set if result is 0 and cleared otherwise
|
Zero-Page
|
$25
|
|
|
Offset-X
|
$35
|
|
|
ASL
|
Assembler
|
$0A
|
Arithmetic shift left. A = A x 2. (11110000 -> 11100000 C = 1)
- Carry flag set if result is greater than 255
- Negative flag is set if result is greater than 127 and cleared otherwise
- Zero flag is set if result is 0 and cleared otherwise
|
Zero-Page
|
$06
|
|
|
Offset-X
|
$22
|
|
|
BCC
|
Relative
|
$90
|
Branch on carry clear to the relative offset.
|
BCS
|
Relative
|
$B0
|
Branch on carry set to the relative offset.
|
BEQ
|
Relative
|
$F0
|
Branch on result zero to the relative offset.
|
BMI
|
Relative
|
$30
|
Branch on result negative to the relative offset.
|
BNE
|
Relative
|
$D0
|
Branch on result not zero to the relative offset.
|
BPL
|
Relative
|
$11
|
Branch on result positive to the relative offset.
|
BRK
|
Implied
|
$00
|
Forced Interupt
|
BVC
|
Relative
|
$50
|
Branch on overflow clear to the relative offset.
|
BVS
|
Relative
|
$70
|
Branch on overflow set to the relative offset.
|
CLC
|
Implied
|
$18
|
Clear carry flag.
|
CLV
|
Implied
|
$B8
|
Clear overflow flag.
|
DEC
|
Zero-Page
|
$C6
|
Decrement accumulator by one.
|
Offset-X
|
$D6
|
|
|
DEX
|
Implied
|
$CA
|
Decrement X Register by one.
|
DEY
|
Implied
|
$88
|
Increment Y Register by one.
|
EOR
|
Immediate
|
$49
|
Logical Exclusive Or. A = A XOR M. (0011 XOR 0101 = 0110)
- Negative flag is set if result is greater than 127 and cleared otherwise
- Zero flag is set if result is 0 and cleared otherwise
|
Zero-Page
|
$45
|
|
|
Offset-X
|
$55
|
|
|
INC
|
Zero-Page
|
$E6
|
Increment accumulator by one.
|
Offset-X
|
$F6
|
|
|
INX
|
Implied
|
$E8
|
Increment X Register by one.
|
INY
|
Implied
|
$C8
|
Increment Y Register by one.
|
LDA
|
Immediate
|
$A9
|
Load A from memory.
- Negative flag is set if result is greater than 127 and cleared otherwise
- Zero flag is set if result is 0 and cleared otherwise
|
Zero-Page
|
$A5
|
|
|
Offset-X
|
$B5
|
|
|
Indirect X
|
$A1
|
|
|
Indirect Y
|
$B1
|
|
|
LDX
|
Immediate
|
$A2
|
Load X from memory.
- Negative flag is set if result is greater than 127 and cleared otherwise
- Zero flag is set if result is 0 and cleared otherwise
|
Zero-Page
|
$A6
|
|
|
Offset-X
|
$B6
|
|
|
LDY
|
Immediate
|
$A20
|
Load Y from memory.
- Negative flag is set if result is greater than 127 and cleared otherwise
- Zero flag is set if result is 0 and cleared otherwise
|
Zero-Page
|
$A4
|
|
|
Offset-X
|
$B4
|
|
|
LSR
|
Assembler
|
$0A
|
Logical shift right. A = A DIV 2. C = A MOD 2. (00001111 -> 000001111 C = 1)
- Carry flag set to right-most digit
- Negative flag is set if result is greater than 127 and cleared otherwise
- Zero flag is set if result is 0 and cleared otherwise
|
Zero-Page
|
$06
|
|
|
Offset-X
|
$22
|
|
|
ORA
|
Immediate
|
$09
|
Logical Or. A = A OR M. (0011 OR 0101 = 0111)
- Negative flag is set if result is greater than 127 and cleared otherwise
- Zero flag is set if result is 0 and cleared otherwise
|
Zero-Page
|
$05
|
|
|
Offset-X
|
$15
|
|
|
PHA
|
Implied
|
$48
|
Push accumulator onto stack.
|
PLA
|
Implied
|
$68
|
Pull accumulator off stack.
|
ROL
|
Assembler
|
$2A
|
Rotate memory one bit left. (11110000 -> 11100001 C = 1)
- Carry flag set if result is greater than 255
- Negative flag is set if result is greater than 127 and cleared otherwise
- Zero flag is set if result is 0 and cleared otherwise
|
Zero-Page
|
$26
|
|
|
Offset-X
|
$34
|
|
|
ROR
|
Assembler
|
$6A
|
Rotate memory one bit right. (00001111 -> 100000111 C = 1)
- Carry flag set to right-most digit
- Negative flag is set if result is greater than 127 and cleared otherwise
- Zero flag is set if result is 0 and cleared otherwise
|
Zero-Page
|
$66
|
|
|
Offset-X
|
$24
|
|
|
STA
|
Zero-Page
|
$85
|
Store A to memory.
|
Offset-Y
|
$95
|
|
|
STX
|
Zero-Page
|
$86
|
Store X to memory.
|
Offset-X
|
$96
|
|
|
Indirect X
|
$81
|
|
|
Indirect Y
|
$91
|
|
|
STY
|
Zero-Page
|
$84
|
Store Y to memory.
|
Offset-X
|
$94
|
|
|
SBC
|
Immediate
|
$E9
|
Subtract with carry. A = A - M - (1 - C) (Mod 256). Flags initially cleared.
- Carry flag set if (A - M - (1 - C)) is less than 255
- Negative flag is set if result is greater than 127
- Overflow flag set if result of actual calculation caused an overflow.
- Zero flag is set if result is 0.
|
Zero-Page
|
$E5
|
|
|
Offset-X
|
$F5
|
|
|
SEC
|
Implied
|
$38
|
Set carry flag.
|
TAX
|
Implied
|
$AA
|
Transfer A to X.
|
TAY
|
Implied
|
$A8
|
Transfer A to Y.
|
TXA
|
Implied
|
$8A
|
Transfer X to A.
|
TYA
|
Implied
|
$98
|
Transfer Y to A.
|