Sherlock: annotated disassembly

Routines

Prev: C388 Up: Map Next: C400
C3E4: Send the screen's top character row to the ZX Printer, if printing is on
Only when $A008 is set (by the PRINT special word; NOPRINT clears it): eight pixel lines from $4000, each through C403, then the printer motor is stopped (OUT ($FB),4).
Input
$A008 Non-zero when printing is on
Output
The top character row sent to the ZX Printer; registers kept
C3E4 LD A,($A008) Read $A008 in "Game variables" into A - Printing off (no PRINT command): nothing to do
C3E7 AND A Clear the carry flag for the caller (A is unchanged)
C3E8 RET Z If A is zero, return
C3E9 PUSH HL Save HL on the stack
C3EA PUSH DE Save DE on the stack
C3EB PUSH BC Save BC on the stack
C3EC LD HL,$4000 Load HL with $4000 - The top character row: eight pixel lines from $4000
C3EF LD B,$08 Load B with $08
C3F1 PUSH BC Save BC on the stack
C3F2 PUSH HL Save HL on the stack
C3F3 CALL $C403 Call the routine "Print one pixel line on the ZX Printer" (C403)
C3F6 POP HL Restore HL from the stack
C3F7 INC H Add one to H - Next pixel line down
C3F8 POP BC Restore BC from the stack
C3F9 DJNZ $C3F1 Count B down and, while it is not zero, go back to C3F1
C3FB LD A,$04 Load A with $04 - Stop the printer motor
C3FD OUT ($FB),A Write A to port ($FB)
C3FF POP BC Restore BC from the stack
Prev: C388 Up: Map Next: C400