QL / PASCAL

Anything QL Software or Programming Related.
User avatar
Peter
Font of All Knowledge
Posts: 2003
Joined: Sat Jan 22, 2011 8:47 am

Re: QL / PASCAL

Post by Peter »

I was surprised to see there seems to be an experimental Sinclair QL port of Free Pascal: https://wiki.freepascal.org/Sinclair_QL
Did anyone try it yet? The port was done by Karoly Balogh, is he on this forum?

I wonder if there is any chance to port one of the GUI libraries that exist around Free Pascal.


User avatar
NormanDunbar
Forum Moderator
Posts: 2276
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: QL / PASCAL

Post by NormanDunbar »

Interesting, very interesting! Something to maybe take a look at - time permitting. Thanks Peter.


Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
User avatar
Peter
Font of All Knowledge
Posts: 2003
Joined: Sat Jan 22, 2011 8:47 am

Re: QL / PASCAL

Post by Peter »

Yes I was positively shocked to read it, because new compiler support for the QL didn't appear for ages. FreePascal seems to have good 68K support.
If only primitive text based programs can be created, I will probably stick with C68 / QDOS-GCC. But any step toward GUI would make this really interesting.


User avatar
Andrew
Aurora
Posts: 795
Joined: Tue Jul 17, 2018 9:10 pm

Re: QL / PASCAL

Post by Andrew »

The QL port was implemented by Karoly Balogh during #QLvember 2020
I means it is a very recent implementation


User avatar
Peter
Font of All Knowledge
Posts: 2003
Joined: Sat Jan 22, 2011 8:47 am

Re: QL / PASCAL

Post by Peter »

Yes, it's kind of a sensation and I wonder why I didn't see any coverage here.
Karoly Balogh is under the impression that QL clones are extreme rarities - could be helpful to let him know that many active QL users have a Q68.


User avatar
Ruptor
Gold Card
Posts: 418
Joined: Fri Dec 20, 2019 2:23 pm
Location: London

Re: QL / PASCAL

Post by Ruptor »

Probably a stupid question but if programs can be written to run on a QL why would you want the compiler or libraries on the QL to run natively? You only need to test and run the compiled program on the QL don't you?


Derek_Stewart
Font of All Knowledge
Posts: 3971
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: QL / PASCAL

Post by Derek_Stewart »

Hi,

I looked at FreePascal quite ago, I thought C68 could compile it quite easily.

Was I wrong in thinking there was no interest in Pascal on the QL, since the Prospero implementation has all the QDOS Libraries already written.

Where as FreePascal can only run pure Pascal programmes.


Regards,

Derek
User avatar
Andrew
Aurora
Posts: 795
Joined: Tue Jul 17, 2018 9:10 pm

Re: QL / PASCAL

Post by Andrew »

Derek_Stewart wrote: Was I wrong in thinking there was no interest in Pascal on the QL, since the Prospero implementation has all the QDOS Libraries already written.
I am a long-time pascal/Delphi programmer and initially I wanted to use C1 Pascal, but I could not find any good code examples. So I ended up writing QL Commander in Superbasic, even if Pascal would probably have been more suitable.
Is there any difference in code speed between compile Superbasic, compiled Pascal and complile C68?


User avatar
Chain-Q
Chuggy Microdrive
Posts: 62
Joined: Mon Nov 16, 2020 1:10 pm
Location: Berlin, DE, EU
Contact:

Re: QL / PASCAL

Post by Chain-Q »

Hi there,

This is my first post in this forum. Glad to be here. So I'm Karoly Balogh (a.k.a Charlie on the demoscene, a.k.a. Chain-Q on IRC and various other forums), the maintainer of the Free Pascal m68k port, and I also wrote a big chunk of the new/resurrected m68k backend a few years back. As some of you already discovered it, inspired by #QLvember I decided to hack together a quick-and-dirty QL target for Free Pascal this month. If there's interest though, there's nothing stopping extending it further. (But for that I need contributors too.) I'm not a native English speaker (I'm Hungarian, but I live in Germany), so sorry if I make mistakes.

So a random facts about FPC, the QL port, and myself (some of it based on what I read here in the forum thread already):

* I do have a huge pile of Amiga and Atari hardware, some 68k Macs too. I also have some experience with Linux/68k and NetBSD/68k, but I'm completely new to the QL or QL clones. So I'm probably doing a lot of things wrong in the FPC port. Hence the label, experimental. I'm primarily an Amiga guy, but I venture out into other 68k systems from time to time, and even 8 bits. The technological diversity of the 80s is just too beautiful to ignore. :)
* I do not have QL hardware, so the only thing I can work with so far is the unregistered version of Q-emuLator on my MacBook (I found 40 the USD registration price a bit steep for now, until I wasn't sure I could get something working), which means I also do not really have access to expanded QL things, which probably influenced a lot of my assumptions while making the port. Hardware donations are welcomed, but not in any way expected.
* The port currently uses a simple BASIC loader, to allow direct cross-compiling. I read somewhere you need some QL native tool to to make your binary executable on the QL after cross compiling it, so I just decided to work that around for now...
* The code FPC generates is not position independent, but the QL startup code (by me) can relocate the binary after loading.
* I do not get the entire job concept of QL yet, and what are the implications of it for my code. But we'll get there eventually. Probably this is because I don't really have any user experience with the QL, so some things are just hard to relate to.
* The compiler can run on real 68k too, but it needs a ton of memory (32MB as a minimum, 128MB recommended for larger projects), and it's quite slow even of a '060/100Mhz... It works quite OK though on fast emulators like UAE though. So if there's something like that for the QL, we can talk about hosting the compiler on QDOS compatibles as well, but it's still a long journey to that point.
* Free Pascal is written in itself, and probably it's a futile endeavor to try to get it to compile with any other compiler. So a native compiler has to be cross-bootstrapped, if we ever get there. This is not difficult, we do it all the time for other 68k platforms.
* The current QL port committed to SVN trunk of Free Pascal will *not* work for anyone but me. This is because I haven't committed all the changes and features yet (see below for the whys).

Ok, so after all this bla-bla and expectation management, what can the port do currently?

I think this is best summed up by this tweet (and video):
https://twitter.com/chainq/status/1328194649052368897

Long story short, compiling executables work, calling QDOS functions work, but the interface to them is partial at best, the RTL (run-time library, Free Pascal's equivalent of a "libc") is very basic, but something is there. The binary can relocate itself after loading, allocate a new stack for itself, and most of the infrastructure to go forward is there. Anything else not mentioned here is probably not there yet.

And I have a related question too: to support QLfloats, I ripped the double_to_qlfloat function from the C68/QDOS-GCC libc implementation for now, but sadly no source archives available online states what's the license for this code. Therefore I haven't committed it to FPC SVN yet, because I'm not sure I can redistribute this or even include in the RTL. This is why the source is not possible to compile currently. The FPC RTL comes under the LGPL license, with a static linking exception to allow static linking. If it's not possible to use these functions from the libc under this license, they will have to be rewritten too.

Anyway, any comments and questions are welcomed. Sorry for the long post, I hope it was useful. Thanks for your interest in this little experiment I do. :)


User avatar
NormanDunbar
Forum Moderator
Posts: 2276
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: QL / PASCAL

Post by NormanDunbar »

If you want an up to date "QL" you could try Marcel's QPC. Check kilgus.net. It's for Windows but I run it on Linux under wine. There's no registration required or payment.

HTH

Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
Post Reply