Prev: A8CA Up: Map Next: A91B
A8D9: Character routine: Elrond gives Bilbo lunch
If Elrond is in Bilbo's room and object 38 (lunch) has not yet been handed over, it is placed with Elrond and he gives it to Bilbo (9308).
A8D9 LD A,($B5E7) A = the room the character started this turn in
A8DC LD HL,$B5E6 Is Bilbo in that same room?
A8DF CP (HL)
A8E0 RET NZ No: nothing happens
A8E1 LD IX,$C552 IX = the lunch's own record
A8E5 LD A,(IX+$10) Has it already been placed anywhere (i.e. already given)?
A8E8 CP $00
A8EA JR Z,$A8F2 No (still nowhere): give it now, below
A8EC LD A,$41 Yes - is it still held by Elrond himself?
A8EE CP (IX+$01)
A8F1 RET NZ No (already handed over): nothing more to do
A8F2 CALL $9C99 Dry run? Then stop here: it always works
A8F5 LD A,($B5E7) The lunch appears in this room...
A8F8 LD (IX+$10),A
A8FB LD (IX+$01),$41 ...held by Elrond
A8FF LD BC,$0026 The lunch (object 38) is the target...
A902 LD ($B5D9),BC
A906 LD A,$1D The action is GIVE TO
A908 LD ($B5D8),A
A90B LD ($B5F8),IX IX = the lunch's own record, for GIVE TO to use
A90F LD HL,$C00B Bilbo (object 0) is the instrument (the receiver)
A912 LD ($B5FA),HL
A915 CALL $9EBF Report it in words
A918 JP $9308 Actually carry out the GIVE TO
Prev: A8CA Up: Map Next: A91B