Sherlock: annotated disassembly

Routines

Prev: F5D2 Up: Map Next: F60B
F5FB: Find the screen byte and bit for the pen
The ROM's PIXEL-ADD ($22AA) with B = y and C = x, then a mask for the bit.
Input
D, E The pen position
Output
HL The screen byte
A The bit mask
BC Kept
F5FB PUSH BC Save BC on the stack - B = E (y), C = D (x): the ROM's pixel address routine ($22AA) gives HL = the screen byte, A = the bit position
F5FC LD B,E Copy E into B
F5FD LD C,D Copy D into C
F5FE CALL $22AA Call the ROM pixel-address routine ($22AA)
F601 LD B,A Copy A into B - Turn the position into a mask: one bit rotated into place
F602 INC B Add one to B
F603 LD A,$01 Load A with $01
F605 RRC A Rotate A right
F607 DJNZ $F605 Count B down and, while it is not zero, go back to F605
F609 POP BC Restore BC from the stack - Return the screen byte in HL and the mask in A
F60A RET Return to the caller
Prev: F5D2 Up: Map Next: F60B