Auto running SBASIC jobs

Anything QL Software or Programming Related.
Post Reply
Martin_Head
Aurora
Posts: 847
Joined: Tue Dec 17, 2013 1:17 pm

Auto running SBASIC jobs

Post by Martin_Head »

From within a SBASIC daughter job. I want to start another SBASIC daughter job, which auto runs a BASIC program.
Leaving the original daughter job running.

I am using EXEC program_name_bas to start the new SBASIC program

The problem is it starts with a window (#0) drawn on top
sbasic1.png
sbasic1.png (3.37 KiB) Viewed 3687 times
If I press any key to to get the next page, then the window disappears
sbasic2.png
sbasic2.png (3.56 KiB) Viewed 3687 times
And does not reappear again, unless I BREAK into the program.

Can I start the SBASIC daughter job without the #0 window appearing?

I have looked at the SMSQ/E manual, But it's not very clear, It talks about this window, but does not mention how to suppress it.


User avatar
pjw
QL Wafer Drive
Posts: 1286
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: Auto running SBASIC jobs

Post by pjw »

SBASIC operation is quite complex. Briefly, however, depending on how you start up an SBASIC daughter job, unless you explicitly open the three default channels, any IO sent to one of those channels causes channel #0 to be opened and the IO to be directed there. Thus PRINT or PAUSE without an explicit channel number will cause the channel #0 window to appear, as shown in your first illustration.


Per
dont be happy. worry
- ?
User avatar
pjw
QL Wafer Drive
Posts: 1286
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: Auto running SBASIC jobs

Post by pjw »

BTW, instead of EXEC you could use EXEP "SBASIC"; "lrun 'my_default_program_bas'" ;) Anything you put on the command line gets fed directly to the command channel #0


Per
dont be happy. worry
- ?
Martin_Head
Aurora
Posts: 847
Joined: Tue Dec 17, 2013 1:17 pm

Re: Auto running SBASIC jobs

Post by Martin_Head »

pjw wrote:SBASIC operation is quite complex. Briefly, however, depending on how you start up an SBASIC daughter job, unless you explicitly open the three default channels, any IO sent to one of those channels causes channel #0 to be opened and the IO to be directed there. Thus PRINT or PAUSE without an explicit channel number will cause the channel #0 window to appear, as shown in your first illustration.
Here's the start of the program

Code: Select all

10 DIM var87C4$(1) : OPEN #1,"con_448x200a32x16"  : PAPER #1,0  : INK #1,7  : BORDER 1,7  : CLS  : CSIZE #1,2,0
20 INK #1,2  : AT #1,0,10  : PRINT#1,"Compact draw help"\\ : INK #1,7
30 PRINT#1,"Alter    : modify a picture file on"\"           microdrive"\\"Box      : Draw a box between the"\"           two cursors."\\
40 PRINT#1;"Circle   : Draw a circle or ellipse."\"           Choose the excentricity"\"           with ¾ & ¿ ,the angle"\"           with ¼ & ½ and the size              with < & >"\\
50 PRINT#1;"Dir      : Give the microdrive direc-"\"           tory ."\"           Scroll with space."\\
60 INK #1,4  : PRINT#1;"ESC to return,any other key for help." : INK #1,7
70 var87C4$ = INKEY$(-1 ) : IF (CODE(var87C4$) = 27) THEN QUIT : END IF
80 AT #1,1,0  : CLS 2
90 PRINT#1,"(End)Fill: Fill a closed shape.    "\\"Grid     : Draw a grid"\\
100 PRINT#1;"Half     : Draw a circle arc . Choose           curve with ¾ & ¿"\\"Ink      : Choose INK on the palette."\\
110 PRINT#1;"Kill     : Delete a picture file."\\
120 PRINT#1;"Load     : Load a picture file."\\"Mistake  : Delete last instruction."\\"New      : Use this to change the I/O           device drive number."
.
.
.
I'm gussing it's line 70 that's causing the problem. As #1 is opened explicitly.
Which fits, as the screen is drawn before the window appears, which I thought was a bit odd.


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

Re: Auto running SBASIC jobs

Post by Martin_Head »

pjw wrote:BTW, instead of EXEC you could use EXEP "SBASIC"; "lrun 'my_default_program_bas'" ;) Anything you put on the command line gets fed directly to the command channel #0
Using this method can you still send a string to the CMD$ variable.

Or would you have to do something like EXEP "SBASIC"; "cmd$='whatever' : lrun 'my_default_program_bas'"

I don't need it for this particular program, but I might want it in another part of the project.


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

Re: Auto running SBASIC jobs

Post by tofro »

Martin,

yes, I guess it's line 70. Even if it isn't explicitly mentioned in the manual, INKEY$ without a channel defaults to #0, so SBASIC seems urged to open that window.

SImply change line 70 to read

Code: Select all

70 var87C4$ = INKEY$(#1,-1 ) : IF (CODE(var87C4$) = 27) THEN QUIT : END IF
Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
pjw
QL Wafer Drive
Posts: 1286
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: Auto running SBASIC jobs

Post by pjw »

Martin_Head wrote:<>
Or would you have to do something like EXEP "SBASIC"; "cmd$='whatever' : lrun 'my_default_program_bas'"
Yup, thats the one.
tofro's suggestion that INKEY$ is the offending command is correct. However, you should look at BORDER, CLS (line 10) etc too..


Per
dont be happy. worry
- ?
User avatar
pjw
QL Wafer Drive
Posts: 1286
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: Auto running SBASIC jobs

Post by pjw »

If you find it too much trouble to specify channel numbers, you might consider the following "trick":

Code: Select all

100 c0 = FOPEN(#0; 'con')
110 c1 = FOPEN(#1; 'con')
120 c2 = FOPEN(#2; 'con')
130 :
140 INK 7: CLS
150 LIST
160 AT 10, 0:PRINT 'This is a test'
170 PAUSE
180 QUIT


Per
dont be happy. worry
- ?
User avatar
pjw
QL Wafer Drive
Posts: 1286
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: Auto running SBASIC jobs

Post by pjw »

I got distracted before finishing my point.
EXEC or EXEP the program above.
Now REM out lines 110 and 120 and try it again.


Per
dont be happy. worry
- ?
Martin_Head
Aurora
Posts: 847
Joined: Tue Dec 17, 2013 1:17 pm

Re: Auto running SBASIC jobs

Post by Martin_Head »

Thanks for the help, I just changed all the INKEY$ commands, and that seems to have sorted it out.


Post Reply