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.

ZeroPage

$65



OffsetX

$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

ZeroPage

$25



OffsetX

$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

ZeroPage

$06



OffsetX

$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

ZeroPage

$C6

Decrement accumulator by one.

OffsetX

$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

ZeroPage

$45



OffsetX

$55



INC

ZeroPage

$E6

Increment accumulator by one.

OffsetX

$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

ZeroPage

$A5



OffsetX

$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

ZeroPage

$A6



OffsetX

$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

ZeroPage

$A4



OffsetX

$B4



LSR

Assembler

$0A

Logical shift right. A = A DIV 2. C = A MOD 2. (00001111 > 000001111 C = 1)
 Carry flag set to rightmost 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

ZeroPage

$06



OffsetX

$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

ZeroPage

$05



OffsetX

$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

ZeroPage

$26



OffsetX

$34



ROR

Assembler

$6A

Rotate memory one bit right. (00001111 > 100000111 C = 1)
 Carry flag set to rightmost 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

ZeroPage

$66



OffsetX

$24



STA

ZeroPage

$85

Store A to memory.

OffsetY

$95



STX

ZeroPage

$86

Store X to memory.

OffsetX

$96



Indirect X

$81



Indirect Y

$91



STY

ZeroPage

$84

Store Y to memory.

OffsetX

$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.

ZeroPage

$E5



OffsetX

$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.
