Zilog Z80 Assembly Language Programming Classic
Zilog Z80 Assembly Language Programming Classic
Zilog assumes no responsibility for the use of any circuitry other than
circuitry embodied in a Zilog product. No other circuit patent licenses 3.00.5,
are implied. REL. 2il
TABLE OF CONTENTS
PAGE
I. INTRODUCTION •••••••••••••••••••••••••••••••••••••••••
APPENDIX:
JANUARY 1978
Z80 ASSEMBLY LANGUAGE PROGRAMMING MANUAL
INTRODUCTION:
LD A,B
LD C,3FH
LD HL,(1200)
LD (IX+6),C
FLAG ON CONDITION
CONDITION
Carry C NC
Zero Z NZ
Sign M (minus) P (pI us)
Parity PE (even) PO (odd)
OPERAND NOTATION
LABELS
EXPRESSIONS
+ UNARY PLUS
UHARY l1I1WS
.NOT. or \ LOGICAL NOT
.RES. RE SU 1'i
** EXPONENTIATION
liUL TI1'L I CATION
*/ DIVISION
.110D. 1l0DULO
.SHR. LOGICAL SUlfT RIGHT
.SaL. LOGICAL SHIFT LEFT
+ ADDITION
SUBTRACTION
.AND. or & LOGICAL AND
.OR. or LOGICAL OR
.XOR. LOGICAL XOR
.EQ. 0 r EQUALS
.GT. or GREATER THAN
.LT. or LESS THAN
.UGT. UNS~GNED GREATER THAN
.ULT. UNSIGNED LESS THAN
LD HL,-OEA9H.
For example:
JR C,LOOP
JR C,$+5
10
DEFll 's' Defines the content of n bytes of
memory to.be the ASCII
representation of string s, where n
is the length of s and must be in
the range O<=n<-63.
CONDITIONAL PSEUDO-OPS
DELIUITERS
11
occur within an expression.
COUMENTS
I/O BUFFERS
UPPER/LOWER CASE
NUMBER BASES
12
different bases: binary, octal, decimal and
hexadecimal. Numbers must always start with a
digit (leading zeros are sufficient), and may be
followed immediately by a single letter which
signifies the base of the number ('B' for binary,
'0' or 'Q' for octal, 'D' for decimal and 'H' for
hexadecimal). If no base is specified decimal is
assumed. For example, the same nucber is
represented in each of the four bases:
E. ASSEMBLER COMMANDS
13
The expected use of *Include is for files of macro
definitions, lists of EQUates, or commonly uSed
subroutines, although it can be used anywher~ in a
program that the other commands would be legal.
The filename must follow the normal convention for
specifying filenames, and furthermore only file
types 'F' through 'T' are allowed. The default
type is '5'. The included file may also contain a
*Include command, up to a nested level of four.
COND exp
*Include FILEl
ENDC
14
III. MACROS
MACRO DEFINITION
[<label>] ENDH
15
include macro calls. (Recursion is allowed.)
16
to the macro file. Each statement of the macro
body is scanned for occurrences of parameter names,
and for each occurrence found, the corresponding
string from the macro call statement is
substituted. After substitution, the statement is
assembled normally.
SYllBOL GENERATOR
LISTING FORHAT
17
IV. SUBROUTINES
CALL REWIND
18
+ N (for the block)
+ 1 (for the RET)
3M+N+1 bytes would be required if using a
subroutine.
19
V. Z80 STATUS INDICATORS (FLAGS)
WHERE:
C .. CARRY FLAG
N .. ADD/SUBTRACT FLAG
p/V .. PARITY/OVERFLOW FLAG
H .. HALF-CARRY FLAG
Z .. ZERO FLAG
S .. SIGN FLAG
X NOT USED
For instructions RLA, RRA, RLS and RRS, the carry bit is
used as a link between the LSB and MSB for any register
or memory location. During instructions RLCA, RLC sand
SLA s, the carry contains the last value shifted out of
bit 7 of any register or memory location. During
20
instructions RRCA, RRC s, SRA sand SRL s the carry
contains the last value shifted out of bit 0 of any
register or memory location.
PARITY/OVERFLOW FLAG
21
The minuend sign has changed from a positive to a
negative, giving an incorrect difference. Overflow is
therefore set.
H ADD SUBTRACT
PAGE
I
I
8 BIT LOAD GROUP
LD r, r'
,
Operation: r +- r
Format:
Opcode Operands
LD r,r
Description:
Register ~'
A • 111
B • 000
C • 001
D • 010
E • 011
H • 100
L • 101
Example:
LD H, E
27
LD r. n
Operation: r~n
Forma t:
Operands
LD r, n
Register
A - 111
B - 000
C - 001
D - 010
E - all
H - 100
L - 101
Example:
LD E, ASH
28
LD r, (HLJ
Operation: r +- (HL)
Format:
Operands
LD r. (HL)
Description:
Register r
A - III
B - 000
C - 001
D - 010
E - 011
H - 100
L - 101
Example:
LD C. (HL)
29
LD r, CIX+dJ
Operation: r+-(IX+d)
Format:
Operands
LD r. (IX+d)
I <<a: <<< d 0: DD
1
0:17-7 7--7< <a I
r
I : : :d: : : :. "I
Description:
Register !.
A = III
B .. 000
C .. 001
D .. 010
E .. 011
H .. 100
L ~ 101
Example:
30
LD B, (IX+19H)
31
LD r, (IY +dJ
Operation: r ~ (IY+d)
Format:
Operands
LD r, (IY+d)
I0:1~<-~.1 :1: 0I
I .. :.\:< : : : I
Description:
Register !:.
A .. 111
B .. 000
C .. 001
DOlO
E .. 011
H .. 100
L .. 101
32
Example:
LD B. (IY+19H)
33
LD CHL1, r
Operation: (HL) ~ r
Format:
Opcode Operands
LD (HL), r
I0: 1 : 1 : 1 : 0 ~r~1
Description:
Register
A - 111
B - 000
C - 001
D - 010
E - all
H - 100
L - 101
Example:
LD (HL), B
34
LD (IX +dJ, r
Operation: (IX+d) ~ r
Format:
Opcode Operands
LD (IX+d), r
1>>>:a :-7r~1
0
I~<:: >1
Description:
Register r
A • 111
B • 000
C • 001
D • 010
E'· 011
H • 100
L • 101
35
Example:
LD (IX+6H), C
will perform the sum 3100H + 6H and will load lCH into
memory location 3106H.
36
LD CIY+dJ, r
Operation: (IY+d) +- r
Format:
Operands
LD (IY+d), r
11 >>>>>:a >I FD
Ia: <<<o7---;r+-1
1< : :< ::. I
Description:
Register
A - 111
B - 000
C - 001
D - 010
E - 011
H - 100
L - 101
37
Example:
LD (IY+4H), C
will perform the sum 2AIIH + 4H, and will load 48H into
memory location 2A15.
38
LD (HLJ, n
Format:
Opcode Operand
LD (HL) ,n
Ia : a >>:a >>:a I 36
I" : In: : : : I
Description:
Example:
LD (HL), Z8H
39
LD CIX+dJ, n
Operation: (tX+d) ~n
Format:
Opcode Operands
LD (IX+d), n
< <
I a: a: <a: <0 I 36
I~<:: ;'1
1~n1 : : >1
Description:
Example:
LD (IX+5H), 5AH
40
LD (IY +dJ, n
Format:
Operands
LD (IY+d) ,n
11»»»>1 FD
I >>>;a >>:a I
0 36
Example:
LD (IY+10H), 97H
41
LD A, (ESC)
Operation: A ~ (Be)
Format:
Opcode Operands
LD A. (BC)
Description:
Example:
LD A. (BC)
42
LD A, (DE)
Operation: A +- (DE)
Format:
Opcode Operands
LD A, (DE)
Description:
Example:
LD A, (DE)
43
LD A, (nn)
Format:
Operands
LD A, (nn)
I0 : 0 >>: 1 : '0 : 1 : 0 I 3A
I~n(::: I
I~n( : : ;'1
Descript Lon:
Example:
LD A, (nn)
44
LD (BCl, A
Operation: (BC) +- A
Format:
Opcode Operands
LD (BC) ,A
Description:
Example:
LD (BC),A
45
LD (DE), A
Format:
Operands
LD (DE) ,A
Description:
Example:
LD (DE) ,A
46
LD (nnJ, A
Operation: (nn)+-A
Format:
Operands
LD (nn) ,A
I 0 ;a >>;a ;a >: I 0 32
l~nJ : : .. I
l~nJ : : >1
Description:
Example:
LD (3141H),A
47
LD A,
Operation: A~I
Format:
Operands
LD A, I
11>:1: >>: 0 0: I ED
I r:
0 :1:0 :1:0 : 1: 1 I 57
Description:
Note:
48
LD A, R
Operation: A+-R
Format:
Operands
LD A,R
Description:
49
LD I J A
Operation: I +-A
Format:
Operands
LD I,A
Description:
50
LD R, A
Operation: R+-A
Format:
Operands
LD R,A
I<<<a; <<a; 1 I ED
Description:
51
-16 BIT LOAD GROUP-
52
LD dd, nn
Operation: dd~nn
Fo rma t:
Operands
LD dd,
Ia : a : d: d: 0: a : a: 1I
I .. : In: : : .. I
1 : : In: : : .. I
Description:
Pair dd
BC 00
DE 01
HL 10
SP 11
Example:
LD HL, SOOOH
53
LD IX, nn
Operation: IX +- nn
Format:
Operands
LD I X, nn
o: 0 :<a: >I 0: 0: 0 21
.. I In: : : >1
., I In: II .. I
Description:
Example:
LD IX,45A2H
54
LD IY, nn
Operation: IV ~ nn
Format:
Operands
LD IY,nn
<1:1:1:1:1:0>1 FD
o: 0:<0:0:0:0 21 >1
.. I In: : : >1
.. I In: :: >1
Description:
Example:
LD IY,7733H
55
LD HL, (nn]
Format:
Operands
LD HL, (nn)
I 0: 0: 1: 0: 1: 0: 1:0 I 2A
l" : :n( : : .. I
I .. : : n( : : .. I
Description:
Example:
LD HL,(4545H)
56
LD dd, (nn)
~:
Operands
LD dd,(nn)
1:1:1:0':1:1:0:11 ED
0:1:«1:0:1:11
.. : In: : : .. I
.. : In: : : .. I
Description
Pair dd
BC 00
DE 01
HL 10
SP 11
57
Example:
LD BC .. (2130H)
58
LD IX, (nn)
Format:
Operands
LD IX, (nn)
1: 1:0: 1: 1: 1:0: 1 DD
o: 0 : 1 : 0: 1 : 0 : 1 : 0 2A
': : : n: : : : I
.; .. In: : : ;.
Description:
The contents of the address (nn) are loaded into the low
order portion of Index Register IX, .and the contents of
the next highest memory address (nn+l) are loaded into
the high order portion of IX. The first n operand after
the op code is the low order byte of nn.
Example:
LD IX,(6666H)
59
LD IY, (rnnJ
Format:
Operands
LD IY, (nn)
«««0>1 FD
.; ; :n:: : >1
.;; In::: ;'1
Description:
Example:
LD !Y, (6666H)
60
LD (nn], HL
Operands
LD (nn).HL
1 0: 0: I; 0: .0;0: 1:01 22
I.. II n11 II II
I.. : :<1"1 .. I
Description:
Example:
LD (B229H).HL
61
LD (nn). de
Format:
Operands
LD (nn) ,dd
BC 00
DE 01
HL 10
SP 11
62
Example:
LD (lOOOH),BC
63
LD (nn), IX
Format:
Operands
LD (nn) ,IX
1 >: >:0: 1 1 : 0: 1 I DD
o: 0: 1: 0: 0: 0: 1: 0 1 22
.; : In: : : >1
.; : In: : : .. I
Description
Example:
LD (4392H) ,IX
64
LD (nnl, IV
~:
Operands
LD (nn), IY
11 >>:1: 1>:0: 1 1 FD
Example:
LJI (8838H), IY
65
LD BP, HL
Operation: SP+-HL
Format:
Opcode Operands
LD SP,HL
Description:
Example:
LD SP,HL
66
LD BP, IX
Operation: SP ~ IX
Format:
Operands
LD SP,IX
11 >>>>:a :a >I F9
Description:
Example:
LD SP,IX
67
LD BP, IV
Operation: SP ~ IV
Format:
Opcode Operands
LD SP,IY
11>>>>>;a >I FD
I<<<<<a; >I 0 F9
Description:
Example:
LD SP,IY
68
PUSH qq
PUSH qq
Format:
Operands
PUSH qq
11 :1:q : q :0 : 1:0 : 1 I
De!ilcription:
Pair qq
BC 00
DE 01
HL 10
AF 11
Example:
PUSH AF
69
PUSH IX
Format:
Opcode Operands
PUSH IX
Description:
Example:
PUSH IX
70
PUSH IV
Format:
Opcode Operands
PUSH IY
>>: >I
11 : 1 : 1 : 1 0 FD
Description:
Example:
PUSH IY
71
POP qq
Format:
Operands
POP qq
Description:
Pair !:.
BC 00
DE 01
HL 10
AF 11
72
Example:
POP HL
73
POP IX
Format:
Operands
POP IX
Description:
Example:
POP IX
74
POP IY
Forma t:
Operands
POP IY
1«««0>1 FD
1«<0;0;0:0>1 E1
Description:
Example:
POP IY
75
-EXGlAr'lJ[, BLOCK TRANSFER AND SEARGI GROUP-
76
EX DE. HL
Operation: DE # HL
Format:
Operands
EX DE.HL
Description:
Example:
EX DE.HL
77
EX AF, AF'
Operation: AF ~ AF
Format:
EX AF,AF'
Description:
Example:
EX AF,AF'
78
EXX
Operation: (BC) +> (BC'), (DE) +> (DE'), (HL) +> (HL')
Format:
Opcode Operands
EXX
Description:
Example:
EXX
the contents of the register pairs will be as follows:
BC: 0988H; DE: 9300H; HL: OOE7H; BC': 445AH; DE': 3DA2H;
and HL': 8859H.
79
EX (SPJ, HL
Format:
Operands
EX (SP) ,HL
Description:
Example:
EX (SP),HL
80
EX (SPJ, IX
Opcode Operands
EX (SP),IX
I <<<a: a: a: < I. 1 E3
Description:
Example:
EX (SP),IX
81
EX (SPJ. IY
Format:
Operands
EX (SP) .IY
1«««<11 FD
I <<<a; a; a; < 11 E3
Description:
Example:
EX (SP). IY
82
LDI
Format:
LDI
11: 0: 1: 0: 0: 0: 0: 0I AO
Description:
83
Example:
LDI
HL 11l2H
(llllH) 88H
DE 2223H
(2222H) 88H
BC 6H
84
LDIR
LDIR
Forma t:
Operands
LDIR
11: 1: 1: 0: r: 1: 0: 1I ED
I r: 0: 1: 1: 0: 0: 0: 0I BO
Description:
For BC-O:
For BC=O:
85
Condition Bits Affected:
s: Not affected
Z: Not affected
H: Reset
P/V: Reset
N: Reset
C: Not affected
Example:
LDIR
HL 11l4H
DE 2225H
BC oooon
(llllH) a8H (2222H) 8aH
(l1l2H) 36H (2223H) 36H
(l1l3H) A5H (2224H) A5H
86
LDD
Format:
Opcode Operands
LDD
S: Not affected
z: Not affected
H: Reset
p/v: Set if BC-1~O;
reset otherwise
N: Reset
C: Not affected
87
Example:
LDD
HL UIOH
(UIIH) 88H
DE 222lH
(2222H) 88H
BC 6H
88
LDDR
~:
Operands
LDDR
1«««0>1 ED
I<a: <<<a: a: I 0 B8
Description:
For BC-O:
For BC-O:
S: Not affected
Z: Not affected
H: Reset
P/V: Reset
N: Reset
89
Example:
LDDR
HL lll1H
DE 2222H
BC OOOOH
90
CPI
Operands
CPI
Description:
Example:
91
CPI
•
CPIR
Forma t:
Operands
CPIR
11»:0»:0>1 ED
>
I<0 >:a :a :0 I > B1
Description:
•
93
Condition Bits Affected:
Example:
(llllH) 52H
(1l12H) OOH
(11l3H) F3H
CPIR
94
CPO
~:
Operands
CPD
1«<0»»1 ED
Description:
Example:
95
the Byte Counter will contain OOOOH, the HL register
pair will contain 1110H, the Z flag in the F register
will be set, and the P/V flag in the F register will be
reset. There will be no effect on the contents of the
Accumulator or address llllH.
CPDR
Format:
Operands
CPDR
1«<0»:0>1 ED
Description:
97
Condition Bits Affected:
Example:
(lll8H) 52H
(1l17H) OOH
(lll6H) F3H
CPDR
98
•
-8 BIT ARIlHr£rIC AND LCXJlCAL Gf{)UP-
99
ADD A, r
Operation: A +- A +r
Format:
Opcode Operands
ADD A,r
Description:
Register
A III
B 000
C 001
D 010
E 011
H 100
L 101
100
Example:
ADD A,C
101
ADD A, n
Operation: A+-A+n
Format:
Opcode Operands
ADD A.n
I<<a: a: a: << I 0 C6
I.. : In: : : .. I
Description:
Example:
ADD A.33H
102
ADD A, (HLJ
Operation: A ~ A + (HL)
Format:
Opcode Operands
ADD A, (HL)
Description:
Example:
----
If the contents of the Accumulator are AOH, and the
content of the register pair HL is 2323ll, and memory
location 2323H contains byte 08H, after the execution of
ADD A, (HL)
103
ADD A, (IX+dJ
Operation: A~A+(IX+d)
Format:
Operands
ADD A, (IX+d)
11 :a: a: a: a:<< I 0 86
I: : :< : : : I
Description:
104
lOOSH is 22H, after the execution of
ADD A, (IX+SH)
'105
ADD A, (IY+dJ
Operation: A+-A+(IY+d)
~:
Operands
ADD A, (IY+d)
11 >>>>>;a >I FD
11 :0 :a :a :a >>: 0 I 86
I~d::: .. ,
Description:
Example:
106
location lOOSH is 22H, after the execution of
ADD A, (I Y+SH)
107
ADC A, s
Operation: A+-A+s+CY
Format:
Operands
----
ADC A,s
ADC A, r
>:0 >>~r*:
ADC A,n
»»»:0 CE
.. : In: : I ;.
ADC A, (HL)
<0:0:0:«<0 8E
ADC A, (IX+d)
»»>:0> DO
;a:a;a»» 8E
.; : >: : : ..
ADC A, (IY+d)
»»>:0> FD
:0;0:0»>:0 8E
I: : :d: : : ;.
*r identifies registers B,C,D,E,H,L or A assembled as
follows in the object code field above:
108
Register
B 000
C 001
D 010
E all
H 100
L 101
A 111
Description:
Example:
ADC A, (HL)
109
SUB s
Operation: A+-A-s
Format:
Operands
SUB
SUB r
<a; a; <~ r7- 0
SUB n
<<a; <a; << 0 D6
.; : In: : : ..
SUB (HL)
:a: a: <a: << 0 96
SUB (IX+d)
>;a >>>;a > DD
:a ;a >:a >>;a 96
.; : Id : : : ;.
SUB (IY+d) 11 : 1 : 1 : 1 : 1 : 1 : 0 : 1 FD
11 ; 0 : 0 : 1 : 0 ; 1 : 1 ; 0 96
I.: : :d: : ; : I
110
Register E...
B 000
C 001
D 010
E 011
H 100
L 101
A III
Description:
SUB r 4 1. 00
SUB n 7 (4,3) 1. 75
SUB (HL) 7 (4,3) 1. 75
SUB (I X+d) 19(4,4,3,5,3) 4.75
SUB (I Y+d) 19(4,4,3,5,3) 4.75
Example:
SUB D
111
sac A, s
Operation: A+-A-s-CY
Format:
Opcode Operands
SBC A,s
SBC A,r
:O:0»~r~
SBC A,n
>:0:««0 DE
.; : In! : : ;.
SBC A, (HL)
>>>>:a
:0 :0 9E
SBC A,(IX+d)
>:0 >>>:0 > DD
9E
I~:d: : : ;.
SBC A,(IY+d)
11 >>>>> ;0 > FD
1
1:°:°;1;1:1:1;° 9E
I : : :< : : ..
*r identifies registers B,C,D,E,H,L or A assembled as
follows in the object code field above:
112
Register E..
B 000
C 00 1
D 010
E all
H 100
L 101
A III
Description:
SBC A, r 4 1. 00
SBC A,n 7(4,3) 1. 75
SBC A, (HL) 7 (4,3) 1. 75
SBC A, (IX+d) 19(4,4,3,5,3) 4.75
SBC A, (IY+d) 19(4,4,3,5,3) 4.75
Example:
SBC A, (HL)
113
AND s
Operation: A ~ A /\ 5
Format:
Opcode Operands
AND
AND r
l:a>:a :a~r~
AND n
1 >>:a :a >>:a E6
.. : In: : : ;.
AND (HL)
<a: <a: a: << a A6
AND (IX+d)
1>;a >>>;a > DO
<a: r: a: a: << a A6
: : :< : :
AND (IY+d)
>>>>>: a > FD
: a >: r: r: a
0 :0 : A6
.. : :< : : :
*r identifies registers B,G,D,E,D,L or A assembled as
follows in the object code field above:
114
Register £
B 000
C 001
D 010
E 011
H 100
L 101
A 111
Description:
AND r 4 1. 00
AND n 7(4,3) 1. 75
AND (HL) 7(4,3) 1. 75
AND (IX+d) 19(4,4,3,5,3) 4.75
AND (IX+d) 19(4,4,3,5,3) 4.75
Example:
AND B
115
OR s
Operation: A ..... A Vs
Format:
Operands
OR
OR r :o»:o~r~
OR n
>>>: >>: 0 0 F6
.; : In: : : ..
OR (HL)
>: <<
:0 :1 0 : 0 86
OR (IX+d)
>: >>>:a:
0 1 DD
>>: >>:
:0 0 0 86
.. : :< : : ..
OR (IY+d) >:a :
:1 :1 :1 :1 1 FD
.; : :< : : ;.
*r identifies registers B,C,D,E,H,L or A assembled as
follows in the object code field above:
116
Register E-..
B 000
C 001
D 010
E 011
H 100
L 101
A 111
Description:
OR r 4 1. 00
OR n 7 (4,3) 1. 75
OR (HL) 7(4,3) 1. 75
OR (IX+d) 19(4,4,3,5,3) 4.75
OR (I Y+d) 19(4,4,3,5,3) 4.75
Example:
OR H
117
XOR s
Operation: A+-Affis
Format:
Operands
XOR
XOR r
l:a>:a >7-: 7-- r
XOR n
<<<a; <<< 0 EE
.; : In: : : ;.
XOR (HL)
<a; <a; <<< 0 AE
XOR (IX+d)
1 >;a >>>;a > DO
1:0: 1: 0:1:1:1: AE
.; : :<: : ;.
XOR (IY+d)
<<<<<<a; FD
118
Register E.
B 000
C 001
D 010
E 011
H 100
L 101
A 111
Description:
XOR r 4 1. 00
XOR n 7(4,3) 1. 75
XOR (HL) 7(4,3) 1. 75
XOR (IX+d) 19(4,4,3,5,3) 4.75
XOR (IY+d) 19(4,4,3,5,3) 4.75
Example:
119
CP s
Operation: A- 5
Format:
Operands
CP
CP r
<0; <<<--:-r;-
CP n
<<<<<<< 0 FE
.; I In! : : ;.
CP (HL)
<a; <<<<< BE
CP (IX+d)
<<a; <<<a; DD
<a; <<1: 1: 1: 0 BE
.; : :< : : : I
CP (IY+d)
«««0> FD
1: 0: 1: 1; 1: 1: 1; 0 BE
.; : :< : : ;.
*r identifies registers B.C.D.E.H.L or A assembled as
follows in the object code field above:
120
Register !.
B 000
C 001
D 010
E 011
H 100
L 101
A 111
Description:
CP r 1 4 LOO
CP n 2 7(4.3) 1.75
CP (HL) 2 7(4.3) L 75
CP (IX+cf) 5 19(4.4.3.5.3) 4.75
CP (IY+d) 5 19(4.4.3.5.3) 4.75
Example:
CP (HL)
121
INC r
Operation: r~r+1
Format:
Opcode Operands
INC r
Description:
Register r
A 111
B 000
C 001
D 010
E 011
H 100
L 101
122
Example:
INC D
123
INC (HLJ
Format:
Opcode Operands
INC (HL)
Description:
Example:
INC (HL)
124
INC (IX+dJ
Format:
Opcode Operands
INC (IX+d)
Ia :a >>:a >:a :a I 34
I.. : :d: : : .. I
Description:
125
Example:
INC (IX+I0H)
126
INC CIY+dJ
Opcode Operands
INC (IY+d)
11 >:1>>>: >I 0 FD
1< : :<: : .. I
Desc r iption:
127
Example:
128
-GENERAL PURPOSE ARIlH£fICAND CPU CONTROL GROUPS-
131
Register !.
B 000
C 001
D 010
E all
H 100
L 101
A 111
Description:
DEC r 1 4 1. 00
DEC (HL) 3 11(4,4,3) 2.75
DEC (IX+d) 6 23(4,4,3,5,4,3) 5.75
DEC (IY+d) 6 23(4,4,3,5,4,3) 5.75
Example:
DEC D
130
Condition Bits Affected:
Example:
15
+27
42
But when the binary representations are added in the
Accumulator according to standard binary arithmetic.
0001 0101
+0010 0111
0011 1100 3C
the SUg is agbiguous. The DAA instruction adjusts this
result so that the correct BCD representation is
obtained:
0011 1100
+0000 0110
0100 0010 • 42
133
DAA
Operation:
Format:
DAA
Description:
HEX HEX
VALUE VALUE NUMBER
C IN H IN ADDED C
BEFORE UPPER BEFORE LOWER TO AFTER
OPERATION DAA DIGIT DAA DIGIT BYTE DAA
(bit (bit
7-4) 3-0)
0 0-9 0 0-9 00 0
0 0-8 0 A-F 06 0
ADD 0 0-9 1 0-3 06 0
ADC
INC } 0
0
0
A-F
9-F
A-F
0
0
1
0-9
A-F
0-3
60
66
66
1
1
1
1 0-2 0 0-9 60 1
1 0-2 0 A-F 66 1
1 0-3 1 0-3 66 1
132
N!EG
Operation: A+-O-A
Forma t:
NEG
1«<0»»1 ED
I >:a ;a ;a >;a :a I
0 44
Description:
135
CPL
Operation: A~ A
Format:
CPL
Description:
S: Not affected
Z: Not affected
H: Set
P/V: Not affected
N: Set
C: Not affected
Example:
CPL
134
Operation: CY~Cy
Format:
CCF
Description:
137
Example:
NEG
136
NOP
Operation:
Format:
Opcode
NOP
Description:
139
SCF
Operation: CY~1
Format:
SCF
Description:
S: Not affected
Z: Not affected
H: Reset
P/V: Not affected
N: Reset
C: Set
138
01
Operation: IFF +- 0
Format:
Opcode
DI
Description:
Example:
DI
141
HALT
Operation:
Opcode
HALT
Description:
140
1M 0
Operation:
Format:
Operands
1M
Description:
1
0
>: :a : >>: I
0 0 0 46
143
EI
Format:
EI
Description:
Example:
EI
RETI
142
1M 2
Operation:
Format:
Operands
1M
1 >:0»»1
1
:
1
ED
I >>>>;a I
0 :1 :0 5E
Description:
145
1M 1
Operation:
Format:
Operands
1M
Description:
144
-16 BIT ARIlH~£TIC GRruP-
146
Example:
ADD HL,DE
Format:
Opcode Operands
ADD HL,ss
Description:
Register
Pair ss
BC 00
DE 01
HL 10
SP 11
S Not affected
Z Not affected
H Set if carry out of
Bit 11; reset otherwise
p/v Not affected
N Reset
C Set if carry from
Bit 15; reset otherwise
147
Example:
ADC HL,BC
150
ADC HL, 88
Operation: HL+-HL+ss+CY
Format:
Operands
ADC HL,ss
1«««<°1
Description:
Register
Pair ~
BC 00
DE 01
HL 10
SP 11
149
Example:
SBC ilL,DE
1~
sac HL, 88
Format:
Operands
SBC HL,ss
1
1:1:<°:1:1:°:11 ED
1°: 1»:°:°:<°\
Description:
Register
Pair ~
BC 00
DE 01
HL 10
SP 11
151
Example:
ADD IX,BC
154
ADD IX, pp
Operation: IX +-IX + pp
Forma t:
Opcode Operands
ADD IX,pp
11 : 1 : 0 >>>: > 0 I DO
1
0
:
0»>:0:0>1
Description:
Register
Pair ~
BG 00
DE 01
IX 10
SP 11
S: Not affected
Z: Not affected
H: Set if carry out of
Bit 11; reset otherwise
p/v: Not affected
N: Reset
C: Set if carry from
Bit 15; reset otherwise
153
Example:
ADD IY,BC
156
ADD IY, rr
Operation: IY+-IY+rr
Format:
Opcode Operands
ADD IY.rr
11 >>>>>:a >I FD
1
0:0»>:0:0>1
Description:
Register
Pair -!.!..
BC 00
DE 01
IY 10
SP 11
S: Not affected
Z: Not affected
H: Set if carry out of
Bit 11; reset otherwise
P/V: Not affected
N: Reset
C: Set if carry from
Bit 15; reset otherwise
155
INC IX
Operation: IX+-IX+1
Format:
Opcode Operands
INC IX
I :a >:a :a :a >>I
0 23
Description:
Example:
INC IX
158
INC 88
Operation: ss~ss+1
Format:
Opcodes Operands
INC ss
Description:
Register
Pair ss
BC 00
DE 01
HL 10
SP 11
Example:
INC HL
157
DEC ss
Op era t io n : SS +- ss -1
Format:
Opcode Operands
DEC ss
Description:
Pair ss
BC 00
DE 01
HL 10
SP 11
Example:
DEC HL
160
INC IV
Operation: IY~IY+1
Format:
Opcode Operands
INC IY
I<<<<<< I 0: 1 FD
I a: <a; a; a; < I
0: 1 23
Description:
Example:
INC IY
159
DEC IY
Operation: IY~IY-1
Format:
Operands
DEC IY
I<<<<< >I 1: 0 FD
Description:
Example:
DEC IY
162
DEC IX
Operation: IX +-IX-1
Opcode Operands
DEC IX
11 : 1 : 0 : 1 : 1 : 1 : 0 : 1 I DD
I0 : 0 : 1: 0 : 1: 0 : 1: 1 I 28
Description:
Example:
DEC IX
161
-ROTATE JWD SHIFT GROJP-
163
Example:
I 0I
after the execution of
RLCA
165
RLCA
Operation:
Format:
r¥EJJ A
Operands
RLCA
Description:
S: Not affected
Z: Not affected
H: Reset
P/V: Not affected
N: Reset
C: Data from Bit 7 of Ace.
164
Example:
RLA
167
RLA
I~I
Operation: ~
A
Format:
Operands
RLA
Description:
s: Not affected
Z: Not affected
H: Reset
P/V: Not affected
N: Reset
C: Data fro~ Bit 7 of Ace.
166
Example:
RRCA
169
RRCA
Operation: CEJlEJA
Format:
Operands
RRCA
Description:
M CYCLES: 1 T STATES: 4 MH Z E. T .: 1. 00
S: Not affected
Z: Not a f f e c t.e d
H: Reset
P/v: Not affected
N: Reset
C: Data from Bit 0 of Acc.
168
Example:
RRA
171
RRA
Operation:
Format:
Operands
RRA
Description:
S: Not affected
Z: Not affected
H: Reset
p/v: Not affected
N: Reset
C: Data froc Bit a of Ace.
170 ,
Condition Bits Affected:
Example:
RLC r
173
RLC r
Operation:
Format:
Operands
RLC
I0 :0 :0 :0 :0 ~r71
Description:
Register .E.-
B 000
C 001
D 010
E 011
H 100
L 101
A III
172
Example:
RLC (HL)
C 4 o
175
RLe (HLJ
Operation:
Format:
WEJJ (HL)
Operands
RLC (HL)
I0 : 0 : 0 :0 : 0 >>;a , 06
Description:
174
Example:
RLC (IX+2H)
177
RLe (IX+dJ
Operands
RLC (IX+d)
11 : < <<>I
0 :1 : 0 DO
11 : 1 :0 :0 >: 0 :1 :1 , CB
I~d::: .. l
I0 :0 :0 :0 :0 >: 1 :0 I 06
Description:
176
Example:
RLC (IY+2H)
C o
179
RLe CIY+dJ
Operation:
Format:
WBJ (IY+dl
Operands
RLC (1Y+d)
11 : 1 : 1 : 1 : 1 : 1 : 0 : 1 I FD
11 : 1 : 0 : 0 : 1 : 0 : 1 : 1 I CB
ISd::: .. \
I0 :0 :0 :0 :0 : 1 >: I 0 06
Description:
178
RL (IY+d) 1 1;1;1;1>:1:0;1 FD
1«0;°»» CB
1< : :< : : ;.
1°;0;0»»> 16
Register
B 000
C 001
D 010
E 011
H 011
L 101
A 111
Description:
RL r 2 8(4.4) 2.00
RL (HL) 4 15(4.4.4.3) 3.75
RL (IX+d) 6 23(4.4.3.5.4.3) 5.75
RL (I Y+d) 6 23(4.4.3.5.4.3) 5.75
181
RL m
Operation: 18BJm
Format:
Operands
RL m
RL r 1 : 1 :0 :0 : 1 :0 >>I CB
a: 0: a: <o~r~
RL (HL)
1: .< a; a; <0; < 1 CB
o: >:a:<<
0: 0 0 16
RL (IX+d)
1>:a >>>: > 0 DD
1 : 1 :0 :0 >: >>
0 CB
~<: : ..
o: 0 : 0 ; 1 ; 0 >; 1:0 16
180
RRC m
Operation: lBLB m
Format:
Operands
RRC
RRC r
1 >: :a >: >: I
0 0 1 CB
:-7r:-
o: 0 : a: 0: 1
RRC (HL)
>: >: >>
0 :0 0 CB
>>>:0
:0 :0 :0 OE
RRC (IX+d)
1 >: >>>;a >
0 DO
7:--7<:: ;.
o;a :a; >>>: 0 0 OE
183
Condition Bits Affected:
Example:
C o
RL D
C o
182
Condition Bits Affected:
Example:
RRC A
185
RRC (IY+d)
II»»»> FD
1 >:0:°>:°»
1 CB
Register .E..
B 000
C 001
D 010
E all
H 100
L 101
A 111
Description:
184
RR (IY+d) <>I
11 : 1 : 1 : 1 : 1 : a FD
I : : :< : : .. I
I :a :a >>>>:a I
0 IE
Register E.
B 000
C 001
D 010
E 011
H 100
L 101
A 111
Description:
RR r 8(4,4) 2.00
RR (HL) 15(4,4,4,3) 3.75
RR (IX+d) 23(4,4,3,5,4,3) 5.75
RR (IY+d) 23(4,4,3,5,4,3) 5.75
187
RR m
Operation:
lEHjJ
m
Format:
RR m
RR r
<<a: a: < >>I 0 CB
o: 0 : 0: 1: 1 ~r~
RR (HL)
<<a: a: <a: < 1 CB
o :a :a >>>>:a IE
RR (IX+d)
<<a: <<<a: DD
.; : :< : : .. \
o: a: a: <<<< I 0 IE
186
SLA m
Operation:
Format:
Operands
SLA
SLA r
1 >:a :a >:a: < I 1 CB
a: a: <a: o~r~1
SLA (IlL)
1: 1: 0 : 0: 1: 0: 1: 1 I CB
a: a: <a: a: << I 0 26
SLA (IX+d)
1 >:a >>>:a : DD
.; : >: : : >
o: 0 : 1:0:0: 1: 1: 0 26
189
Condition Bits Affected:
S: Se t i f result is negative;
reset otherwise
z: Set i f result is zero;
reset otherwise
H: Reset
P/V: Se t i f parity is even;
reset otherwise
N: Reset
C: Data from Bit 0 of
source register
Exampl e:
RR (HL)
188
Condition Bits Affected:
Exampl e:
SLA L
the contents of register L and the Carry Flag will be
C o
191
SLA (IY+d)
1«««0: FD
1«0:0:<0:< CB
I': : :<: : ;.
1
0:0:<0:0:« 26
Register E..
B 000
C 001
D 010
E 011
H 100
L 101
A 111
Description:
SLA r 8 (4,4) 2. 00
SLA (HL) 15(4,4,4,3) 3.75
SLA (I X+d) 23(4,4,3,5,4,3) 5.75
SLA (IY+d) 23(4,4,3,5,4,3) 5.75
190
SRA(IY+d) 1<1:1>:1:1:0:11 FD
11 >:0: 0>:0: 1: 1I CB
Register .E.
B 000
C 001
D 010
E all
H 100
L 101
A 111
193
BRA m
Operands
SRA
SRA r
< < a: a: < a: < 1I CB
a;O:<O:l~r;-
SRA(HL)
<<a; a; <a; < CB
a; a; < <<<
0: 2E
SRA(IX+d)
<<a; <<<0: DO
1: 1: 0: 0: 1: 0: 1: CB
.; : :< : : ;.
a; a; <a; <<< 2E
192
SRL m
Operation: o~
m
Format:
Operands
SRL m
SRL r 1: 1: 0: 0: 1: 0: 1: 1I CB
0: o;r;r: l;-;-r~1
SRL (HL) 1: 1; 0: 0: 1: 0: 1: 1I CB
0: 0: 1: 1: 1: 1: 1: 0I 3E
SRL (IX+d) 1 ;r :a: r; 1 >: >I
0 DD
1 >:0:0>:0>>, CB
.. : :< : : : I
a; a; <<<<< I 0 3E
195
Condition Bits Affected:
Example:
SRA (IX+3H)
194
Condition Bits Affected:
S: Reset
Z: Set if result is zero;
reset otherwise
H: Reset
p/v: Set if parity ~s even;
reset otherwise
N: Reset
C: Data from Bit 0 of
source register
Example:
SRL B
197
SRL (I Y+d)
1«1»»>1 FD
I.. : Ict: : : .. I
I a: a: <<<<< I 0 3E
Register E.
B 000
C 001
D 010
E all
H 100
L 101
A 111
Description:
SRL r 8( 4,4) 2. 00
SRL (HL) 15(4,4,4,3) 3.75
SRL (IX+d) 23(4,4,3,5,4,3) 5.75
SRL (IY+d) 23(4,4,3,5,4,3) 5.75
196
Example:
Accumulator
(5000H)
RLD
the contents of the Accumulator and memory location
5000H will be
Accumulator
(5000H)
199
RLD
Operation: A~(HL)
Format:
Opcode Operands
RLD
1«1»»>1 ED
I0: 1: r: 0: 1: <<1I 6P
Description:
The contents of the low order four bits (bits 3,2,1 and
0) of the memory location (HL) are copied into the high
order four bits (7,6,5 and 4) of that same memory
location; the previous contents of those high order four
bits are copied into the low order four bits of ihe
Accumulator (register A); and the previous contents of
the low order four bits of the Accumulator are copied
into the low order four bits of memory location (HL).
The contents of the high order bits of the Accumulator
are unaffected. Note: (HL) means the memory location
specified by the contents of the HL register pair.
198
Example:
Accumulator
(5000H)
RRD
Accumulator
(5000H)
201
RRD
Operation: A~(HL)
Format:
Opcode Operands
RRD
I<<< <<Q: I 0: 1 ED
I >>:a; >>>I
0 Q 67
Description:
The contents of the low order four bits (bits 3,2,1 and
0) of memory location (HL) are copied into the low order
four bits of the Accumulator (register A); the previous
contents of the low order four bits Gf the Accumulator
are copied into the high order four bits (7,6,~ ~nd 4)
of location (HL); and the previous contents of the high
order four bits of (HL) are copied into the low order
four bits of (HL). The contents of the high order bits
of the Accumulator are unaffected. Note: (HL) means
the memory location specified by the contents of the HL
register pair.
200
-BIT SEL RESET AND lEST GRa.lP-
202
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
Example:
BIT 2,B
Operation: Z~rb
Format:
Operands
BIT b,r
I0: 1~b~:~r7-1
Description:
S: Unknown
Z: Set if specified Bit is
0; reset otherwise
H: Set
p Iv: Unknown
N: Reset
C: Not affected
203
Example:
BIT 4, (HL)
206
BIT b. CHLJ
Operation: Z~(HLlt,
Format:
Operands
BIT b, (HL)
Description:
1
0
>~b~1 >: I 0
Bit Tested 1?
0 000
1 001
2 010
3 011
4 100
5 101
6 110
7 111
S: Unknown
Z: Set if specified Bit is
0; reset otherwise
H: Set
P/V Unknown
H Reset
C Not affected
205
Condition Bits Affected:
S: Unknown
z: Set if specified Bit is
0; reset otherwise
H: Set
P/V: Unknown
N: Reset
C: Not affected
Example:
BIT 6. (IX+4H)
208
BIT b, CIX+dJ
Format:
Operands
BIT b,(IX+d)
1: 1: >: >>
0 :0 0 CB
.. : :<: : "
o >:-+b~«O
Description:
Bit Tested 1?
0 000
1 001
2 010
3 011
4 100
5 101
6 110
7 111
S: Unknown
Z: Set if specified Bit is
0; reset otherwise
207
Condition Bits Affected:
S: Unknown
z: Set if specified Bit is
OJ reset otherwise
H: Set
p/V: Unknown
N: Reset
C: Not affected
Example:
BIT 6, (IY+4H)
210
BIT b, CIY+dJ
BIT b, (IY+d)
Format:
Operands
BIT b, (IY+d)
: 1 : a :0 >: 0 :1 :1 1 CB
~d::: >1
o >7-7b~ 1>:0I
Description:
209
SET b, (HLJ
Operation: (HL1b ~ 1
Forma t:
Operands
SET b, (HL)
Bit Tested E-
O 000
1 001
2 010
3 011
4 100
5 101
6 110
7 III
M CYCLES: T STATES: 15(4,4,4,3) 4 MHZ E. T.: 3.75
Example:
SET 4,(HL)
212
SET b, r
Format:
Operands
SET b,r
11 >~b-;-:~r-:-- ,
Description:
Example:
SET 4,A
211
Example:
SET O,(IX+3H)
bit 0 in memory location 2003H will be 1. (Bit 0 in
memory location 2003H is the least significant bit.)
214
SET b, CIX+dJ
Operation: (IX+d)~~1
Format:
Operands
SET b, (IX+d)
~d::::.
1>7-7b~l >:a
Description:
0 000
1 001
2 010
3 011
4 100
5 101
6 110
7 111
213
the execution of
SET O,(IY+3H)
216
SET b, (IY+dJ
Format:
Operands
SET b,(IY+d)
11>>>>>:a >I FD
l~<:: .I
11 : 17-+b~1 :1 :0 I
Description:
Bit Tested E.
0 000
1 001
2 010
3 011
4 100
5 101
6 110
7 111
Example:
215
Bit Reset b Register r
0 000 B 000
1 001 C 001
i 010 D 010
3 011 E 011
4 100 H 100
5 101 L 101
6 110 A 111
7 111
Description:
Example:
RES 6,D
218
RES b, m
Operation: sb +- 0
Opcode Operands
RES p,m
RES b,r
t :1 :0 :0 : <>>I
0 CB
1;0 :~b+-:~r71
RES b,(HL)
>: >: >>I
0 :0 0 CB
:O~b~l >:01
RES b, (IX+d)
>: 0 : 1 : 1 : 1 :0 : 1 DO
I~d::: .
11 :0 7--:b~1 >:0
RES b, (IY+d)
11 >>>>>: > 0 FO
11 >: >: »
0 :0 0 CB
I~d::: .
11 : 7--:b~ 1>:a
0
217
-JlJ'P GIUJP-
219
CC, nn
Operation: IF cc TRUE, PC +- nn
Format:
Opcode Operands
JP cc.nn
11 :1~cc~ 0 : 1:0 I
I.. : In: : : .. I
1< : :n; : : :·1
Note: The first n operand in this assembled object code
is the low order byte of a 2-byte memory address.
Description:
cc CONDITION RELEVANT
FLAG
221
nn
Operation: PC+-nn
Format:
Operands
JP nn
I<< :a :a :a >>I
0 C3
Description:
220
~R e
Operation: PC+-PC+e
Forma t:
Ope ode
JR e
I :a :a >>:a :a ;a I
0 18
1~~-2: : : ;.1
Description:
Example:
JR $+5
The resulting object code and final PC value is shown
below:
Location Instruction
480 i8
481 03
482
483
484
485 PC after jump
223
M CYCLES: T STATES: 10(4,3,3) 4 MHZ E. T .: 2.50
Example:
JP C,1520H
222
JR C,$-4
Location Instruction
225
~R c, e
Operation: If C = 0, continue
IfC=1, PC+-PC+e
Format:
Operands
JR C,e
I >>>:
0: 0 0: 0: 0 I 38
I*:e-~ :: :.,
Description:
If condition is met:
Example:
224
JR NC. $
Location Instruction
227
~R Ne, e
Opcode Operands
JR NC,e
I-:-+-:e-~ : : .. I
Description:
Example:
226
JR Z,$ +5
Location Instruction
300 28
301 03
302
303
304
305 PC after jump
229
~R z, e
Operation: If Z = O. continue
If Z = 1, PC +- PC + e
Format:
Operands
JR Z,e
1*:e-2: :: :·1
Description:
Example:
228
JR NZ,$-4
Location Instruction
231
~R NZ, e
Operation: If Z = 1, continue
If Z = 0, PC +- PC + e
Format:
Opcode Operands
JR NZ,e
I >:
0 :0 0 :0 :0 : 0 :0 , 20
1-7-+-: e 2
- : : : :. I
Description:
Exampl e:
230
(IX)
Operation: PC+-IX
Format:
Operands
JP (IX)
Description:
Example:
JP (IX)
233
(HLJ
Operation: PC+-HL
Format:
Operands
JP (ilL)
Description:
Example:
JP (HL)
232
D~NZJ e
Operation:
Format:
DJNZ e
Ia; a; a; <a; a; a; 0 I 10
1*~-2: :: :11
Description:
If B"O:
I f B-O:
Example:
235
(IY)
Operation: PC+-IY
Format:
Operands
JP (IY)
1«««0>1 FD
Description:
Example:
JP (IY)
234
-00 JV{) REIU~ GIUJP-
237
(OUTBUF). It moves the bytes until it finds a CRt or
until it has moved 80 bytes, whichever occurs first.
236
Example:
Location Contents
lA47H CDH
lA48H 35H
lA49H 2lH
CALL 2l35H
239
CALL nn
Format:
Operands
CALL nn
I <<a: a: <<a: 1 I CD
I .. :In: : : .. I
I.. : In: : : :'1
Note: The first of the two n operands in the assembled
object code above is the least significant byte of a
two-byte memory address.
Description:
238
the push is executed. Condition cc is programmed as one
of eight status which corresponds to condition bits in
the Flag Register (register F). These eight status are
~fined in the table below, which also specifies the
corresponding cc bit fields in the assembled object
code:
cc Condition Relevant
Flag
If cc is true:
If cc is false:
Example:
Location Contents
1A47H 04n
1A48H 35H
1A49H 21n
then if an instruction fetch sequence begins, the
three-byte instruction 0435210 will be fetched to the
CPU for execution. The mnemonic equivalent of this is
CALL NC,2135H
241
CALL CC, nn
Opcode ~erands
CALL cC,nn
I < ~:cc7--+< a: I
1 0
Description:
240
RET
RET
Description:
Example:
RET
243
After the execution of this instruction, the contents of
memory address 300lR will be lAR, the contents of
address 3000R will be 4AR, the contents of the Stack
Pointer will be 3000R, and the contents of the Program
Counter will be 2l35R, pointing to the address of the
first opcode of the subroutine now to be executed.
~2
M CYCLES: 3 T STATES: 11(5,3,3) 4 MHZ E. T.: 2.75
If cc is false:
Example:
RET M
245
RET cc
Format:
RET cc
Description:
Condition Relevant
Flag
244
B generates an interrupt and is acknowledged. (The
interrupt enable out. lEO. of B goes low. blocking any
lower priority devices from interrupting while B is
being serviced). Then A generates an interrupt.
suspending service of B. (The lEO of A goes 'low'
indicating that a higher priority device is being
serviced.) The A routine is completed and a RETl is
issued resetting the lEO of A. allowing the B routine to
continue. A second RETl is issued on completion of the
B roatine and the lEO of B is reset (high) allowing
lower priority devices interrupt access.
~7
RETI
Format:
RETI
11»»»>1 ED
Description:
Example:
~ I_IE_'I_-,-_ _I_E_0-J~
INT~ 246
order-byte first. and 0066H will be loaded onto the
Program Counter. That address begins an interrupt
service routine uhich ends with RETN instruction. Upon
the execution of RETN. the former Program Counter
contents are popped off the external memory stack.
low-order first. resulting in a Stack Pointer contents
again of lOOOH. The program flow continues where it
left off with an opcode fetch to address lA45H.
249
RETN
Format:
RETN
Description:
Example:
248
Example:
251
RST p
Format:
Opcode
RST p
Description:
--L
DOH 000
08H 001
10H 010
18H 011
20n 100
2!ln 101
30Il 110
38H 111
260
-INPUT AND aJTPlJT GIUIP-
252
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
IN r, [CJ
Operation: r ~ (C)
Format:
Operands
IN r,(C)
10 : 1 ~r~ 0 : 0 : 0 I
Description:
Reg.
B 000
C 001
D 010
E 011
H 100
L 101
A 111
254
IN A, (n)
Fo rmat:
Operands
IN A, (n)
I~<::"I
Description:
Exampl e:
IN A,(OIH)
253
INI
Format:
INI
11 :0 >: :a ;0 >: I
0 Q A2
Description:
S: Unknown
Z: Set if B-l-O;
reset otherwise
H: Unknown
ply: Unknown
N: Set
C: Not affected
Example:
256
Condition Bits Affected:
Example:
IN D,(C)
255
INIR
Format:
INIR
Description:
I f B=O:
I f B=O:
258
after the execution of
un
memory location lOOOH will contain 7BH, the HL register
pair will contain lOOlH, and register B will contain
OFH.
257
IND
Format:
IND
1<0>:0>:0;<01 AA
Description:
S: Unknown
Z: Set if B-l-O;
reset otherwise
H: Unknown
ply: Unknown
N: Set
C: Not affected
Example:
260
Condition Bits Affected:
S: Unknown
Z: Set
H: Unknown
p/V: Unknown
N: Set
C: llot affected
Example:
SlH
A9H
03H
INIR
Location Contents
lOOOH SlH
lOOlH A9H
l002H 03H
259
INDR
Format:
INDR
Description:
I f B=O:
I f B=O:
262
peripheral device mapped to I/O port address 07H, then
after the execution of
IND
memory location 1000H will contain 7BH, the HL register
pair will contain OFFFH, and register B will contain
OFH.
OUT (n), A
Operation: (n) +- A
Format:
Operands
OUT (n),A
Description:
I~<:: ;.)
The operand n is placed on the bottom half (AO through
A7) of the address bus to select the I/O device at one
of 256 possible ports. The contents of the Accumulator
(register A) also appear on the top half (A8 through
A15) of the address bus at this time. Then the byte
contained in the Accumulator is placed on the data bus
and written into the selected peripheral device.
Example:
OUT (OIH),A
264
Condition Bits Affected:
S: Unknown
Z: Set
H: Unknown
ply: Unknown
N: Set
C: Not affected
Example:
5111
A9H
03H
INDR
Location Contents
OFFEH 03H
OFFFH A9H
lOOOH 5111
263
Condition Bits Affected: None
Example:
OUT (C).D
266
OUT (el, r
Operation: (e) +- r
Format:
Operands
OUT (C) ,r
10: 1 ~r~o: 0: 11
Description:
Register
B 000
C 001
D 010
E 011
H 100
L 101
A 111
265
59H, then after the execution of
OUTI
268
OUTI
Format:
Opcode
OUT!
Description:
S: Unknown
Z: Set if B-1-0;
reset otherwise
H: Unknown
ply: Unknown
N: Set
C: Not affected
Example:
267
Condition Bits Affected:
S: Unknown
z: Set
H: Unknown
p /V: Unknown
N: Set
C: Not affected
Example:
Location Contents
lOOOH 5iH
lOOlH A9H
l002H 03H
OTIR
5iH
A9H
03H
270
OTIR
Format:
OTIR
1«<0»:0>1 ED
Description:
If B-O:
I f B-O:
269
register Bare IOH, the contents of the HL register pair
are IOOOH, and the contents of memory location IOOOH are
59H, after the execution of
OUTD
272
aUTO
Format:
OUTDo
11 >>:°>>: 1I 0: ED
1 1:0;1:°:1:°;1;11 AB
Description:
S: Unknown
Z: Set if B-1-0j
reset otherwise
H: Unknown
p/V: Unknown
N: Set
C: Not affected
Example:
271
Condition Bits Affected:
S: Unknown
z: Set
H: Unknown
p /V: Unknown
N: Set
C: Not affected
Example:
Location Contents
OFFEH 5lH
OFFFH A9H
lOOOH 03H
OTDR
03H
A9H
5lH
274
OTDR
Format:
OTDR
1«««0:11 ED
I f B-O:
I f B"O:
273
EX (SP),IX Exchange the location (SP)
and IX 81
EX (SP),IY Exchange the location (SP)
and IY 812
EX AF,AF' Exchange the contents of AF and AF' 78
EX DE,HL Exchange the contents of DE and HL 77
EXX Exchange the contents of
BC,DE,HL with contents of
BC' ,DE' ,HL' respectively 79
HALT HALT (wai-t for interrupt or reset) 14P
1M 0 Set interrupt mode 0 143
1M I Set interrupt mode I , 1~
1M 2 Set interrupt mode 2 145
IN Ii., (n) Load the Acc. with
input from device n " 253
IN r, (C) Load the Reg. r with
input from device (C) 254
INC (HL) Increment location (HL) 124
INC IX Increment IX 1513
INC (IX+d) Increment location (IX+d) 125
INC IY Increment IY 159
INC (IY+d) Increment location (IY+d) 12'7
INC r Increment Reg. r 122
INC ss Increment Reg. pair ss 15'7
IND Load location (HL) with
input from port (C),
decrement HL and B 260
INDR Load location (HL) with
input from port (C),
decrement HL and decrement B,
rep eat un til B• 0 .. •.. . .• 262
INI Load location (HL) with
input from port (C);
and increment HL and decrement B 256
INIR Load location (HL) with
input from port (C),
increment HL and decrement B,
repeat until B.O 258
JP (HL) Unconditional Jump to (HL) 232
JP (IX) Unconditional Jump to (IX) 233
JP (IY) Unconditional Jump to (IY) 234
JP cc,nn Jump to location nn
if condition cc is true 221
JP nn Unconditional jump to location nn 220
JR C,e Jump relative to
PC+e if carry· I 224
JR e Unconditional Jump
relative to PC+e ~ 223
JR NC,e Jump relative to
PC+e if carry.O 226
276
zao-cpu INSTRUCTION SET
ALPHABETICAL
ASSEMBLY MNEMONIC OPERATION PAGE
275
LDI Load location (DE) with location (HL),
increment DE,HL, decrement BC .•...•...•........ ~ .•. a3
LDIR Load location (DE) with location (HL),
increment DE,HL, decrement
BC and repeat until BC=O .•...••.................•....... 85
NEG Negate Acc. (2's complement) •..•...•.•••••......••... 13!l
NOP No operation •....................•..•.••••.•••••.•..•.••••..••.•. 139
OR s Logical 'OR' of operand sand Acc •.............. 116
OTDR Load output port (C) with location (HL)
decrement HL and B,
rep eat un til B= 0 273
OTIR Load output port (C) with location (HL),
increment HL, decrement B,
rep eat un til B= 0 269
OUT (C),r Load output port (C) with Reg. r .....••.••........ 26!/
OUT (n),A Load output port (n) with Acc •..•.•••..•........... 264
OUTD Load output port (C) with location (HL),
decrement HL and B....•.•••••.••..•••••.••.•...•••...••••.••• 271
OUTI Load output port (C) with location (HL),
increment HL and decrement B 267
POP IX Load IX with top of stack 74
POP IY Loa d I Y wit h top 0 f s t a c k .. . . . . . . . . . .. .. . . . . . . .. . .. 75
POP qq Load Reg. pair qq with top of stack 72
PUSH IX Load IX onto stack 70
PUSH IY Load IY onto stack •.•..•••••.••.•••••••..•••.....•........... 71
PUSH qq Load Reg. pai.r qq onto stack 69
RES b,m Reset Bit b of operand m ...................••..•..••..•. 217
RET Return from subroutine 243
RET cc Return from subroutine if condition
c c i s t rue 244
RETI Return from interrupt 246
RETN Return from non maskable interrupt ..•.••...•.•.. 248
RL m Rota te left through carry operand m •••••••••••• 180
RLA Rotate left Acc. through carry ......•....•..•..•.•. 166
RLC (HL) Rotate location (HL) left circular ...•.•..•••... 174
RLC (IX+d) Rotate location (IX+d) left circclar ........•.. 176
RLC (IY+d) Rotate location (IY+d) left circular 178
RLC r Rotate Reg. r left circular 172
RLCA Rotate left circular Acc 164
RLD Rotate digit left and right
between Acc. and location (HL) ..........•.......•... 198
RR m Rotate right through carry operand m 186
RRA Rotate right Acc. through carry 170
RRC m Rotate operand m right circular 183
278
JR NZ,e Jump relative to
PC+e if non zero (Z-O) ................•..........•....••.. 230
JR Z,e Jump relative to
PC+e if zero (Z-1) ....•...................................... 228
LD A, (BC) Load Ace. with location (BC) ...•.....•......•........ 42
LD A, (DE) Load Ace. with location (DE) 43
LD A,I Load Ace. with I 48
LD A,(nn) Load Ace. with location nn .........•....••..••...•.... 44
LD A,R Load Ace. with Reg. R 49
LD (BC) ,A Load location (BC) with Ace •......................... 45
LD (DE) ,A Load location (DE) with Ace •......................... 46
LD (HL),n Load location (HL) with value n 39
LD dd,nn Load Reg. pair dd with value nn 53
LD dd,(nn) Load Reg. pair dd with location (nn>. 57
LD HL, (nn) Load HL with location (nn) 56
LD (HL),r Load location (HL) with Reg. r ......•...•.......... 34
LD I,A Load I with Ace 50
LF IX,nn Load IX with value nn 54
LD IX, (nn) Load IX with location (nn) 59
LD (IX+d),n Load location (IX+d) with value n 40
LD (IX+d),r Load location (IX+d) with Reg. r •.•............... 35
LD IY,nn Load IY with value nn 55
LD IY,(nn) Load IY with location (nn) 60
LD (IY+d) ,n Load location (IY+d) with value n 41
LD (IY+d),r Load location (IY+d) with Reg. r 37
LD (nn),A Load location (nn) wi th Ace. 47
LD (nn),dd Load location (nn) with Reg. pair dd 62
LD (nn),HL Load location (nn) with HL 61
LD (nn),IX Load location (nn) with IX 64
LD (nn),IY Load location (nn) with IY 65
LD R,A Load R wi th Ace. 51
LD r,(HL) Load Reg. with location (HL) ...•................. 29
LD r,(IX+d) Load Reg. with location (IX+d) 30
LD r,(IY+d) Load Reg. with location (IY+d) 32
LD r,n Load Reg. with value n 28
LD r , r ' Lo ad Reg. r wi t h Reg. r' 27
LD SP,HL Load SP with HL 66
LD SP,IX Load SP with IX ...•...•...........•....•...................... 67
LD SP,IY Load SP with IY 68
LDD Load location (DE) with location (HL),
decrement DE,HL and BC ...............................••.. 87
LDDR Load location (DE) with location (HL),
decrement DE,HL and BC;
repea t un til BC-O 89
277
APPENDIX A
ERROR MESSAGES AND EXPLANATIONS
280
RRCA Rotate right circular Acc •.•.•........•..•..•.....•... 168
RRD Rotate digit right and left
between Acc. and location (HL) ........•...........• 200
RST P Restar t to location p .....•................•.............. 250
SBC A, s Subtract operand s
from Acc. with carry 112
SBC HL,ss Subtract Reg. pair ss from
HL with carry 151
SCF Set carry flag (C-l) 138
SET b,(HL) Set Bit b 0 f l o cat ion ( HL) 212
SET b,(IX+d) Set Bit b of location (IX+d). 213
SET b, (IY+d) Set Bit b of location (IY+d) 215
SET b, r Set Bit b of Reg. r 211
SLA m Shift operand m left arithmetic 189
SRA m Shift operand m right arithmetic 192
SRL m Shift operand m right logical 195
SUB s Subtract operand s from Acc 110
XOR s Exclusive 'OR' operand sand Acc 118
279
bytes). The line will be truncated.
16) MACRO STACK OVERFLOW
Indicates that the depth of nesting of macro
calls has exceeded the macro parameter stack
buffer capacity. Occurs when the sum of the
parameter string lengths (plus some additional
information for each macro call) is longer
than the buffer (currently 256 bytes), which
often happens if infinitely recursive macro
calls are used. The macro call which caused
the error will be ignored.
17) INCLUDE NESTED TOO DEEP
Indicates that a *Include command was found
which would have caused a nesting of included
source files to a depth greater than four,
where the original source file is considered
to be level one. The command will be ignored.
18) GLOBAL DEFINITION ERROR
Indicates that either a label was present on a
GLOBAL pseudo-op statement, or there was an
attempt to give an absolute value to a GLOBAL
symbol in a relocatable module. The latter
case is not allowed since all GLOBALs in a
relocatable module will be relocated'by the
Linker. May occur either after a GLOBAL
pseudo-op or after an EQU or DEFL statement
which is attempting to absolutize a
relocatable GLOBAL symbol.
19) EXTERNAL DEFINITION ERROR
Indicates that either a label was present on
an EXTERNAL pseudo-op statement, or there was
an attempt to declare a symbol to be EXTERNAL
which had previously been defined within the
module to have an absolute value. May occur
due to a misspelling or other oversight.
20) NAME DECLARED GLOBAL AND EXTERNAL
Indicates that the name was found in both a
GLOBAL pseudo-op and an EXTERNAL pseudo-op
which is contradictory. May occur due to a
misspelling or other oversight.
21) LABEL DECLARED AS EXTERNAL
Indicates that a name has been declared in
both an EXTERNAL pseudo-op and as a label in
this module. May occur due to a misspelling
or other oversight.
22) INVALID EXTERNAL EXPRESSION
Indicates that a symbol name which has been
declared in an EXTERNAL pseudo-op is
improperly used in an expression. May occur
when invalid arithmetic ope~ators are applied
to an external expression or when the mode of
~2
was never defined. Occurs when a name is
misspelled or not declared as a label for. an
instruction or pseudo-ope
9) INVALID OPERAND COMBINATION
Indicates that the operand combination for
this opcode is invalid. Occurs when a register
name or condition code is missspelled or
incorrectly used with the particular opcode.
10) EXPRESSION OUT OF RANGE
Indicates that the value of an expression is
either too large or too small for the
appropriate quantity. Occurs on 16-bit
arithmetic overflow or division by zero in an
expression, incrementing the reference counter
beyond a 16-bit value, or trying to use a
value which will not fit into a particular
bit-field - typically a byte.
11) MULTIPLE DECLARATION
Indicates that an attempt was made to redefine
a label. Occurs when a label is. misspelled,
or mistakenly used several times. The
pseudo-op DEFL can be used to assign a value
to a label which can then be redefined by
another DEFL.
12) MACRO DEFINITION ERROR
Indicates that a macro is incorrectly defined.
Occurs when the M option is not specified but
macros are used, when a macro is defined
within another macro definition, when the
parameters are not correctly specified, or an
unrecognized parameter is found in the macro
body.
13) UNBALANCED QUOTES
Indicates that a string is not properly
bounded by single quote marks or quote marks
inside a string are not properly matched in
pairs.
14) ASSEMBLER COMMAND ERROR
Indicates that an assembler command is not
recognized or is incorrectly formed: The
command must begin with an asterisk (*) in
column one, the first letter identifies the
command, and any parameters such as 'ON','OFF'
or a filename must be properly delimited. The
command will be ignored.
15) MACRO EXPANSION ERROR
Indicates that the expansion of a single line
in a macro has overflowed the expansion
buffer. Occurs when substitution of parameter
causes the line to increase in length beyond
the capacity of the buffer (currently 128
APPENDIX B
INSTRUCTION SET ALPHABETICAL ORDER
2-BO CRUSS ASSEMBLER VERSION 1.06 OF 06/18176
07109176 10=22 :47 OPCOOE L ISTlNG
LUC 08J COOt: STMT SOURCE STATEMENT LOC 08J CODE STMT SOURCE STATEMENT
284
an operand m~st be either absolute or
relocatable.
23) INVALID RELOCATABLE EXPRESSION
Indicates than an expression which contains a
relocatable value (either a label or the
reference counter sumbol $ in a relocatable
module) is improperly formed or used. May
occur when invalid arithmetic operators are
applied to a relocatable expression or when
the mode of an operand must be absolute.
Remember that all relocatable values
(addresses) must be represented in 16 bits.
24) EXPRESSION MUST BE ABSOLUTE
Indicates that the mode of an expression is
not absolute when it should be. May occur
when a relocatable or external expression is
used to specify a quantity that must be either
constant or representable in less than 16
bits.
25) UNDEFINED GLOBAL(S)
Indicates that one or more sumbols which were
declared in a GLOBAL pseudo-op were never
actually defined as a label in this module.
May occur due to a misspelling or other
oversight.
26) WARNING - ORG IS RELOCATABLE
Indicates that an ORG statement was
encountered in a relocatable module. This
warning is issued to remind the user that the
reference counter is set to a relocatable
value, not an absolute one. May occur when
the Absolute option is not specified for an
absolute module. This warning may be
suppressed by the NOW option.
283
Z-80 CROSS ASSEMBLER VERSION 1.06 OF 06/18176
01109176 10J22JIo7 opeOOE LISTING
Loe 08J CODE STMT SOURCE STATEMENT Loe OBJ eOOE STMT SOURCE STATEMENT
022E
022F
70
3E20
277
278
LO
LO
A,L
A,N
02 AS
02AB
OD6E05
FD6E05
3'06
3'07
LO
LO t:::~:::g:
0231 '06 279 LO B,(HLI 02AE 6F 3'08 LO L,A
0232 00'0605 280 LO B,(JX"INOI 02AF 68 3'09 LO L,8
0235 FOlo605 281 LO B,II\'.. INOI 0280 69 350 LO L,e
0238 '07 282 LO B,A 02B1 6A 351 LO L,O
0239 '00 l83 LO 8,8 0282 6B 352 LO L,E
023A '01 28'0 LO B,e 02B3 6e 353 LO L,H
0238 '02 285 LO B,O 02BIo 6D 35'0 LO L,L
023e '03 286 LO B,E 02B5 2E20 355 LO L,N
0230 '0'0 287 LO B,H,NN 02B7 ED7B81005 356 LO SP,UINI
OnE '05 '288 LO B,L 0288 F9 357 LO SP,H~
023F 0620 289 LO B,N 028e OOF9 358 LO SP,Il(
02'01 EDitB81005 290 LO Be,INNI 028E FDF9 359 LD SP, It
0245 018'005 291 LO Be,NN 02eo 318'005 360 LO SP,Nr,!
0210B 4E 292 LD e,lHlI 02e3 EOU 361 LOO
0249 00loE05 293 LO e,( IXHNDI 02es ED88 362 LODR
0210e FOloE05 29'0 LO e,IIYHNOI 02e7 EDAO 363 LOI
0210F 'oF 295 LO e,A 02e9 EOBO 36'0 LOIR
0250 '08 296 LO e,B 02e8 EOIoIo 365 NEG
0251 49 297 LO e,e 02eo 00 3bb Nap
0252 loA 298 LO e,o 02eE B6 361 OR (HLI
0253 loB 299 LO e,E 02eF 00B605 368 OR IIXt>t NOI
0254 Ioe 300 LO e,H 0202 FOB605 369 OR (lY" NOI
0255 '00 301 LO e,L 0205 B7 370 OR A
0256 OE20 302 LO e,N 0206 BO 371 DR B
025B 56 303 LD O,lHlI 02D7 Bl 372 OR e
0259 OD5605 30'0 LO O,IIXHNDI 0208 B2 373 OR 0
025e F05605 305 LO 0,( IY+INOI 0209 B3 37'0 OR E
025F 57 306 LO O,A 020A Bio 375 OR H
0260 50 307 LO O,B 020B B5 376 OR L
0261 51 3011 LO !;l,e 020C Fb20 377 OR N
0262 52 309 LO D,O 020E EOBB 378 DTOR
02b3 53 310 LO O,E 02EO EOB3 379 OUR
02blo 5'0 311 LO O,H 02E2 E079 380 DUT (CI,A
02b5 55 312 LO O,L 02E1t EOlol 381 OUT ICI.B
0266 1620 313 LO O,N 02E6 EDit9 382 OUT lel.C
026B E05BBIo05 31'0 LO DE, (I'll'll 02E8 E051 383 OUT (CHO
026e 118'005 315 LO OE,NN 02EA ED59 38'0 OUT I"I.E
026F 5E 316 LO E,IHll 02Ee ED61 385 OUT (el,H
0270 005E05 317 LO E,( IX+INOI 02EE E069 386 OUT ICHL
0273 F05E05 318 LO E,IIY+INOI 02FO 0320 387 OUT N,A
0216 SF 319 LO E,A 02F2 EOA8 388 OUTO
0277 58 320 LO E,B 02F1t EOA3 389 DUll
0278 '59 321 LO E,e 02F6 Fl 390 POP AF
0279 5A 322 LO E,O 02F7 e1 391 POP Be
027A 5B 323 LO E,E 02F8 01 392 POP OE
0278 5e )Z1o LO E,H 02F9 El 393 POP HL
027e 50 325 LO E,L 02FA OOEI 394 POP IX
0210 lE20 326 LO E,N 02Fe FOEI 395 POP IY
027F 66 327 LO H,lHlI 02FE F5 396 PUSH AF
02'clO 006605 328 LO H, (IX+INOI 02FF e5 397 PUSH Be
0283 F06605 329 LO H,( I Y+I NOI, 0300 05 398 PUSH DE
0286 67 330 LO H,A 0301 E5 399 PUSH HL
0287 60 331 LO H,8 0302 OOE5 '000 PUSH IX
0288 61 332 LO H,e 030'0 FOES '001 PUSH IY
0289 62 333 LO H,O 0306 CB86 '002 RES O,(~LI
028A 63 33'0 LO H,E 0308 00C80586 '003 RES 0, Illx+INOI
028B 6'0 335 LO H,H 030e FDCB0586 '00'0 RES O,lIiY+INOI
028e 65 336 LO H,L 0310 eB87 405 RES O,A
0280 2620 337 LO H,N 0312 C880 1o0b RES O,B
028F 2A81005 338 LO HL,INNI 031'0 CB81 '001 RES o,e
0292 218'005 339 LO HL,NN 0316 C882 408 RES 0,0
0295 EOIt7 3'00 LO I,A 0318 C883 '009 RES O,E
0297 002A8405 3'01 LO IX,INNI 031A CB810 '010 RES O,H
029B 00218'005 3'02 LO IX,NN 031C CB85 411 RES O,L
029F F02A81005 3'03 LO IY, (I'll'll 031E CB8E '012 RES 1,(HI-I
0243 FD2181005 3'0'0 LO IY,NN 0320 ooeB058E '013 RES l,llXHNDI
02A7 6E 310S LO L,IHLJ 032'0 FOC8058E 'olio RES 1, I I"'''INOI
286
%-80 CROSS ASS EMBLER VERSION 1.06 OF 06/18176
u7l09176 10:22:47 OPCOOE liStiNG
LOC 08J CODE STMT SOURCE STATEMENT LOC OtlJ CODE 5TMT SOURCE STATEMENT
285
2-80 CROSS ASSEMBLER VERSION 1.06 OF 06/18116
01l0911b 10:22:47 OPCOOE LISTING
lot OBJ COOl: STMT SOURCE ST ATEMENT lOC OBJ CODE STMT SOURCE STATEMENT
288
2-80 (.1l0SS ASS EMBlEIl VERS ION 1.06 OF 06118176
07109116 10:U:41 OPCODI: LISTING
lO(. OIlJ CODE STMT SOURCE STATEMENT lO(. OBJ CODE STMT SOURCE STATEIl4ENT
287
APPENDIX C
INSTRUCTION SET NUMERICAL ORDER
290
I-eo CROSS ASSEMBLER VERSION 1.06 OF 06/18176
07/09116 10:22 :47 OPCOOI: LISTING
LuC UllJ CODE ::'TMT SOURCE S1 ATEMENT
289
2-80 CROSS ASSEII8lER VERSION 1.06 Of 06/18176
07109176 10:20:50 .OPCOOE LI STlNG
lOC 08J CODE STilT SOURCE STATEMENT laC 08J COOl: STilT SOURCE STATE"ENT
277 RR II 0202 CB65 3lt6 81T It,l
0178 C818
011A C819 278 RR C 020" C866 3lt7 BU ",(lfll
C8lA 279 RR 0 0206 C867 3lt8 lilT ",A
017C 81T 5,8
017E t818 280 RR E 0208 C86B 3't9
281 RR H 020A C869 350 lilT 5,C
0180 C81C
282 RR l 020C t86A 351 81T 5,0
0182 t8l0
C81E 283 RR (HlI 020E C868 352 8IT 5,E
0181t
C81F RR A 0210 tB6C 353 8U 5,H
0186 28"
Olaa t820 285 SU 8 0212 t860 351t 81T 5,l
018A t821 286 SU t 021lt C86E 355 8IT 5,(Mll
018C C822 2117 SlA 0 0216 C86F 356 8ll 5,A
OlaE CII23 288 SlA E 0218 t870 357 81T 6,8
0190 C82't 289 SlA H 02lA C811 3511 81T 6,C
0192 C825 290 SlA l 021C C872 359 8U 6,0
C826 291 SlA (HlI 021E C813 360 81T 6,E
019"
0196 C827 292 SU A 0220 C871t 361 8U 6,H
0198 C828 293 SRA 8 0222 t875 362 8IT 6,l
019A t829 291t SRA C 0221t t876 363 81T 6,HIll
019C C82A 295 SRA 0 0226 C877 361t 8IT 6,A
019E CII28 296 SRA E 0228 C878 365 8IT 7,8
0140 C82t 297 SRA H 022A C879 366 81T 7,C
OlA2 C820 298 SRA l 022C C8lA 367 8ll 7,0
CII2E 299 SRA (HLI 022E C878 368 8IT 7,E
OlA"
OlA6 C82f 300 SRA A 0230 CB7C 369 BIT 7,H
OlA8 CB38 301 SRl B 0232 CB70 370 8ll 7,l
OlAA CB39 302 SRl C 0231t CUE 371 BIT 7,Cllll
OlAC CB3A 303 SRl 0 0236 CB7F 372 BIT 7,A
OlAE CBlB 30lt SRl E 023B CB80 373 RES O,B
1)180 CB3C 305 SRl H 023A CB81 37" RES O,C
01B2 CB30 306 SRl l 023C CB82 375 RES 0,0
OlB" CB3E 307 SRl (Hll 023E CB83 376 RES O,E
01B6 CB3F 308 SRl A 02ltO CB81t 377 RES O,H
01B8 CBltO 309 81T O,B 02lt2 C885 378 RES O,l
018A CB"l 310 BIT O,C 021t" CB86 379 RES O,(HlI
01BC CBlt2 311 811 0,0 02"6 CB87 380 RES O,A
OUE C8lt3 312 BIT O,E 02ltB C888 381 RES 1,8
01CO 313 8IT O,H 02ltA C889 382 RES 1,C
C8""
01C2 C8lt5 31lt 81T O,l 02"C CBU 383 RES 1,0
01C" C8"6 315 BIT O,(HlI 02"E CBBB 38" RES l,E
UIC6 CBIt7 316 8IT O,A 0250 CBBC 385 RES l,H
01U CB"II 317 81T 1,8 0252 CBIIO 386 RES 1,l
01CA CB"9 318 B11 1,C 025" CBBE 387 RES 1,CHlI
UICC C8"A 319 8IT lt~ 0256 CB8F 388 RES 1,A
OlCE CB"B 32U BJT 1,E 0258 C890 389 RES 2,8
UIOO C8"C 321 8IT ltH 025A C891 390 RES 2,C
Ol02 CB"U 322 B11 l,l 025C CB92 391 RES 2,0
OlD" C8"E 323 81T l,(HlI 025E CB93 392 RES 2,E
0106 C8"F 32" 8IT loA 0260 CB9It 393 RES 2,H
0108 CB50 325 81T 2,8 0262 e895 39" RES 2,l
010A CB51 326 BIT 2,e 026" eB96 395 RES 2,(Hll
010e eB52 327 8IT 2,0 0266 e897 39t> RES 2,A
010E C853 328 81T 2,E 0268 e898 397 RES 3,8
OlEO C854 329 811 2,H 026A CB99 398 RES 3,C
OlE2 C855 330 8IT 2,l 026e C89A 399 RES 3,0
OlE" C856 331 BIT 2,(HlI 026E C898 "00 RES 3,E
01E6 CB57 332 1111 2,A 0270 C89C "01 R.ES 3,H
01E8 C858 333 811 3,8 0272 C890 "02 RES 3,l
OlEA e859 3l" 81T 3,C 027" CB9E "03 RES 3,(H!ll
OLEC CB5A 335 8ll 3,0
8IT 3,E
027t> CB9F
ClIAO
"04 RES 3,A
OlEE: C858 336 0278 "05 RES ",8
UIFO C85e 337 8ll 3,H 027A C8Al loOt> RES ",e
.01F2 C850 318 81T 3,l 027C e8A2 "07 RES ",0
01FIt C85E 339 8ll 3, (HlI 027E C8A3 "08 RES ",E
OlF6 C85F 3"0 OIT 3,A 0280 CBA" "09 RES ",H
01F8 CB60 3"1 81T ",B 0282 eU5 "10 RES ",l
01FA e861 3"2 IIIT ",e 028" C8A6 "11 RES ",(HLI
OlFC CB62 3lt3 8IT ",0 0286 CBAl "12 RES ",A
OlH eB63 3't" BIT ",E 0288 CBA8 "13 RES 5,8
02(10 eB61t 3lt5 BIT ",H 028A ellA9 u. RES 5,e
292
1-80 CROSS ASS EM8lER VERS ION 1.06 OF 06/18116
07109116 10=20=50 .OPCOOE LISTING
lOC 06J CODE STMT SOURCE STATEMENT lOC OBJ CODE SIMT SOURCE STATEMENT
291
1-80 CROSS ASS EM8LER VERSION 1.06 OF 06/18176
07/09176 10120150 .OPCOO!: LISTING
LaC OBJ CODE STHT SOURCE STATEMENT LOC 08J COOf STMT SOURCESUTEMllNT
t~ ~~:~~~r.~o~
0436 E049 580 OUT CC. ,C 04EO F07705 649
0'038 E04A 581 AOCHL,8C 04E3 F07E05 .50
043A ED4884U5 582 LO BC,INNI 04E6 F08605 651 ADD A,IIY!+INO.
043E E040 583 RETl 04E9 F08E05 652 AOC A,ClY~INO.
0440 E050 584 IN O,IC. 04EC F09605 653 SU8 IlY+INO.
04't2 EOSI 585 OUT IC. ,0 04EF F09E05 654 S8C A,ClYi+lNO)
0444 ED 52 586 S8C HL,OE 04F2 FOA605 655 AND I IY+I~O.
0446 E0538405 587 LO INNI,OE O'tF5 FOAE05 656 XOR IlY+INO)
0444 E056 588 1M 1 04F8 F08605 651 OR IIY+INIU
044C E057 589 LO A,I 04F8 F08E05 658 CP IIY+INIH
044E E058 590 IN E,IC. 04FE FOEI 659 POP IY
0450 E059 591 OUT IC. ,E 0500 FOE3 660 EX ISPI,IY
0452 E05A 592 AOC HL,OE 0502 FOE5 661 PUSH IY
0454 E0588405 593 LO OE,INIH 05O't FOE9 662 JP l i n
0458 E05E 594 1M 2 0506 FOF9 661 LO SP,IY
0'o5A ED60 595 IN H,IC. 0508 FOC80506 664 RLC IIY+IllO.
045C ED61 596 OUT IC. ,H 050C FOC8050E 665 RRC IlY+ItO.
045E E062 597 S8C HL,HL 0510 FDC80516 666 RL ClY+IN •
0460 ED67 598 RRO 051'0 FOC8051E 667 RR I IY+IN~.
0462 E068 599 IN L,CC. 0518 FOC80526 668 SLA IlY+I O.
0464 E069 600 OUT ICI,L 051C FOC8052E 669 SRA IlY+ItlO.
0466 ED6. 601 AOC HL,HL 0520 FDC8053E 670 SRL IlY+I~O)
0468 E06F 602 RLO 0524 FOC80546 671 8IT O,ClYHNO.
046A E072 603 S8C HL,SP 0528 FDC8054E 672 8IT 1,IIYt!NO.
046C E073a405 604 LO INNhSP 052C FOC80556 673 81T 2,IIYt!NO.
0470 E078 605 IN A,IC. 0530 FOC8055E 6\4 BIT 3, (lYt!NO.
0472 E079 606 OUT CC. ,A 0534 FOC80566 675 8IT 4,IIYt!NO.
0474 EOlA 607 AOC HL,SP 0538 FOC8056E 676 8IT 5, I IYt!NO.
0476 ED 788'oU5 608 LO SP,INN. 053C FOC80516 677 8IT .6, II ytiNO.
047A EOAO 609 LOI 0540 FOCB057E 678 8IT 1,1 IYHNO.
041C EOAl 610 CPI 054'0 FOCB0586 619 RES 0, I IYtINO)
047E EOA2 611 INI 0548 FOCB058E 680 RES l,ClYtINO.
0't80 EOA3 612 OUTl 054C FOCB0596 681 RES 2~ I IYHNO.
0'082 EOA8 613 LOO 0550 FDCB059E 682 RES 3,1 lYtINO.
0484 EOA9 614 CPO 0554 FOCB05A6 6413 RES 4,llYtlNO.
0486 EOAl 615 INO 0558 FOCB05AE 68'0 RES 5, I IY.... NO.
0488 EOAB 616 OUTO 055C FOC805B6 685 RES 6,ClVHNO.
048A E080 611 LOIR 0560 FDCB05BE 686 RES 7, II V+INO.
048C E081 618 CPIR 0564 FDC805C6 687 SET 0, ClVtlNO.
O't8E E082 619 INIR 0568 FOCB05CE 688 se T l,IlV+INO.
0490 EOU 620 OTiR 056C FDCB05D6 6lJ9 SET 2,IIVHND.
0'092 EOB8 621 LOOR 0510 FOC8050E 690 SET 3,IIY+INDJ
294
2-80 CROSS ASSEMBLER VERSION 1.06 OF 06/18176
01109116 10:20:50 .OPCOOE LISTING
LOC OBJ CODE STMT SOURCE STATEMENT LOC 08J CODE STMT SOURCE STATEM~NT
293
MAIN REG SET ALTERNATE REG SET
~~
ACCUMULATOR FLAGI ACCUMULATOR FLAGS
A F A' F'
}--' PURPOSE
REGISTERS
INTERRUPT MEMORV
VECTOR REFRESH
I
)R". PURPOSE
REGISTERS
PROGRAM COUNTER PC
~
.
0 1 2 3 4 5 8 7
.
5 4 3 2 1
LSD 000 001 010 0" 100 '01 "0 111
HEX=DEC HEX' DEC HEX· DEC HEX' DEC HEX' DEC HEX· DEC
o o o o p
0 0 0 0 0 00 0 0 0000 NUL DLE
,
SP 0
11,048,576
22.097,152
166.536
2131,072
14,086
28.192
1261
2612
1
2
111
32 2 2
1 1
2
0001
00'0
SOH
STX
DCl
DC2
1
2
A
B
0
R : q
:
33,145,728 3196.808 312.288 3168 3 48 3 3 ETX # 3 S
3 0011 DC3 C
44,194,304 4262.144 416,384 41.024 4 64 4 4
4 0'00 EOT DC4 S 4 D T t
55,242.880 5321,680 520,490 51,290 5 90 5 5
5 E U
66,291,456
77.340,032
6393,216
7458.152
624,575
728,672
61,538
7',782
8
7
95 6
1121
6
1
5
8
0'0'
0110
ENG
ACK
NAK
SYN '~" 6 F V f
88.388,608 8524,288 832.168 82.048 8 '28 6 8 7 0111 BEL ETB 7 G W 8 w
99,437.184 9581,824 936,864 82,304 9 '44 8 8 8 1000 BS CAN ( 8 H X h
A 10,485.160 A 865,380- A 40.960 A 2,680 A 160 A 10 9 1001 HT EM I 9 I Y i
811,534.336
C12,582.912
8120.896
C78••432
845.058
C 49.152
82,81.
C 3.072
8
C
11. 8
192 C
11
12
A 'DID LF SUB J Z i ~
013,631.488 D 86',II6lI D 53,248 D 3,328 D 206 D '3 B '011 VT ESC K I k
E14.680,064
F15.728,640
0123
BYTE
E9'7.604
F983.040
4567
E57,344
F.1,440
0123
E3.664
F3.840
BYTE
4567
E
F
224 E
240 F
0123
BYTE
4587
14
15
C
D
E
F
1100
1101
1110
1111
FF
CR
SO
SI
FS
GS
RS
VS
.
-
I
<
>
?
L
M
N
0 -
\
J
I
I
m
I
-
DEL,
POWERS OF 2 POWERS OF 16
2" n 16"
256 8 zO '1s" 1 0
512 8 z4 "8' 18 1
1024 10 z8 "82 258 2
2048 11 2'2.,&3 4086 3
4086 12 2'6'1&4 lll5538 4
8192 13 :z3l.,&6 1048578 5
18384 14 2'4·1&6 18777218 8
32788 15 z26"87 2884364158 7
lll5638 18 z32·188 4294987298 8
131072 17 z38,,&, 88 719478738 9
262144 18 z40"8'o 1099611 B27 778 10
524288 19 z44',8" 17692188044418 11
1048578 20 z48"8 12 28147497671011158 12
2097152 21 z82"8 13 4 603 599 827 370 498 13
4194304 22 zIi8'18'4 72057594 037 927 938 14
838880S 23 zSO',8 15 1152921 504 808 8415 978 16
18777218 24
296
,-80 CROSS ASSEM8LER VERSION 1.06 OF 06/18/16
01109116 10:20:50 .OPCOOE LISTING
LOC 08J COOE STMT SOURCE STATEMENT
295