Page 1 of 2

QL core sources

Posted: Thu Sep 17, 2020 8:59 am
by MarcelK
Two years ago I set out to improve the QL core. Despite this being my first FPGA project I got pretty far but then had some problems and eventually didn't have time anymore to finished everything I wanted to do. So I at least created a stable version and put it online a few months ago at https://www.kilgus.net/ql/mister/. Wanted to release the sources, too, but again time was a problem. This week I was asked for the sources so I did another update to incorporate @sorgelig's latest changes and pushed the result to https://github.com/MarcelKilgus/QL_MiSTer/tree/fx68k.

Changes:
  • Switched the 68k core to the fx68k CPU core, which perfectly models a 68000 (though not a 68008, so still not perfect for a QL)
  • The different bus of the fx68k allows QL-SD to run correctly with all CPU speeds
  • I implemented a “MiSTer Gold Card”. The QL had two CPU accelerator cards called "GoldCard" (68000) and "SuperGoldCard" (68020). One of them is required to boot the much improved QL operating system SMSQ/E. The "MiSTer Gold Card" I created is a mix between the two, it mimics the registers of a SuperGoldCard but with a 68000 CPU. I created a special boot ROM for this, which is integrated into the core.
  • The MiSTer Gold Card allows booting of (a special version of) the SMSQ/E operating system!
  • I implemented a special memory speed controller that emulates the memory contention of a real QL in order to try to match the original speed. Activated when CPU speed “QL” is selected. This is still not as perfect as I'd like.
  • Using the latest QL-SD drivers (also from me) the .WIN container files can be stored on the main SD and selected through the menu.
Quickstart-guide:
  • Download my core and put it on MiSTer
  • Download qlsd109_bin.zip, take "Minerva_1.98a1_qlsd109.bin" and put it as "boot.rom" into the MiSTer QL directory
  • Download qlsd_win_demo.zip and put the "QXL.WIN" file as "boot.vhd" into the QL directory
Booting should now give you a choice between booting to a QL desktop environment and a few games.

My changes are in a separate branch, but I'd be happy if they got adopted for the master MiSTer core. They have diverged quite some bit from the current master, but I tried to track the changes as well as I could.

Unfinished:
  • Implementation of the Aurora graphics card. I had problems re-configuring the pixel clock PPLs, sometimes it worked, sometimes it didn't. Meta-stability strikes again or whatever, this is where I got to the end of my limited FPGA-fu.
  • Further improvement to exact QL timings. The ROM is currently accessed 16-bit wide, which is of course much faster than in the original.
All the best, Marcel

Re: QL core sources

Posted: Thu Sep 17, 2020 10:43 am
by tontonkaloun
Hello,

Which version should I take, the one on your website or the one on your github ... ?

there is a recent version on both and they are not the same files

Re: QL core sources

Posted: Thu Sep 17, 2020 11:11 am
by MarcelK
Not sure why the RBF from January was included in the last commit. The latest version is on the website.

Re: QL core sources

Posted: Thu Sep 17, 2020 9:10 pm
by danielb
Hi Marcel,

Thanks for updating the core, which is actually a very nice stable platform for running SMSQ/E, and a very valuable contribution to the Mister.

Rgds,

Daniel

Re: QL core sources

Posted: Fri Sep 18, 2020 7:31 am
by MarcelK
Thanks Daniel.

The last-minute source code reorganizations broke my "GoldCard" code. I've uploaded a new version to my page. Also, the OS can now be changed through the OSD menu, that was something that I had already done but for some reason not committed.

Re: QL core sources

Posted: Fri Sep 18, 2020 2:53 pm
by pgimeno
Thanks for the updated core!

I'm on a quest to run the Spanish version of Psion Archive on MiSTer, but I've found several hurdles. I can run it on the original MiSTer QL core, BUT there's no option to save back the microdrives to SD, therefore there's no permanent storage and everything I do is lost. It's also very unstable and it frequently locks out while I'm doing something.

So I tried your core, which brings much more stability and permanent storage through the Winchester (win1_) devices. It works very well; however, it also breaks microdrive support: I can no longer access mdv1_ after loading a microdrive. Which means that I can't transfer the Spanish Psion Archive to HD.

Even if I can transfer it, there's still the issue of the ROM. IIUC I need to be running a Minerva ROM in order to have a working win1_ device; on the other hand, I need to be running a Spanish ROM in order to run the Spanish version of Archive, so it seems I'm on a catch-22 kind of situation.

I have some hope of being able to patch Archive to work on any ROM, but the main problem to solve at this moment is the lack of microdrive support. Are you planning on adding it?

Re: QL core sources

Posted: Fri Sep 18, 2020 3:30 pm
by danielb
Hi again,

I also noticed that the Microdrive support doesn't work. I was trying to emulate my very first QL, which had a JM ROM and microdrives, without success. It was pretty picky before too, and I could not create images that worked with it.

Anyway, would the MDI drivers help you in your quest? They allow the QL to read microdrive images, which you store on the WIN file.

The latest version (1.08)_ is here:http://www.dilwyn.me.uk/utils/index.html.

Bear in mind that the MDI drivers use their own image format, but it includes converters for the others. The one that Mister uses is called the QLAY format, after an emulator that was quite popular a long time ago.

D.

Re: QL core sources

Posted: Fri Sep 18, 2020 5:14 pm
by danielb
pgimeno wrote: Fri Sep 18, 2020 2:53 pm
Even if I can transfer it, there's still the issue of the ROM. IIUC I need to be running a Minerva ROM in order to have a working win1_ device; on the other hand, I need to be running a Spanish ROM in order to run the Spanish version of Archive, so it seems I'm on a catch-22 kind of situation.
Hi again, the win device seems to work fine with a JS ROM.

D.

Re: QL core sources

Posted: Fri Sep 18, 2020 6:16 pm
by pgimeno
danielb wrote: Fri Sep 18, 2020 5:14 pm Hi again, the win device seems to work fine with a JS ROM.
Ooooh, sweet, thanks for the heads-up! So the only thing pending is the transfer.

Re: QL core sources

Posted: Fri Sep 18, 2020 6:22 pm
by danielb
Good luck... Meanwhile, I am having an issue with the core locking up under Minerva. I haven't noticed it happening under SMSQ/E, but I haven't tried it all that much yet.

From the feel of it, I'd say it's a problem with the keyboard driver.

D.

Re: QL core sources

Posted: Fri Sep 18, 2020 6:31 pm
by danielb
pgimeno wrote: Fri Sep 18, 2020 6:16 pm
danielb wrote: Fri Sep 18, 2020 5:14 pm Hi again, the win device seems to work fine with a JS ROM.
Ooooh, sweet, thanks for the heads-up! So the only thing pending is the transfer.
One thing... you need to load Minerva first, and then switch to the JS ROM. That way, the driver appears to be retained and is usable under the JS. Maybe it's possible to create a JS ROM with the WIN driver in a single file.

I have no idea how stable this is. Presumably you'll find out...

D.

Re: QL core sources

Posted: Fri Sep 18, 2020 7:12 pm
by MarcelK
pgimeno wrote: Fri Sep 18, 2020 2:53 pmSo I tried your core, which brings much more stability and permanent storage through the Winchester (win1_) devices. It works very well; however, it also breaks microdrive support: I can no longer access mdv1_ after loading a microdrive.
OK, interesting. I haven't played with MiSTer for a long time and microdrives is not something I normally use, on real QLs and others.
Which means that I can't transfer the Spanish Psion Archive to HD.
QEmuLator can access both MDV images and WIN drivers. Or use my free QPC emulator and the mentioned MDI driver.
Even if I can transfer it, there's still the issue of the ROM. IIUC I need to be running a Minerva ROM in order to have a working win1_ device;
No, my driver works on QDOS, too. It's actually easier there, Minerva needs some nasty workarounds. I just generally don't recommend QDOS as it's just inferior. Basic program to create QL-SD enabled JS image, for example in QPC:

Code: Select all

100 rom = ALCHP(65536)
110 LBYTES "dos1_temp_js_rom",rom
120 LBYTES "dos1_temp_qlsd109_rom",rom+48*1024
130 SBYTES_O "dos1_temp_js_qlsd_109_rom", rom, 65536
140 RECHP rom 
Are you planning on adding it?
I might have a look at it, but I currently don't really have the time to do much with the core. Too many other projects (like real QL-SD hardware and QL-VGA video converter).

Cheers, Marcel

Re: QL core sources

Posted: Fri Sep 18, 2020 7:17 pm
by MarcelK
danielb wrote: Fri Sep 18, 2020 6:22 pm From the feel of it, I'd say it's a problem with the keyboard driver.
Might be the the very flimsy link between CPU and 8049 co-processor getting out of sync. But generally difficult to debug :(

Re: QL core sources

Posted: Fri Sep 18, 2020 8:44 pm
by pgimeno
danielb wrote: Fri Sep 18, 2020 6:22 pm Meanwhile, I am having an issue with the core locking up under Minerva. I haven't noticed it happening under SMSQ/E, but I haven't tried it all that much yet.

From the feel of it, I'd say it's a problem with the keyboard driver.
I've been having the same problem. At first I thought it was fixed in this core, but after trying it much more thoroughly today, it's the same issue in both.

It looks like quite often, the key release event is lost. There must be some other problem on top of that, though, as sometimes the whole keyboard locks up for a while, even if I re-press the keys that I just pressed. But even when it appears to lock up, if I keep pressing keys randomly, eventually one gets through and I can continue normally.

Re: QL core sources

Posted: Fri Sep 18, 2020 9:54 pm
by danielb
I just though I'd mention that I was able to get the Spanish Psion running rather easily in Q-Emulator.

Have you tried this?

D.

Re: QL core sources

Posted: Fri Sep 18, 2020 10:00 pm
by pgimeno
MarcelK wrote: Fri Sep 18, 2020 7:12 pm
Which means that I can't transfer the Spanish Psion Archive to HD.
QEmuLator can access both MDV images and WIN drivers. Or use my free QPC emulator and the mentioned MDI driver.
Even if I can transfer it, there's still the issue of the ROM. IIUC I need to be running a Minerva ROM in order to have a working win1_ device;
No, my driver works on QDOS, too. It's actually easier there, Minerva needs some nasty workarounds. I just generally don't recommend QDOS as it's just inferior. Basic program to create QL-SD enabled JS image, for example in QPC:

Code: Select all

100 rom = ALCHP(65536)
110 LBYTES "dos1_temp_js_rom",rom
120 LBYTES "dos1_temp_qlsd109_rom",rom+48*1024
130 SBYTES_O "dos1_temp_js_qlsd_109_rom", rom, 65536
140 RECHP rom 
Thanks! Just to be sure, isn't that just a concatenation? I can do that easily on Linux.

Oh, you're the author of QPC, I gave it a try on 2015; it runs great under Wine. I think I was unable to use QEmuLator with Wine; QLay worked though. I still have both QLay and QPC2 (4.02) installed on the Wine drive. QLay was the only means I had to run Archive, but it wasn't nearly the experience I get with MiSTer.

It turns out that the zip with the Spanish version of the Psion suite (from http://www.dilwyn.me.uk/psions/ ) already contains the separate files instead of a microdrive image; I somehow managed to place them in the microdrive image myself. I had forgotten about that.

OK, so I have the files, and now I know I can use QPC to do the transfer. Which leaves me with just one problem: how do I create a fresh, formatted .WIN image on Linux (or with Wine)? I've seen something called qxltool.zip in http://www.dilwyn.me.uk/files/index.html - is that the way to go? Edit: I found out myself. Yes, it compiles easily on Linux and I've successfully created a .WIN image. Yay!

Re: QL core sources

Posted: Fri Sep 18, 2020 10:19 pm
by danielb
Spanish Quill on Mister :)

Running the MGE ROM. I unzipped the Psion files onto my Mister WIN file using QPC2.

D.

Re: QL core sources

Posted: Fri Sep 18, 2020 10:26 pm
by MarcelK
pgimeno wrote: Fri Sep 18, 2020 10:00 pm Thanks! Just to be sure, isn't that just a concatenation? I can do that easily on Linux.
Yes, if your OS ROM is exactly 48kb long. If not, then no.
OK, so I have the files, and now I know I can use QPC to do the transfer. Which leaves me with just one problem: how do I create a fresh, formatted .WIN image on Linux (or with Wine)?
If QPC is running there's no need to bring 3rd party tools into this

Code: Select all

WIN_DRIVE 2,'c:\temp\blah.win'
WIN_FORMAT 2,1
FORMAT win2_10

Re: QL core sources

Posted: Sat Sep 19, 2020 2:40 am
by pgimeno
danielb wrote: Fri Sep 18, 2020 10:19 pm Spanish Quill on Mister :)

Running the MGE ROM. I unzipped the Psion files onto my Mister WIN file using QPC2.

D.
YES!!!! That did it. Got it running, at final last! Now I can finally save the work. Thank you so very much, danielb and MarcelK!!!! Also, apologies to MarcelK for the thread hijack.

MarcelK wrote: Fri Sep 18, 2020 10:26 pmIf QPC is running there's no need to bring 3rd party tools into this

Code: Select all

WIN_DRIVE 2,'c:\temp\blah.win'
WIN_FORMAT 2,1
FORMAT win2_10
And the third party tool didn't work correctly anyway, so when everything else fails, it's time to read the manual... which said exactly this :D :oops: (in my defence, I didn't even think at first that QPC would come with that kind of help). Thanks again!

Re: QL core sources

Posted: Sun Sep 27, 2020 8:32 pm
by MarcelK
So, I made a few more changes. For once, I fixed the MDV timings. I'm sure I had done this at one time but it somehow got lost again along the way.

Also, I reworked the internal clocks and moved the IPC co-processor to the main clock domain. My hope is that this fixes the keyboard lockups. Didn't have time to test it for long, but so far I've had no more problems.

Enjoy.

Re: QL core sources

Posted: Sun Sep 27, 2020 9:06 pm
by danielb
That's great! Thanks very much Marcel.

Looking forward to trying it,

D.

Re: QL core sources

Posted: Mon Sep 28, 2020 12:19 am
by pgimeno
MarcelK wrote: Sun Sep 27, 2020 8:32 pm So, I made a few more changes. For once, I fixed the MDV timings. I'm sure I had done this at one time but it somehow got lost again along the way.

Also, I reworked the internal clocks and moved the IPC co-processor to the main clock domain. My hope is that this fixes the keyboard lockups. Didn't have time to test it for long, but so far I've had no more problems.
Microdrive is working again, thanks a lot! The Spanish Psion suite seems to have the help file hardwired to mdv1_, so I had to choose between having a help file but losing all work (original MiSTer core) or having permanent storage but without a help file (your previous core). Now, by working on win1_ but having the help file in mdv1_, I can have both!

I only did a quick test, I will test more thoroughly in the next days, but my first impression is that the keyboard is working FAR better than before and not losing any events nor inserting any extraneous ones. Great job, thanks a lot for giving us these wonderful improvements to get the QL core to a point where it's fully functional as a replacement of the original machine!

I'll report back if I find any issues with the keyboard, but I'm quite excited by the results so far. Pressing simultaneous keys quickly used to cause issues very frequently, and for now I haven't gotten any with this core.

Update: After several hours of working with this core, I had no single problem. I think the keyboard issue can be considered fixed for good. Thanks again!

Re: QL core sources

Posted: Mon Sep 28, 2020 8:29 am
by danielb
Hi Marcel,

Thanks again for your work on this core.

The keyboard problems do appear to have been solved - I have not seen the core lock up since I started using it.

As for the Microdrives, they do work. However, I am having a hard time understanding which images work with it.

For example, these work: http://web.inter.nl.net/hcc/A.Jaw.Venema/psion.zip, but, as far as I can see, these don't: http://www.dilwyn.me.uk/vdrive/index.html, even though they are all (AFAIK) images of 174930 bytes in the QLAY format. This is not unique to your core - the "official" core displays the same symptoms. I tried some of them in QEmulator and they worked fine.

Do you happen to know why this is?

Thanks,

Daniel

Re: QL core sources

Posted: Mon Sep 28, 2020 9:59 am
by desin24
there are two microdrive .img formats and the Vdrive format

the QL cores for the Mist(er) uses the QLAY format

how to : https://www.atari-forum.com/viewtopic.p ... 69#p351069

Greetings
Markus

Re: QL core sources

Posted: Mon Sep 28, 2020 12:28 pm
by danielb
Thanks very much, that worked :)

I was under the impression that the vDrive uses the QLAY format.

Rgds,

Daniel

Re: QL core sources

Posted: Mon Sep 28, 2020 2:30 pm
by danielb
One final question (I promise...) - are the Microdrive images mounted read only?

D.

Re: QL core sources

Posted: Mon Sep 28, 2020 8:03 pm
by MarcelK
Yes, MDV images are loaded into memory and then repeatedly played back in an endless loop. There is no mechanism to save changes back to the image.

Re: QL core sources

Posted: Tue Sep 29, 2020 8:07 am
by danielb
Thanks,

D.

Re: QL core sources

Posted: Tue Sep 29, 2020 8:53 am
by pgimeno
MarcelK wrote: Mon Sep 28, 2020 8:03 pm Yes, MDV images are loaded into memory and then repeatedly played back in an endless loop. There is no mechanism to save changes back to the image.
Besides that, I've noticed that it doesn't seem to give an error (as I would expect if it was write protected) but it also doesn't seem to be recording anything to the in-memory image. The directory shows the file for as long as it's cached, but the contents are not there, and if the directory is reloaded, the file is missing.

This is not new; the original core behaved the same way. It's not a big deal because it still doesn't allow writing the image back to SD anyway; I'm just concerned that it may cause problems with software that assumes that it can write something to microdrive and read it back. I haven't run into any such program myself.

Re: QL core sources

Posted: Tue Sep 29, 2020 9:24 am
by MarcelK
pgimeno wrote: Tue Sep 29, 2020 8:53 amBesides that, I've noticed that it doesn't seem to give an error (as I would expect if it was write protected) but it also doesn't seem to be recording anything to the in-memory image. The directory shows the file for as long as it's cached, but the contents are not there, and if the directory is reloaded, the file is missing.
I think this behaviour is actually the same as with a write protected real Microdrive. Write protection is done in hardware, there is no way for the software to tell if a drive is protected or not.