Re: [Ql-Users] [Fwd: Re: Help with BASIC/SBASIC WINDOWS]

2009-10-15 Thread P Witte

Marcel Kilgus writes:

Ive had a blocked pipe in my qlusers system somewhere. Just had the 
odd mail until today when I got 107 all at once!



P Witte wrote:

Of course this isnt half as clever as it looks, as nowadays you arnt
guaranteed (AFAIK) that ALCHP wont return a negative address.


Is that so? ALCHP returns a memory address, so at least on QPC you
would have to have more than 2GB of memory to achieve this. On MMU
based systems it could be possible in theory, but I'm not aware that
it's the case.


Id swear that on one (or more) of the systems Ive used over the years 
Ive had to

watch out for negative addresses. Whether it was on a QVME or QXL, I dont
recall, only Ive been shy of them ever since. Probably mere superstition.


The much more grave problem is the other one you mention yourself,
namely that ALCHPed memory is discarded upon release of a job, so
you're returning an illegal pointer. Please never ever anybody use
this method. If you insist, use RECHP. This introduces a small memory
leak, but that's preferable to having a race condition.


My intention was to warn, as the technique of producing your own error 
messages is quite legal, but it breaks down in the case where it is a 
job's dying croak. However, for the purpose of interactively testing 
small scripts, there is usually never a problem.



Per
___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] [Fwd: Re: Help with BASIC/SBASIC WINDOWS]

2009-10-04 Thread gdgqler


On 3 Oct 2009, at 13:37, John Gilpin wrote:



I understand that there is no need to compile BASIC programs when  
using QPC2 (SMSQ) - the SBASIC code can be EXEC'd without TURBO or  
QLIBERATOR.


Do I take this to mean that I just   Ex win1_program_bas   ?  
And if it's as easy as that, what are the benefits and drawbacks of  
doing this?


The introduction to the SMSQ/E manual states:

SuperBASIC has been replaced by SBASIC . . . which executes at speeds  
more often associated with compiled SuperBASIC than interpreted  
SuperBASIC. There is no longer any need to compile SuperBASIC  
programs: you can just EXECute them.


That may be true of Qlib but Turbo still gives a speed advantage.

The manual also says that you can invoke SBASIC as a thing. Typing  
EXEP sbasic brings up a daughter SBASIC with its 3 windows. The  
manual also says that you can start SBASIC with channels and a  
parameter string. The first channel is taken as the SBASIC program.  
Thus you should be able to type EXEP sbasic,ram1_p_bas to get the  
same effect as EX ram1_p_bas. Unfortunately this doesn't work because  
EXEP ignores the channels given to it. However you can use my EXEG  
instead. Typing EXEG sbasic,ram1_p_bas does indeed execute ram1_p_bas.


George
___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] [Fwd: Re: Help with BASIC/SBASIC WINDOWS]

2009-10-04 Thread gdgqler


On 3 Oct 2009, at 17:03, P Witte wrote:


As it is not widely advertised and the documentation is hard to find,
I thought I should just mention that as of SMSQ/E 3.06 the QUIT
keyword takes an optional longword parameter. Earlier versions will
simply ignore this


A useful bit of information. Where is this recorded?

I suppose you go to the witch's wood and find the parchment under the  
third stone from the left. Or is it in one of the QL Today's?


It would be good to know.

George 
___

QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] [Fwd: Re: Help with BASIC/SBASIC WINDOWS]

2009-10-04 Thread François Van Emelen

gdgqler schreef:


On 3 Oct 2009, at 17:03, P Witte wrote:


As it is not widely advertised and the documentation is hard to find,
I thought I should just mention that as of SMSQ/E 3.06 the QUIT
keyword takes an optional longword parameter. Earlier versions will
simply ignore this


A useful bit of information. Where is this recorded?

I suppose you go to the witch's wood and find the parchment under the 
third stone from the left. Or is it in one of the QL Today's?


It would be good to know.

George

I found it on the official SMSQE site.
SMSQE v 3.06: The 'QUIT' keyword takes an optional parameter (long int) 
that is passed to the calling job.

François Van Emelen



___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] [Fwd: Re: Help with BASIC/SBASIC WINDOWS]

2009-10-03 Thread Rich Mellor



 Original Message 
Subject: Re: [Ql-Users] Help with BASIC/SBASIC WINDOWS
Date: Wed, 30 Sep 2009 21:59:40 +0100
From: John Gilpin johngilpin...@btinternet.com
To: ql-us...@q-v-d.com
References: 4ac21f89.8050...@btinternet.com 
e494d004-604c-4ec1-a863-5b7f1ff50...@gmail.com




gdgqler wrote:
The advice for a cure might be to open a second window, which need 
not be used, over the whole screen.


George

I think that George ought to be awarded an A* for that suggestion!! 
:-) :-)


One solution I have tried is to add the following code to the end of 
the procedure:-


OPEN#chan,SCR
WINDOW#chan,512,256,0,0:BORDER#chan,2,7

and lo and behold all the borders are in place again.

Don't go away guys, this is just the beginning of my program review 
(taking my old BASIC code from my Aurora/SGC set-up and running it on 
QPC2), I am certain to need your help again later.


And just to prove this point, can anyone guide me on the following:

I understand that there is no need to compile BASIC programs when 
using QPC2 (SMSQ) - the SBASIC code can be EXEC'd without TURBO or 
QLIBERATOR.


Do I take this to mean that I just   Ex win1_program_bas   ? And 
if it's as easy as that, what are the benefits and drawbacks of doing 
this?


In the meantime, thanks a million for your suggestions.

Regards to all,

John Gilpin.




Yes under SMSQ/e you can simply EX win1_program_bas (or EW 
win1_program_bas).


The benefits? 
1) You can run multiple basic programs without compiling them.
2) You can test a program in the background, without overwriting the 
BASIC program currently in memory
3) If it is a number crunching program, you can leave it running in the 
background, whilst you work on something else
4) You can set up pipes to pass information, so use SuperBASIC programs 
as filters


It is all in the SBASIC/SuperBASIC Reference Manual  - there is a whole 
chapter devoted to running multiple basics.


--
Rich Mellor
RWAP Services
URL:http://www.rwapsoftware.co.uk
URL:http://www.rwapservices.co.uk


___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] [Fwd: Re: Help with BASIC/SBASIC WINDOWS]

2009-10-03 Thread Dilwyn Jones
I understand that there is no need to compile BASIC programs when 
using
QPC2 (SMSQ) - the SBASIC code can be EXEC'd without TURBO or 
QLIBERATOR.


Do I take this to mean that I just   Ex win1_program_bas   ? 
And
if it's as easy as that, what are the benefits and drawbacks of 
doing this?


In the meantime, thanks a million for your suggestions.

Regards to all,

John Gilpin.
As a start point, make sure you are familiar with the Executing 
SBASIC Programs section of the SMSQ/E user guide (page 27 in the 
admittedly old version I have).


But in many cases it's as simple as executing the SBASIC program: EX 
win1_PROGRAM_bas and once that program finishes typing in a QUIT 
command to close the SBASIC job and return to the original SBASIC 
(unless your program closes channel #0 as its last act in which case 
the SBASIC might decide to die cleanly and that's that IIRC)


When you EX a basic program which goes into a new incarnation of 
SBASIC (i.e. a separate job to the original SBASIC) this is called a 
daughter job (understanding this helps you understand some of the 
explanations in the manual).


However...

Remember that the position of the windows will usually overlap the 
original windows unless your program changes it. There are various 
options to control size and position of the windows.


Make sure your program has a filename ending with _bas. SBASIC prefers 
this. Or _sav if you saved it with QSAVE.


Some programs use features or extensions which rely on the job details 
being 0,0 (the numbers listed by the JOBS command), i.e. will only 
work in the main SBASIC. The fix for some of these is trivial (don't 
use them), while others need some individual attention.


You may get problems with the windows as you have already discussed. 
Probably best to seek help on these as you find them.





___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] [Fwd: Re: Help with BASIC/SBASIC WINDOWS]

2009-10-03 Thread Bob Spelten
Op Sat, 03 Oct 2009 14:37:11 +0200 schreef John Gilpin  
thegilp...@btinternet.com:



I understand that there is no need to compile BASIC programs when using
QPC2 (SMSQ) - the SBASIC code can be EXEC'd without TURBO or QLIBERATOR.

Do I take this to mean that I just Ex win1_program_bas?And if it's as  
easy as that, what are the benefits and drawbacks of doing this?



It's as easy as that.
One small drawback can be that when a Qliberated program crashes there  
usually is the infamous red screen with an error message.
This is not always the case with executed SBasic, it just disappears.  
That's why I always write and test my SBasics in QD and use the qd/sbas  
thing to execute from there. Then QD will report the error.


Bob

--
Gemaakt met Opera's revolutionaire e-mailprogramma:  
http://www.opera.com/mail/

___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] [Fwd: Re: Help with BASIC/SBASIC WINDOWS]

2009-10-03 Thread François Van Emelen

John Gilpin schreef:
SNIP
Don't go away guys, this is just the beginning of my program review 
(taking my old BASIC code from my Aurora/SGC set-up and running it on 
QPC2), I am certain to need your help again later.


And just to prove this point, can anyone guide me on the following:

I understand that there is no need to compile BASIC programs when using 
QPC2 (SMSQ) - the SBASIC code can be EXEC'd without TURBO or QLIBERATOR.


Do I take this to mean that I just   Ex win1_program_bas   ? And 
if it's as easy as that, what are the benefits and drawbacks of doing this?


Of course you can EW or EW a sbasic program instead of using LRUN but it 
is not always  adviseable as consequences are not the same.

Example:
ram1_trythis_bas contains the 2 following lines

10 a_variable=10
20 open#3,con_

After EX ram1_trythis_bas
if you type (command line)
print a_variable 0 will be returned
if you type (command line)
close#3 Invalid Channel ID will be returned

After LRUN ram1_trythis_bas
print a_variable will return 10
close#3 will close#3

So if you want to preserve the 'environment' LRUN should be used.
Hope this helps
Regards,
François Van Emelen
P.S. My English is not as good as it should be




In the meantime, thanks a million for your suggestions.

Regards to all,

John Gilpin.




___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] [Fwd: Re: Help with BASIC/SBASIC WINDOWS]

2009-10-03 Thread P Witte

Bob Spelten writes:


Op Sat, 03 Oct 2009 14:37:11 +0200 schreef John Gilpin 
thegilp...@btinternet.com:



I understand that there is no need to compile BASIC programs when using
QPC2 (SMSQ) - the SBASIC code can be EXEC'd without TURBO or QLIBERATOR.

Do I take this to mean that I just Ex win1_program_bas?And if it's 
as easy as that, what are the benefits and drawbacks of doing this?



It's as easy as that.
One small drawback can be that when a Qliberated program crashes there 
usually is the infamous red screen with an error message.
This is not always the case with executed SBasic, it just disappears. 
That's why I always write and test my SBasics in QD and use the 
qd/sbas thing to execute from there. Then QD will report the error.


As it is not widely advertised and the documentation is hard to find,
I thought I should just mention that as of SMSQ/E 3.06 the QUIT
keyword takes an optional longword parameter. Earlier versions will
simply ignore this

QUIT error_code

where error_code are the usual suspects. If you EW program_bas, and
program_bas terminates with a QUIT error_code parameter, the calling
program will receive the error message.

Below follows an example using a home made error code. (The Home made
error codes principle has always been part of SMSQ/E (and if IRRC,
Qdos) but most people, I suspect, will have forgotten all about it ;o)

1 REMark Example of QUIT
2 REMark Using own error message
3 REMark by pjwitte 2009
4 :
100 addr = ALCHP(100)
110 erm$ = 'something got seriously buggered here..'  CHR$(10)
120 POKE_W addr, LEN(erm$), erm$
130 er = BIN('1'  BIN$(addr, 32)(2 TO))
140 REMark La di da
150 QUIT er
160 :

If the program snippet above is saved as ram1_Test_bas (for example)
then if

EW ram1_Test_bas

is executed from another basic console it should return the error
message something got seriously buggered here..! (pardon my Latin!)

Of course this isnt half as clever as it looks, as nowadays you arnt
guaranteed (AFAIK) that ALCHP wont return a negative address. Another
potential pitfall is if you use

er = FEW(ram1_Test_bas)

and try to work out the error message from there, as the location of
the error message is no longer defined since the job that owned the
space has disappeared!

However, the concept is valid. Youll just have to find a workaround
for those issues.

Per

___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm


Re: [Ql-Users] [Fwd: Re: Help with BASIC/SBASIC WINDOWS]

2009-10-03 Thread P Witte



I wrote:


1 REMark Example of QUIT
2 REMark Using own error message
3 REMark by pjwitte 2009
4 :
100 addr = ALCHP(100)
110 erm$ = 'something got seriously buggered here..'  CHR$(10)
120 POKE_W addr, LEN(erm$), erm$
130 er = BIN('1'  BIN$(addr, 32)(2 TO))
140 REMark La di da
150 QUIT er
160 :


Line 120 should actually read something like

120 POKE_W addr, LEN(erm$): POKE addr + 2, erm$

I was using one of my own keywords to test and then edited it out in 
the email before sending it off in a hurry without re-testing! Just as 
well I was bleating in the wilderness, otherwise Id have had a torrent 
of protests!


QUIT -10

Per
___
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm