Our microcomputer move data to and from peripheral devices in eight-bit bytes. There are two methods of moving a byte from one location to another. We can send all eight bit at once, or we can send one bit at a time. The one-bit-at-a-time approach is called serial data transmission, and the all-at-once approach is called parallel data transmission. Plotters and printers usually operate with parallel interfaces (usually CENTRONICS protocol).
This project consist of two external ports: Centronics, and a parallel interface.
The parallel interface consist of eight imput signal lines and eight output (latched) signal lines.
The Centronics interface consist of ten signal lines and ground Of the active lines (non-ground), eight are for data, one is strobe line, which indicates to the receiving device that it should take the data present on the data lines, one is BUSY signal, which goes high (usually) to indicate that the receiving device is busy, and not to transmit any more data until it goes low.
Some printers may have additional signals such as “PAPER END”, “SELECT”, “I-PRIME”, “FAULT”, “+ 5 Volts”, etc.
What software is needed?
The programs described here can be adapted and expanded in a number of ways.
Program “TEST”: can be used to test parallel I/O port. You must adapted this principle to your need.
Printer Program: The TS1000 uses its own special character code so in the program SINCLAIR code are translated to ASCII code before output.
ASCII encoded data (used to driver printer) requires seven bits, so the eight bit may be ignored or used for other purposes.
The routine is relocatable.
Minor changes may be needed for some printers. For example, an active low READY signal requires that the jump at 16669 must be changed from JR Z to JR NZ.
The addresses used by this interface is MAPPED I/O F3, but can be easily changed to FB (used by TS2040 printer) if you make an omission of inverter IC in line A3 and you must change 243 by 251 in ML at address 16647 and 16666.
PROGRAM “TEST”
16514 219 IN A, N 16522 136
16515 243 16523 64
16516 6 LD B,N 16524 211 OUT N,A
16517 0 16525 243
16518 79 LD C, A 16526 1 LD BC,NN
16519 201 RET 16527 0
16520 0 DATA 16528 0
16521 58 LD A, (NN) 16529 201 RET
1 REM ..(16 bytes)..
5 REM OUTPUT
10 IMPUT B
20 POKE 16520,B
30 RAND USR 16521
35 STOP
40 REM IMPUT
50 LET F=USR 16514
60 PRINT F

PRINTER PROGRAM
1 REM ...(159 BYTES)...
10 INPUT A$
20 FOR X=1 TO LEN A$
30 IF CODE A$(X)<=10 THEN GOTO
80
40 POKE 16664,CODE A$(X)
50 RAND USR 16665
60 NEXT X
70 GOTO 10
80 POKE 16642,CODE A$(X)
90 RAND USR 16643
100 GOTO 60


CONTROL CODES (ASCII)

SI = shift in
SO = shift out
DC4 = device control 4
CR = carriage return
LF = line feed
BS = backspace
DLE = data link escape
ESC = escape
NUL = null / tape feed
FS = file separator
When you need for your printer some control codes, “Printer Program” will solve this problem for you. In fact, Sinclair graphics characters aren’t included in the program printable character set and some are interpred by the printer as special control characters
You will include some control character into string A$ as part of text, and the printer (that not print those) consider those characters as control codes and respond accordingly.
ENDING
This program is only a starting-point for a more elaborated for your TS1000, with LIST, COPY, GRAPHIC, etc. capability.
73’s Guillermo (LU8MAD)
Corrections
[Correction printed in QZX December 1988 (v7n1), page 7; the article is referred to there as the November 1988 issue:]
There are two errors in the schematic. The IC in the upper right corner is a 74LS123 (not a 74LS132). Also the pin of that IC between pins 11 and 4 is pin 16. In the short BASIC program which accompanied the article line 30, 80, 90, and 100 should be deleted.