UT_LINK/MEM_LLST UT_UNLNK/MEM_RLST - Vectors $D2 $D4
These vectors link and unlink an item into and from a list.
Call Parameters | Return Parameters | ||
---|---|---|---|
A0.L | Pointer to item. | A0.L | Preserved. |
A1.L | Pointer to pointer to list. | A1.L | See Notes. |
Errors
No errors are returned by this vector call.
Notes
- All registers not shown above are not used on entry and are preserved on exit.
- A1.L is preserved for UT_LINK/MEM_LLST but corrupted for UT_UNLNK/MEM_RLST.
- Each item must start with a long word which will be used to point to the next item.
- When the list is first set up the pointer to the list should be zero.
Example
The examples below show a list being started and an item being unlinked.
The pointer to the list is the long word at ptr(A6) and that items are located at item1(A6), item2(A6), item3(A6) etc.
Init_l lea ptr(a6),a1 ; Pointer to pointer to list. clr.l (a1) ; 1st pointer must be zero. lea item1(a6),a0 ; Item to be set in the list movea.w UT_LINK,a2 ; UT_LINK vector address. jsr (a2) ; Make the call ; Now ptr(a6) contains the address of item1(a6). Unlink lea ptr(a6),a1 ; Pointer to pointer to list. lea item2(a6),a0 ; Item to be unlinked. movea.w UT_UNLNK,a2 ; UT_UNLNK vector address. jsr (a2) ; Make the call