Apple I Replica Creation -- Appendix D: Instructions by Category

Appendix D

Instructions by Category

 



Load and Store

LDA — Load Accumulator with Memory


M → A

Flags: N, Z


Addressing Mode Opcode
a AD
a,x BD
a,y B9
# A9
zp A5
(zp,x) A1
zp,x B5
(zp),y B1

LDX — Load Index X with Memory


M → X

Flags: N, Z


Addressing Mode Opcode
a AE
a,y BE
# A2
zp A6
zp,y B6

LDY — Load Index Y with Memory


M → Y

Flags: N, Z


Addressing Mode Opcode
a AC
a,x BC
# A0
zp A4
zp.x B4

STA — Store Accumulator in Memory


A → M

Flags: none


Addressing Mode Opcode
a 8D
a,x 9D
a,y 99
zp 85
(zp,x) 81
zp,x 95
(zp),y 91

STX — Store Index X in Memory


X → M

Flags: none


Addressing Mode Opcode
a 8E
zp 86
zp,y 96

STY — Store Index Y in Memory


Y → M

Flags: none


Addressing Mode Opcode
a 8C
zp 84
zp,x 94

Arithmetic

ADC — Add Memory to Accumulator with Carry


A + M + C → A

Flags: N, V, Z, C,


Addressing Mode Opcode
a 6D
a,x 7D
a,y 79
# 69
zp 65
(zp,x) 61
zp,x 75
(zp),y 71

SBC — Subtract Memory from Accumulator with Borrow


A — M - ~C → A

Flags: N, V, Z, C


Addressing Mode Opcode
a ED
a,x FD
a,y F9
# E9
zp E5
(zp,x) E1
zp,x F5
(zp),y F1

Increment and Decrement

INC — Increment Memory by One


M + 1 → M

Flags: N, Z


Addressing Mode Opcode
a EE
a,x FE
zp E6
zp,x F6

INX — Increment Index X by One


X + 1 → X

Flags: N, Z


Addressing Mode Opcode
i E8

INY — Increment Index Y by One


Y + 1 → Y

Flags: N, Z


Addressing Mode Opcode
i C8

DEC — Decrement Memory by One


M — 1 → M

Flags: N, Z


Addressing Mode Opcode
a CE
a,x DE
zp C6
zp,x D6

DEX — Decrement Index X by One


X — 1 → X

Flags: N, Z


Addressing Mode Opcode
i CA

DEY — Decrement Index Y by One


Y — 1 → Y

Flags: N, Z


Addressing Mode Opcode
i 88

Shift and Rotate

ASL — Accumulator Shift Left One Bit


C ← 7 6 5 4 3 2 1 0 ← 0

Flags: N, Z, C


Addressing Mode Opcode
a 0E
a,x 1E
A 0A
zp 06
zp.x 16

LSR — Logical Shift Right One Bit


0 → 7 6 5 4 3 2 1 0 → C

Flags: N, Z, C


Addressing Mode Opcode
a 4E
a,x 5E
A 4A
zp 46
zp.x 56

ROL — Rotate Left One Bit


C ← 7 6 5 4 3 2 1 0 ← C

Flags: N, Z, C


Addressing Mode Opcode
a 2E
a,x 3E
A 2A
zp 26
zp.x 36

ROR — Rotate Right One Bit


C → 7 6 5 4 3 2 1 0 → C

Flags: N, Z, C


Addressing Mode Opcode
a 6E
a,x 7E
A 6A
zp 66
zp.x 76

Logic

AND — AND Memory with Accumulator


A ^ M → A

Flags: N, Z


Addressing Mode Opcode
a 2D
a,x 3D
a,y 39
# 29
zp 25
(zp,x) 21
zp,x 35
(zp),y 31

ORA — OR Memory with Accumulator


A v M → A

Flags: N, Z


Addressing Mode Opcode
a 0D
a,x 1D
a,y 19
# 09
zp 05
(zp,x) 01
zp,x 15
(zp),y 11

EOR — Exclusive-OR Memory with Accumulator


A v M → A

Flags: N, Z


Addressing Mode Opcode
a 4D
a,x 5D
a,y 59
# 49
zp 45
(zp,x) 41
zp,x 55
(zp),y 51

Compare and Test Bit


For all Compare instructions:


Condition N Z C
Register < Memory 1 0 0
Register = Memory 0 1 1
Register > Memory 0 0 1

CMP — Compare Memory and Accumulator


A - M

Flags: N, Z, C


Addressing Mode Opcode
a CD
a,x DD
a,y D9
# C9
zp C5
(zp,x) C1
zp,x D5
(zp),y D1

CPX — Compare Memory and Index X


X - M

Flags: N, Z, C


Addressing Mode Opcode
a EC
# E0
zp E4

CPY — Compare Memory and Index Y


Y - M

Flags: N, Z, C


Addressing Mode Opcode
a CC
# C0
zp C4

BIT — Test Bits in Memory with Accumulator


A ^ M

Flags: N = M7, V = M6, Z


Addressing Mode Opcode
a 2C
# 89
zp 24

Branch

BCC — Branch on Carry Clear


Branch if C = 0

Flags: none


Addressing Mode Opcode
r 90

BCS — Branch on Carry Set


Branch if C = 1

Flags: none


Addressing Mode Opcode
r B0

BEQ — Branch on Result Zero


Branch if Z = 1

Flags: none


Addressing Mode Opcode
r F0

BMI — Branch on Result Minus


Branch if N = 1

Flags: none


Addressing Mode Opcode
r 30

BNE — Branch on Result Not Zero


Branch if Z = 0

Flags: none


Addressing Mode Opcode
r D0

BPL — Branch on Result Plus


Branch if N = 0

Flags: none


Addressing Mode Opcode
r 10

BVC — Branch on Overflow Clear


Branch if V = 0

Flags: none


Addressing Mode Opcode
r 50

BVS — Branch on Overflow Set


Branch if V = 1

Flags: none


Addressing Mode Opcode
r 70

Transfer

TAX — Transfer Accumulator to Index X


A → X

Flags: N, Z


Addressing Mode Opcode
i AA

TXA — Transfer Index X to Accumulator


X → A

Flags: N, Z


Addressing Mode Opcode
i 8A

TAY — Transfer Accumulator to Index Y


A → Y

Flags: N, Z


Addressing Mode Opcode
i AB

TYA — Transfer Index Y to Accumulator


Y → A

Flags: N, Z


Addressing Mode Opcode
i 98

TSX — Transfer Stack Pointer to Index X


S → X

Flags: N, Z


Addressing Mode Opcode
i BA

TXS — Transfer Index X to Stack Register


X → S

Flags: N, Z


Addressing Mode Opcode
i 9A

Stack

PHA — Push Accumulator on Stack


A → S

Flags: none


Addressing Mode Opcode
i 48

PLA — Pull Accumulator from Stack


S → A

Flags: N, Z


Addressing Mode Opcode
i 68

PHP — Push Processor Status on Stack


P → S

Flags: none


Addressing Mode Opcode
i 08

PLP — Pull Processor Status from Stack


S → P

Flags: all


Addressing Mode Opcode
i 28

Subroutines and Jump

JMP — Jump to New Location


Jump to new location

Flags: none


Addressing Mode Opcode
a 4C
(a,x) 7C
(a) 6C

JSR — Jump to New Location Saving Return Address


Jump to Subroutine

Flags: none


Addressing Mode Opcode
a 20

RTS — Return from Subroutine


Return from Subroutine

Flags: none


Addressing Mode Opcode
i 60

RTI — Return from Interrupt


Return from Interrupt

Flags: none


Addressing Mode Opcode
i 40

Set and Clear

SEC — Set Carry Flag


1 → C

Flags: none


Addressing Mode Opcode
i 38

SED — Set Decimal Mode


1 → D

Flags: none


Addressing Mode Opcode
i F8

SEI — Set Interrupt Disable Status


1 → I

Flags: none


Addressing Mode Opcode
i 78

CLC — Clear Carry Flag


0 → C

Flags: C = 0


Addressing Mode Opcode
i 18

CLD — Clear Decimal Mode


0 → D

Flags: D = 0


Addressing Mode Opcode
i D8

CLI — Clear Interrupt Disable Bit


0 → I

Flags: I = 0


Addressing Mode Opcode
i 58

CLV — Clear Overflow Flag


0 → V

Flags: V = 0


Addressing Mode Opcode
i B8

Miscellaneous

NOP — No Operation


No Operation

Flags: none


Addressing Mode Opcode
i EA

BRK — Break


Force an interrupt

Flags: B = 1, I = 1


Addressing Mode Opcode
i 00



← Previous Contents Next →