Sherlock: annotated disassembly

Routines

Prev: D5EF Up: Map Next: D60B
D5FB: DE = the word for direction A (NORTH ... DOWN)
From the table at D064 (bit 7 of A ignored).
Input
A A direction number (bit 7 ignored)
Output
DE The direction's word
D5FB LD HL,$D064 Point HL at D064 - Table D062: the words for the directions, two bytes each
D5FE DEC HL Step HL back one byte
D5FF DEC HL Step HL back one byte
D600 LD E,A Copy A into E
D601 RES 7,E Clear bit 7 of E - A with bit 7 cleared is the direction number (1 = NORTH...)
D603 LD D,$00 Load D with $00
D605 ADD HL,DE Add DE to HL
D606 ADD HL,DE Add DE to HL
D607 LD E,(HL) Read the byte HL points at into E - DE = the word
D608 INC HL Step HL on to the next byte
D609 LD D,(HL) Read the byte HL points at into D
D60A RET Return to the caller
Prev: D5EF Up: Map Next: D60B