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. 

Discussions