Ql Clone build

Nagging hardware related question? Post here!
andy_edin
ROM Dongle
Posts: 8
Joined: Wed Aug 23, 2023 9:05 am
Location: Wellington, New Zealand

Ql Clone build

Post by andy_edin »

Hi,

Lurker here - finally joined the board - hello!

I'm looking at building a (rough) clone of the QL - based on the V6 HAL/V5 schematics. There is no specific reason for me to do this other than interest. It will not be a form fit replacement. I'm intending to use a RC2014 type passive backplane for the boards and possibly migrating to a 41612 connector version once it works. I'm planning on splitting the design into two boards - the first with the CPU/ROM/Base RAM/ZX8301 video and the second would have the IPA/ZX8302 peripheral sub system. For the first board, I'll change things a little and use the EPM7160/7128 ZX8301 replacement by lliont and 41464 RAM (or possibly a 128K SRAM with some TTL to handle RAS/CAS address latching from the ZX8301).

My questions really concern the ULAs/IPD. lliont's design look like it covers the 8301 very well - and provides some potential for future enhancements. It also looks like there is code available to programme a 8749 IPD (either original or Hermes versions) but I've come against a wall for the 8302. Is there any open source design available for it ? I've looked through this site - and others - but have drawn a blank so far.

For the 8302 functionality, I'm not really interested in the microdrive, serial or net connectivity at this stage. To start with, I'm simply looking for something that will support boot, handle reset system and the keyboard and interrupts. Given the reduced functionality, I'm wondering if there is a QL PS2 keyboard interface design available (i.e. from PS2 connector to CPU bus interface removing the need for the IPD/8302) - and if the interrupt/basic RTC cct could be through discrete TTL.

Any pointers in the right direction would be appreciated !

Thanks,

Andy.


User avatar
tofro
Font of All Knowledge
Posts: 2702
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Ql Clone build

Post by tofro »

Welcome, Andy! And nice you want to play around with the QL's hardware.

First things first: No, there's never been an attempt to re-make the 8302 in the QL. None of the QL re-makes actually implement the microdrive and network circuitry or the 8049 interface directly (other than the FPGA implementations in MIST and MISTer). The 8302 is probably the most quirky piece of QL hardware, and just as well one of the main sources of its limitations. In a modern implementation that doesn't focus so much on cost reduction as Sinclair did, you would probably completly do without it and make yourselves a lot happier in the long run..... You would also likely want to replace the 8049 with a more modern and capable replacement, like an AVR, for example.

What does it do:
  1. Microdrive handling. You say you want to omit this, with I think is a reasonable decision.
  2. Serial port handling. You say you want to omit this as well, if you really wanted it it would be much better (and likely, in a way more functionally sound way) implemented with a proper UART today. The IPC/8049 implementation never worked reliably to spec in the original QL.
  3. QL Networking. You also want to do without, even if this is really simple (it's mainly just a 1-bit port, all the rest is done in software).
  4. Real-time clock. The QL can easily do without this - most people today don't even bother setting it, so it could easily be left out.
  5. Keyboard. Is mainly implemented on the 8049, if you replace that one with a n AVR, for example, you could implement a PS/2 interface there (there's lots of examples out there) and feed the keyboard codes through a proper UART into the QL. The 8302 connects to the 8049 with a bit-banged serial port and two 1-bit latches - if you replace this with a proper UART connection, you'd lose a lot of QL quirkyness....
If I would do this today, I would wire in a proper UART to the CPU in a fairly standard way (if you use one that has more than one port, you could also implement proper serial ports), connect that to an AVR and rather re-write the Minerva source code in these areas (keyboard, serial, sound, joysticks) than try and replicate the QL hardware fully.


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
Pr0f
QL Wafer Drive
Posts: 1308
Joined: Thu Oct 12, 2017 9:54 am

Re: Ql Clone build

Post by Pr0f »

one thing to note regarding the ZX8302 - it does handles interrupts - and one the QL cannot do without - the vsync interrupt - it's used to drive the QL's main scheduler - so without the interrupt - the QL would simply stop doing jobs or doing anything much.

clearly you could provide such a regular heartbeat interrupt from any timer source - or from the FPGA that Leon's devised - but that still needs to be handled


User avatar
tofro
Font of All Knowledge
Posts: 2702
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Ql Clone build

Post by tofro »

Pr0f wrote: Sun Aug 27, 2023 1:38 pm one thing to note regarding the ZX8302 - it does handles interrupts - and one the QL cannot do without - the vsync interrupt - it's used to drive the QL's main scheduler - so without the interrupt - the QL would simply stop doing jobs or doing anything much.

clearly you could provide such a regular heartbeat interrupt from any timer source - or from the FPGA that Leon's devised - but that still needs to be handled
I was thinking you could use a 68901 MFP - this has (apart from an UART and other useful peripherals like an 8-bit parallel port) timers on board that could easily provide an interrupt source.


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
andy_edin
ROM Dongle
Posts: 8
Joined: Wed Aug 23, 2023 9:05 am
Location: Wellington, New Zealand

Re: Ql Clone build

Post by andy_edin »

Hi Both, Many thanks for your replies - very helpful

@tofro - thanks for the split out of the ULA functions - we're very much on the same pages here. It looks like the key function from your list is the kb interface as all the rest are 'optional' or at least not required for the system to boot. I'm looking to use the stock ROMs if possible as I want to avoid, at least initially, rewriting portions on the ROM code.

I've no problem with the AVR code for the PS2 interface - and the QL keyboard row mapping - but I'm a little stuck on translating the keyboard codes to the 68008 addresses. I'm assuming the kb row required is input via a rd of x18003 and the 8 bits are returned via x18021 - but I may have this wrong. Is there any info you can point me to one this ? It does look like the AVR can do the heavy lifting before using some TTL to present the right format to the IPD command on the bus.

@prOf - thanks for the heads up on the interrupts. Is it simply a matter of providing linking the 8301 vsync (25/50Hz?) to the relevant 68008 IPL pins - or would I need to implement the vysnc i/p and reset o/p on D3 of x18021 too ?

I guess I'm trying to find the minimal initial design for my peripheral board - and build on it with a proper UART etc in a second iteration.

Many thanks,

Andy.


User avatar
Pr0f
QL Wafer Drive
Posts: 1308
Joined: Thu Oct 12, 2017 9:54 am

Re: Ql Clone build

Post by Pr0f »

tofro wrote: Sun Aug 27, 2023 2:36 pm
Pr0f wrote: Sun Aug 27, 2023 1:38 pm one thing to note regarding the ZX8302 - it does handles interrupts - and one the QL cannot do without - the vsync interrupt - it's used to drive the QL's main scheduler - so without the interrupt - the QL would simply stop doing jobs or doing anything much.

clearly you could provide such a regular heartbeat interrupt from any timer source - or from the FPGA that Leon's devised - but that still needs to be handled
I was thinking you could use a 68901 MFP - this has (apart from an UART and other useful peripherals like an 8-bit parallel port) timers on board that could easily provide an interrupt source.
It's what I picked as a solution for my build ;-) You can then chose a time based schedule interrupt or still use vsync signal - as those 8 bit's on the 68901 are not just an 8 bit port - but a maskable set of interrupt inputs :-)


User avatar
M68008
Trump Card
Posts: 224
Joined: Sat Jan 29, 2011 1:55 am
Contact:

Re: Ql Clone build

Post by M68008 »

andy_edin wrote: Sun Aug 27, 2023 2:43 pm I'm assuming the kb row required is input via a rd of x18003 and the 8 bits are returned via x18021 - but I may have this wrong.
The keyboard is connected to the 8049 and the ZX8302 only provides a serial link to it. Unless you change the ROM to use a different communication method, you would have to implement some of the 8049 commands (see the docs for TRAP #1 D0=$11) directly on your ZX8302 replacement and receive the commands and send replies one bit at a time.


User avatar
Pr0f
QL Wafer Drive
Posts: 1308
Joined: Thu Oct 12, 2017 9:54 am

Re: Ql Clone build

Post by Pr0f »

you don't need to restrict to one bit at a time - if you rewrite the MT.IPCOM trap - you could chose 8 bit transfer for instance - which makes for a quicker interface between the QL and the IPC - assuming you still need it of course.

I think it makes some sense to have workloads running autonomously away from the main CPU.


User avatar
janbredenbeek
Super Gold Card
Posts: 633
Joined: Wed Jan 21, 2015 4:54 pm
Location: Hilversum, The Netherlands

Re: Ql Clone build

Post by janbredenbeek »

Pr0f wrote: Sun Aug 27, 2023 4:42 pm you don't need to restrict to one bit at a time - if you rewrite the MT.IPCOM trap - you could chose 8 bit transfer for instance - which makes for a quicker interface between the QL and the IPC - assuming you still need it of course.
The keyboard is read via a polled interrupt task and calls the IPC low-level interface code directly, without using MT.IPCOM. It's easy to disable this (just clear the SV.PLIST system variable) but you need to copy lots of (unvectored) ROM code with classic QDOS.

Minerva has the main keyboard routines vectored, so it's fairly easy to add your own keyboard code and have the same functionality as the QL's original keyboard (CTRL-C, CTRL-space for BREAK, etc.). See the Minerva for Q68 project on GitHub for example.


ones' complement
Over Heated PSU
Posts: 133
Joined: Tue Nov 30, 2021 1:19 am

Re: Ql Clone build

Post by ones' complement »

tofro wrote: Sun Aug 27, 2023 2:36 pmI was thinking you could use a 68901 MFP
Hmm ?


Post Reply