Re: A83: Re: Executing Basic


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

Re: A83: Re: Executing Basic




DAH!!...yes, very soon :)

Anyway, for all you poor ppl without it, what the hell here is #49.

Introduction.
Again, thanks to Pat Milheron for sharing this with us!  Running BASIC programs really helps the ASM community, since before
BASIC program support in shells was done by writing to an actual BASIC program, then making the loader run that
program…complicated, and often involved rather large code.  Now it’s a few lines.

New Commands.
We have a new mode flag!
	ProgExecuting,(iy+newDispf)	- Stores state whether program is running.

The Code.

This is pretty simple, and guess what?  The romcall we knew from back in Tutorial 35!

Progexecuting  equ  1	; Equates.
NewDispF       equ  8
progobj        equ  5
_parseinp      equ  4E8Ch

.org 9327h
call _zerooop1	; Set Op1 to zero
  	ld hl,progname1	; the name of the prog
	ld de,op1 		; copy it to op1
	ld bc,7		; 7 chars in name
	ldir			; do the copying
	bit   ProgExecuting,(iy+newDispf)
	push  af		; Save it.
	set   ProgExecuting,(iy+newDispf)
	call  _parseInp	; Run program!
	pop   af		; Restore state.
	jr    nz,stateset	; Jump if on

res   ProgExecuting,(iy+newDispf)	; reset
stateset:
	ret

Progname1: .db progobj,"JAMES",0

This program will run program JAMES!  Ok, small explanation needed about why we use ProgExecuting.  Well, I don't really know
why, but what we have to do is get the state, then save it, set the state, and restore the previous state.  The reason we do
this (I think) is to allow for nested programs, so that the OS doesn't stop execution once a nested program has finished
running.

All tutorials Copyright (c) James Matthews 1998, unless specified.

HTH,

James Matthews (matthews@tkb.att.ne.jp)

ICQ: 7413754
http://home.att.ne.jp/gold/tomcat21/index.html
http://library.advanced.org/18242/

----------
> From: Jkhum98@aol.com
> To: assembly-83@lists.ticalc.org
> Subject: Re: A83: Re: Executing Basic
> Date: Sunday, November 29, 1998 9:39 AM
> 
> 
> 
> In a message dated 11/28/98 7:26:32 PM, matthews@tkb.att.ne.jp writes:
> 
> >> How do you load a basic program from asm?
> >
> >See Tutorial #49.  God I love saying that! :)...
> >
> >If you don't have it, I'll post it.
> >
> >James.
> 
> Hey James, even though I dont need that subject right now, I'd like to point
> out I dont have that tutorial... =P  HTML or Plain-Text coming any time soon?
> ;)
> 
> 															--Jason K.