LIST DELETE ACTIONS
PREVIOUS POINTS TO 1000H
1000H
1003H
1006H
3000H
VALUE
1OD6
LINK
VALUE
NEXT
LINK
VALUE
1003
LINK
LIST INSERT ACTIONS
VALUE
XXXX
1000H
1003H
3000H
VALUE
3000
LINK
VALUE
NEXT
LINK
1003
LINK
VALUE
1006
LINK
ENTRY TO
BE INSERTED
Fig. 13-9. List delete and insert actions.
0
The address of the first entry of the list is loaded from HEADLS.
A check is made to see if the address of the next data item is a -1
which would signify the end of the list, or an empty list (HEADLS
= -1). The check is made, incidentally, by adding one to the ad-
dress in HL by addition of BC to HL. The ADC HL,SS and SBC
HL,SS are unique in that they set the Z flag if the result is zero; none
of the other 16-bit arithmetic instructions affect the Z flag. If the
address is a valid address, the data value from the next list entry is
retrieved and a match is tried. If no match is found, the link address
of the data item is loaded into HL in preparation for the next
comparison.
List operations for inserts and deletes are similar to the sequential
searches discussed under table operations. More overhead is in-
volved in finding the insertion or deletion point for the list, but once
the proper list entry is found, only a slight additional amount of
code is involved to change pointers and the data movement over-
PREVIOUS POINTS TO 1006H
X/
71
DELETED
VALUE
LINK
NEXT
VALUE
1003
LINK
206
Need help?
Do you have a question about the Z80 and is the answer not in the manual?
Questions and answers