BECAUSE most users of the T/S1000,ZX81 are software-orientated, the hardware has been made simple in this design. The software needed to run it consequently will be large and some of it is in machine code.
The heart of the design is the 8255 programmable peripheral interface device. This chip has 24 lines of input or output, which can be defined by software. There are only sufficient to handle the 2532 EPROM. Port A is used to output the eight least significant bits and port C for the remaining address bits and control bits. Table one shows which functions port C has for each of the two types of EPROM. The design caters for the 2516 and 2432 EPROMs from Texas Instruments. The 50ms programming pulse is timed by the hardware and PC4 output must return to 0 before 50ms has gone by.
A simple program is included to enable the programming of the EPROM. The machine code routine in the first REM statement will program one memory location and read that memory location. The Basic will call the routine as required. The reason machine code is required is because the 8255 chip is placed in the I/O map of the Z-80 so that the memory map is left alone. In the T/S1000,ZX81 the PEEK and POKE commands access only the memory map. As Sinclair has not fully decoded the I/O map it was difficult finding somewhere where the 8255 was not affected by the T/S1000,ZX81.
Another reason for leaving the memory map alone is so that EPROMs can be placed above the 8K ROM. These could contain routines to improve the 8K Basic. Anyone building it is also advised to acquire a data sheet on the 8255, as the chip is very complex.
Referring to the circuit diagrams, two Nand gates have been used and three Or gates to drive the chip select pin. CS will go low only when A0, A1, A2, A3 are logic 1 and A7, IORQ are logic 0. That places the 8255 at 1FH, 3FH, 5FH, and 7FH. The other two Nand gates ensure that the 8255 and 50ms timer are re-set when power is applied.
The only difference between the 2516 and 2532 EPROMs are two pins and that is why a switch has been included. When programming the 2532, the programming voltage must be switched from 5V to 26V and back to 5V either side of the programming pulse. With the 2516 it may be left at 26V to verify the EPROM contents. The 26V regulator can be switched to 5V by the PC7 output going high, switching-on the BC108 and placing a 5V zener across the 24V zener.
The power supply is standard, using a single transformer and half-wave rectification for the 5V supply and voltage doubling for the 26V supply. It is best to make sure that the transformer you buy has two 9V windings in series aiding. The 50ms timer uses a 74123 TTL chip — only one half is being used. The diode And gate is needed as pin 20 of a 2532 needs to be low when reading (C5) and low for 50ms when programming.
The prototype is constructed on two pieces of Veroboard: the PSU on 0.15in. matrix and the main components on a piece of VQ board. It is wired with Verowire, which is ideal for a prototype, as modifications are easy to implement. The final board is somewhat cluttered because an extra chip had to be added at a later stage to help with the decoding of the CS line. The transformer is bolted to the base of the case and a cassette-type mains plug and socket on the case.




The power transistor (BD235) and voltage regulator do not need heat-sinks as they pass fairly small currents. The two boards are fixed on top of each other, with the EPROM socket emerging through a hole in the top cover of the box. The switch is mounted next to the EPROM socket.
With a REM statement on the first line of a program, the first character is at memory location 16514 decimal. The first four locations are used to hold data for the machine code program, the machine code sub-routine starting at 16518.
16514 — BYTE FOR PORT B
16515 — BYTE FOR PORT C
16516 — BYTE FOR PORT A
16517 — READ FROM PORT A — used for verification.
Within the program, register H holds the byte for Port C, and register that for port B, and register B that for port A. Register C contains the I/O location of the three ports and the Control Location. Register DE is used as a counter to pause for longer than 50ms — when following the machine code routine, it is useful to look at table one.
The timer has to last for 50ms, so an electrolytic capacitor is used. Because they have tolerances between plus 100 percent or minus 50 percent the pre-set is made very large to take account of it. If electrolytics are used, the timer should be set up on an oscilloscope. If an oscilloscope is not available, tantalum capacitors should be used instead. Alternatively, it is possible to feed the Q output temporarily to the port A input — any will do — and write a small program to measure the duration of the output pulse, time between C4 going low and Q output returning low.
The software has been tested on a 2516 EPROM and programmed a routine successfully into it. The software for a 2432 EPROM will be given in a later issue of the magazine.
Table 1
2516,2K by 8-bit
EPROM function Nothing Read Program
PC0 A8 —Standard Address Inputs
PC1 A9 —Standard Address Inputs—
PC2 A10 —Standard Address Inputs—
PC3 Not used
PC4 PD/PGM Low Low Pulsed high
PC5 Not used — — —
PC6 CS High Low High
PC7 5v/26v High High Low
2352,4K by 8-bit
EPROM function Nothing Read Program
PC0 A8 —Standard Address Inputs—
PC1 A 9 —Standard Address Inputs—
PC2 A10 —Standard Address Inputs—
PC3 A11 —Standard Address Inputs—
PC4 Pd/PGM Low Low Pulsed high
PC5 Not used High Low High
PC6 CS — — —
PC7 5v/26v High High Low


Components
- 1 × INS8255 (1C 1)
- 1 × 74132 (IC 2)
- 1 × 74LS32 (IC 3)
- 1 × 74LS00 (IC 4)
- 1 × 7805 (IC5) 5v 1A regulator
- 1 × BD235 (TR 1)
- 1 × BC108 (TR 2)
- 3 × IN 4002
- 1 × BZY88 24V Zener
- 1 × BXY88 5V Zener
- 3 × IN4148
- 2 × 470 µ-F 63V electrolytic
- 1 × 2200 µ-F 16V electrolytic
- 1 × 10 µ-F 10V electrolytic
- 1 × 1 µ-F 63V tantalum
- 3 × 0.1 µ-F Polyester
- 1 × 47K ohms Preset Resistor
- 1 × 5K6 ohms 1/2w 5% Resistor
- 1 × 4K7 ohms 1/2w 5% Resistor
- 1 × 2K7 ohms 1/2w 5% Resistor
- 1 × 2 pole change-over switch
- 1 × 40 pin DIL socket
- 1 × 24 pin zero force socket
- 1 × 9-0-9V 1 amp transformer
- 1 × case 16cm. × 10cm. × 6cm.
- Veroboard—VQ board
- Verowire
- 12in. ribbon cable—20-way
- Nuts and bolts
- Cassette-type chassis plug and free socket
- Connecting wire—single plus twin mains
- 23-way double-edge connector
- 23-way double male-male PCB
Programming program
100 PRINT "WHAT ADDRESS IN THE EPROM"
110 INPUT Y
120 REM 3 MSB NEED TO BE A LOGIC 1
130 LET Y=Y+57344
140 POKE 16514,Y-256*INT (Y/256)
150 POKE 16515,INT (Y/256)
160 PRINT "ENTER NO OFBYTES TO BE SENT"
170 INPUT A
180 DIM B(A)
190 FOR C=1 TO A
200 INPUT B(C)
210 PRINT B(C)
220 NEXT C
230 FOR C=1 TO A
240 POKE 16516,B(C)
250 LET S=USR 16518
260 IF PEEK 16516<>PEEK 16517 THEN GOTO 1000
270 LET Y=Y+1
280 POKE 16514,Y-256*INT (Y/256)
290 POKE 16515,INT (Y/256)
300 NEXT C
310 PRINT "JOB FINISHED, NO ERRORS"
320 PRINT "DO YOU REQUIRE TO PROGRAM MORE DATA IN"
330 INPUT Z$
340 IF Z$="Y" THEN GOTO 100
350 STOP
1000 PRINT "ERROR HAS OCCURRED"
1010 LET Y=Y-57344
1020 PRINT "ERROR OCCURRED AT";Y
1030 PRINT "DATA READ FROM THIS LOCATION IS ";PEEK 16517
1040 STOP


Machine code loader
1 REM AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
10 LET X=16518
20 INPUT Y
30 PRINT X,Y
40 POKE X,Y
50 LET X=X+1
60 GOTO 20
N.B. THERE SHUULD BE AT LEAST 60 A"S IN LINE 1
Machine Code Table
16514
16516
16518 14127 LDR.N r=c, N=7FH Conditions the ports as outputs
16520 LDr.N r=A, N=80
16522 237121 OUT(C),r r=A
16524 4213064 LDHL,(nn) nn=16514 Sets up H, L and B.
16527 5813264 LDA,(nn nn=16516
16530 71 LDr,r r=B;r=A
16531 1495 LDr,N r=C,N=5FH
16533 23797 OUT(C),r r=H Outputs
16535 1463 LDr,N r=C,N=3FH H to port C
16537 237105 OUT(C),r r=L L to Port B
16539 1431 LDr,N r=C,N=HFH B to Port A
16541 23765 OUT(C),r r=B
06543 1495 LDr,N r=C,N=5PH
16545 203188 Bit 7 Low Begins
programming
Cycle.
r=11
16547 203238 SETb,r Bit 4 High
r=H
16549 23797 OUT(C),r r=H
16551 203164 RESb,r Bit 4 Low Reconditions Report C does
r=H
16553 23797 OUT(C),r r=H not stop 74123 from working.
16555 1700000 LDdd,nn dd=DE,nn=00
16558 29 DECm m=E
16559 32253 JR NZ,e e=1 1 10ms delay.
16561 21 DECm m=D
16562 32250 JR NZ,e e=4
16564 14127 LDr,N r=C,N=7FH Reconditions A as 1/P.
16566 62144 LDr,N r=A,N=90 Reconditions A as I/P.
16568 237121 OUT(C),r r=A
16570 203180 RESb,r Bit 6 Low Reconditions H and
r=H
16572 1495 LDr,N r=C,N=5FH sends to Port C.
16574 23797 OUT(C),r r=11
16576 1463 LDr,N r=C,N=3FH Refills Port B.
16578 237105 OUT(C),r r=1
16580 1431 LDr,N r=C,N=1FH Read EPROM.
16582 237120 IN(C),r r=A Store result at 16517
16584 5013364 LDnn,A
16587 201 RET







