Sherlock: annotated disassembly

Routines

Prev: C400 Up: Map Next: C415
C403: Print one pixel line on the ZX Printer
Port $FB is the ZX Printer's. Sets the printer speed (slower for the last two of the eight lines: the B < 3 test at C403-C407), waits until the printer is ready (IN A,($FB), RET M / JR NC) and joins the 48K ROM's COPY-LINE code at $0F12, which prints one pixel line. Called eight times by C3E4 for each character row sent to the printer, so it is reached only when printing is on (PRINT special word).
Input
B The pixel line number
HL The screen address of the line
Output
The line sent to the printer through the ROM at $0F12
C403 LD A,B Copy B into A - Slow the motor for the last two lines (B < 3): the start of the ROM's COPY-LINE ($0EF4), copied without its BREAK test
C404 CP $03 Compare A with $03
C406 SBC A,A Subtract A and the carry from A
C407 AND $02 Isolate bit 1 of A (mask $02)
C409 OUT ($FB),A Write A to port ($FB)
C40B LD D,A Copy A into D
C40C IN A,($FB) Read port ($FB) into A - Wait for the printer: bit 6 set (no printer) returns, bit 7 is the stylus
C40E ADD A,A Double A (shift it left one bit)
C40F RET M If the last result was negative (sign flag set), return
C410 JR NC,$C40C If it did not overflow, go back to C40C
C412 JP $0F12 Join the ROM's COPY-LINE where it starts sending the 32 bytes
Prev: C400 Up: Map Next: C415