Prev: A792 Up: Map Next: A7C6
A79F: Character routine: Bard remembers his orders
If Bard has been given an order (8907), it is checked and then written into Bard's own behaviour program: the action ($B5D7), target and instrument ($B5D9, B5DA) are stored at $C8D2-$C8D4, and the first byte at C8D1 is set to $42 (an action instruction that cannot be interrupted by orders). From then on Bard carries out that order every turn. So 'say to bard "shoot the dragon"' keeps him shooting until it works.
SAVE and LOAD (8284, 8209) preserve the three bytes at C8D1-$C8D3, because the behaviour programs are not otherwise saved; the instrument at $C8D4 is not included.
A79F LD A,($B5E5) Has the player given Bard an order?
A7A2 CP $01
A7A4 RET NZ No: nothing to do
A7A5 SUB A It is dealt with now
A7A6 LD ($B5E5),A
A7A9 INC A
A7AA CALL $8907 Take the order and match it to an action and objects
A7AD RET Z It makes no sense: ignore it
A7AE SUB A Do not carry it out now
A7AF LD ($B5EC),A
A7B2 LD A,($B5D7) Write the action...
A7B5 LD ($C8D2),A ...into Bard's next instruction at C8D1...
A7B8 LD BC,($B5D9) ...with its target and instrument...
A7BC LD ($C8D3),BC
A7C0 LD A,$42 ...and make it an action instruction that orders cannot interrupt ($42)
A7C2 LD ($C8D1),A
A7C5 RET From now on Bard repeats it every turn
Prev: A792 Up: Map Next: A7C6