Sherlock: annotated disassembly

Routines

Prev: DA7D Up: Map Next: DAE8
DAC6: Read a token that is not a word: money, a number or punctuation
A '£' (character $60) starts an amount of money (DB67); a digit starts a time or a number (DAEF); a full stop, comma or quote mark gives the punctuation tokens $B0, $A0 and $90.
Input
A The first character of the word
HL The word
Output
A The token class; BC its value; HL past it, for money, a number, full stop, comma or quote
F NZ for any other character
DAC6 CP $60 Compare A with $60 - A pound sign ($60 in the game's character set): read an amount of money (DB67)
DAC8 JP Z,$DB67 If A equals $60, jump on to the routine "Read an amount of pre-decimal money" (DB67)
DACB CALL $DAE8 A digit? (DAE8)
DACE JP NC,$DAEF Yes: read a number (DAEF)
DAD1 LD B,$B0 Load B with $B0 - A full stop: class $B0 (end of a command)
DAD3 CP $2E Compare A with $2E
DAD5 JR Z,$DAE2 If A equals $2E, skip ahead to DAE2
DAD7 LD B,$A0 Load B with $A0 - A comma: class $A0
DAD9 CP $2C Compare A with $2C
DADB JR Z,$DAE2 If A equals $2C, skip ahead to DAE2 - A double quote: class $90 (starts or ends a quotation)
DADD CP $22 Compare A with $22
DADF RET NZ If A differs from $22, return - Anything else: carry on with the caller (RET NZ)
DAE0 LD B,$90 Load B with $90
DAE2 INC HL Step HL on to the next byte - Past the character; class in A, value 0
DAE3 LD A,B Copy B into A
DAE4 LD BC,$0000 Load BC with $0000
DAE7 RET Return to the caller
Prev: DA7D Up: Map Next: DAE8