[A83] Re: Executing a BASIC program that executes an ASM program...


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

[A83] Re: Executing a BASIC program that executes an ASM program...




> Van: David Lindström <okvin@tiscali.se>
> 
> Why not just:
> 
> ld hl,BASIC
> rst 20h

This is a handy opt. It copies 9 bytes from HL to OP1, just don't forget
the zero-terminator (not needed when prog-name is 8 bytes long).

> set ProgExecuting,(iy+newDispF)
> B_CALL ParseInp
> ;;;;ret
> res ProgExecuting,(iy+newDispF)
> StateSet2:
> 
> BASIC: db ProgObj,"BASIC",0

I think this set/res ProgExecuting,(iy+newDispF) might give problems. The
TIOS checks this flag to see if there is still a BASIC program running. But
it might also be that it doesn't mind how you set it (if the TIOS saves it
by itself before calling your prog/the shell). Just be shure to set it
though before calling _ParseInput, else it might not return to your prog.

	ld hl,BASIC
	rst 20h
	bit ProgExecuting,(iy+newDispF)
	push af
	set ProgExecuting,(iy+newDispF)
	B_CALL ParseInp
	pop af
	jr nz,StateSet2
	res ProgExecuting,(iy+newDispF)
	StateSet2:
	[..]

BASIC: db ProgObj,"BASIC",0

> > From: "Thomas Lutz" <tlutz@stevens-tech.edu>
> > Would it be bad to execute a BASIC program that ran an ASM program from
> > within an ASM program? Is the following code correct?
> >
> > Also, what happens when an ASM program executes? How is the memory
> > deallocated and what could prevent it from being deallocated? Thanks

It shouldn't give problems running BASIC programs that execute normal
send(9,  asm( or ZASMLOAD programs. But running Venus programs will give
problems since these will be loaded in usermem (where your program is), and
won't get unloaded (because it's not necesairy either).

The best way to do this is to move your BASIC caller to a safe-ram area,
and then call it. Add some check code to see if your program is still
loaded.

Or use Venus yourself, there are uhm.. 'hacks' that can be done so your
venus-program gets reloaded after quiting the BASIC prog. See the venus
shells for examples.

BTW: I do see you program for the Ti83+ (you are using BCALL) and since
there is no Venus for the Ti83+, you won't have those problems.

	Henk Poley <><