Prev: 03807 Up: Map Next: 03884
03828: 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 (1 to 176)
HL Display file address or printer buffer address
COPY_LINE 03828 LD A,B Copy the pixel-line number.
03829 CP 3 The A register will hold 0 until the last two lines are being handled.
03831 SBC A,A
03832 AND 2
03834 OUT (251),A Slow the motor for the last two pixel lines only.
03836 LD D,A The D register will hold either 0 or 2.
There are three tests to be made before doing any 'printing'.
COPY_L_1 03837 CALL BREAK_KEY Jump forward unless the BREAK key is being pressed.
03840 JR C,COPY_L_2
03842 LD A,4 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'.
03844 OUT (251),A
03846 EI
03847 CALL CLEAR_PRB
03850 RST 8
03851 DEFB 12
COPY_L_2 03852 IN A,(251) Fetch the status of the printer.
03854 ADD A,A
03855 RET M Make an immediate return if the printer is not present.
03856 JR NC,COPY_L_1 Wait for the stylus.
03858 LD C,32 There are thirty two bytes.
Now enter a loop to handle these bytes.
COPY_L_3 03860 LD E,(HL) Fetch a byte.
03861 INC HL Update the pointer.
03862 LD B,8 Eight bits per byte.
COPY_L_4 03864 RL D Move D left.
03866 RL E Move each bit into the carry.
03868 RR D Move D back again, picking up the carry from E.
COPY_L_5 03870 IN A,(251) Again fetch the status of the printer and wait for the signal from the encoder.
03872 RRA
03873 JR NC,COPY_L_5
03875 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'.
03876 OUT (251),A
03878 DJNZ COPY_L_4 'Print' each bit.
03880 DEC C Decrease the byte counter.
03881 JR NZ,COPY_L_3 Jump back whilst there are still bytes; otherwise return.
03883 RET
Prev: 03807 Up: Map Next: 03884