ZX ROMKEY - wilf rigter

 

A simple ZX/PC project

 

This is my "reductio ad absurdum" ZX81 hardware project and I have just

about eliminated all components with a surprising result: it does more!

It must be running on paradox power! You may recall this started out as

trip down memory lane, revisiting a 1986 6 chip joystick interface project

called ZEX. But along the way I lost 5 chips (good riddance) and in the

process got the ultimate PC to ZX81 interface. This little treasure

allows you to use your PC keyboard as a transparent substitute for the

old ZX81 membrane. You can reset the ZX81 with a PC keystroke.

You can send a batch file to load a communication (or any other) program

to the ZX81 and run the program to upload or download programs or data

at high speed all without touching the ZX81 keyboard.

How's that for a controller application? Add a battery to the ZX81 and

when the PC is shut down, the ZX81 continues to run your security or data

logging system. The hardware couldn't be simpler than this: just 1 chip,

3 diodes and a some resistors. I have the ROMKEY circuit working on a

PROTO board and a single sided PCB is in the works.

 

THE ZX ROMKEY CIRCUIT

 

ZX81 PCB REAR ZX ROM KEY PC PRINTER PORT

EDGE CONNECTOR 27C256 DB 25

______________ _________

| | | pin name|

D0 ---------------11| D0 A8 |25-----| O2 D0 |

D1 ---------------12| D1 A9 |24-----| O3 D1 |

D2 ---------------13| D2 A10 |21-----| O4 D2 |

D3 ---------------15| D3 A11 |23-----| O5 D3 |

D4 ---------------16| D4 A12 |2------| O6 D4 |

A8 ---------------10| A0 A13 |26-----| O7 D5 |

A9 ----------------9| A1 A14 |27-----| O8 D6 |

A10 ----------------8| A2 OE |22-----| O1 STB |-+-[10K]-- +5V

A11 ----------------7| A3 D5 |17-----| 10 ACK |-+--||---- GND

A12 ----------------6| A4 D6 |18-----| 11 RDY |-+--||---- GND

A13 ----------------5| A5 D7 |19-----| 12 INI |-+--||---- GND

A14 ----------------4| A6 | ___ | 24 GND | | 0.01

A15 ----------------3| A7 | | _| 14 ALF | |

A0 ______|\|______20| CE | | | |_________| |

|/| | |______________| | | |

| | | [100k]

IORQ _____|\|_____| 1N918A | | |

|/| | | | +5V

| | |

RD _____|\|_____| | |

| |/| | | |

| | | |

[10K] [10K] | |

| | | |

+5V | | |

0V _____________|____________________| |

RST _____________________________________|

 

HOW ZX ROMKEY WORKS

 

SCANNING THE KEYBOARD

 

I won't go over old ground in detail here: suffice it to say that the

ROMKEY EPROM converts ASCII from the PC parallel port to ZX81 scan codes.

The PC LPT data register feeds data to D0-6 and the LPT control register

STB bit supplies the OE signal to enable the EPROM D0-D4 on the ZX81 data

bus. The ZX81 supplies the normal keyboard row scanning via the A8-A15

lines and enables the EPROM CE at the normal keyboard I/O address (FE).

The whole communication process described below is booted with a simple

keyboard batch file ie. what you could normally type in from the keyboard

but which is performed by the PC as a batch file of keyboard codes.

Needless to say the keyboard boot loads slowly (about 10 characters/s)

since it has to be de-bounced by the key scanning software but once the 100

or so characters are loaded it runs a much faster loader which in turn

loads the communication program above RAMTOP.

Can you guess the first 2 characters of the boot-strap routine?

If you said FAST N/L you win the prize! This is just like the old days

when the boot software had to be the simplest little program since it had

to be manually typed in (did someone say loaded from front panel toggle

switches). So now you get to use the PC to do all the typing for you but

because the keyboard has a slow data rate the sooner you can use a more

direct method to load data, the better.

 

RESETTING THE ZX

 

The ZX81 RESET line can be asserted with the ALF bit in the LPT

control register allowing the PC to take full control of the ZX81.

 

LOADING DATA FROM PC TO ZX

 

The same keyboard interface can also be used as a high speed

communication channel to load hex data from the PC printer port at up to

20Kbytes/s. The data path from the PC to the ZX81 is 4 bits plus one

control bit. This makes it possible to load programs and data in a few

seconds. The data is transferred from the PC to the ZX81 using hex format

plus a control bit. The data is read as a single row of data using the unique

row address on A8-A15 of FF together with PC ASCII codes 00 - 1F which are

read on the ZX81 data bus D0-D4. Codes 00-0F are hex data codes signified

by the MS bit low. I propose to reserve the following control codes:

(all have the MS bit high but at least one other bit low) - Code 1E is the

clock code, 1D is the start code , 1B is the stop code and 17 is the address

code. Code 1F is the NULL or inter character code with all bits high.

This leaves 10 other unique control codes that can be used for other

applications.

 

SAVING DATA FROM ZX TO PC

 

The unused EPROM data bits (D5-D7) have been programmed to

allow transfer of data from the ZX81 to the PC via the LPT status

register. The data path from the ZX to the PC it is 2 bits plus a

control bit. This means that only 4 control codes (code 4-7 including

NULL code 7)) are available and the 2 bit data path (code 0-3) will

of course limit the data transfer bandwidth. Moreover, in order to

stretch the data output duration, the outputs are equipped with .01

capacitors and 100K pull-up resistors. This means that the 2 bit data is

available and must be read within 500 usec ( no problem for a XT and up

computer) and that the maximum practical data rate is about 100 bytes/s.

The remarkable fact remains that you can send data to the PC by READING

ZX81 I/O address FE with 7 unique scan codes (00-07) on A8-A15, which enables

data 0-7 on the D5-D7 lines connected to the LPT status bits.

 

FUTURE PLANS

 

Well there it is in a nutshell: The simplest of ZX81 hardware projects and

yet ... perhaps the most talented of my ZX81 peripherals. I am sure there is

some more hidden potential there and a better definition of control codes

and data transfer protocol is required (on this subject I could really use some

input before further development). I am not altogether happy with the

capacitor solution to stretching the ZX > PC data but I am loath to add

more hardware. However there must be an optimum level of simplicity and a

3 bit latch on the EPROM D5-D7 lines providing a 5 Kbyte/s ZX > PC data

transfer rates may be the solution. But I will leave that to a future article.

 

2005 Update Still not fully implemented but here are the ROMKEY files:

 

ROMKEY.ZIP

 

enjoy

 

wilf

 

www.000webhost.com