1
; void __FASTCALL__ *adt_ListPopFront(struct adt_List *list)
11
; enter: hl = struct adt_List *
12
; exit : no carry indicates list empty, hl = 0 else:
13
; hl = item removed from list
14
; last item removed from list and current points to new last item
15
; uses : af, bc, de, hl
19
ld d,(hl) ; de = count
23
jr z, fail ; fail if list empty
24
dec de ; count = count - 1
29
; getting rid of only item in list
44
call _u_free ; free NODE
47
ex (sp),hl ; hl = list, stack = item
54
; more than one item in list
56
.morethanone ; hl = list, de = new count
62
ld (hl),1 ; state = INLIST
68
ld e,(hl) ; de = head NODE
69
ex de,hl ; hl = head NODE, de = head+1
77
ld c,(hl) ; bc = next NODE
78
ex de,hl ; hl = head+1, de = head NODE.next+1
81
ld (hl),b ; new head ptr = next NODE
85
ld (hl),b ; new curr ptr = next NODE
87
add hl,bc ; hl = next NODE.prev
90
ld (hl),0 ; next NODE.prev = 0
92
add hl,de ; hl = NODE to delete
94
call _u_free ; free the NODE
96
pop hl ; hl = front item