![]() |
Routines |
| Prev: 41836 | Up: Map | Next: 42179 |
|
Used by the routine at ChooseDirection.
Finds the type of the cell next to an entity in a direction, and tests whether a program packet could go there. The directions are 0 for the lower X cell, 1 for the higher Y cell, 2 for the higher X cell and 3 for the lower Y cell.
|
||||||||||||||||||||||
| TestCellInDirection | 42136 | LD C,A | Keep the direction. | |||||||||||||||||||
| 42137 | PUSH DE | Save the position. | ||||||||||||||||||||
| 42138 | PUSH HL | |||||||||||||||||||||
| 42139 | JR Z,TestCellInDirection_X1 | Jump if the direction is zero. | ||||||||||||||||||||
| 42141 | DEC A | Jump if the direction is one. | ||||||||||||||||||||
| 42142 | JR Z,TestCellInDirection_Y1 | |||||||||||||||||||||
| 42144 | DEC A | Jump if the direction is two. | ||||||||||||||||||||
| 42145 | JR Z,TestCellInDirection_X2 | |||||||||||||||||||||
| 42147 | DEC H | Otherwise use the lower Y cell. | ||||||||||||||||||||
| TestCellInDirection_Cell | 42148 | CALL FindMapCell | Find the cell using FindMapCell. | |||||||||||||||||||
| 42151 | PUSH HL | Copy its address into IY. | ||||||||||||||||||||
| 42152 | POP IY | |||||||||||||||||||||
| 42154 | POP HL | Restore the position. | ||||||||||||||||||||
| 42155 | POP DE | |||||||||||||||||||||
| 42156 | AND A | Return with the zero flag set if the cell is empty (type 0). | ||||||||||||||||||||
| 42157 | RET Z | |||||||||||||||||||||
| 42158 | CP 15 | Return with the zero flag set if the type is 15. | ||||||||||||||||||||
| 42160 | RET Z | |||||||||||||||||||||
| 42161 | CP 1 | Return with the zero flag set if the type is 1. | ||||||||||||||||||||
| 42163 | RET Z | |||||||||||||||||||||
| 42164 | CP 7 | Return with the zero flag set if the type is 7. | ||||||||||||||||||||
| 42166 | RET Z | |||||||||||||||||||||
| 42167 | CP 9 | Compare the type with 9, and return. | ||||||||||||||||||||
| 42169 | RET | |||||||||||||||||||||
| TestCellInDirection_X1 | 42170 | DEC D | Use the lower X cell, and jump back. | |||||||||||||||||||
| 42171 | JR TestCellInDirection_Cell | |||||||||||||||||||||
| TestCellInDirection_Y1 | 42173 | INC H | Use the higher Y cell, and jump back. | |||||||||||||||||||
| 42174 | JR TestCellInDirection_Cell | |||||||||||||||||||||
| TestCellInDirection_X2 | 42176 | INC D | Use the higher X cell, and jump back. | |||||||||||||||||||
| 42177 | JR TestCellInDirection_Cell | |||||||||||||||||||||
| Prev: 41836 | Up: Map | Next: 42179 |