Sherlock: annotated disassembly

Routines

Prev: D57C Up: Map Next: D5C9
D590: Say what a person is carrying, or what is on or in a thing
'<thing> IS CARRYING' (68B1) for a person (+5 bit 6), otherwise IS or ARE and the relation word (D5D3).
Input
A A thing
C How many things it holds
Output
"IS CARRYING" or IS/ARE with how it holds them printed
D590 PUSH IX Save IX on the stack - Save the registers; A = a thing
D592 PUSH BC Save BC on the stack
D593 PUSH AF Save AF on the stack
D594 CALL $D237 Its record (D237)
D597 BIT 6,(IX+$05) Test bit 6 of the flags byte (+5) of the thing record at IX (person) - Bit 6 of +5 (a person)?
D59B JR Z,$D5A5 If bit 6 of the flags byte (+5) of the thing record at IX is clear, skip ahead to D5A5
D59D POP AF Restore AF from the stack
D59E PUSH AF Save AF on the stack
D59F PUSH AF Save AF on the stack
D5A0 LD HL,$68B1 Point HL at the message "THE TRASH PILE IS CARRYING" (68B1)
D5A3 JR $D5C1 Skip ahead to D5C1
D5A5 LD HL,$0485 Load HL with $0485
D5A8 DEC C Subtract one from C
D5A9 JR Z,$D5AE If C has become zero, skip ahead to D5AE
D5AB LD HL,$007A Load HL with $007A
D5AE PUSH HL Save HL on the stack
D5AF CALL $D5D3 Call the routine "Print how a thing is held: IN, ON, BEHIND, UNDER or..." (D5D3)
D5B2 LD A,$01 Load A with $01
D5B4 LD ($A2AA),A Store A in "Use THE: a flag for the article printer (A7F2)" (A2AA)
D5B7 CALL $D3D5 Call the routine "Print thing IX's name" (D3D5)
D5BA XOR A Clear A to zero (and the carry flag)
D5BB LD ($A2AA),A Store A in "Use THE: a flag for the article printer (A7F2)" (A2AA)
D5BE LD HL,$68D9 Point HL at the message "THERE ‹word›" (68D9)
D5C1 CALL $A59F Call the routine "Print the message at HL" (A59F)
D5C4 POP AF Restore AF from the stack
D5C5 POP BC Restore BC from the stack
D5C6 POP IX Restore IX from the stack
D5C8 RET Return to the caller
Prev: D57C Up: Map Next: D5C9