Sherlock: annotated disassembly

Routines

Prev: A7EA Up: Map Next: A80E
A7EB: Print the article for article code DE
THE, A, AN or SOME from A24D - or from A255 when $A027 or A2AA is set - picked by bits 4-5 of D (A887 prints it). Reached from A7D0 when DE is not a word reference.
Input
D The article code in its top nibble
Output
The article (THE, A, AN or SOME) printed
DE Kept
A7EB LD HL,$A24D Indefinite table A24D: THE, A, AN, SOME
A7EE LD A,($A027) Read $A027 in "Game variables" into A - Unless $A027 or A2AA is set...
A7F1 LD E,A Copy A into E
A7F2 LD A,($A2AA) Read "Use THE: a flag for the article printer (A7F2)" (A2AA) into A
A7F5 OR E Set in A the bits that are set in E
A7F6 JR Z,$A7FB If the result is zero, skip ahead to A7FB
A7F8 LD HL,$A255 ...then table A255: THE, THE, THE, SOME (a definite narration)
A7FB LD A,D Copy D into A - The article code is the top nibble of D; two bytes an entry
A7FC RRCA Rotate A right one place (bit 0 goes to carry and bit 7)
A7FD RRCA Rotate A right one place (bit 0 goes to carry and bit 7)
A7FE RRCA Rotate A right one place (bit 0 goes to carry and bit 7)
A7FF AND $1E Keep only bits 1, 2, 3, 4 of A (mask $1E)
A801 PUSH DE Save DE on the stack
A802 LD E,A Copy A into E
A803 LD D,$00 Load D with $00
A805 ADD HL,DE Add DE to HL
A806 LD E,(HL) Read the byte HL points at into E - DE = the word; print it (A887)
A807 INC HL Step HL on to the next byte
A808 LD D,(HL) Read the byte HL points at into D
A809 CALL $A887 Call A887 (inside "Print the dictionary word that HL refers to")
A80C POP DE Restore DE from the stack
A80D RET Return to the caller
Prev: A7EA Up: Map Next: A80E