Close

Getting it working again

A project log for ZX81 hi-res graphics board G007

By Gary Keall. 256x192 pixels. Patches BASIC so you can PLOT(n,x,y) instead of USR(addr) calls.

keithKeith 09/09/2023 at 21:470 Comments

2023-09-09

For some reason, it isn't working. The 32K RAM piggy-back is working, but graphics are not.

It has been modified to take a 4K EPROM.

Quick tests:

1 LET B=11520
10 FOR A = 0 TO 8
20 PRINT PEEK A - PEEK (B+A)
30 NEXT A

 I get:

128
64
32
16
8
4
2
1

 This is what I expect, indicating the G007 ROM is present.

But looking at 8192 onward, all I see is 255 when I expect random RAM values. Okay, they might be 255 by chance but POKE 8192,55 does not change the value returned by PEEK.

I deduce that the G007 ROM is present but the 2K RAM that should be at 8192, is not.

There should be a monitor I can use. The original article said:

9996 STOP
9997 POKE 16417, 0
9998 RAND USR 32598; REM 7F56
9999 GOTO 9996

So the new entry point should be 32598 - 16384 = 16214

RAND USR 16214

crashes my system. I suspect the monitor RAM is not there either.

Tracing back the ZX81 /RAMCS signal from the 8K RAM pin 20, edge connector contact 2A, pin 11 of U5 gate D. A11 used to select G007 ROM/RAM. A11 is edge connector pad 1B. Seems fine, maybe ZX81 RAM is only present if in graphics mode, and the ROM is not letting it do that.

I notice that my board differs from the Maplin circuit again, as U6 is a NOR gate instead of an LS32 OR gate. I really ought to work out the circuit diagram for it.

2023-09-12

The ROM patch is always present when the G007 board is fitted, so the design could be simplified by having a ready-patched BASIC. As a bonus, the 256 byte patch is freed for other uses.

I noticed that the ZX80 circuit does not have the ROM chip select taken through a resistor to pad 23B, as it is on the ZX81.
This explains why my ZX80 was not accepting G007 commands. The BASIC ROM was simply not being patched.

I went to mod my modern board when I noticed it does have this feature but only if you make jumper 99. So I did.

I now find I when I type in lines of BASIC, it now crashes after pressing NEWLINE.

Clearly the BASIC ROM is now being patched, but badly! Oh well, it is a step in the right direction.

2023-09-14

I found the numerous non-connections between the ROM and RAM chip data lines were due to most of them being swapped around. And the Z80 was not fully seated in its socket. So I pressed the Z80 down and ... it still isn't working. Checked the ROM socket modified for EEPROM - found /WE floating. Tied this high. Something poorly visible on screen. Adjusted TV from white-on-black to black-on-white levels. Hurrah! it works!

I know the 32K RAM circuit works when the ZX81 /ROMCS is not connected, so I think the problems are now just down to the G007 ROM patching circuitry. My board circuit differs from the Maplin version, so I will have to reverse engineer it before proceeding.

2023-09-26

It is possible that the G007 board is not compatible with the heavily corrected 'shoulders of giants' version of ZX81 BASIC so to remove this possibility I created a reference ROM with ZX BASIC edition 3 at location 0000. It is a 32K EEPROM, so in the second half I have put the same BASIC ready-patched with G007 firmware, plus the 2K G007 ROM and a 2K monitor.

This ROM boots up to a stable cursor. I'd like to do more but the plastic film keypad broke. So the next job is to wire up my new PCB keyboard.

2023-09-27

New keyboard wired in. The new ROM now accepts new BASIC syntax like "10 CLS 2" and "20 PLOT N, X, Y" although it does return errors if you try to run it. The ZX81 RAM will not be at 2000-27FF where it is expected.

With the G007 board fitted, the video is very poor, probably due to clashes. Further work required. 

2023-09-29

More thinking. I had a glance at the ZX97 design and resolved to add any nice features from there. The ZX81 uses up to 16K RAM, and most people just use half a 32K SRAM chip. The other half is usually wasted. Most software was written for 16K RAM machines so there isn't much need for any more. However, you can enable the spare RAM at 2000-3FFF hex if you want an extra 8K RAM that isn't wiped at reset. The ZX97 design allows you to boot from ROM, jump elsewhere, then disable the ROM at 0000-1FFF hex which is then replaced by RAM. You then have a machine that you can load with any firmware you wish.

This is desirable because you won't need to use a device programmer every time you want to try something new. Also, some versions of BASIC are mostly the same with a few bytes changed, so a boot ROM can store one copy and then patch it with a few bytes instead of using switches to select one of several 8K versions. This produces a much more hackable machine, and that's what we are into.

2023-10-01

I accidentally tried it with a DRAM pack and the 32K piggyback RAM fitted, and noticed the video was much less noisy. I would have expected conflicts, but if you write to both then the data will be the same read back from both. Okay, so maybe a noisy data bus? Applying my finger to the data lines affected the video noise, reducing it somewhat.

I tried replacing the original 4K ROM, which is over 40 years old. This made no difference, and the original read back the data expected. So it is not bit rot.

Removing the piggyback RAM kludge did not help. At this point I'm getting a bit fed up, and would just like to start replacing chips until I find the culprit. 

2023-10-02

Replaced the chips with sockets today. I took a photo before fitting the sockets, in order to record the PCB tracks:

Some pads lifted and missing but none went anywhere on top.

One pad did have a track but it will be held down by the IC sockets.

I noticed one of the ceramic caps was missing. Could this have been the culprit?

Three ceramic caps is rather frugal, especially as they are marked 10n 25V. I'd normally expect 100n per pair of 74LS chips. 

I fitted a 22u capacitor on the top, as there was no low-frequency decoupling at all. I can tack surface-mount 100n caps under the board at a later date if I wish.

I plugged it between a ZX81 and a 16K DRAM pack, to check there was no fault caused by the bare PCB. Switching on produced a mess of video. I needed to tie the ROM nCS signal high. After that, it booted up much better.

I noticed there was a single unexpected "(" character (hex 10) on the screen. Sorry about the poor photo, my camera has trouble focusing on things flickering at 50 Hz.

It seemed fairly stable so I had a go typing some BASIC. Nothing reliant on the G007 graphics hardware that is no longer there. It ran, but I would get error codes like "R/10" which I expect are the software's way of saying "I can't find the ZX81's RAM at 2000 hex". 

I can get round this by kludging a suitable memory decoder. 

2024-01-06

I changed the 32K RAM on the ZX81 to an 8K RAM, so that it will be aliased in the 8K BASIC ROM space when required by the G007. It starts up and reports RAMTOP is 24K, as expected. The ROM occupies the first 16K, with the first 8K being original ZX81 BASIC, and the 8K after that being blank (hex FF) to avoid any confusion with any other ROM. The ZX81 seems to work, although it sometimes crashes which I suspect may be due to me touching the underside of the keyboard with my hands and picking up RF noise.

I replaced the last chips needed in the G007 sockets. It failed to work with my ZX81 and DRAM pack. I shall have a look at my ZX81 to see if it was hacked in such a way as to prevent it working. Alas I don't have time right now so I'll shelve it until I do.

2024-01-06

Not knowing which of the boards are at fault, I ordered a second ZX81, which has not been modified by me. It cost me £53 but it will save more than the equivalent cost of my time. And I can always sell it later, when I no longer need it.

2024-01-11

New ZX81 arrives. It is issue 1, all chips socketed and the RAM is a single 1K x 8 chip. I modified the video to bypass the modulator. It needs a mains plug fitting to the PSU, which I shall do tomorrow.

2024-01-13

Plug fitted, unit dead. Thankfully just the PSU dead, I'll look at that some other time. Isolated the 7805 regulator output and added a 2.1mm socket on flexible wires. Unit works! Added my DRAM pack, it does not work. Which is good news because it means the DRAM pack is at fault and not my ZX81s. So now I have to fit a RAM chip to my G007 board.

Despite checking the signals ( /RAMCS = A14 & MREQ), still not working.

Okay, now to disable all G007 apart from the 32K RAM?

Removed the LS374, 125, 126 chips and wired D6 and D7 to ZX81 side. No joy, even with ZX81 RAM out..

Remove the LS00 driving the ZX81 ROM/RAM chip selects and the G007 ROM CS line  (U5 pin 3), and removed ZX81 RAM. No joy.

Removed all other TTL chips from G007. No joy.

Fitted ZX81 RAM. No joy.

Removed 32K RAM from G007. Works! So some kind of RAM conflict?

G007 only has ROM, U7(LS27), and U2 (LS04) now.

Restored all chips apart from the LS126 (drives D7 and D6), the LS374 (drives data bus), and the LS00 (drives memory chip selects), and it still works with ZX81 RAM and no G007 RAM. Could I have a dead RAM? A fresh RAM works in the G007 with no ZX81 RAM. I check and find I had been using a TC53512 which is a 64 kbyte mask-programmed ROM.

Hoping this was the reason it was failing, I fitted the remaining chips. Alas, not working!

Adding some decent decoupling capacitors did not help.

2024-01-20

I built a separate static RAM pack to isolate the issue. The RAM pack worked fine with both ZX81s alone, but the G007 stopped the system working so I am now sure it is the sole cause. I suspect the piggy-backed RAM is working fine, because the decoding logic is the same as the RAM pack I bought.

2024-01-23

More jiggery-pokery and still not working.

Discussions