[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Q about loading BASIC programs
- Subject: Re: Q about loading BASIC programs
- From: mjmahon@aol.com (Michael J. Mahon)
- Date: 06 Jan 2005 23:14:15 GMT
- Newsgroups: comp.sys.apple2
- Organization: AOL http://www.aol.com
- References: <sdczd.11479$fe5.4485@trndny06>
- Xref: g2news1.google.com comp.sys.apple2:6781
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/