Download Print this page

ZiLOG Z80380 User Manual page 72

Advertisement

Z
ILOG
CPI
COMPARE AND INCREMENT (BYTE)
CPI
Operation:
A - (HL)
if (XM) then begin
HL(31-0)
end
else begin
HL(15-0)
end
BC(15-0)
This instruction is used for searching strings of byte data. The byte of data at the location
addressed by the HL register is compared with the contents of the accumulator and the Sign
and Zero flags are set to reflect the result of the comparison. The contents of the accumulator
and the memory bytes are unaffected. Two's complement subtraction is performed. Next the
HL register is incremented by one, thus moving the pointer to the next element in the string.
The BC register, used as a counter, is then decremented by one.
Flags:
S: Set if the result is negative; cleared otherwise
Z: Set if the result is zero, indicating that the contents of the accumulator and the memory
byte are equal; cleared otherwise
H: Set if there is a borrow from bit 4 of the result; cleared otherwise
V: Set if the result of decrementing BC is not equal to zero; cleared otherwise
N: Set
C: Unaffected
Addressing
Mode
Syntax
CPI
5-38
HL(31-0) + 1
HL(15-0) + 1
BC(15-0) - 1
Instruction Format
11101101 10100001
Execute
Time
Note
3+r
X
Z380
U
'
M
SER
S
ANUAL
DC-8297-03

Advertisement

loading
Need help?

Need help?

Do you have a question about the Z80380 and is the answer not in the manual?

Subscribe to Our Youtube Channel