| The Hobbit (v1.0) | Routines |
| Prev: A7C6 | Up: Map | Next: A81A |
|
Next time, Gollum looks for an order given to him by the player (8907): the answer must be said to him, as in SAY TO GOLLUM "NIGHT". The words of the order are searched for the answer word stored in the riddle's entry (the CPIR loop). If the answer is there, all is well. If not, or if the player said nothing: 'someone strangles you from behind.', and Bilbo is dead (903C).
|
||||
| A7EA | CALL $9C99 | Dry run? Then just record that this would work, and return | ||
| A7ED | SUB A | Gollum is no longer waiting for an answer... | ||
| A7EE | LD ($B5EA),A | |||
| A7F1 | CALL $8907 | Take the order the player gave Gollum (SAY TO GOLLUM "...") off the orders buffer; HL points at it | ||
| A7F4 | JR Z,$A809 | Nothing was said to him: Bilbo is strangled | ||
| A7F6 | LD BC,$0018 | Search the 24 bytes of the order... | ||
| A7F9 | LD DE,($B5DF) | DE = the riddle entry chosen at the start of the game | ||
| A7FD | LD A,(DE) | A = the low byte of the answer word (NIGHT or MAN) | ||
| A7FE | CPIR | Look for it in the order | ||
| A800 | JR NZ,$A809 | Not there: Bilbo is strangled | ||
| A802 | INC DE | Found: now check the high byte of the word | ||
| A803 | LD A,(DE) | |||
| A804 | DEC DE | |||
| A805 | CP (HL) | Does the next byte of the order match it? | ||
| A806 | JR NZ,$A7FE | No: keep searching the rest of the order | ||
| A808 | RET | Yes: the answer was right, and Bilbo lives | ||
| A809 | CALL $9C99 | Dry run? Then stop | ||
| A80C | LD A,$01 | Make sure the player sees the message | ||
| A80E | LD ($B5F3),A | |||
| A811 | LD HL,$B0CD | "someone strangles you from behind." | ||
| A814 | CALL $72D4 | |||
| A817 | JP $903C | Bilbo is dead | ||
| Prev: A7C6 | Up: Map | Next: A81A |