![]() |
Routines |
| Prev: CFA5 | Up: Map | Next: CFF2 |
|
Used by the routine at DrawCellAndObjects.
Makes a list at ObjectList of the addresses of all of the objects which are in a cell. The list ends with a zero word.
|
||||||||
|
Point at the list and the first object slot.
|
||||||||
| FindObjectsInCell | CFAF | LD IY,$D15D | Point IY at ObjectList. | |||||
| CFB3 | LD IX,$BC8E | Point IX at ObjectTable. | ||||||
|
Turn the cell round if the view is rotated.
|
||||||||
| CFB7 | CALL ConvertCell | Call ConvertCell. | ||||||
| CFBA | EX DE,HL | Keep the column in E and the row in D. | ||||||
|
Look at this slot.
|
||||||||
| FindObjectsInCell_Loop | CFBB | LD A,(IX+$00) | Jump to FindObjectsInCell_Next to move on if the object is free. | |||||
| CFBE | AND A | |||||||
| CFBF | JR Z,FindObjectsInCell_Next | |||||||
| CFC1 | LD A,E | Jump to FindObjectsInCell_Next to move on if the object is not in the column. | ||||||
| CFC2 | CP (IX+$02) | |||||||
| CFC5 | JR NZ,FindObjectsInCell_Next | |||||||
| CFC7 | LD A,D | Jump to FindObjectsInCell_Next to move on if the object is not in the row. | ||||||
| CFC8 | CP (IX+$04) | |||||||
| CFCB | JR NZ,FindObjectsInCell_Next | |||||||
| CFCD | PUSH IX | Copy the address of the object into HL (using the stack). | ||||||
| CFCF | POP HL | |||||||
| CFD0 | LD (IY+$00),L | Add the address of the object to the list. | ||||||
| CFD3 | LD (IY+$01),H | |||||||
| CFD6 | INC IY | Move on to the next place in the list. | ||||||
| CFD8 | INC IY | |||||||
|
Move on to the next object.
|
||||||||
| FindObjectsInCell_Next | CFDA | LD BC,$0010 | Move on to the next object slot. | |||||
| CFDD | ADD IX,BC | |||||||
| CFDF | PUSH IX | Copy the address of the object to HL (using the stack). | ||||||
| CFE1 | POP HL | |||||||
|
See whether every slot has been looked at.
|
||||||||
| CFE2 | LD BC,$BDFE | Check whether the end of the object table at StartGame has been reached. | ||||||
| CFE5 | AND A | |||||||
| CFE6 | SBC HL,BC | |||||||
|
Go back for the next slot.
|
||||||||
| CFE8 | JR C,FindObjectsInCell_Loop | Loop back until all 17 objects have been checked. | ||||||
|
End the list.
|
||||||||
| CFEA | XOR A | Write a zero word to the end of the list. | ||||||
| CFEB | LD (IY+$00),A | |||||||
| CFEE | LD (IY+$01),A | |||||||
| CFF1 | RET | Return. | ||||||
|
View the equivalent code in;
|
||||||||
| Prev: CFA5 | Up: Map | Next: CFF2 |