![]() |
Routines |
| Prev: C19F | Up: Map | Next: C1E7 |
|
Used by the routine at DrawCellObjects.
Makes a list at CellObjectList 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 | C1A4 | LD IY,$C352 | Point IY at CellObjectList. | |||||
| C1A8 | LD IX,$A27D | Point IX at ObjectSlot_01. | ||||||
|
Turn the cell round if the view is rotated.
|
||||||||
| C1AC | CALL ConvertCell | Call ConvertCell. | ||||||
| C1AF | EX DE,HL | Keep the column in E and the row in D. | ||||||
|
Look at this slot.
|
||||||||
| FindObjectsInCell_Next | C1B0 | LD A,(IX+$00) | Jump to FindObjectsInCell_Skip if the slot is not in use. | |||||
| C1B3 | AND A | |||||||
| C1B4 | JR Z,FindObjectsInCell_Skip | |||||||
| C1B6 | LD A,E | Jump to FindObjectsInCell_Skip if the object is not in the same column. | ||||||
| C1B7 | CP (IX+$02) | |||||||
| C1BA | JR NZ,FindObjectsInCell_Skip | |||||||
| C1BC | LD A,D | Jump to FindObjectsInCell_Skip if the object is not in the same row. | ||||||
| C1BD | CP (IX+$04) | |||||||
| C1C0 | JR NZ,FindObjectsInCell_Skip | |||||||
| C1C2 | PUSH IX | Copy the address of the object into HL (using the stack). | ||||||
| C1C4 | POP HL | |||||||
| C1C5 | LD (IY+$00),L | Add the address of the object to the list. | ||||||
| C1C8 | LD (IY+$01),H | |||||||
| C1CB | INC IY | Move on to the next place in the list. | ||||||
| C1CD | INC IY | |||||||
| FindObjectsInCell_Skip | C1CF | LD BC,$0010 | Move on to the next object slot. | |||||
| C1D2 | ADD IX,BC | |||||||
| C1D4 | PUSH IX | Copy the address of the slot into HL (using the stack). | ||||||
| C1D6 | POP HL | |||||||
|
See whether every slot has been looked at.
|
||||||||
| C1D7 | LD BC,$A36D | Test whether this is past the last slot. | ||||||
| C1DA | AND A | |||||||
| C1DB | SBC HL,BC | |||||||
|
Go back for the next slot.
|
||||||||
| C1DD | JR C,FindObjectsInCell_Next | Jump to FindObjectsInCell_Next if it is not. | ||||||
|
End the list.
|
||||||||
| C1DF | XOR A | Write a zero word to the end of the list. | ||||||
| C1E0 | LD (IY+$00),A | |||||||
| C1E3 | LD (IY+$01),A | |||||||
| C1E6 | RET | Return. | ||||||
|
View the equivalent code in;
|
||||||||
| Prev: C19F | Up: Map | Next: C1E7 |