At line 20594:4 fatal error in SBASIC interpreter

Anything QL Software or Programming Related.
User avatar
ql_freak
Gold Card
Posts: 427
Joined: Sun Jan 18, 2015 1:29 am

At line 20594:4 fatal error in SBASIC interpreter

Post by ql_freak »

Code: Select all

20592 DEFine FuNction hps_openOver%(c%,fnam$):REMark Opens device for writing
This results (when calling another, working function of the module) in:

At line 20592:4 fatal error in SBASIC interpreter

The function is empty (contains no code) except a RETurn 0
Following does not give this error and calling another FuNction of this module is working perfect:

Code: Select all

20592 DEFine FuNction hps_openOver%(c,fnam$):REMark Opens device for writing
        REMark                      c% (see above) gives the fatal error
This is my hps_openOver%() function which I have published here in another thread, where it runs perfectly (I even have written a SB-program with 4 tests for it).


http://peter-sulzer.bplaced.net
GERMAN! QL-Download page also available in English: GETLINE$() function, UNIX-like "ls" command, improved DIY-Toolkit function EDLINE$ - All with source. AND a good Python 3 Tutorial (German) for Win/UNIX :-)
User avatar
tofro
Font of All Knowledge
Posts: 3007
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: At line 20594:4 fatal error in SBASIC interpreter

Post by tofro »

ql_freak wrote: Wed Feb 12, 2025 11:42 pm

Code: Select all

20592 DEFine FuNction hps_openOver%(c%,fnam$):REMark Opens device for writing
This results (when calling another, working function of the module) in:

At line 20592:4 fatal error in SBASIC interpreter

The function is empty (contains no code) except a RETurn 0
Following does not give this error and calling another FuNction of this module is working perfect:

Code: Select all

20592 DEFine FuNction hps_openOver%(c,fnam$):REMark Opens device for writing
        REMark                      c% (see above) gives the fatal error
This is my hps_openOver%() function which I have published here in another thread, where it runs perfectly (I even have written a SB-program with 4 tests for it).
Can you try and remove the comment from the DEFine line? I seem to recall cases where comments tend to upset the interpreter.


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
ql_freak
Gold Card
Posts: 427
Joined: Sun Jan 18, 2015 1:29 am

Re: At line 20594:4 fatal error in SBASIC interpreter

Post by ql_freak »

This was the first thing I have tried, doesn't solve it. But I have now detected, that the error does not occure in the first SuperBASIC job (0,0) only in MultiBASIC-Jobs.


http://peter-sulzer.bplaced.net
GERMAN! QL-Download page also available in English: GETLINE$() function, UNIX-like "ls" command, improved DIY-Toolkit function EDLINE$ - All with source. AND a good Python 3 Tutorial (German) for Win/UNIX :-)
User avatar
ql_freak
Gold Card
Posts: 427
Joined: Sun Jan 18, 2015 1:29 am

Re: At line 20594:4 fatal error in SBASIC interpreter

Post by ql_freak »

I have now tested my test program for hps_openOver()-function in a MultiBASIC (SBASIC) job (not 0,0) and there it is working (all tests passed). I will now delete parts of the program (SB-Library) where the (fatal SB-Interpreter) error occures to find out, what the problem is.


http://peter-sulzer.bplaced.net
GERMAN! QL-Download page also available in English: GETLINE$() function, UNIX-like "ls" command, improved DIY-Toolkit function EDLINE$ - All with source. AND a good Python 3 Tutorial (German) for Win/UNIX :-)
User avatar
ql_freak
Gold Card
Posts: 427
Joined: Sun Jan 18, 2015 1:29 am

Re: At line 20594:4 fatal error in SBASIC interpreter

Post by ql_freak »

I have now tested my test program for hps_openOver()-function in a MultiBASIC (SBASIC) job (not 0,0) and there it is working (all tests passed). I will now delete parts of the program (SB-Library) where the (fatal SB-Interpreter) error occures to find out, what the problem is.

First result: The following program crashes SBASIC (MultiBASIC; not even CTRL-SPACE is working) but runs in first SBASIC (0,0) job (load program and then enter: test):

Code: Select all

1 REMark hps_slb - my (hps) SuperBasic Library
2 REMark               ^^^  ^    ^     ^
3 REMark Last updated 2025-02-12 Wed
9 :
10 REMark GO TO 32752 is used instead of STOP, which may have problems on some VER$
19 :
20 REMark Required Toolkits:
21 REMark SuperToolkit II, TurboToolkit
40 REMark EDLINE$ function improved from me (hps), see:
41 REMark http://peter-sulzer.bplaced.net/htdocs/index.php?pagefile=ql%2fqldownloadEN.php
90 :
98 REMark U N D E R   C O N S T R U C T I O N !
99 :
100 REMark Following line eventually needed (delete if not needed):
101 c%=1:f%=4:REMark c%: Console channel - f%: File channel
19996 :
20000 REMark Library procedures and functions
20004 REMark Required: SuperToolkit II, TurboToolkit
20008 :
20100 DEFine PROCedure test
20110   PRINT 'In PROCedure "test"'
20120 END DEFine
20588 :
20592 DEFine FuNction hps_openOver%(c%,fnam$):REMark Opens device for writing
20596   REMark Commented function and tests see in SUPERBASIC_DIRECTORY_test_
20600   REMark (e.g. WIN1_home_hps_bas_test_) the file hpsOpenOver_bas.
20604 :
20608   IF DEVICE_STATUS(0,fnam$)>=0:DELETE fnam$
20612   IF DEVICE_STATUS(1,DATAD$&fnam$)>=0:RETurn -15:REMark A fully qualified
20616   REMark filename must be passed to this function!
20620   RETurn FOP_NEW(#c%,fnam$)
20624 END DEFine :REMark hps_openOver()
32750 :
32751 REMark Use GO TO 32752 instead of STOP. STOP may not work on all ROM versions!)
32752 REMark END OF PROGRAM (NO LINES MUST follow, some ROMs may not allow line numbers >= 32752!
It seems the MultiBASIC of SMSQ/E is not as stable as the one of Minerva. I cannot remember (in my old days, where I have had just Minerva), that there were such problems.

EDIT: If I change the first parameter of hps_openOver() (c%) to just c (i.e. a floating point variable instead of an integer) then the procedure "test" works also in an SMSQ/E MultiBASIC job. Strange...


http://peter-sulzer.bplaced.net
GERMAN! QL-Download page also available in English: GETLINE$() function, UNIX-like "ls" command, improved DIY-Toolkit function EDLINE$ - All with source. AND a good Python 3 Tutorial (German) for Win/UNIX :-)
User avatar
ql_freak
Gold Card
Posts: 427
Joined: Sun Jan 18, 2015 1:29 am

Re: At line 20594:4 fatal error in SBASIC interpreter

Post by ql_freak »

Solved - arrggghhhhh

The problem is the variable

Code: Select all

err%
which seems to be not allowed (perhaps clashes with ERRor from WHEN ERRor?). On uQLx these lines were marked with MISTake. I have now replaced it with rorre% and then it runs also in a secondary SBASIC job.


http://peter-sulzer.bplaced.net
GERMAN! QL-Download page also available in English: GETLINE$() function, UNIX-like "ls" command, improved DIY-Toolkit function EDLINE$ - All with source. AND a good Python 3 Tutorial (German) for Win/UNIX :-)
Derek_Stewart
Font of All Knowledge
Posts: 4608
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: At line 20594:4 fatal error in SBASIC interpreter

Post by Derek_Stewart »

ql_freak wrote: Sat Feb 15, 2025 5:55 pm Solved - arrggghhhhh

The problem is the variable

Code: Select all

err%
which seems to be not allowed (perhaps clashes with ERRor from WHEN ERRor?). On uQLx these lines were marked with MISTake. I have now replaced it with rorre% and then it runs also in a secondary SBASIC job.
Hi

I think you will find that the variable err% gives an error in QDOS, Minerva ROM and SMSQ/E allows the the variable.


Regards,

Derek
Martin_Head
Aurora
Posts: 939
Joined: Tue Dec 17, 2013 1:17 pm

Re: At line 20594:4 fatal error in SBASIC interpreter

Post by Martin_Head »

I had a similar problem recently with a variable called ret$ in a function.


User avatar
RalfR
QL Wafer Drive
Posts: 1140
Joined: Fri Jun 15, 2018 8:58 pm

Re: At line 20594:4 fatal error in SBASIC interpreter

Post by RalfR »

Martin_Head wrote: Sun Feb 16, 2025 9:01 amI had a similar problem recently with a variable called ret$ in a function.
This will happen for all variables that match the capitalized part of QDOS' own keywords, e.g.:

RETurn, ERRor, PROCedure, FuNction, REPeat, DEFine etc.

For a procedure or function it is enough to simply write "def proc" or "def fn" in ED. Interestingly, this only works with QDOS's own commands, not with loaded toolkits.


7000 4E75
User avatar
ql_freak
Gold Card
Posts: 427
Joined: Sun Jan 18, 2015 1:29 am

Re: At line 20594:4 fatal error in SBASIC interpreter

Post by ql_freak »

Thank you for testing Derek. I have now tested it again on QPC2 and now it runs also in a MultBASIC Window, seems something in the former QPC-session has been corrupted. But when I try to load it in Minerva on uQLx all lines which contain err% are marked with MISTake :-( I have printed EXTRAS to a file and have had searched for ERR%, but such a SuperBASIC command does not exist. Strange. Following show a stripped down version with the MISTake in TKII-Editor and on the right the program in MicroEMACS.
errIntMinervaMISTake.png
Here the program source:

Code: Select all

100 err%=hps_openOver(#4,'RAM1_DELETE_ME')
19990 :
20000 REMark Library functions
20010 REMark Required: SuperToolkit II, TurboToolkit
20040 :
20080 DEFine FuNction hps_openOver%(c%,fnam$):REMark Opens device for writing
20090   REMark If it's a file (filename) which already exists it will first be
20100   REMark deleted before the file is opened new (with fop_new(). If the file
20110   REMark could not be opened for read/write, an error is returned
20120   REMark The arguments (parameters) are not altered by the function
20130   REMark W A R N I N G : fnam$ must be a fully qualified name (no default from
20140   REMark SuperToolkit II, e.g. DATAD$ is added before fnam$)! If not a fully
20150   REMark qualified filename, error "bad parameter" (-15) is returned.
20160   REMark Note: File is not really opened with FOP_OVER but it's deleted and
20170   REMark then opened with FOP_NEW(). This means it also will work on UQLX
20180   REMark which does NOT support OPEN_OVER
20190 :
20220   IF DEVICE_STATUS(0,fnam$)>=0:DELETE fnam$
20260   IF DEVICE_STATUS(1,DATAD$&fnam$)>=0:RETurn -15:REMark A fully qualified
20300   REMark filename must be passed to this function!
20340   RETurn FOP_NEW(#c%,fnam$)
20380 END DEFine :REMark hps_openOver()
32757 :
32758 REMark Use GO TO 32759 instead of STOP. STOP may not work on all ROM versions!)
32759 REMark END OF PROGRAM (NO LINES MUST follow, some ROMs may not allow line numbers >= 32760!


http://peter-sulzer.bplaced.net
GERMAN! QL-Download page also available in English: GETLINE$() function, UNIX-like "ls" command, improved DIY-Toolkit function EDLINE$ - All with source. AND a good Python 3 Tutorial (German) for Win/UNIX :-)
Post Reply