Subject: Re: AppleSoft memory usage Newsgroups: comp.sys.apple2.programmer From: dempson@actrix.gen.nz (David Empson) Date: Thu, 29 Jun 2000 23:30:37 +1200 Message-ID: <1ed0eg8.6khh5l7dno74N%dempson@actrix.gen.nz> References: <8je5lj$806$1@nnrp1.deja.com> <8jem5i$jah$1@nnrp1.deja.com> Organization: Empsoft User-Agent: MacSOUP/2.4.2 NNTP-Posting-Host: 202.49.157.176 X-Original-NNTP-Posting-Host: 202.49.157.176 X-Trace: 30 Jun 2000 00:06:14 NZST, 202.49.157.176 Lines: 45 Path: lobby!newstf02.news.aol.com!portc01.blue.aol.com!gip.net.MISMATCH!news-peer.gip.net!news-stock.gip.net!news.gsl.net!gip.net!news.iprolink.co.nz!news.actrix.gen.nz!dempson wrote: > $67 $68 load location > Or, what is required to RUN another program that is IN MEMORY, without > erasing variables? I do not want to use CHAIN. There was a reasonably common technique used by some programs (Taipan comes to mind) to deal with a large BASIC program that needs to use the hires screen. Taipan was an Applesoft file, loaded at $0801, as normal, but was actually a saved binary image of memory containing several pieces that went something like this: $0801 to about $083F: stub Applesoft program about $0840 to $17FF: lots of little machine code routines (sound, etc.) $1800 to $1BFF: hi-res character generator $1C00 to $1FFF: character sets for the HRCG (two of them). $2000 to $3FFF: title screen $4000 to whereever: actual Applesoft program. I don't recall whether it also used hires page 2. If so, then $4000 to $5FFF was unused in the loaded file, and the actual Applesoft program started at $6000. The stub program consisted of a single line, which did three POKEs and a RUN to start the second part of the program running. Two of the POKEs simply set the "run location" zero page variables to the new location. Given your details above, I expect this was $67 and $68. The third POKE stuck a zero byte before the start of the actual Applesoft program (this is a requirement of Applesoft). i.e. it was probably: 10 POKE 103,1: POKE 104,64: POKE 16384,0: RUN If I remember right, this technique doesn't work with GOTO - you have to use RUN. -- David Empson dempson@actrix.gen.nz Snail mail: P O Box 27-103, Wellington, New Zealand