| The Hobbit (v1.0) | Routines |
| Prev: C67D | Up: Map | Next: C6A1 |
|
Not every character is active from the start. The butler (object 66) begins the game in the Elvenking's cellar (room 32), invisible (bit 7 of his flags clear), and his slot in the character table at $C9D6 holds 0, so 976C passes him by and he does nothing at all.
The first time Bilbo walks into Beorn's house - roughly half way through the journey - this handler switches him on: his object number $42 is written into that slot, which already holds the address of his behaviour program (C83F) and reaction table (C835), and he is made visible. From then on he goes about his business in the cellar every turn (unlocking and locking the red door, drinking wine, throwing barrels through the trap door, capturing intruders; see C71C), so that by the time Bilbo arrives in the Elvenking's halls the butler is already at work.
If the butler has been killed (bit 3 of his flags), nothing happens. Because the slot is simply overwritten, entering Beorn's house again later does no harm: it writes the same value again.
|
||||
| C693 | LD HL,$C326 | HL = the butler's flags | ||
| C696 | BIT 3,(HL) | Is the butler dead? | ||
| C698 | RET NZ | Yes: leave him be | ||
| C699 | LD A,$42 | Put the butler (object 66) into his empty slot in the character table... | ||
| C69B | LD ($C9D6),A | ...so that from now on he acts every turn | ||
| C69E | SET 7,(HL) | ...and make him visible | ||
| C6A0 | RET | |||
| Prev: C67D | Up: Map | Next: C6A1 |