Prev: 0EDF Up: Map Next: 0F2C
0EF4: THE 'COPY-LINE' SUBROUTINE
Used by the routines at COPY and COPY_BUFF.
The subroutine is entered with the HL register pair holding the base address of the thirty two bytes that form the pixel-line and the B register holding the pixel-line number.
Input
B Pixel line number (+01 to +B0)
HL Display file address or printer buffer address
COPY_LINE 0EF4 LD A,B Copy the pixel-line number.
0EF5 CP $03 The A register will hold +00 until the last two lines are being handled.
0EF7 SBC A,A
0EF8 AND $02
0EFA OUT ($FB),A Slow the motor for the last two pixel lines only.
0EFC LD D,A The D register will hold either +00 or +02.
There are three tests to be made before doing any 'printing'.
COPY_L_1 0EFD CALL BREAK_KEY Jump forward unless the BREAK key is being pressed.
0F00 JR C,COPY_L_2
0F02 LD A,$04 But if it is then stop the motor, enable the maskable interrupt, clear the printer buffer and exit via the error handling routine - 'BREAK-CONT repeats'.
0F04 OUT ($FB),A
0F06 EI
0F07 CALL CLEAR_PRB
0F0A RST $08
0F0B DEFB $0C
COPY_L_2 0F0C IN A,($FB) Fetch the status of the printer.
0F0E ADD A,A
0F0F RET M Make an immediate return if the printer is not present.
0F10 JR NC,COPY_L_1 Wait for the stylus.
0F12 LD C,$20 There are thirty two bytes.
Now enter a loop to handle these bytes.
COPY_L_3 0F14 LD E,(HL) Fetch a byte.
0F15 INC HL Update the pointer.
0F16 LD B,$08 Eight bits per byte.
COPY_L_4 0F18 RL D Move D left.
0F1A RL E Move each bit into the carry.
0F1C RR D Move D back again, picking up the carry from E.
COPY_L_5 0F1E IN A,($FB) Again fetch the status of the printer and wait for the signal from the encoder.
0F20 RRA
0F21 JR NC,COPY_L_5
0F23 LD A,D Now go ahead and pass the 'bit' to the printer. Note: bit 2 low starts the motor, bit 1 high slows the motor, and bit 7 is high for the actual 'printing'.
0F24 OUT ($FB),A
0F26 DJNZ COPY_L_4 'Print' each bit.
0F28 DEC C Decrease the byte counter.
0F29 JR NZ,COPY_L_3 Jump back whilst there are still bytes; otherwise return.
0F2B RET
Prev: 0EDF Up: Map Next: 0F2C