![]() |
Routines |
| Prev: A36C | Up: Map | Next: A4C3 |
|
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 00 for the lower X cell, 01 for the higher Y cell, 02 for the higher X cell and 03 for the lower Y cell.
|
||||||||||||||||||||||
| TestCellInDirection | A498 | LD C,A | Keep the direction. | |||||||||||||||||||
| A499 | PUSH DE | Save the position. | ||||||||||||||||||||
| A49A | PUSH HL | |||||||||||||||||||||
| A49B | JR Z,TestCellInDirection_X1 | Jump if the direction is zero. | ||||||||||||||||||||
| A49D | DEC A | Jump if the direction is one. | ||||||||||||||||||||
| A49E | JR Z,TestCellInDirection_Y1 | |||||||||||||||||||||
| A4A0 | DEC A | Jump if the direction is two. | ||||||||||||||||||||
| A4A1 | JR Z,TestCellInDirection_X2 | |||||||||||||||||||||
| A4A3 | DEC H | Otherwise use the lower Y cell. | ||||||||||||||||||||
| TestCellInDirection_Cell | A4A4 | CALL FindMapCell | Find the cell using FindMapCell. | |||||||||||||||||||
| A4A7 | PUSH HL | Copy its address into IY. | ||||||||||||||||||||
| A4A8 | POP IY | |||||||||||||||||||||
| A4AA | POP HL | Restore the position. | ||||||||||||||||||||
| A4AB | POP DE | |||||||||||||||||||||
| A4AC | AND A | Return with the zero flag set if the cell is empty (type 00). | ||||||||||||||||||||
| A4AD | RET Z | |||||||||||||||||||||
| A4AE | CP $0F | Return with the zero flag set if the type is 0F. | ||||||||||||||||||||
| A4B0 | RET Z | |||||||||||||||||||||
| A4B1 | CP $01 | Return with the zero flag set if the type is 01. | ||||||||||||||||||||
| A4B3 | RET Z | |||||||||||||||||||||
| A4B4 | CP $07 | Return with the zero flag set if the type is 07. | ||||||||||||||||||||
| A4B6 | RET Z | |||||||||||||||||||||
| A4B7 | CP $09 | Compare the type with 09, and return. | ||||||||||||||||||||
| A4B9 | RET | |||||||||||||||||||||
| TestCellInDirection_X1 | A4BA | DEC D | Use the lower X cell, and jump back. | |||||||||||||||||||
| A4BB | JR TestCellInDirection_Cell | |||||||||||||||||||||
| TestCellInDirection_Y1 | A4BD | INC H | Use the higher Y cell, and jump back. | |||||||||||||||||||
| A4BE | JR TestCellInDirection_Cell | |||||||||||||||||||||
| TestCellInDirection_X2 | A4C0 | INC D | Use the higher X cell, and jump back. | |||||||||||||||||||
| A4C1 | JR TestCellInDirection_Cell | |||||||||||||||||||||
| Prev: A36C | Up: Map | Next: A4C3 |