Compiling a SuperBasic program

Anything QL Software or Programming Related.
Post Reply
User avatar
Popopo
Gold Card
Posts: 367
Joined: Wed Apr 07, 2021 10:37 am

Compiling a SuperBasic program

Post by Popopo »

Hi all!
I am trying to write a program in SuperBasic,
Getting a lot of problems, but I hope to solve most part of them.

What I will not solve is the speed. Running it is very very very slow, by now just printing some points on the screen, reading again those positions back.
So... I guest I should compile it to get it faster.

How could I do it?
By now using QEmulator in a virtual machine. That allows me to test it from microdrive.

Thanks a lot


Maskenlos
Trump Card
Posts: 224
Joined: Sat Nov 03, 2018 12:14 pm

Re: Compiling a SuperBasic program

Post by Maskenlos »

Hi,

check out Qliberator:

https://dilwyn.theqlforum.com/qlib/index.html

There are others, but 25+ years ago this was my choice.

Stephan


User avatar
Popopo
Gold Card
Posts: 367
Joined: Wed Apr 07, 2021 10:37 am

Re: Compiling a SuperBasic program

Post by Popopo »

Maskenlos wrote: Mon Dec 30, 2024 9:37 am Hi,

check out Qliberator:

https://dilwyn.theqlforum.com/qlib/index.html

There are others, but 25+ years ago this was my choice.

Stephan
Thank you Stephan


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

Re: Compiling a SuperBasic program

Post by Derek_Stewart »

you could also look at Turbo Compiler, which gives faster compiled programs, but not as compatible as Qliberator.

Both compilers are free, so have a look at both and use the one you like.


Regards,

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

Re: Compiling a SuperBasic program

Post by tofro »

Derek_Stewart wrote: Mon Dec 30, 2024 6:38 pm you could also look at Turbo Compiler, which gives faster compiled programs, but not as compatible as Qliberator.

Both compilers are free, so have a look at both and use the one you like.
On an SMSQ/E system running SBasic, QLiberator can actually not achieve any speed increase over SBasic, which does some sort of "just-in-time compilation" (did it before that was even a thing) - The only "advantage" here is obfuscating the program which is, given the decompiler we have now, not much of a (questionable, in the first place) achievement. Liberated programs on SuperBASIC are, however, still significantly faster on the original black box than the interpreted version - but that's more to the reason that SuperBASIC is so slow in the first place.

Turbo achieves a considerable speed increase over both SuperBASIC and SBASIC, and thanks to the changes that the late George Gwilt has made to it, will happily compile nearly any S*Basic construct except some really esoteric ones like calculated DATA items and typeless PROCedures and FuNctions.


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
Popopo
Gold Card
Posts: 367
Joined: Wed Apr 07, 2021 10:37 am

Re: Compiling a SuperBasic program

Post by Popopo »

Thanks both for your answers and extra information,

Let's say from wikipedia :
Wikipedia wrote:While SMSQ/E does not run on any unmodified QL, it runs on all of the more advanced QL compatible platforms, from the Miracle Systems (Super)GoldCard CPU plug-in cards to the Q60 motherboard.
So I am not interesting in anything that could take advantage in other QL that would be a real QL, stock preferably or with small (simple) expansions (RAM for example).

The discussion about which car is better for the run, nice and I like it. But my problem is that I have no idea how to drive it. :)
So setting up the tool-chain or whatever to make a simple BASIC program to compile and get an compiled code to run directly on my QL is the most important part.
Later about what will result in a better tool based on the context or environment will be very helpful.

I know, for expert people who already have done it, it seems very easy to prepare the system, but for newbies like me... there are too many factors that could discourage to go on.
I am just now, trying to make a tool to check out the RAM memory in the system. Later more extended for other modules (sound, keyboard, serial ports, ROM, CPU, multiplexers... ).

What I have noticed is that in basic it is terribly slow just to check out the screen RAM section. Just the first pattern FF is veeeeeery slow.
I could apply expert acknowledge (algorithm) to increase the speed of this area, but at the end... it is just a exercise to know how will be to explore 640KB or higher quantity of RAM.


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

Re: Compiling a SuperBasic program

Post by tofro »

Popopo wrote: Tue Dec 31, 2024 5:28 pm
So setting up the tool-chain or whatever to make a simple BASIC program to compile and get an compiled code to run directly on my QL is the most important part.
Later about what will result in a better tool based on the context or environment will be very helpful.
Assume you have a QL with enough memory and TK2 loaded. Further assume you have a floppy drive
  1. Load Turbo Toolkit: LRESPR flp1_turbo_tk_cde
  2. Set the default drive to the device and directory where your turbo compiler is: DEFAULT_DEVICE flp1_turbo_
  3. Load your S*BASIC Program: LOAD flp1_compileme_bas
  4. compile it: CHARGE
  5. Run it (depends on how you named it in the window before under OBJECT): EX flp1_test_task
Done.

That assumes you have downloaded Turbo Toolkit and placed it as flp1_turbo_tk_cde, then
downloaded the Turbo compiler and put the two _task files in there into flp1_Turbo_


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
Popopo
Gold Card
Posts: 367
Joined: Wed Apr 07, 2021 10:37 am

Re: Compiling a SuperBasic program

Post by Popopo »

tofro wrote: Tue Dec 31, 2024 5:50 pm
Popopo wrote: Tue Dec 31, 2024 5:28 pm
So setting up the tool-chain or whatever to make a simple BASIC program to compile and get an compiled code to run directly on my QL is the most important part.
Later about what will result in a better tool based on the context or environment will be very helpful.
Assume you have a QL with enough memory and TK2 loaded. Further assume you have a floppy drive
  1. Load Turbo Toolkit: LRESPR flp1_turbo_tk_cde
  2. Set the default drive to the device and directory where your turbo compiler is: DEFAULT_DEVICE flp1_turbo_
  3. Load your S*BASIC Program: LOAD flp1_compileme_bas
  4. compile it: CHARGE
  5. Run it (depends on how you named it in the window before under OBJECT): EX flp1_test_task
Done.

That assumes you have downloaded Turbo Toolkit and placed it as flp1_turbo_tk_cde, then
downloaded the Turbo compiler and put the two _task files in there into flp1_Turbo_
Thank you very much!
I have a stock QL that I have added expansion RAM.
But I will code and compile from an emulator. By now in a Virtual Machine with QEmulator (free version & limited).
Your steps seems to be pretty easy to follow!!!! Thank you very much. I was afraid of environment and system variables or lot of switches to set up.

I will get the tool/compiler from Dylwin's site and follow your steps as close as I can. :)


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

Re: Compiling a SuperBasic program

Post by tofro »

Popopo wrote: Tue Dec 31, 2024 5:58 pm
tofro wrote: Tue Dec 31, 2024 5:50 pm
Popopo wrote: Tue Dec 31, 2024 5:28 pm
So setting up the tool-chain or whatever to make a simple BASIC program to compile and get an compiled code to run directly on my QL is the most important part.
Later about what will result in a better tool based on the context or environment will be very helpful.
Assume you have a QL with enough memory and TK2 loaded. Further assume you have a floppy drive
  1. Load Turbo Toolkit: LRESPR flp1_turbo_tk_cde
  2. Set the default drive to the device and directory where your turbo compiler is: DEFAULT_DEVICE flp1_turbo_
  3. Load your S*BASIC Program: LOAD flp1_compileme_bas
  4. compile it: CHARGE
  5. Run it (depends on how you named it in the window before under OBJECT): EX flp1_test_task
Done.

That assumes you have downloaded Turbo Toolkit and placed it as flp1_turbo_tk_cde, then
downloaded the Turbo compiler and put the two _task files in there into flp1_Turbo_
Thank you very much!
I have a stock QL that I have added expansion RAM.
But I will code and compile from an emulator. By now in a Virtual Machine with QEmulator (free version & limited).
Your steps seems to be pretty easy to follow!!!! Thank you very much. I was afraid of environment and system variables or lot of switches to set up.

I will get the tool/compiler from Dylwin's site and follow your steps as close as I can. :)
The actually are a lot of switches and fiddly screws to mess with. But the above should get you going and we can take it from there. And you should really read the manuals, both the Toolkit and Compiler manual. They're really good and worth a read.


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
Popopo
Gold Card
Posts: 367
Joined: Wed Apr 07, 2021 10:37 am

Re: Compiling a SuperBasic program

Post by Popopo »

tofro wrote: Tue Dec 31, 2024 6:02 pm The actually are a lot of switches and fiddly screws to mess with. But the above should get you going and we can take it from there. And you should really read the manuals, both the Toolkit and Compiler manual. They're really good and worth a read.
I will.
Last night was hard to get them. Not sure why I didn't go directly to Dylwin's site and alwasy try to get fast answer from Google or ChatGPT (waste of time).
QDOS SMS Reference Manual and qlsuperbasic.

I will download the rest from Dylwin's site.
Toolkit and compiler ASAP family gives me the time.
tofro, you help is amazing! thanks one more time.


Post Reply