Quick and Dirty Routines for Newbies

Helpful tips and guides, also new users can ask for help here.
Post Reply
User avatar
Mr_Navigator
QL Fanatic
Posts: 782
Joined: Mon Dec 13, 2010 11:17 pm
Location: UK, Essex
Contact:

Quick and Dirty Routines for Newbies

Post by Mr_Navigator »

If you are starting out using a QL, QL Emulator or other such hardware equivalent that uses SuperBASIC or even the coverall S*BASIC, then here are a few routines to assist you or at least get you thinking about making your own.

The absolute beauty of SuperBASIC for me is the ability to add your own commands just by simply writing procedures and functions and then you can immediately use them. TOOLKIT II is assumed to be invoked and these are routines that I use a great deal when writing programs to keep things ordered.

Saving your program as you go along with a simple S + Return

1000 DEFine PROCedure S
1010 DEV$="FLP1_"
1020 FILE$="Filename"
1030 SAVE_O DEV$&FILE$
1040 SAVE DEV$&FILE$&"_BAK"
1050 END DEFine


Getting a directory as you go along with a simple D + Return

2000 DEFine PROCedure D
2010 DEV$="FLP1_" :REMark or assume that it already exist in 'S'
2020 DIR DEV$
2030 END DEFine


Renumbering your program as you go along with a simple R + Return

3000 DEFine PROCedure R
3010 RENUM
3020 END DEFine


Quitting from your QPC2 program with a simple Q + Return, write and use with care

4000 DEFine PROCedure Q
4010 S:D
4020 QPC_EXIT
4030 END DEFine


-----------------------------------------------------------------------------------
QLick here for the Back 2 the QL Blog http://backtotheql.blogspot.co.uk/
User avatar
tofro
Font of All Knowledge
Posts: 2685
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Quick and Dirty Routines for Newbies

Post by tofro »

Hi,
your "S" Procedure is fine for anyone not using SMSQ/E.

Some other interesting thing is the following:

If you work with SMSQ/E you can as well simply use "SAVE" or "SAVE_O" (Without arguments). The interpreter remembers where it got the current program from and saves it in the same place. It took me a while before I realized that and so I think it makes sense to share.

Cheers,
tofro


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
Mr_Navigator
QL Fanatic
Posts: 782
Joined: Mon Dec 13, 2010 11:17 pm
Location: UK, Essex
Contact:

Re: Quick and Dirty Routines for Newbies

Post by Mr_Navigator »

When programming stuff early on the QL, sometimes it is useful to display the character set. Here is another straight forward procedure to display the QL character set, I have deliberately made it simplistic, so newbies or re-newbies will have to adjust 10070 to suit other character sets.

10010 DEFine PROCedure char
10020 OPEN#5, scr_
10030 WINDOW#5, 512,256,0,0
10040 PAPER#5, 7:INK#5, 0
10050 CLS#5: CSIZE#5, 3,0
10060 PRINT#5, VER$
10070 FOR f=32 TO 287
10080 PRINT#5, " ";CHR$(f);
10090 NEXT f
10100 CLOSE#5
10110 END DEFine


A screen shot from Qemulator on the MAC on which it was run is available here
http://backtotheql.blogspot.com/2011/09 ... on-ql.html


-----------------------------------------------------------------------------------
QLick here for the Back 2 the QL Blog http://backtotheql.blogspot.co.uk/
User avatar
qxl-kumbah
ROM Dongle
Posts: 24
Joined: Thu Apr 17, 2014 11:56 pm
Location: Waltham, MA

Re: Quick and Dirty Routines for Newbies

Post by qxl-kumbah »

Thanks for these routines ! :)

The save and directory program were modified slightly, since I am
using QLay and Qemulator (QLay doesn't do the SAVE_O command).

I think Qemulator does, but I haven't transferred anything that I've
been everperimenting on, to it yet.

On that note, guess I better move over to the emulation part of the forum. :)


* qxl-kumbah *
"TS-1000, Eighty-One,TS-2068, Spectrum Anywhere, QXL, QLay, and Qemulator on board"
Post Reply