Prev: A539 Up: Map Next: A577
A550: Character routine: Thorin
Thorin's idle behaviour. A random number from 0 to 8 (9BF4) decides: 5 or more, nothing; 3 or 4, 'thorin waits.'; 0, 'thorin sits down and starts singing about gold.'; 1 or 2, he says 'hurry up'.
A fourth line, 'get us out of this one, thief!', is set up at A563 but can never be printed: the JP Z that would print it tests the flags from CP 3, and Z can only be set there if A was 3, which the JP NC before it has already taken care of.
A550 CALL $9C99 Dry run? Then stop: this always works
A553 LD A,$08 Pick a random number from 0 to 8
A555 CALL $9BF4
A558 CP $05 5 or more...
A55A RET NC ...do nothing
A55B CP $03 3 or 4...
A55D LD HL,$AFE6 "thorin waits."
A560 JP NC,$9752
A563 LD HL,$AFC7 "get us out of this one, thief!" (never reached: see the bug note)
A566 JP Z,$A113
A569 LD HL,$AFD7 "thorin sits down and starts singing about gold."
A56C CP $00 0?
A56E JP Z,$9752
A571 LD HL,$AF4D 1 or 2: he says "hurry up"
A574 JP $A113
Prev: A539 Up: Map Next: A577