Prev: A79F Up: Map Next: A7EA
A7C6: Character routine: Gollum asks his riddle
If Gollum (whose location is at C3B0) is in Bilbo's room and Bilbo is visible, he asks the riddle chosen at the start of the game (970B, C6EB), and $B5EA is set to show he is waiting for an answer.
A7C6 LD A,($C3B0) A = Gollum's own location
A7C9 LD HL,$B5E6 Is Bilbo in the same room?
A7CC CP (HL)
A7CD RET NZ No: say nothing
A7CE LD HL,$C012 Is Bilbo actually visible?
A7D1 BIT 7,(HL)
A7D3 RET Z No (he is wearing the ring): Gollum cannot see him to ask
A7D4 CALL $9C99 Dry run? Then stop here: it always works
A7D7 LD HL,($B5DF) HL = the riddle chosen at the start of the game...
A7DA INC HL ...moved on 2 bytes, to the riddle's own text
A7DB INC HL
A7DC LD E,(HL) DE = the riddle's address
A7DD INC HL
A7DE LD D,(HL)
A7DF PUSH DE HL = that address
A7E0 POP HL
A7E1 CALL $A113 Gollum asks it
A7E4 LD A,$01 Remember that he is now waiting for the answer
A7E6 LD ($B5EA),A
A7E9 RET
Prev: A79F Up: Map Next: A7EA