![]() |
Routines |
| Prev: A1C7 | Up: Map | Next: A24D |
|
Used by the routine at ProcessMemoryEntry.
Adds the link word to its own address so the pointer reaches the linked record.
|
||||
| CalculatePointerOffset | A20C | PUSH IX | Copy the record into the pointer, step back two bytes, and read the link. | |
| A20E | POP HL | |||
| A20F | DEC HL | |||
| A210 | DEC HL | |||
| A211 | LD E,(IX-$02) | |||
| A214 | LD D,(IX-$01) | Add the link to its own address to reach the linked record, and read the record's flag byte. | ||
| A217 | ADD HL,DE | |||
| A218 | LD E,(IX+$00) | |||
| A21B | LD D,(IX+$01) | Read the moved marker. | ||
| A21E | LD A,D | Jump ahead to CalculatePointerOffset_Next if the pointer is not zero. | ||
| A21F | OR E | |||
| A220 | JR NZ,CalculatePointerOffset_Next | |||
| A222 | OR %00000001 | Reset the zero flag. | ||
| A224 | RET | Return. | ||
|
Return unless the two pointers are the same distance apart.
|
||||
| CalculatePointerOffset_Next | A225 | AND A | Return if the adjusted pointer does not match the link. | |
| A226 | SBC HL,DE | |||
| A228 | RET NZ | |||
| A229 | LD L,(IX+$00) | Read the link in this record and the field it points at. | ||
| A22C | LD H,(IX+$01) | |||
| A22F | PUSH BC | |||
| A230 | LD E,(HL) | |||
| A231 | INC HL | Read the high byte of the link into D. | ||
| A232 | LD D,(HL) | |||
| A233 | INC HL | |||
| A234 | LD C,(HL) | Read the following word into BC. | ||
| A235 | INC HL | |||
| A236 | LD B,(HL) | |||
| A237 | LD L,(IX-$02) | Read the low byte saved ahead of this record. | ||
| A23A | LD H,(IX-$01) | Add DE to the saved pointer and store the low byte. | ||
| A23D | ADD HL,DE | |||
| A23E | LD (IX-$02),L | |||
| A241 | LD (IX-$01),H | Store the high byte of the pointer in the previous record. | ||
| A244 | LD (IX+$00),C | Store the record's flag byte and store the moved marker. | ||
| A247 | LD (IX+$01),B | |||
| A24A | POP BC | |||
| A24B | XOR A | Clear A. | ||
| A24C | RET | Return. | ||
| Prev: A1C7 | Up: Map | Next: A24D |