Toastie

Sinclair ZX81 (1981) and LEGO Interface A (1986): #9750 controlled by a Zeddy

Recommended Posts

Dear All,

motivated by Evan’s 9750 EuroBricks hacking challenge, I tried to get my beloved ZX81 (Zeddy) in touch with the LEGO Interface A (#9750). It appears as if TLG never wondered into Sinclair world; they were more on the professional IBM, Apple, Acorn, Commodore, and Philips side of things. Expensive things that is, not on the el cheapo side, where I was.

My Zeddy is an ISSUE ONE (as it is printed on the PCB, I am not exaggerating here!) machine from 1981 … Does the text above sounds familiar? Yes, I just c/p’d from my ZX Spectrum thread posted earlier. And yes, my posts in this regard may be annoying, but so are super cars. Or Cada stuff, 2++ m tall cranes, ++$600 sets – >only< to me, that is! And here is to feeling good:pir-huzzah2:!

The Zeddy is one of a kind, I can tell … its design is beyond belief – in the absolutely positive sense. Made for the masses, using incredible techniques. IBM just went ballistic with regard to parts and pieces in their original PCs and then XTs (which I am madly in love with). 8000 something German Mark in 1983. And TLG was sailing along – after three more years they introduced Technic Control, and PC’s, XT’s, Apples, and so on were the prime machines targeted for that technology – in schools that is … no way to go cheap there!

There was a nice ad in the back-then magazines (this one from the 1983 April issue of Sinclair Projects:

800x579.jpg

 

Spoiler

 

Sinclairs (ZX81, ZX Spectrum) sold for less than 400 German Mark () – which is a factor of about 20 less expensive than you had to pay for an IBM XT. But hey, mid and high school students need to learn with the real thing. There is always a viable route to legally siphon off from educational funds.

Why is a Zeddy so “cheap”? Because it is made in an incredibly smart way; there is no monitor, no floppy drive. You get: A computer that displays on a b/w TV set, loads/saves from a tape recorder (as the original IBM PC also did), and has one whopping 1kByte of RAM. Video is composed in a crazy way (1kByte RAM does not allow you to keep the screen content simply in there, oh no), and address decoding is cut down to the absolute >bare< minimum. BUT: It is a fully functioning 8bit computer. Adding some hardware to this systems seems to be nearly impossible – the 8k ROM (w/ ZX81 BASIC) is “shadowing” all over the place, as is the 1k internal memory. Attaching a 16kRAM pack cleans addresses up a bit – but only a bit, as its address decoding hardware is shadowing in 16k increments … BUT: Sinclair gave us ROMCS# and RAMCS# (“#” = active low). Which means, it is up to >you< to get rid of all the unresolved addresses causing shadowing: Pull RAMCS# to +5V = internal RAM dead, same for ROMCS# for the built-in ROM). And this makes absolutely sense: The moment you add one more address decoding TTL chip to the computers PCB, at least 16 new tracks have to be routed. It is not only the chip, but mostly the size of the PCB driving the production costs. But again: All is good with ROMCS# and RAMCS#.

 

So, here we go again:

The Sinclair “interface” for LEGO Interface A is exactly the same as described earlier on EB for the ZX Spectrum, so there is nothing to add. The edge connector layouts of the Speccy and Zeddy are “identical” (for the Zeddy’s contact range); thus the interface for #9750 I built into the ZX Printer case along with the printer’s edge connector plug/cable are fully compatible. All that is needed is (again) CE#, RD#, and WR#; CE# is enabling reading/writing from/to the interface and includes resolving address and memory request (MREQ#). Why not I/O request (IORQ#) as for the Spectrum? Simply because standard ZX81 BASIC does not feature the OUT/IN command/function. Machine code works well using the Z80 out/in directives as well on the ZX81 of course, but I like to keep it simple; BASIC command POKE and function PEEK are my best friends. Both issue MREQ# rather than IORQ# for getting access to the data bus.

The really crazy part is the address decoding, which should be compatible with the 1kByte ZX81 base unit as well as with a Zeddy having a 16k Sinclair RAM pack attached; who knows what I will program into these sheer endless rows of empty bytes … Here’s what we are dealing with: The 8kByte ROM of the ZX81 has 13 address lines A0 to A12 (0x0000 to 0x1FFF) – so Sinclair only attaches these with no further decoding of A13, A14, and A15. In other words, the ROM also responds to addresses from 0x2000 to 0x3FFF, and so on (these additional “regions” are sometimes called “shadows”). However, for one, there is the clever Ferranti ULA, which is connected directly to the Z80 CPU using all 16 address lines, and always knows what’s going on in the system. And the ULA can control the ROM and RAM access via its RAMCS# and ROMCS# outputs. It does clean up the address mess a bit but certainly not everything, as it has other, way more important things to do. If you want to dig any further, I recommend starting here: https://www.zx81keyboardadventure.com/2023/02/zxio-interface-for-zx81-part-2.html

As my Zeddy does have a 16kByte RAM pack attached, which is located at 0x4000 to 0x7FFF, followed by ROM shadows 3 and 4, which are followed by 16k RAM shadow 1, all 64k addresses are in use. Furthermore, the 16kByte RAM pack does not have a RAMCS# input. I did not want to open it (again that is, needed to do it a couple of years ago to replace two 4116 memory chips); I was thus left with cleaning out ROM shadows and use corresponding addresses to read from/write to the ZX Printer interface which in turn talks to #9750. This approach has been frequently used back in the days as well of course; see for example this article also referenced in the above zx81keyboardadventure blog thread on page-1.

And without further ado, here is my approach to a) free up addresses 0x2000 to 0x3FFF (the first ROM shadow) and establish 8 (memory mapped) I/O ports for – well – controlling 8 #9750 interfaces:

1280x724.jpg

As I am going cheap here, in the tradition of Sinclair Research Ltd.:pir-huzzah2:, I am using only 2 TTL chips from the 1980’s (this an essential is part of @evank 's challenge!), to get 8 I/O ports (and not only one, as described in the ETI article referenced above) at the addresses 0x2000 to 0x2007, when address lines A0, A1, A2 are actually connected to the 3 channel select inputs of the 74LS138 de-multiplexer. OK, in principle only; currently I have hard-wired only one I/O port at 0x2000 (8192 dec), as all three channel select inputs of 74LS138 are connected to ground (L), which always resolves to output Y0#. Only when this chip is enabled though, otherwise Y0# is H. Taking advantage of the 3 enable inputs (FE1 needs to be H AND FE2A# needs to be L AND FE2B# needs to be L) allows appropriate address decoding when the de-multiplexed A, B, C input information (3 bits = 8 combinations = 8 I/O ports) is used to select an Y# output port. In the above configuration, A15 AND A14 AND MREQ# need to be L AND A13 needs to be H (= CPU memory access to address 0x2000), and as A-C are L = 0, Y0# then goes L. This is exactly the same approach I used for the ZX Spectrum – in other words, I can use the exact same interface described before built into the ZX Printer case. This is also in the tradition of Sinclair Research, of course; the ZX Printer works on both the ZX81 and the ZX Spectrum. Now the ROM shadow needs to get kicked out; this is done by inverting Y0#, and use one additional npn transistor as “tristate” driver: When Y0# = L, the output of IC2c is H and the transistor pulls the ROMCS# line high (ROM = not responding), when Y0# = H, the output of IC2c is L and the transistor is in “high impedance” state and the ULA can do whatever it wishes to do on the ROMCS# line. The only thing left is to route the Y0# (CE#), RD#, and WR# lines to the interface as well, as was also done for the Spectrum.

And now we can add the good’ol Zeddy (Grrrrrr …) to the list of 8 bit machines operating the LEGO Interface A. At >very< low cost:

800x529.jpg640x407.jpg

Left: The Zeddy - a full-blown 8bit computer! The tape is for insulation. Soldered extra wires are for connecting to the "interface" shown on the right. This is the circuit enclosed in blue in the above schematic.

640x431.jpg640x342.jpg

Left: "Interface" mounted to the PCB. Right: Focus on the 16kByte RAM pack (me and photography, this was on purpose, of course) and the ZX Printer interface connecting to #9750.

1280x1962.jpg

 The Sinclair workspace - here, the Zeddy illuminates the 4.5V light bricks: POKE 8192,63 does it ...

400x148.jpg

This is the program playing the lights as shown in this video: https://bricksafe.com/files/Toastie/zx81/ZX81 8750.mp4

All the best,
Thorsten

Edited by Toastie

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.