GN_Xin, Insert an entry into a linked list
Register parameters
RST 20H, DEFW $4609
IN: HL = pointer to a 9-byte parameter block (usually on the stack): (HL+0) ... (HL+2) = pointer of block to insert (HL+3) ... (HL+5) = pointer to previous block (HL+6) ... (HL+8) = pointer to next block OUT, if call successful: Fc = 0 OUT, if call failed: Fc = 1 A = error code: RC_BAD ($04), if pointer to block to insert = 0. Registers changed after return: ..BCDEHL/IXIY same AF....../.... differentÂ
Notes
Algorithm: Assuming inserting entry I between entries X and Y (for more details, read Linked lists):
*I = X XOR Y *X = *X XOR Y XOR I *Y = *Y XOR X XOR I Â Â Â Â
If X and Y are zero then the link is cleared.
Related calls
GN_Xdl, delete an entry from a linked listÂ
GN_Xnx, index next entry in linked list