E
B
A
N
# BYTES/ ENTRY
#OF ENTRIES
B-BIT KEY VALUE
ENTRY 1
# BYTESIENTRY
ENTRY 2
M -1
M
TYPICAL ENTRY
M BYTES LONG, KEY
IN BYTE 0
1
Fig. 16-3. Table search routine.
of entries remaining in the table. The reentry address is a second
entry point in the routine. The initial entry is at SRTAB, while the
"reentry" point is at SRTAB1.
SRTAB
LD
D,0
NOW HAVE # BYTES/ ENTRY IN D,E
LOOP
CP
A,(IX)
COMPARE SEARCH KEY TO ENTRY
RET
Z
GO IF MATCH
SRTABI
ADD
IX,DE
BUMP IX TO NEXT ENTRY
DJNZ
LOOP
GO IF NOT LAST ENTRY
LD
IX,-1
FLAG FOR NOT FOUND
RET
RETURN
244
Need help?
Do you have a question about the Z80 and is the answer not in the manual?
Questions and answers