![]()  | 
Routines | 
| Prev: 39900 | Up: Map | Next: 40056 | 
| 
 
Used by the routine at Action_Dir.
 
 | 
||||
| 40001 | PUSH IX | Stash IX, IY and BC on the stack. | ||
| 40003 | PUSH IY | |||
| 40005 | PUSH BC | |||
| 40006 | LD B,A | Stash A in the B register temporarily so it doesn't get overwritten. | ||
| 40007 | CALL LocateLocation | Call LocateLocation. | ||
| 40010 | LD A,(IX+1) | |||
| 40013 | LD C,A | Stash A in the C register temporarily so it doesn't get overwritten. | ||
| 40014 | LD IX,49248 | Set IX to 49248 which is 3 bytes less than the start of the object table due to the following line adding 0003 and moving us on to the first record. | ||
| 40018 | CALL Step3ByteTable | Call Step3ByteTable. | ||
| 40021 | JR Z,40045 | Jump to 40045 if we've reached the end of the object data. | ||
| 40023 | LD A,(IY+0) | If the TODO is not 1 (TODO), then loop back round to 40018 to move onto the next record. | ||
| 40026 | CP 1 | |||
| 40028 | JR NZ,40018 | |||
| 
 
Success! We've found a record which matches 1 (TODO).
 
 | 
||||
| 40030 | LD A,B | Restore the previous value of A from the B register. | ||
| 40031 | CP (IY+16) | |||
| 40034 | JR NZ,40018 | |||
| 40036 | LD A,C | |||
| 40037 | SUB (IY+2) | |||
| 40040 | JR C,40052 | |||
| 40042 | LD C,A | |||
| 40043 | JR 40018 | Jump to 40018. | ||
| 40045 | LD A,C | Restore the previous value of A from the C register. | ||
| 40046 | POP BC | Restore BC, IY and IX from the stack. | ||
| 40047 | POP IY | |||
| 40049 | POP IX | |||
| 40051 | RET | Return. | ||
| 40052 | LD C,0 | |||
| 40054 | JR 40045 | Jump to 40045. | ||
| Prev: 39900 | Up: Map | Next: 40056 |