This the multi-page printable view of this section.Click here to print.

Return to the regular view of this page.

SUB Subtract without Carry

Subtraction without Carry

Table of Contents

\(A \longleftarrow A - s\)

This s operand is any of r, n, (HL), (IX+d), or (IY+d).

These possible op code/operand combinations are assembled as follows in the object code:

76543210
 
SUB r
10010r
 
SUB n
11010110D6
n
 
SUB (HL)
1001011096
 
SUB (IX+d)
11011101DD
1001011096
d
 
SUB (IX+d)
11111101FD
1001011096
d
Registers
Registerr
B000
C001
D010
E011
H100
L101
A111
Flags Affected
Flags
sz-h-p/v-c
sset if result negative
zset if result is 0
hset if borrow from bit 4
p/vset if overflow
cset if borrow
Opcode Matrix
ABCDEHL(HL)(IX+d)(IY+d)n
A
SUB A,A
9714
SUB A,B
9014
SUB A,C
9114
SUB A,D
9214
SUB A,E
9314
SUB A,H
9414
SUB A,L
9514
SUB A,(HL)
9617
SUB A,(IX+d)
DD96nn319
SUB A,(IY+d)
FD96nn319
SUB A,n
D6nn27
Opcode Matrix Legend
Instruction Opcode hexSize bytesCycle count
 Register Memory Implicit