Sherlock: annotated disassembly

Routines

Prev: F514 Up: Map Next: F56E
F54A: Move the pen one pixel (Z when it would leave the picture area)
E is the pen's y and D its x. F54A moves down (stopping at 176), F555 up (stopping at 0), F55E right (stopping at 255), F565 left - stopping when bit 7 of D would clear, so the pen can never leave the right half of the screen, which is why every picture sits there.
Input
E The pen's y
Output
E One more unless it would reach 176
F Z at the edge
F54A INC E Add one to E - One pixel up (E + 1) - unless that reaches y = 176 ($B0): then put it back and Z
F54B LD H,A Copy A into H
F54C LD A,E Copy E into A
F54D CP $B0 Compare A with $B0
F54F LD A,H Copy H into A
F550 RET NZ If A differs from $B0, return
F551 DEC E Subtract one from E
F552 XOR A Clear A to zero (and the carry flag)
F553 LD A,H Copy H into A
F554 RET Return to the caller
This entry point is used by the routines at F490 and F56E.
F555 DEC E Subtract one from E - One down (E - 1), not below 0
F556 LD H,A Copy A into H
F557 LD A,E Copy E into A
F558 CP $FF Compare A with $FF
F55A LD A,H Copy H into A
F55B RET NZ If A differs from $FF, return
F55C INC E Add one to E
F55D RET Return to the caller
This entry point is used by the routines at F490 and F56E.
F55E INC D Add one to D - One right (D + 1), not past 255
F55F RET NZ If D is not zero, return
F560 DEC D Subtract one from D
F561 LD H,A Copy A into H
F562 XOR A Clear A to zero (and the carry flag)
F563 LD A,H Copy H into A
F564 RET Return to the caller
This entry point is used by the routines at F490 and F56E.
F565 DEC D Subtract one from D - One left (D - 1), not out of the right half (bit 7 of D must stay set)
F566 BIT 7,D Test bit 7 of D
F568 RET NZ If bit 7 of D is set, return
F569 INC D Add one to D
F56A LD H,A Copy A into H
F56B XOR A Clear A to zero (and the carry flag)
F56C LD A,H Copy H into A
F56D RET Return to the caller
Prev: F514 Up: Map Next: F56E