QD SBASIC Parser Thing

Anything QL Software or Programming Related.
User avatar
pjw
Super Gold Card
Posts: 686
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: QD SBASIC Parser Thing

Postby pjw » Sun May 24, 2020 1:10 am

The SBAS/QD Thing doesnt open any windows, nor is there a need to open any windows unless your program needs them. The most likely reason you get the miniature SBASIC window is that something in your program implicitly addresses channel #0 or #1. It may not be obvious, but things like SCR_XLIM and PAUSE, among many others, all use a default channel and will therefore cause a window to be opened if no channel has been specified.


Per
Be wary of large West-Coast corporations bearing gifts!
- Ancient Trojan proverb
Derek_Stewart
QL Wafer Drive
Posts: 1835
Joined: Mon Dec 20, 2010 11:40 am
Location: Runcorn, Cheshire, UK

Re: QD SBASIC Parser Thing

Postby Derek_Stewart » Sun May 24, 2020 9:52 am

Hi Per,

Thank you for the extras vital information, it now makes sense.

If the default channel is not supplied, then a SBAS/QD thing opens a channel to accommodate this.

In my case the missing channel statement was on an INKEY$ definition scanning for a key to be pressed:

Code: Select all

REPeat loop
  IF INKEY$(-1)<>"": EXIT loop
END REPeat Loop

SBAS/QD thing would open a default channel for the missing channel in the INKEY$. Adding the defined console channel solved this, for example:

Code: Select all

REMark #chan is a console channel
REPeat loop
  IF INKEY$(#chan,-1)<>"": EXIT loop
END REPeat Loop

Bad programming on my part.

Is there any documentation on the SBAS/QD thing?


Regards,

Derek
User avatar
pjw
Super Gold Card
Posts: 686
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: QD SBASIC Parser Thing

Postby pjw » Sun May 24, 2020 11:48 am

Hi Derek,
I often write short, line number-less, windowless utilities to be run entirely under SBAS/QD:
Execute the source file into a QD via Qpac2 Files, adjust a parameter or two, press F10. A
satisfying beep or nasty burp signals success or failure - an' Bob's yer mum's live-in lover!

Window-less or not, the SBASIC miniature window feature can be useful for debugging:
Provided your designated output channels are opened with FOPXXX (which returns consecutive
channel numbers starting with #3), you can put a line anywhere in your code to print out
debugging information. When satified, just delete it again. Eg:

Code: Select all

..
..
rem     Check out PIC
ch = fop_in(ifn$): if ch < 0: ret ch
fl = flen(#ch)
wget#ch; f%, x%, y%, l%, m%
close#ch

print fl! ifn$\ f%, x%, y%, l%, m% div 256: pause: rem Debug

..
..

The debug line is unlikely to mess with the rest of your program

If there was any documentation, I no longer remember. Its too long ago. All my physical stuff
is elsewhere so I cant check. Someone else please pipe up!


Per
Be wary of large West-Coast corporations bearing gifts!
- Ancient Trojan proverb
User avatar
tofro
QL Wafer Drive
Posts: 1964
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: QD SBASIC Parser Thing

Postby tofro » Sun May 24, 2020 2:09 pm

pjw wrote: - an' Bob's yer mum's live-in lover!

There's something messed up in your family relations...


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
BSJR
Bent Pin Expansion Port
Posts: 92
Joined: Sun Oct 18, 2015 12:53 pm
Location: Amsterdam
Contact:

Re: QD SBASIC Parser Thing

Postby BSJR » Sun May 24, 2020 2:32 pm

pjw wrote:If there was any documentation, I no longer remember. Its too long ago. All my physical stuff
is elsewhere so I cant check. Someone else please pipe up!

The QD manual does not explain anything but there is a small chapter in the SMSQ/E manual: "The SBASIC Interface Thing" (page 33).
A word of warning when using this with DATA lines. A "RESTORE linenumber" does not work and will restore to the beginning.

Bob
PS: I deny ever having met "yer mum".


Derek_Stewart
QL Wafer Drive
Posts: 1835
Joined: Mon Dec 20, 2010 11:40 am
Location: Runcorn, Cheshire, UK

Re: QD SBASIC Parser Thing

Postby Derek_Stewart » Sun May 24, 2020 3:11 pm

Hi,

I did remember Jochen saying something about the RESTORE line, it seemed to a difficult statement to renumber.

But if numberless lines are used, the RESTORE statement will only restore to start of the programme.

Pity there was not Labels in SBASIC, so that the DATA lines could be referenced by Label rather than number.

The more I think about the way SBAS/QD handles channel numbers, the more I like it. As I always try write programmes with their own channels and not use Channels #0,1,2

With regards to your mother's brother called Robert, I doubt he is a live in lover outside Scandinavia, as they different customs than in the UK and Europe.


Regards,

Derek
User avatar
RalfR
Gold Card
Posts: 413
Joined: Fri Jun 15, 2018 8:58 pm

Re: QD SBASIC Parser Thing

Postby RalfR » Sun May 24, 2020 5:10 pm

BSJR wrote:A word of warning when using this with DATA lines. A "RESTORE linenumber" does not work and will restore to the beginning.
Aha, so much for a full working program.....


User avatar
pjw
Super Gold Card
Posts: 686
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: QD SBASIC Parser Thing

Postby pjw » Sun May 24, 2020 5:18 pm

BSJR wrote:<>
The QD manual does not explain anything but there is a small chapter in the SMSQ/E manual: "The SBASIC Interface Thing" (page 33).
A word of warning when using this with DATA lines. A "RESTORE linenumber" does not work and will restore to the beginning.

Then this shouldnt work in SBAS/QD:

Code: Select all

10 ch = FOPEN("con")
20 CLS#ch
25 :
30 RESTORE 100
40 READ item
50 PRINT#ch; item! '= 100?'
60 PAUSE#ch: QUIT
70 :
80 DATA 80
90 DATA 90
100 DATA 100
110 :

But it does in my current version (whatever that is). So does this BTW:

Code: Select all

ch = FOPEN("con")
CLS#ch
:
RESTORE 11
READ item
PRINT#ch; item! '= 11?'
PAUSE#ch: QUIT
:
DATA 80
DATA 90
DATA 11
:

I think its just a poorly formulated way of saying that there is no reliable way of using RESTORE
with line numberless programs.
BSJR wrote:PS: I deny ever having met "yer mum".

I never said anything, Robert ;)


Per
Be wary of large West-Coast corporations bearing gifts!
- Ancient Trojan proverb
User avatar
RalfR
Gold Card
Posts: 413
Joined: Fri Jun 15, 2018 8:58 pm

Re: QD SBASIC Parser Thing

Postby RalfR » Sun May 24, 2020 5:21 pm

Who has written the SBAS/QD? Was it JMS or TT? Would be better, to get the source to correct a few things! And there is also QBASIC. What do we use?


User avatar
pjw
Super Gold Card
Posts: 686
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: QD SBASIC Parser Thing

Postby pjw » Sun May 24, 2020 5:40 pm

Derek_Stewart wrote:<>
Pity there was not Labels in SBASIC, so that the DATA lines could be referenced by Label rather than number.

Well, theres always this:

Code: Select all

RANDOMISE DATE
RESTORE
READ dummy
READ LABel1
READ LABel2
READ LABel3
:
DATA 0: REMark Dummy
PRINT 'LABel1 is at line no.'! LABel1
PRINT 'LABel2 is at line no.'! LABel2
PRINT 'LABel3 is at line no.'! LABel3
:
FOR i = 0 TO 2
 choose = RND(1 TO 3)
 PRINT 'Choice'! choose,
 ON choose GO SUB LABel1, LABel2, LABel3
END FOR i
BGET k%
IF JOBID: QUIT: ELSE : STOP
:
REMark Lable 1
DATA PEEK_W(\\ $94)
PRINT 1: RETurn
:
REMark Lable 2
DATA PEEK_W(\\ $94)
PRINT 2: RETurn
:
REMark Lable 3
DATA PEEK_W(\\ $94)
PRINT 3: RETurn
:
:D
Strictly SBASIC only! (Ie not even a Qlibbed program running on SMSQ/E)

The more I think about the way SBAS/QD handles channel numbers, the more I like it. As I always try write programmes with their own channels and not use Channels #0,1,2
Actually, I think it is a feature of SBASIC more than SBAS/QD. You may loose a little space on the "gap" in the S*BASIC channel table if channel numbers only start at #3 but, of course you can override it.

With regards to your mother's brother called Robert, I doubt he is a live in lover outside Scandinavia, as they different customs than in the UK and Europe.
Without wishing to impugn my family: Yes, we Scandinavians sure do have more relaxed mores and customes! And Im glad of it! However, that doesnt necessarily stretch as far as the misunderstanding seems to be here. It is not uncommon, even in English-speaking countries, for kids to call their divorced mother's subsequent boyfriend(s) for 'uncle'. After all the 'Dad' label is already taken.


Per
Be wary of large West-Coast corporations bearing gifts!
- Ancient Trojan proverb

Who is online

Users browsing this forum: No registered users and 7 guests