Prev: C6A8 Up: Map Next: C6CC
C6AF: Room-entry handler: the Elvenking's cellar (room 32) wakes the dragon and Bard
Entering the cellar where the king keeps his barrels of wine brings the last part of the adventure to life. Three things happen:
  • Timer 9 (C9B2) is started with a count of 3. This is the timer that controls the side door of the Lonely Mountain (object 11), far away in room 42: it makes 'a loud crack and a hole appears about three feet from the ground' for one turn in every five (A985), after which 'the hole vanishes' (A968), unless it has been opened. The count of 3 means the first appearance happens two turns after Bilbo enters the cellar.
  • The dragon (object 60) is switched on by writing its number, $3C, into its empty slot in the character table at C9F2 - unless it is already dead. Until now the dragon has been lying inert in the lower halls; from now on its behaviour program (A5D5, A591, A5BB) runs every turn.
  • Bard (object 70) is switched on in the same way, by writing $46 into the slot at $C9EB, unless he is dead. He starts waiting for orders (A79F).
So the dragon cannot threaten Bilbo, and Bard cannot help him, until Bilbo has reached the Elvenking's cellar. Like the butler's handler (C693), this runs every time Bilbo enters the cellar, restarting the side door timer at 3 each time.
C6AF LD A,$03 Start timer 9 (the Lonely Mountain's side door)...
C6B1 LD ($C9B3),A ...with a count of 3
C6B4 LD HL,$C02A HL = the dragon's flags
C6B7 BIT 3,(HL) Is the dragon dead?
C6B9 JR NZ,$C6C0 Yes: skip
C6BB LD A,$3C Put the dragon (object 60) into its empty character-table slot...
C6BD LD ($C9F2),A ...so it starts acting
C6C0 LD HL,$C3B9 HL = Bard's flags
C6C3 BIT 3,(HL) Is Bard dead?
C6C5 RET NZ Yes: done
C6C6 LD A,$46 Put Bard (object 70) into his empty slot...
C6C8 LD ($C9EB),A ...so he starts waiting for orders
C6CB RET
Prev: C6A8 Up: Map Next: C6CC