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

Re: Q about loading BASIC programs



Moll wrote:

>A problem I have had with code I wrote to DMA a program into emulated 
>6502 space (I tried this on two of my Apple ][ emulator projects) was 
>that when I ran the program, accessing a variable would cause code to be 
>overwritten.
>
>Obviously some POKE has to be set to point to the top of the program 
>space, but I am not sure which one.

Take a look at my website.  There are several examples there
of RUNning BASIC programs that have been POKEd into a
machine's memory.

Quoting from the page:

http://members.aol.com/MJMahon/PRUNPaper.html

<<Then we POKE pointers dependent on the length of the Applesoft
program and simulate a "RUN" command:

 1260  POKE BUF + 1,PGND / 256: POKE BUF,PGND - 256 *  PEEK (BUF + 1)
 1270 VARTAB = 6 * 16 + 9: REM  $0069
 1280  &  POKE (D,VARTAB,2,BUF): REM  Set VARTAB = PGND
 1290 :
 1300 PRGND = 10 * 16 + 15: REM  $00AF
 1310  &  POKE (D,PRGND,2,BUF): REM  Set PRGEND = PGND
 1320 :
 1330 RNPROG = 13 * 4096 + 5 * 256 + 6 * 16 + 6: REM  $D566
 1340  &  CALL (D,RNPROG): REM  Start slave program>>

So you have to set up $69 and $AF with the address of the end of
the program, then call $D566.

-michael

New Applesoft BASIC interface for NadaNet networking!
Home page:  http://members.aol.com/MJMahon/