| The Hobbit (v1.0) | Routines |
| Prev: 8E9D | Up: Map | Next: 8ED3 |
|
Moves the actor through the exit at IX (see the room records at B97A): byte 0 the direction, byte 1 a door or other obstacle, byte 2 the destination. Exits with no destination cannot be used. If the exit has a door, the door must be open (bit 5 of its flags). The direction is then used as the action number and the move is made by 8D19 (at 8D27). If the exit cannot be used, 9EBF reports it.
|
||||||||||
| 8EA0 | CP $FF | Is there no such exit at all? | ||||||||
| 8EA2 | JP Z,$9EBF | Fail with the usual message | ||||||||
| 8EA5 | LD A,(IX+$02) | A = where the exit leads | ||||||||
| 8EA8 | CP $00 | |||||||||
| 8EAA | JP Z,$9EBF | Leads nowhere: fail | ||||||||
| 8EAD | LD A,(IX+$01) | Does the exit have a door? | ||||||||
| 8EB0 | CP $00 | |||||||||
| 8EB2 | JR Z,$8EC2 | No: go straight ahead | ||||||||
| 8EB4 | PUSH IX | Yes: save the exit | ||||||||
| 8EB6 | CALL $9B25 | IX = the door's own record | ||||||||
| 8EB9 | BIT 5,(IX+$07) | Is it open? | ||||||||
| 8EBD | POP IX | Restore the exit | ||||||||
| 8EBF | JP Z,$9EBF | Closed: fail ("you cannot go that way") | ||||||||
| 8EC2 | CALL $9C99 | Dry run? Then stop here: it would work | ||||||||
| 8EC5 | LD A,(IX+$00) | A = the exit's own direction, used as the movement action | ||||||||
| 8EC8 | LD ($B5D8),A | |||||||||
| 8ECB | LD A,$FF | No specific target - just moving in this direction | ||||||||
| 8ECD | LD ($B5D9),A | |||||||||
| 8ED0 | JP $8D27 | Carry out the move (joining the ordinary movement routine partway through) | ||||||||
| Prev: 8E9D | Up: Map | Next: 8ED3 |