| The Hobbit (v1.0) | Routines |
| Prev: 9FEA | Up: Map | Next: A054 |
|
For each exit of room A that has a visible door, prints 'to the east there is the round green door' (or 'above'/'below' for up and down).
|
||||
| 9FF8 | PUSH BC | Save the caller's BC, DE, IY and IX | ||
| 9FF9 | PUSH DE | |||
| 9FFA | PUSH IY | |||
| 9FFC | PUSH IX | |||
| 9FFE | CALL $9FDE | IX = the start of room A's exits, BC = 3 (the size of each one) | ||
| A001 | ADD IX,BC | Step back one exit's width, so the loop below lands on the very first exit the first time round | ||
| A003 | PUSH IX | IY will be the loop's own pointer, a copy of IX | ||
| A005 | POP IY | |||
| A007 | SUB A | Is this the very first exit (guards against a room with no exits at all)? | ||
| A008 | CP (IY+$01) | |||
| A00B | JR Z,$A043 | It is: there is nothing to describe yet, so skip straight to moving on | ||
| A00D | LD A,(IY+$01) | A = this exit's door object | ||
| A010 | CALL $9B25 | IX = the door's own record | ||
| A013 | BIT 7,(IX+$07) | Is the door visible? | ||
| A017 | JR Z,$A043 | No: say nothing about it and move on | ||
| A019 | LD DE,$0008 | DE = 8: the offset, from the start of a record, to an object's own words | ||
| A01C | ADD IX,DE | IX = the door's own words | ||
| A01E | PUSH IX | Save that for a moment | ||
| A020 | LD A,(IY+$00) | A = this exit's direction | ||
| A023 | CALL $9FEA | DE = the word for that direction | ||
| A026 | CP $09 | Is the direction UP or DOWN (9 or 10)? | ||
| A028 | JR C,$A034 | No: use the ordinary "to the <direction> there is" wording | ||
| A02A | LD DE,$07B9 | "above" | ||
| A02D | JR Z,$A03A | It was UP: use that word | ||
| A02F | LD DE,$082F | "below" | ||
| A032 | JR $A03A | It was DOWN: use that word instead | ||
| A034 | LD HL,$AD0A | "to the <direction> there is" | ||
| A037 | CALL $72D4 | |||
| A03A | CALL $74B8 | Print the direction word (or "above"/"below") | ||
| A03D | LD HL,$AF05 | "the <door>." | ||
| A040 | CALL $72D4 | Print it, naming the door | ||
| A043 | ADD IY,BC | Move on to the next exit | ||
| A045 | LD A,$FF | Have we reached the end of the exits? | ||
| A047 | CP (IY+$00) | |||
| A04A | JP NZ,$A007 | Not yet: look at this next one | ||
| A04D | POP IX | Finished: restore the caller's IX, IY, DE and BC | ||
| A04F | POP IY | |||
| A051 | POP DE | |||
| A052 | POP BC | |||
| A053 | RET | |||
| Prev: 9FEA | Up: Map | Next: A054 |