joijoijoij

poijkopijoi

Pictures of the breadboard and PCB proto

 

 

I have blogged in the past. Here's an archive mirror of my old site:

 

http://www.russelldavis.org/CamputersLynx/PALE/

But I have been told I don't blog enough.

In part this is now due to medical issues (so please excuse any small typos herein) but mostly it's due to me being pretty introverted (apart from the circus persona). Maybe also I just don't report on 'almost there' projects, of which like many engineers I have nnnn or so (where nnnn is base-16).

I will try harder. 

 

Here is a blog about olde Camputers Lynx Z80 interfacing to a modern ESP32 microcontroller.

 

oh, btw I'm not known for waffle.

 

So to start, the Camputers Lynx from 1982- is a Z80 based UK micro with a range of addons icluding a 1793 based disk drive.

 

Camputers Lynx 128 from 1983

 

The floppy disk controller comes in two parts - an EPROM expansion box and the green FDC board which usually lives in the first drive of the system. Here it is hooked up to an HxC floppy emulation device.

 

The original Camputers disk drives for the machine

 

 

I programmed an emulator for this system back in 2004 including the FDC 1793 disk controller.

 

It's called PALE, you can get it from Russ's site:

http://www.russelldavis.org/CamputersLynx/PALE/

 

The sourcecode for PALE (on many platforms) is here along with some other ZX Spectrum related code.

https://github.com/retrogubbins

 

At the time I had a debug version just using a big array disk[200kBytes] in RAM for a disk.

So recently I thought maybe I can run this code to emulate the Lynx disk chain using an ESP32. Plus all the other things the ESP brings to the banquet.

The Lynx (Z80) bus is presented as the expansion bus as a 40-way connector. The address bus is multiplexed down to 8 bits in a particularly convoluted fashion... which I won't bore you with.

 

So I need to emulate a range of ports from 0x50-0x58 which are the original Lynx FDC port addresses.

 

 

The internal FDC emulation brought over from the PALE emulator emulates these commands:

 

I will not emulate the disk ROM itself at present though I have tried this and it seems workable within the refresh constraints.

But as is usual in these projects I need ns timing where us is the norm (unless you are into Parallax Propeller or Pi Pico more later...)

So. How to link up an 80's micro with the (relatively slow) ESP32.

Here's the plan of action...

Don't try catching IOREQ drop, instead use the original LS TTL hardware (there's a reason for this later to do with the HH Tiger.. stay tuned).

From this decode we can apply /WAIT and then take as much time on the ESP side as we like (subject to dynamic refresh requirements..  !)

 

1. For Z80 port writes

a) the esp seems able to keep up with this without WAIT

b) but I use it anyway and clear it after I read the Z80 bus with the ESP input pins

 

2. For Z80 port reads

Use a trick I saw somewhere with BUSREQ (on the EEVBlog forums).

a) drop WAIT on addressed IO space

b) service IO request (including decoding of the 16 ports in the 0x5x address space)

c) enable output latches to send data to the Z80 (and change direction of ESP32 data pins to output)

d) drop BUSREQ

e) clear the WAIT condition - but Z80 runs into the BUSREQ so stays in the current instruction)

f) re-arrange the ESP32 data bus pine as inputs

g) stop the output buffers on the ESP32

h) clear BUSREQ

 *in the actual code I abuse a lot of the order due to time constraints and hardcoded delays.

 

 With Byte-banging from the ESP32 side this yields a robust 66kBps ESP->Z80 transfer rate. Or YNXVADERS (3kB) loaded in around 1/10th of a second versus ?a minute over tape. It peaks at near 200kBps for known txfers.

 Here's the big-mess-of-wires on the bench:

 

 In the next post - Schemas and Code...

 http://www.retrogubbins.co.uk/2-uncategorised/5-thegolem

 

 

 

 

 

 

 

 

This is a continuation of my blog on design of a Camputers Lynx Z80 <-> ESP32 interface

 

You might want to start reading here first:

 http://www.retrogubbins.co.uk/2-uncategorised/4-blogging

 

 

The short version:

 

Code is here:

https://github.com/retrogubbins/thegolem

 

Schematic is:

 

 The Long version:

 

At the top the lynx data bus is buffered by a bidirectional 245 , it's direction based on /RD

The next bit down is an (from the Z80's perspective) output port /58 used by the Lynx to control  few extras on the FDC. This includes switching in and out the disk ROM overlay into the Lynx memory map. Bit 4 of /58 controls whether the ROM is enabled or not. I don't use this circuit any longer. The port is now emulated within the ESP with the rest.

Central to the schematic is the decode of 16 ports in the range 0x5x using a 139 and some OR gates. /IOREQ will drop and enable the 139.  Bits 4 & 6 of the address bus must be High, Bit 5 must be Low (and is ORed in after the 139). The last OR gate I do not use now as it is not required to decode the A3 line on the hardware side.

The output (active LOW) of the decode circuit is then inverted to give a rising edge clock into the WAIT flip-flop.

This part of the circuit immediately drops the Z80 /WAIT line through an open collector stage (LS09).

/RESET is brought in so that on reset the FF is cleared properly. 

A signal /CLEARWAIT comes from the ESP32 to clear the wait condition.

 

Voltage translation is (not) done by using 1K resistors and the forebearance of the ESP inputs until I get some new parts in.

 

The Code:

 

The code is as tight as I could get it, I'm sure sprite_tm and BitLuni could show me a few gotchas / ways of speeding it up.

I'm waiting on a new ESP32 board with PSRAM which can hold the disk buffers, then WiFi might be possible.

 

 

 And the Result:

 

LynxDOS loading the directory from the disk buffer

 

Loaded LOTR 

 

Loaded (and playing)  Football Manager by Kevin Toms

 

 

 

 

 

I created a quick and dirty spectrum emulator for the ESP32 platform. The code is my usual hack together so don't expect much, at present it allows programs to be typed in and run, no tape loading as yet.

Code is available here:

 

https://github.com/retrogubbins/pase