Sherlock: annotated disassembly

Routines

Prev: A82F Up: Map Next: A851
A83A: Message bytes $60 and up: a common word
Byte - $60 indexes the two-byte table at 67B7; the word reference it holds (with $50 added to the high byte) is printed like any other (A5EA). A840 does the lookup and is also used by $B7D6.
Input
A The byte, $60 or more
Output
The common word printed
F NZ
A83A CALL $A840 Call A840 (inside "Message bytes $60 and up: a common word") - Convert the common-word byte (A840) and print it as a word reference (A5EA)
A83D JP $A5EA Go back to A5EA
This entry point is used by the routine at B77F.
A840 SUB $60 Subtract $60 from A - Index = A - $60; the list of words is at 67B7, two bytes each
A842 LD E,A Copy A into E
A843 LD D,$00 Load D with $00
A845 LD HL,$67B7 Point HL at "Message bytecode: everything the game prints" (67B7)
A848 ADD HL,DE Add DE to HL
A849 ADD HL,DE Add DE to HL
A84A LD E,(HL) Read the byte HL points at into E
A84B INC HL Step HL on to the next byte
A84C LD A,(HL) Read the byte HL points at into A
A84D ADD A,$50 Add $50 to A - High byte + $50: class $50, as for a noun
A84F LD D,A Copy A into D
A850 RET Return to the caller
Prev: A82F Up: Map Next: A851