6502_Instruction_Set_Summary 6502 Instruction Set Summary
User Manual: 6502_Instruction_Set_Summary
Open the PDF directly: View PDF .
Page Count: 4
~
MOS
TECHNOLOGY,
INC.
Valley
Forge
Corporate
Center
950
Rittenhouse
Road
Norristown,
Pa.
19401
MCS6500
SET
INS
T'R
U C T
ION
SUMMARY
PROCESSOR PROGRAMMING
MODEL
i
PCH
PCL
j
,
INlvl
Ie
101'
Izici
~
ACCUMULATOR
INDEX REGISTER
INDEX
REGISTER
PROGRAM COUNTER
"PC"
STACK
POINTER
"S"
PROCESSOR
STATUS
REG
"P"
CARRY
1 =
TRUE
ZERO 1
'"
RESULT ZERO
IRQ DISABLE 1
'"
DISABLE
DECIMAL MODE 1
'"
TRUE
BRKCOMMANO
OVERFLOW 1 z TRUE
NEGATIVE 1 = NEG.
INSTRUCTIONS
I"UDI"'T£
AISOlUT£
lERO
~AGE
ACCUM
IMPLIED (lNO.X) (lND).Y
i.PAGE.x
AIS. X
...
as.
V RElATIVE IliIDlRtCT
i!.~"'GE.
V
CONDITION
CODES
_EMOIIIC
OPERATION
OP N #
OP
N #
OP
N
_ OP
NI_
OP
N #
OP'
N -
OP
N
1#
OP
N #
OP
N -
OP
N #
OP
N #
OP
N -
OP
N # N , e , D V
ADC
A<-M'C _ A 14111,
1~9
, i 1
6D!'
J 16;
jJ
2 I
61,
6 1 " ; 2
';J~
,
i'?.l
' 3 .
.'.'.:'.]
,
..
:
.....
:.
,
,.
,,'1 6 J
1;6
! ,
'I'"
,
AS
L
~
:; I'
OA
, , " : 6 ,
8 C 5
BRANCH
ON
C~I
'" ,
;,;r;
, -
8EQ
BRANCH
ON
~_1
,"
",'
2
8M'
BRANCH
ON
N~
1 '" . J j 30
'!'
l - - - -
8 P L
BRANCH
ON
N~(I
'" I " , ,
8 R K
ISe!F,g
II
1.
'"
,
, ,
8 V 5
BRANCH
ON
V-I
'"
,1
.1.
..
i " , ,
'c
L D
'_D
i
08
1 , I j , •
C L
..
' 1'-' i
;"".,.'.,
..
'
",MP
A-.
'"
C9 , ,
lc.~
,
..
,'.
e~
•. 3 ...
~
T r
Ie!.~
, D'
;,'
D;
, , IDD , i ,
D9
.
, , , ,
C P Y
y-.
c.
, , cc , ,
e,
3,1
.'
I , , ,
DEC
M-l_M
CE
6 3
C6
; , ,
.I
.L
06,
6 ,
DE
, , , ,
" ''i
'"
"""
y,
I
DEY
'0'
1-'0'
: 88 2 1 , ,
"
,~,
~,
~E
I 6 3
",
6 , IFE ,
:NC
M'"
_M
f6
; 1 , , ,
'NX
X'I
-x
E8 , 1 , ,
J M P JUMP TO
NEW
LOC
:,:
3 i 3 i j 1
6e
; 3
F7'(;';"
dK
'0,
..
,
!3
11.
513 I I
Al
6 2
3"
, M
_A
III
11.9
, ,
AD
, " ; , " , ,
'D
, 3 , ,
IMMEDIATE AISOlUTE
lERO
~"'GE
"'CCUM. IMPLIED
(lND)O
(lNo),
Y
i!.~"'GE,X
US,
X
...
IS
.... IIiDIREeT
~PAGE.'"
CONDITION
COOES
111010111:
O'fRATIOI
OP
N
#OPN
#
OPN
#
0..,
#
OPN
#
OP'"
#
OPN
#
OPN
#
OPN
#
OPN
#
OPN
#
OP
...
#
OPN#
N
tl
C I 0 V
LOX"
.... x
nlA222AE43A632
8E41~.
~~.4:2
lS
R
E634652A21
56615E73
. , ,
19
2 2
~O
4 3
95
3 2 III 6 1
11
5 2
IS
4 2
'0
4 3
19
4 3
sa
, ,
"0
2E632615'lA"
, , ,
A 0 R
6EI
6 3 ,66 5 2
6A
2 1 76 6 2
7E
7 3
"T
S
,,,,,,.21
ATANSU,
I"
6 1
T5X
s
....
x
TXS
x-s
TVA
'D!'
3
las
3 ,
IF PAGE BOUNDRY
IS
CROSSED
ADD 1 TO
"N"
IF 6RANCH OCCURS
TO
SAME PAGE
ADO 2
TO
'N"
IF 6RANCH OCCURS TO
DIFFERENT
PAGE
I"
I'
,
F8 2 I
AAI2
1
9A
2 I
'"
, ,
X
INDEX,
x
A
ACCUMULATOR
I
81
6 I 2
"'1,1,
I
-SUBTRACT
99 ; 3
..
EXCLUSIVE
OR
MODIFIED
NOT
MODIFIED
, ,
N
NO.
CYCLeS
.,
NO.
BYTES
-
..
IF IN DECIMAL MODE Z FLAG
IS
INVAliD
ACCUMUlATOR
MUST
BE
CHECI<ED FOR ZERO RESULT. M
MEMORY
PER
EFFEcrlVE
ADDRESS
M5
MEMORY
PER STACK POINTER
M,
MEMORY
81T
7
'.16
MEMORY
81T 6
QP
-CODE
TABLE
~
MID
•
,
•
6
8
ORA
IND, X
ORA
2.
Pago
ANO·INO,X
61T
~.P.ge
ROll.Pago
EOR.INO.X
EOR
2
Page
lSR
~.p.9'I
ACC
IND. X
ADC
~
Page
STA
INO, X
STY
~
Page
STA1!
Page
STX·2-
P;oge
lOA·INO,
X
,CD"P'~
LOA
2!
Pa'}!'
LOX
2-
Page
CMP
INO, x
Cry
l
P<>qe
CMP;l,P.~.
DEC
2-
Po'}!'
I'ec,,~,
CPX
2-
.~.ge
SBC.i!
Pa.~,
INC
2-;f~~
IMMEDIATE
ADDRESSING
-
THE
OPERAND
IS
CONTAINED
IN
THE
SECOND
BYTE
OF
THE
INSTRUCTION
ABS·
ABSOLUTE
ADDRESSING
-THE SECOND
BYTE
OF
THE
INSTRUCTION
CONTAINS
THE
8 LOW
ORDER
BITSOF
THE
EFFECTIVE
ADDRESS
THE
THIRD
BYTE
CONTAINS
THE
8
HIGH
ORDER
BITS
OF
THE
EFFECTIVE
ADDRESS
l PAGE
ZERO
PAGE
ADDRESSING
SECOND
BYTE
CONTAINS
THE
8 LOW
ORDER
BITS
OF
THE
EFFECTIVE
ADDRESS
THE
8
HIGH
ORDER
BITS
ARE
ZERO
ACCUMULATOR
ONE
BYTE
INSTRUCTION
OPERATING
ON THE
ACCUMULATOR
l PAGE.X
~
PAGE Y
ZERO
PAGE
INDEXED
THE SECOND
BYTE
OF THE
INSTRUCTION
IS
ADDED
TO
THE
INDEX
(CARRY
IS
DROPPEDI TO
FORM
THE LOW
ORDER
BYTE
OF
THE
EA
T,iE
HIGH
ORDER
BYTE
OF
THE
EA
IS ZE
ROS
A
PL~
i
"Of""
D
LSD/
//MSD
ABS x ABS Y
ABSOLUTE
INDEXED
THE
EFFECTIVE
ADDRESS
IS
FORMED
BY
AODING
THE
INDEX
TO
THE
SECOND
AND
THIRD
BYTE
OF
THE
INSTRUCTION
liND
X~
INDEXED
INDIRECT
THE
SECOND
BYTE
OF
THE
INSTRUCTION
IS
ADDED
TO
THE
X
INDEX,
DISCARDING
THE
CARRY
THE RESULTS POINTS
TO
A
LOCATION
ON
PAGE
ZERO
WHICH
CONTAINS
THE 8 LOW
ORDER
BITS
OF
THE
EA
THE
NEXT
8YTE
CONTAINS
THE B
HIGH
ORDER
BITS
(lND~.Y
INDIRECT
INDEXED
-THE SECOND
BYTE
OF
fHE
INSTRUCTION
POINTS
TO A LOCA
-
TION
IN
PAGE
ZE-RQ-
THE
CONTE~TS
OF THIS
\~E"'10RY
LOCATION
IS
ADDED
TO THE
'0'
INDEX
THE RESUL T
BEING
THE LOW
ORDER
EIGHT
BITS
OF THE
EA
THE
CARRY
FROM
THIS
OPERATION
IS
ADDED
TO THE CONTE!\JTS
OF
THE IIJEXT PAGE
ZERO
LOCATION
THE
RESULT
BEI'lJG THE 8
HIGH
ORDER
BITS
OF
THE
EA
pc-
. ,
. ,
" 4 I 6
L--f-f--II
4
\1
7
RTI
F F F A
AOL
F F
AD
H
F F F C
ADL
F F F 0
ADH
F F F e
AOL
05
F F F
FAD
H
114
_.
~SP
AFTER IAQ
OR
NMI
BUT BEFORE
ATI
BEFORE
I RO OR
NMI
AND AFTER RTI
_PCATTIMEORIRQOR
NMI • THIS INSTRUCTION
WI
LL
COMPLETE
BEFORE
I I
AVICEO
INTERRUPT SERVICE
MAIN
BODY
RETURN FROM
INTERRUPT
NMI VECTOR
RES
VECTOR
lAO
VECTOR
FIG.1
IRa.
NMI. ATI, BRK OPERATION
pc-
• 3 • • J 5 R "
• 3 • 1 A 0 L
.,
0 3 , , A 0 H
..
, 3 • 3
" 4 " 5
, 4 e 6
II
4 e 7
114118
RTS
"
FIG.:Z
JSR,
RTS
OPERATION
JUMP
TO
SUBROUTINE
RETURN FROM SUBROUTINE
TO
THIS LOCATION
SUBROUTINE MAIN
BODY
RETURN FROM SUBROUTINE
ASCII CHARACTER SET (7-BIT
CODE)
ASSEMBLER DIRECTIVES
~
• , 2 , • 5 6 7
•
OPT·
IF
useD
MUST
BE
THE
FIRST
EXECUTABLE
STATEMENT
IN THE PROGRAM. LSD
...
."
."
" ,
,,,
,.
, ,
10
, "
• OPTIONS
ARE:·
IOPTIONS
USTED
ARE THE
DEFAULT
VALUE.
TURNED
OFF
BY
(NO) PREFIX.)
COUNT (COU
OR
CNT)·
LIST
ALL
INSTRUCTIONS
AND
THEIR
USAGE. ,
0000
NUL
OLE
SP
, • p P
NOGENERATE (NOG) -DO NOT GENERATE MORE
THAN
ONE LINE OF CODE FOR ASCII STRINGS. ,
01)(111
SOH
DC'
I 1 A Q q
XREf
(XflE)·
PRODUCE A CROSS-REFERENCE LIST IN THE SYMBOL
TABLE.
2
0010
STX
DC2
2 B R b
ERRORS
(ERR)·
CREATE
AN
ERROR
FILE.
MEMORY
(MEM) . CREATE
AN
ASSEMBLER OBJECT OUTPUT
FILE.
,
0011
ETX
DC'
# , C S
LIST
(LIS)·
PRODUCE A
FULL
ASSEMBLY LISTING. •
011010
EDT
DC.
S 4 0 T d .
•
BYTE·
PRODUCES A SINGLE
BYTE
IN
MEMORY
EQUAL
TO EACH OPERAND SPECIFIED.
•
WORD·
PRODUCES TWO BYTES IN MEMORY
eQUAL
TO
EACH OPERAND SPECIFIED. 5
0101
ENG
NAK
% 5 E U "
-
...
DEFINES THE BEGINNING OF A NEW PROGRAM COUNTER SEaUENCE. 6
01
HI ACK SYN • 6 F V f
• PAGE -ADVANCES THE LISTING TO THE TOP OF A NEW PAGE. 7
0111
BEL
ETB
7 G W , w
• END -DEFINES
THE
END OF A SOURCE PROGRAM. B 11100
BS
CAN I B H X h ,
9 11101 HT
EM
I 9 I Y ; y
A
1010
LF SUB J Z j ,
B
10'1
VT
ESC
, K [ k
LABELS: C
1199
FF
FS
< L \ I I
LABELS
BEGIN
IN
COLUMN 1
AND
ARE SEPARATED FROM THE INSTRUCTION
BY
AT
LEAST
ONE SPACE. 0 11111
CR
GS
-M ] m
LABELS
CAN
BE
UP
TO
6
ALPHANUMENIC
CHARACTERS LONG
AND
MUST BEGIN WITH AN
ALPHA
CHARACTER.
A,
X,
Y,
S,
AND
P ARE RESERVED
AND
CANNOT
BE
USED
AS
LABELS. E
1119
SO
RS
. > N t
~
LABEL
-EXPRESSION
CAN
BE
USED
TO
EQUATE LABELS TO INSTRUCTIONS. F
1111
51
VS I , 0 -p DEL
*-*+
LABEL
N CAN
BE
USED
TO
RESERVE AREAS IN MEMORY
CHARACTERS USED
AS
SPECIAL PREFIXES:
INDICATES AN ASSEMBLER
01
RECTIVE
# SPECIFIES THE
IMMEDIATE
MODE OF ADDRESSING.
SPECIFIES A
HEXADECIMAL
CHARACTER.
" SPECIFIES
AN
OCTAL
NUMBER.
'J(,
SPECIFIES A
BINARY
NUMBER.
SPECIFIES
AN
ASCII
LITERAL
CHARACTER.
()
INDICATES
INDIRECT
ADDRESSING.
IN
COLUMN 1 INDICATES A COMMENT.