Prev: 41415 Up: Map Next: 41549
41484: Calculate Pointer Offset
Used by the routine at ProcessMemoryEntry.
Adds the link word to its own address so the pointer reaches the linked record.
CalculatePointerOffset 41484 PUSH IX Copy the record into the pointer, step back two bytes, and read the link.
41486 POP HL
41487 DEC HL
41488 DEC HL
41489 LD E,(IX-2)
41492 LD D,(IX-1) Add the link to its own address to reach the linked record, and read the record's flag byte.
41495 ADD HL,DE
41496 LD E,(IX+0)
41499 LD D,(IX+1) Read the moved marker.
41502 LD A,D Jump ahead to CalculatePointerOffset_Next if the pointer is not zero.
41503 OR E
41504 JR NZ,CalculatePointerOffset_Next
41506 OR %00000001 Reset the zero flag.
41508 RET Return.
Return unless the two pointers are the same distance apart.
CalculatePointerOffset_Next 41509 AND A Return if the adjusted pointer does not match the link.
41510 SBC HL,DE
41512 RET NZ
41513 LD L,(IX+0) Read the link in this record and the field it points at.
41516 LD H,(IX+1)
41519 PUSH BC
41520 LD E,(HL)
41521 INC HL Read the high byte of the link into D.
41522 LD D,(HL)
41523 INC HL
41524 LD C,(HL) Read the following word into BC.
41525 INC HL
41526 LD B,(HL)
41527 LD L,(IX-2) Read the low byte saved ahead of this record.
41530 LD H,(IX-1) Add DE to the saved pointer and store the low byte.
41533 ADD HL,DE
41534 LD (IX-2),L
41537 LD (IX-1),H Store the high byte of the pointer in the previous record.
41540 LD (IX+0),C Store the record's flag byte and store the moved marker.
41543 LD (IX+1),B
41546 POP BC
41547 XOR A Clear A.
41548 RET Return.
Prev: 41415 Up: Map Next: 41549