HYUNDAI MicroElectonics
32
CMP
( Compare accumulator )
Function
: ( A )
( M )
Description : Compare the accumulator with the contents of memory or immediate data.
The results effects N, Z, C and the accumulator and the contents of memory are not changed.
Flag
:
Mnemonic
OP Code
Bytes
Cycles
CMP #imm
44
2
2
CMP dp
45
2
3
CMP dp + X
46
2
4
CMP !abs
47
3
4
CMP !abs + Y
55
3
5
CMP [ dp + X ]
56
2
6
CMP [ dp ] + Y
57
2
6
CMP { X }
54
1
3
Example
:
243 E116 C533
LDA
33H
244 E118 4414
CMP
#14H
245 E11A F0F6
BEQ
OPROG
241
QMODE
EQU
0BFH
247 E11C C533
LDA
33H
248 E11E 45BF
CMP
QMODE
249 E120 F0F0
BEQ
OPROG
CMPX
( Compare X-register )
Function
: ( X )
( M )
Description : Compare the X-register with the contents of memory or immediate data.
The results effects N, Z, C and the X-register and the contents of memory are unchanged.
Flag
:
Mnemonic
OP Code
Bytes
Cycles
CMPX #imm
5E
2
2
CMPX dp
6C
2
3
CMPX !abs
7C
3
4
Example
:
5 E004 1E00
LDX
#0
; RAM CLEAR (00H-BFH)
6 E006 C400
RAM_CLR:
LDA
#0
7 E008 FB
STA
{X}+
8 E009 5EC0
CMPX
#0C0H
9 E00B 70F9
BNE
RAM_CLR