Re: A86: Re: _exec_basic and _findAlphaUp


[Prev][Next][Index][Thread]

Re: A86: Re: _exec_basic and _findAlphaUp




see what happens if you do something like this:
	ld hl,(_OPBASE)		;save original op stack base
	push hl
	ld hl,(_FPBASE)		;save original fp stack base
	push hl
	ld hl,(_OPS)			;base the stacks at their current location
	ld (_OPBASE),hl
	ld hl,(_FPS)
	ld (_FPBASE),hl
-------exec_basic here-------
	pop hl				;restore original values
	ld (_FPBASE),hl
	pop hl
	ld (_OPBASE),hl

the difference between Stop and Return is that Stop resets those stacks
to all but the topmost values.  if your asm program is those topmost
values, it might return to it instead of the homescreen.  (completely
untested)

-josh

On Thu, 09 Dec 1999 17:08:44 -0800 Cassady Roop <croop@oregontrail.net>
writes:
>
>Is there any way to know ahead of time how much crap will be on the
>stack?
>
>Chris Phelps wrote:
>> 
>> Cuz there is crap on the stack from the call  _exec_basic, and 
>anything else you
>> have left there.
>> 
>> > Does anyone have any idea as to WHY it crashes in the first 
>place?
>> >
>> > Andreas Finne wrote:
>> > >
>> > > Yas, ase and Rascall use this method to run basic programs with 
>some small
>> > > differences. Also in the documentation to Rascall it says: "You 
>should NOT
>> > > start it with the command Asm(rascall) however, since the shell 
>will then
>> > > fail to execute BASIC programs!"
>> > >
>> > > Andreas Finne
>> > > a_finne@hotmail.com
>> > >
>> > > >From: Cassady Roop <croop@oregontrail.net>
>> > > >
>> > > >and what happens if the user tries to run the shell from the 
>actual
>> > > >assembly program instead of the loader?  Chaos?  Great.
>> > > >
>> > > >
>> > > >
>> > > >Robin Kirkman wrote:
>> > > > >
>> > > > > It's a basic program that is run instead of the actual 
>assembly code to
>> > > > > start the shell.
>> > > > >
>> > > > > Example:
>> > > > >
>> > > > > ------------
>> > > > > Lbl 1
>> > > > > ::::::::
>> > > > > Asm(ShelName)
>> > > > > If Ans==1:Goto 1
>> > > > > Return
>> > > > > ------------
>> > > > >
>> > > > > The shell ShelName can run assembly programs by itself 
>easily. However,
>> > > > > to run a basic program, the shell must do some more 
>complicated stuff:
>> > > > > 1) Set Ans to 1. Use those funky op routines.
>> > > > > 2) Modify the basic program in RAM, so that :::::::: is 
>replaced with
>> > > > > the BASIC program (Ex: :::::::: -> BProg:::)
>> > > > > 3) Quit. Yes, the shell quits.
>> > > > >
>> > > > > The shell quits, and since Ans = 1, it jumps to the 
>::::::::, which is
>> > > > > now BProg:::
>> > > > > The TIOS runs BProg and -doesn't- crash ;)
>> > > > > The shell is started again.
>> > > > >
>> > > > > For the shell to exit, it just sets Ans to zero and quits.
>> > > > > --robin
>> > > > >
>> > > > > Cassady Roop wrote:
>> > > > > >
>> > > > > > Hold on, just what exactly does that mean?  What is a 
>BASIC loader?
>> > > > > >
>> > > > > > Kirk Meyer wrote:
>> > > > > > >
>> > > > > > > The problem with _exec_basic is one that has been known 
>for quite
>> > > >some time,
>> > > > > > > and this is why any good shell uses a BASIC loader and 
>runs BASIC
>> > > >programs
>> > > > > > > from BASIC - simply because they won't work otherwise.
>> > > > > > >
>> > > > > > > ----- Original Message -----
>> > > > > > > From: Cassady Roop <croop@oregontrail.net>
>> > > > > > > To: <assembly-86@lists.ticalc.org>
>> > > > > > > Sent: Wednesday, December 08, 1999 7:56 PM
>> > > > > > > Subject: A86: _exec_basic and _findAlphaUp
>> > > > > > >
>> > > > > > > > When I use _exec_basic to run a basic program, it runs 
>perfectly
>> > > >but for
>> > > > > > > > one problem:  if the basic program has a STOP command 
>at the end,
>> > > > > > > > instead of a RETURN or nothing at all, it crashes the 
>calculator
>> > > > > > > > totally.  Is this a bug in _exec_basic or am I not 
>passing
>> > > >something to
>> > > > > > > > the routine that I should be?  I am passing in the 
>name to run in
>> > > >OP1;
>> > > > > > > > I thought that was all it needed.  I have ROM 1.3.  
>Can anyone
>> > > >duplicate
>> > > > > > > > this?
>> > > >
>> > >
>> > > ______________________________________________________
>> > > Get Your Private, Free Email at http://www.hotmail.com
>

___________________________________________________________________
Why pay more to get Web access?
Try Juno for FREE -- then it's just $9.95/month if you act NOW!
Get your free software today: http://dl.www.juno.com/dynoget/tagj.


Follow-Ups: