GN_Xin, Insert an entry into a linked list

Register parameters

RST 20H, DEFW $4609
     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 


Algorithm: Assuming inserting entry I between entries X and Y (for more details, read Linked lists):

*I = X XOR Y
*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

web analytics