![]() |
Routines |
| Prev: CF08 | Up: Map | Next: CFF2 |
|
Used by the routine at DRAW_CELLS.
The first half of drawing the things in one cell of the town (the drawing order at DRAW_CELLS calls it for every cell whose things are drawn, and SORT_AND_DRAW_THINGS follows it). Every object record from KNIGHT to the end of the records whose graphic is not 0 and whose column and row -- the high bytes of U and V, +2 and +4 -- are this cell's has its address put on DRAW_LIST, which a zero word then ends.
The cell comes in the drawing order's terms, which are turned round with the town (TURN_CELL), and the records keep the town's own; TURN_CELL is its own inverse, so it turns the cell back. Nothing counts the entries: the list has room for fifteen, and the most measured in the simulator, at 1748 stops here over thirty random cells of play, was four.
|
||||||||
| LIST_THINGS_IN_CELL | CFAF | LD IY,DRAW_LIST | IY at the start of the list, IX at the first record | |||||
| CFB3 | LD IX,KNIGHT | |||||||
| CFB7 | CALL TURN_CELL | The cell in the town's own terms, into DE: E the column, D the row | ||||||
| CFBA | EX DE,HL | |||||||
| LIST_THINGS_IN_CELL_0 | CFBB | LD A,(IX+$00) | An empty record is not drawn | |||||
| CFBE | AND A | |||||||
| CFBF | JR Z,LIST_THINGS_IN_CELL_1 | |||||||
| CFC1 | LD A,E | Is the record in this cell: its U's high byte this column, its V's this row? | ||||||
| CFC2 | CP (IX+$02) | |||||||
| CFC5 | JR NZ,LIST_THINGS_IN_CELL_1 | |||||||
| CFC7 | LD A,D | |||||||
| CFC8 | CP (IX+$04) | |||||||
| CFCB | JR NZ,LIST_THINGS_IN_CELL_1 | |||||||
| CFCD | PUSH IX | It is: its address onto the list | ||||||
| CFCF | POP HL | |||||||
| CFD0 | LD (IY+$00),L | |||||||
| CFD3 | LD (IY+$01),H | |||||||
| CFD6 | INC IY | |||||||
| CFD8 | INC IY | |||||||
| LIST_THINGS_IN_CELL_1 | CFDA | LD BC,$0010 | The next record, until the end of the records at START | |||||
| CFDD | ADD IX,BC | |||||||
| CFDF | PUSH IX | |||||||
| CFE1 | POP HL | |||||||
| CFE2 | LD BC,START | |||||||
| CFE5 | AND A | |||||||
| CFE6 | SBC HL,BC | |||||||
| CFE8 | JR C,LIST_THINGS_IN_CELL_0 | |||||||
| CFEA | XOR A | A zero word ends the list | ||||||
| CFEB | LD (IY+$00),A | |||||||
| CFEE | LD (IY+$01),A | |||||||
| CFF1 | RET | |||||||
| Prev: CF08 | Up: Map | Next: CFF2 |