CPC Guide - Controlling the PrinterPrinter Control The printer is controlled using port &EFxx and port &F5xx of the 8255 PPI. The ready status of the printer is controlled by checking bit 6 of port &F5xx. If the printer is on-line, this bit will be set to 1, if it is offline this bit will be set to 0. Data may be sent to the printer by using port &EFxx. (This port cannot be read.) The user may only send 7 bit values. The 8th bit is used as the strobe. This is like a flag telling the printer that data is ready, it is a peak, as shown in the diagram below: The strobe looks like this: +---+ | | _______| |_________ The user must send a 0 on the strobe bit, then a 1 and then a 0. The printer will then take the byte and print it. (At all times the data that you want the printer to take and print, should be present on bits 7-0.) NOTE: When the computer is switched on or reset, the strobe bit is set to 0. Making a printer lead What you need 34-way ribbon cable 34-way edge connector (for CPC's with edge connectors) A 36-way centronics D type male edge connector Attach the edge connector to one end of the ribbon cable, and the D-type connector to the other end of the ribbon. When you connect the D-connector you will see 2 columns of pins which are not used. Make sure that pin 1 of the edge connector connects to pin 1 of the D-type connector. There is a problem with the CPC printer lead. When you try to print something out extra lines (carriage returns) are generated, and so the text comes out as if it was double spaced. To solve this is easy, just cut the wire in the ribbon cable for pin 14 (see the wiring diagram for the printer interface because it doesnt follow normal ribbon cable numbering patterns). Summary Bit 7 Centronics Strobe 1: Activate strobe Bit 6 Data bit 6 Bit 5 Data bit 5 Bit 4 Data bit 4 Bit 3 Data bit 3 Bit 2 Data bit 2 Bit 1 Data bit 1 Bit 0 Data bit 0 Programming examples a) Checking the printer is on-line, LD B,&F5 ;8255 PPI Port B .not_on_line IN A,(C) ;get byte from port and %01000000 ;isolate bit indicating printer ;on-line status jp z,not_on_line RET b) Sending a byte to the printer, LD B,&EF ;Printer data port AND %01111111 ;make sure bit 7 is set to 0. OUT (C),A ;send byte to printer ;low part of diagram OR %10000000 ;make sure bit 7 is set to 1. ;(Activate strobe). OUT (C),A ;send byte ;peak of diagram AND %01111111 ;make sure bit 7 is 0. OUT (C),A ;send byte again ;low part of diagram RET ;and end