Prev: A5BB Up: Map Next: A600
A5D5: Character routine: the dragon wakes
Does nothing while the valuable treasure (location at C4CC) is still in room 41. Once it has been moved, and if the dragon's current room is lit, a random number from 0 to 100 (9BF4) decides: below 80, 'in the distance you see the shape of a monstrous dragon flying after you.'; otherwise 'the dragon descends and in a terrific spout of flames burns you to a crisp.' and Bilbo dies. Because of the skew in the random numbers (9BFD), the fatal result comes up about 16% of the time, every turn, for as long as the dragon lives.
A5D5 LD A,($C4CC) Is the treasure still in room 41?
A5D8 CP $29
A5DA RET Z Yes: the dragon sleeps on
A5DB CALL $9C99 Dry run? Then stop: this would work
A5DE LD A,$01 Make sure Bilbo sees what follows
A5E0 LD ($B5F3),A
A5E3 CALL $9C8C IX = the room the dragon (the actor) is in
A5E6 BIT 7,(IX+$00) Is it lit?
A5EA RET Z No: nothing happens
A5EB LD HL,$B098 "in the distance you see the shape of a monstrous dragon flying after you."
A5EE LD A,$64 Pick a random number from 0 to 100
A5F0 CALL $9BF4
A5F3 CP $50 Below 80?
A5F5 JR C,$A5B7 Yes: the dragon is just a shape in the distance
A5F7 LD HL,$B0AC Otherwise: "the dragon descends and in a terrific spout of flames burns you to a crisp."
A5FA CALL $72D4
A5FD JP $903C Bilbo is dead
Prev: A5BB Up: Map Next: A600