f



Calling a BASIC programme from a BASIC programme and coming back

Put simply : from within a BASIC programme (Prog1) is it possible to call another BASIC programme (Prog2) and come back executing the lines after the call (in Prog1) ?

0
xltardy
5/2/2016 8:40:46 PM
comp.sys.acorn.programmer 2499 articles. 0 followers. Post Follow

4 Replies
251 Views

Similar Articles

[PageSpeed] 58

On 02/05/2016 21:40, xltardy@gmail.com wrote:
> Put simply : from within a BASIC programme (Prog1) is it possible to call another BASIC programme (Prog2) and come back executing the lines after the call (in Prog1) ?

You used to have to do a horrible concoction of setting PAGE and 
CHAINing the program and then back again. But you should now just be 
able to load a BASIC program in to memory above HIMEM, and executing 
BASIC with with the address of the program. See *BASIC for help, as I 
can't remember the details.

---druck

0
druck
5/2/2016 8:50:00 PM
xltardy@gmail.com wrote:
> Put simply : from within a BASIC programme (Prog1) is it possible to
>  call another BASIC programme (Prog2) and come back executing the
> lines after the call (in Prog1) ?

You can start Prog2 with *WimpTask and Prog1 will carry on, but I
imagine you only want Prog1 to carry on after Prog2 quits, so not
really. druck has suggested juggling with PAGE, and there are things you
could do there, but it does get a bit complicated.

What is the problem to be solved? That may lead to a simple answer.

My immediate thought is to load the whole of Prog2 as a library and call
a procedure in the library to run it.
0
Steve
5/3/2016 9:47:37 AM
On 3/05/2016 9:47 p.m., Steve Drain wrote:
> xltardy@gmail.com wrote:
>> Put simply : from within a BASIC programme (Prog1) is it possible to
>>  call another BASIC programme (Prog2) and come back executing the
>> lines after the call (in Prog1) ?
>
> You can start Prog2 with *WimpTask and Prog1 will carry on, but I
> imagine you only want Prog1 to carry on after Prog2 quits, so not
> really.

If prog2 calls wimp_initialise (but then doesn't call wimp_poll
before it exits) you'll get what you want, prog1 (and everything else!)
suspended until prog2 finishes.

I did this years ago, there was a wrinkle, something to do with the
message list passed to wimp_initialise...think you had to pass 200 in
the wimp_initialise or it hung waiting for the first poll.

....something like that, I forget!

> My immediate thought is to load the whole of Prog2 as a library and call
> a procedure in the library to run it.

That's probably better than abusing swi wimp_starttask. :-)


Rob.
-- 
Maple Glen         http://www.mapleglen.co.nz/
Garden on Flickr   http://www.flickr.com/photos/mapleglen/
0
Rob
5/3/2016 10:13:59 AM
Rob Davison wrote:
> Steve Drain wrote:
>> You can start Prog2 with *WimpTask and Prog1 will carry on, but I
>> imagine you only want Prog1 to carry on after Prog2 quits, so not
>> really.
>
> If prog2 calls wimp_initialise (but then doesn't call wimp_poll
> before it exits) you'll get what you want, prog1 (and everything
> else!) suspended until prog2 finishes.
>
> I did this years ago, there was a wrinkle, something to do with the
> message list passed to wimp_initialise...think you had to pass 200
> in the wimp_initialise or it hung waiting for the first poll.
>
> ...something like that, I forget!

I assumed Prog2 was to be multi-tasking. If it is single-tasking, I
think that everything (except interrupts?) stops anyway. Prog1 must be 
multi-tasking, I think, but that could be in a TaskWindow.
0
Steve
5/3/2016 10:35:12 AM
Reply: