Sherlock: annotated disassembly

Routines

Prev: A880 Up: Map Next: A94D
A92F: Add a dictionary word's suffix to the spelling at IX
The low nibble of (HL) picks one of the four-letter suffixes at A85C (15 = none), copied to IX and ended with 0.
Input
HL A dictionary record
IX The end of the spelling
Output
IX At the end of the suffix, ended with 0
A92F LD A,(HL) Read the byte HL points at into A - Low nibble of the record's byte picks a suffix
A930 AND $0F Keep only bits 0, 1, 2, 3 of A (mask $0F)
A932 CP $0F Compare A with $0F - 15: none
A934 RET Z If A equals $0F, return
A935 RLCA Rotate A left one place (bit 7 goes to carry and bit 0) - Times 4: an index into the table at A85C
A936 RLCA Rotate A left one place (bit 7 goes to carry and bit 0)
A937 LD L,A Copy A into L
A938 LD H,$00 Load H with $00
A93A LD BC,$A85C Load BC with A85C (-22436 as a signed offset), the amount that is added next
A93D ADD HL,BC Add BC to HL
A93E LD B,$04 Load B with $04 - Copy four letters to IX...
A940 LD A,(HL) Read the byte HL points at into A
A941 INC HL Step HL on to the next byte
A942 LD (IX+$00),A Store A in the first byte of the record at IX
A945 INC IX Step IX on to the next byte
A947 DJNZ $A940 Count B down and, while it is not zero, go back to A940
A949 LD (IX+$00),B Store B in the first byte of the record at IX - ...and end with 0
A94C RET Return to the caller
Prev: A880 Up: Map Next: A94D