Sherlock: annotated disassembly

Routines

Prev: D3E8 Up: Map Next: D448
D405: Print a thing's name with its adjectives (IY = its name words)
Used by the routines at A7BA and D1C6.
Input
IY A thing's name words
Output
The name printed with its adjectives; A and DE kept
D405 PUSH AF Save AF on the stack
D406 PUSH DE Save DE on the stack
D407 LD D,(IY+$01) Read byte +1 of the record at IY into D - The noun (+0/+1): an article first, or note it is YOU (A7D0)
D40A LD E,(IY+$00) Read the first byte of the record at IY into E
D40D CALL $A7D0 Call the routine "Print an article, or note whether the word is YOU" (A7D0)
D410 LD A,($A028) Read $A028 in "Game variables" into A - $A028 set: the noun alone
D413 AND A Test A for zero (this leaves A as it was and clears carry)
D414 JR NZ,$D438 If A is not zero, skip ahead to D438
This entry point is used by the routine at D3E8.
D416 LD E,(IY+$02) Read byte +2 of the record at IY into E - First adjective (+2/+3), unless bit 7 marks it as not to be printed
D419 LD D,(IY+$03) Read byte +3 of the record at IY into D
D41C RES 7,D Clear bit 7 of D
D41E BIT 7,(IY+$03) Test bit 7 of byte +3 of the record at IY
D422 LD A,$40 Load A with $40
D424 CALL Z,$A815 If bit 7 of byte +3 of the record at IY is clear, call A815 (inside "Print word reference DE (code $04's printer)")
This entry point is used by the routine at D3E8.
D427 LD E,(IY+$04) Read byte +4 of the record at IY into E - Second adjective (+4/+5), likewise
D42A LD D,(IY+$05) Read byte +5 of the record at IY into D
D42D RES 7,D Clear bit 7 of D
D42F BIT 7,(IY+$05) Test bit 7 of byte +5 of the record at IY
D433 LD A,$40 Load A with $40
D435 CALL Z,$A815 If bit 7 of byte +5 of the record at IY is clear, call A815 (inside "Print word reference DE (code $04's printer)")
D438 LD E,(IY+$00) Read the first byte of the record at IY into E - Then the noun
D43B LD D,(IY+$01) Read byte +1 of the record at IY into D
D43E LD A,D Copy D into A
D43F OR E Set in A the bits that are set in E
D440 LD A,$50 Load A with $50
D442 CALL NZ,$A815 If the result is not zero, call A815 (inside "Print word reference DE (code $04's printer)")
D445 POP DE Restore DE from the stack
D446 POP AF Restore AF from the stack
D447 RET Return to the caller
Prev: D3E8 Up: Map Next: D448