Coding SuperBasic
Coding SuperBasic
Hello all,
The QL's operating system includes the SuperBasic interpreter. But is it possible to write a program to one or more text files and then use a compiler to build an executable ?
Thanks,
Regards
The QL's operating system includes the SuperBasic interpreter. But is it possible to write a program to one or more text files and then use a compiler to build an executable ?
Thanks,
Regards
- NormanDunbar
- Forum Moderator
- Posts: 2285
- Joined: Tue Dec 14, 2010 9:04 am
- Location: Leeds, West Yorkshire, UK
- Contact:
Re: Coding SuperBasic
You can, as already mentioned above, write your code in the interpreter and compile it, after testing, with QLiberator or Turbo. That's probably the standard method.
However, you can use SSB (Structured SuperBasic) which allows you to write your code in an editor, without line numbers, then generate an actual SuperBASIC file with line numbers ready to test and then compile.
SSB is a fantatic utility.
I run Linux and I have QPC2 as my QL emulator. I code in VSCode in Linux, then execure SSB in the emulator. That reads the _ssb source and generates a _bas file in the same (Linux) location. That can then be loaded into the interpreter and tested.
If ypu read the thread on SSB (link below) there is a link to a version I created to fix a buglet and to make a couple of changes to generste code thd wsy I like it. Controlled by environment variables of course!
HTH
There's a good thread on SSB, where to get it etc at viewtopic.php?t=4207.
Cheers,
Norm.
However, you can use SSB (Structured SuperBasic) which allows you to write your code in an editor, without line numbers, then generate an actual SuperBASIC file with line numbers ready to test and then compile.
SSB is a fantatic utility.
I run Linux and I have QPC2 as my QL emulator. I code in VSCode in Linux, then execure SSB in the emulator. That reads the _ssb source and generates a _bas file in the same (Linux) location. That can then be loaded into the interpreter and tested.
If ypu read the thread on SSB (link below) there is a link to a version I created to fix a buglet and to make a couple of changes to generste code thd wsy I like it. Controlled by environment variables of course!
HTH
There's a good thread on SSB, where to get it etc at viewtopic.php?t=4207.
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.
Author of Arduino Software Internals
Author of Arduino Interrupts
No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
Re: Coding SuperBasic
My main problem is the line numbers. I usually program away at the interpreter in these old computers (also in the ZX Spectrum).
Because I don't do any planning of the program before, the line numbering sometimes get in the way.
I have heard of Turbo, but never of SSB. I will give it a try.
Thanks for all the help
Because I don't do any planning of the program before, the line numbering sometimes get in the way.
I have heard of Turbo, but never of SSB. I will give it a try.
Thanks for all the help
Re: Coding SuperBasic
I've used SSB during the coding of the QLirc program for using IRC on QL emulators which have access to the TCP/IP of the host computer. It took me a while to adapt to its way of working. SSB is a great utility, but you'll need to choose your editor carefully to get the best from it. Most QL editors are designed for editing plain text files OK, but not all are up to the task of editing QL BASIC programs - considerations such as line length, word wrapping behaviour and ability to copy and paste adequately , for example.
I expect you'll get different answers from everyone as to which QL-based editor might be the best choice, so I won't try to suggest one - there's a selection on my page at http://www.dilwyn.me.uk/editview/index.html
It is on my "to do" list to write a fairly simple editor more geared up to handling BASIC programs than text, but that's for the future. I have a much bigger "to do" list of QL software to write than I'll ever get time to write I guess
You can of course use a non-QL editor to prepare the QL BASIC programs as plain text files - just remember that the QL requires a linefeed CHR$(10) only as end of line character, not a carriage return, and you may need to translate the odd character to QL character set equivalents upon transfer from an editor on, say, a Windows system.
Good luck, and welcome to the Forum.
I expect you'll get different answers from everyone as to which QL-based editor might be the best choice, so I won't try to suggest one - there's a selection on my page at http://www.dilwyn.me.uk/editview/index.html
It is on my "to do" list to write a fairly simple editor more geared up to handling BASIC programs than text, but that's for the future. I have a much bigger "to do" list of QL software to write than I'll ever get time to write I guess
You can of course use a non-QL editor to prepare the QL BASIC programs as plain text files - just remember that the QL requires a linefeed CHR$(10) only as end of line character, not a carriage return, and you may need to translate the odd character to QL character set equivalents upon transfer from an editor on, say, a Windows system.
Good luck, and welcome to the Forum.
--
All things QL - https://dilwyn.qlforum.co.uk/index.html
All things QL - https://dilwyn.qlforum.co.uk/index.html
- NormanDunbar
- Forum Moderator
- Posts: 2285
- Joined: Tue Dec 14, 2010 9:04 am
- Location: Leeds, West Yorkshire, UK
- Contact:
Re: Coding SuperBasic
SSB is not a compiler as such, well, technically it's a "transpiler" it takes in source code without line numbers etc, and spits out a file containing the line numbers. It is, however, a great help in writing SuperBASIC code when you don't like using line numbers and occasionally (or frequently) want to move things around.
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.
Author of Arduino Software Internals
Author of Arduino Interrupts
No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
- NormanDunbar
- Forum Moderator
- Posts: 2285
- Joined: Tue Dec 14, 2010 9:04 am
- Location: Leeds, West Yorkshire, UK
- Contact:
Re: Coding SuperBasic
When I was working, back in the day, I had to write scripts and code for Uinx boxes on a Windows PC. I used Notepad++ (https://notepad-plus-plus.org/) as my editor of choice. Line endings were set to Unix by default, and if I needed an actual Windows file, it can be simply changed while editing the file.dilwyn wrote: ↑Tue Nov 22, 2022 1:06 pm You can of course use a non-QL editor to prepare the QL BASIC programs as plain text files - just remember that the QL requires a linefeed CHR$(10) only as end of line character, not a carriage return, and you may need to translate the odd character to QL character set equivalents upon transfer from an editor on, say, a Windows system.
Thoroughly recommended.
Sounds very interesting Dilwyn, although I#m slightly puzzled in that SuperBASIC files are plain text. Do you have a (brief) list of features that you might be planning to implement?
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.
Author of Arduino Software Internals
Author of Arduino Interrupts
No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
Re: Coding SuperBasic
Me too. And I added Superbasic syntax highligting.NormanDunbar wrote: ↑Tue Nov 22, 2022 2:14 pm I used Notepad++ (https://notepad-plus-plus.org/) as my editor of choice. Line endings were set to Unix by default, and if I needed an actual Windows file, it can be simply changed while editing the file.
Thoroughly recommended.
To install SuperBasic syntax highlight: from menu select Language -> User Defined language -> Define your language -> Import
and import the attached file
- Attachments
-
- QL SuperBasic.zip
- (2.37 KiB) Downloaded 118 times
- mk79
- QL Wafer Drive
- Posts: 1349
- Joined: Sun Feb 02, 2014 10:54 am
- Location: Esslingen/Germany
- Contact:
Re: Coding SuperBasic
I think that's what the Basic Linker was for https://www.wlenerz.com/qlstuff/#basic_linker
Re: Coding SuperBasic
Before you get over-excited, Norman, nothing too ambitious. No syntax checking or highlighting, for example (I'm not clever enough).NormanDunbar wrote: ↑Tue Nov 22, 2022 2:14 pmSounds very interesting Dilwyn, although I#m slightly puzzled in that SuperBASIC files are plain text. Do you have a (brief) list of features that you might be planning to implement?
Cheers,
Norm.
Using code which already partly exists in my ProcMan software (which handles untokenised BASIC files), it'd have :
Proc/Fn listing (enabling you to cut/copy/paste/jump to individual procs/fns or view lists of procs/fns
Copy and Paste for areas of code
Merge in or extract library routines
Elementary QREF-style operations - see lists of identifiable routine and variable names
Add/remove line numbers
Labels for no-line-number listings for when you choose to add line numbers (only needed if you are desperate enough to need to use GOTO/GOSUB).
So, nothing too ambitious or drastic, but having some QL BASIC awareness.
No code has been written, just a document outlining what I want to aim for with it. If it happens at all, it won't be before next year. I foolishly let people know I'd retired early, and got dragged into all sorts of committees and activities and things, and now seem to have less free time than when I was working!
--
All things QL - https://dilwyn.qlforum.co.uk/index.html
All things QL - https://dilwyn.qlforum.co.uk/index.html