Routines
| Prev: 9ED0 | Up: Map | Next: 9F1E |
9ED1: After-turn routine: the gardener
|
See 9EC1.
At 9pm he is put off stage with the state word SLEEPING and +5 bit 6 cleared (the bit the flag-word table at C471 calls DEAD when it is clear); at his next turn he is put back in the room he left and woken.
|
||||||||||||
| 9ED1 | LD HL,$9ED0 | The gardener's state byte 9ED0: the room he left, or 0 while about | ||||||||||
|
This entry point is used by the routine at 9ECB.
|
||||||||||||
| 9ED4 | LD BC,$0000 | Load BC with $0000 - B = 0, C = 0 (the cook joins here too; Strachan comes in at 9ED7 with B = 74, C = $80) | ||||||||||
|
This entry point is used by the routine at 9EC1.
|
||||||||||||
| 9ED7 | LD A,(HL) | Read the byte HL points at into A | ||||||||||
| 9ED8 | AND A | Test A for zero (this leaves A as it was and clears carry) | ||||||||||
| 9ED9 | JR Z,$9EF2 | Not away: see whether it is time to go | ||||||||||
| 9EDB | LD B,A | Away, and this is the turn to come back: B = the room left | ||||||||||
| 9EDC | XOR A | Clear A to zero (and the carry flag) - Store 0 at 9ED0, put him in room B, next turn in 0 minutes (9F1E) | ||||||||||
| 9EDD | LD DE,$0000 | Load DE with $0000 | ||||||||||
| 9EE0 | CALL $9F1E | Call the routine "Store A at HL, put the actor in room B, and its next..." (9F1E) | ||||||||||
| 9EE3 | LD A,($A036) | Read $A036 in "Game variables" into A - State word and bits back to none (F1C1, DE = 0, B = C) | ||||||||||
| 9EE6 | LD B,C | Copy C into B | ||||||||||
| 9EE7 | LD DE,$0000 | Load DE with $0000 | ||||||||||
| 9EEA | CALL $F1C1 | Call the routine "Set a thing's state word and state bits" (F1C1) | ||||||||||
| 9EED | SET 6,(IX+$05) | Set bit 6 of byte +5 of the record at IX - and +5 bit 6 set: a person again | ||||||||||
| 9EF1 | RET | Return to the caller | ||||||||||
| 9EF2 | LD A,($9FE2) | Read 'a' or 'p' (9FE2) into A - Is it am? | ||||||||||
| 9EF5 | CP $61 | Compare A with $61 | ||||||||||
| 9EF7 | RET Z | Yes: nothing to do | ||||||||||
| 9EF8 | LD A,($9FE0) | Read the hour, 1-12 (9FE0) into A - Is it 9 (pm)? | ||||||||||
| 9EFB | CP $09 | Compare A with $09 | ||||||||||
| 9EFD | RET NZ | If A differs from $09, return | ||||||||||
| 9EFE | LD DE,$01F8 | DE = 504 minutes (8 hours 24) | ||||||||||
| 9F01 | LD A,$1E | Load A with $1E - A = a random number from 0 to 30 | ||||||||||
| 9F03 | CALL $D2A4 | Call the routine "A random number from 0 to A" (D2A4) | ||||||||||
| 9F06 | ADD A,E | Add E to A - BUG: added to E only - from 8 up the carry into D is lost and 256 minutes go with it | ||||||||||
| 9F07 | LD E,A | Copy A into E | ||||||||||
| 9F08 | LD A,($A00A) | Read the current actor's room (A00A) into A - Remember the room in the state byte, move to room B (0, or 74 for Strachan), next turn DE minutes on | ||||||||||
| 9F0B | CALL $9F1E | Call the routine "Store A at HL, put the actor in room B, and its next..." (9F1E) | ||||||||||
| 9F0E | LD A,($A036) | Read $A036 in "Game variables" into A - State word SLEEPING ($07F0), bit 4 of +8 (F1C1) | ||||||||||
| 9F11 | LD B,$10 | Load B with $10 | ||||||||||
| 9F13 | LD DE,$07F0 | Load DE with $07F0 | ||||||||||
| 9F16 | CALL $F1C1 | Call the routine "Set a thing's state word and state bits" (F1C1) | ||||||||||
| 9F19 | RES 6,(IX+$05) | Clear bit 6 of byte +5 of the record at IX - and +5 bit 6 cleared: no longer a person to talk to | ||||||||||
| 9F1D | RET | Return to the caller | ||||||||||
| Prev: 9ED0 | Up: Map | Next: 9F1E |