My struggles with compilers...

Anything QL Software or Programming Related.
User avatar
Dave
SandySuperQDave
Posts: 2765
Joined: Sat Jan 22, 2011 6:52 am
Location: Austin, TX
Contact:

My struggles with compilers...

Post by Dave »

You may all recall that a little over a year ago I was all "yeah, I'm gonna write a couple of GAMES! They'll be AWESOME!" and so on?

Well, I got a good way into it, but I got really stuck, especially because I just ran out of time on an unexpanded QL. By that, I mean the game updated with a tick each second, and if the calculations took longer than around 1/2 a second, it would skip the redraw and keep doing the math (this was an Air Traffic Control simulator).

I asked here and was pointed to a couple of available compilers I could use. It was a real struggle because, in my very very humble opinion, the documentation for them both absolutely, utterly sucked.

How could I say such a mean thing?

If you sell, or in this day and age give away, a programming tool, you have to look at your average user. Back in the 90s, only a hardcore programmer who knew everything about squeezing the last drop of performance out of a QL would use such a thing. The instructions would be terse, and assume you knew a lot. Nowadays, the average person taking up a compiler will be quite different, and a little more hand-holding would be required.

So, does anyone out there have the time and patience to do a little handholding to help me adapt my (really awful) programming style to use a compiler? Please? :)


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

Re: My struggles with compilers...

Post by tofro »

Dave,
just go ahead. I'd think I should be able to help you.

(And maybe it would help others as well)

Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
Dave
SandySuperQDave
Posts: 2765
Joined: Sat Jan 22, 2011 6:52 am
Location: Austin, TX
Contact:

Re: My struggles with compilers...

Post by Dave »

Ok :)

To lay out my stall: I will be using a BBQL with a SGC and floppy, and Qemulator on a 4 Core i7 with USB floppy, and want to use the same toolchain on both.

I want to publish/distribute the things I write for free.

I haven't used any of the QL WIMP systems since the 80s - I have no clue how to write for those so my approach has always been to write general code for a base QL.

Which compiler do you recommend? :)


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

Re: My struggles with compilers...

Post by tofro »

Dave,
first of all, you would probably want to read this:
http://www.rwapadventures.com/ql_wiki/i ... =en&id=166

I couldn't explain it much better than Dilwyn has done.

Supercharge is out of the question - There's no reason except true retro devotedness to still use it these days. It just combines the downsides of the other two and adds quirky copy protection

That leaves us with QLiberator and Turbo (I have and have worked with both of them).

QLib is very close to real SuperBasic (That is, it will be able to compile even very weird programs), but produces between 100 and 30% slower code compared to Turbo. It still costs some money and might be not that easy to obtain. It is able to work on an unexpanded QL, although with some difficulties. QLib is no longer sold or maintained, Liberation Software has long gone out of business.

Turbo is by far the fastest (Basic) compiler for the QL (Both measured in time needed to compile and execution speed of the resulting programs). In today's form it's free software, and it's its the only compiler still actively maintained (thanks to George Gwilt). Turbo was (when still sold) always somewhat boastfully advertised as "educating you to write correct programs" - Which is partially true, although you can write perfectly wrong programs with it..... Writing "good" code (whatever that might be and to what extent) will make it easier to compile it.
The WIMP argument (not able to compile QPTR or EasyPtr programs - even if it doesn't apply to you) is no longer . Turbo today is perfectly able to do that.

The downside is: to my knowledge (but I stand to be corrected), it will not really run on a machine without at least some RAM extension, although the executables produced will.

Both compilers need a runtime module (of similar size), so there's not much difference here as well
Both compilers produce executable, self-contained files

Some things need to be listed that only QLib can do (some of them rather esoteric):
- Running single Procedures as separate background tasks in parallel to the main program
- Procedures and functions taking variable types at runtime (for example a single sorting procedure that can sort integers, characters, strings and floating point numbers) with the same code

Yes, Turbo would be my tool of choice. (And actually is ;) - as I said, I have both and mostly use Turbo, never missed any of the QLiberator features)

Hope this helps,
Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
Dave
SandySuperQDave
Posts: 2765
Joined: Sat Jan 22, 2011 6:52 am
Location: Austin, TX
Contact:

Re: My struggles with compilers...

Post by Dave »

I bought this compiler, used, but it had none of these manuals with it when I got it. I'm downloading the manuals now. It seems the version numbers have increased a LOT since then, too. :)


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

Re: My struggles with compilers...

Post by Derek_Stewart »

Hi,

There is only one compiler to use... Turbo, the reason is that George Gwilt is still supporting it and it is free.

George has even made Turbo compile Qptr programmes.

Derek


Regards,

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

Re: My struggles with compilers...

Post by tofro »

Dave wrote:I bought this compiler, used, but it had none of these manuals with it when I got it. I'm downloading the manuals now. It seems the version numbers have increased a LOT since then, too. :)
Dave,
not sure what version you have, then - Make sure you're downloading the current version of the compiler as well - There is constant improvement that you want to benefit from.

Regards,
Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
Dave
SandySuperQDave
Posts: 2765
Joined: Sat Jan 22, 2011 6:52 am
Location: Austin, TX
Contact:

Re: My struggles with compilers...

Post by Dave »

I have started reading the manual, which was last updated in 2005. I do believe that given the range of emulators, the oft-repeated advice on 'installation' without losing the binary headers would be handy so us spoon-fed types didn't have to use the search function ;)


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

Re: My struggles with compilers...

Post by M68008 »

+1 for Turbo, excellent compiler, you'll be amazed at how much faster your SuperBASIC code runs once compiled, especially after minor tweaks like adding IMPLICIT% statements.

To use with Q-emuLator, mount the .zip files directly as a disk and either run from there or copy to another location from the emulated QL... any messing with executable headers will be taken care of transparently for you when/if needed.


User avatar
Dave
SandySuperQDave
Posts: 2765
Joined: Sat Jan 22, 2011 6:52 am
Location: Austin, TX
Contact:

Re: My struggles with compilers...

Post by Dave »

Which is really handy, because then I can transfer it to floppy, and from there onto a QL I'm using for testing :)

So far I have read a bit of the manual and I have more questions than answers. I will save my questions until I have finished the manual.


Post Reply