[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: DRAW & XDRAW... How to use
In article <851a6j$s4i$1@acme.gcfn.org>, dalloff@gcfn.org (Dave Althoff
Jr) wrote:
> There is some space starting at $300 (768) but not a whole lot. If
> you're
> not using hi-res page 2 ($4000-$6000 (16384-24576) that is fairly safe
> because
> it is out in the middle of nowhere...and you know your Applesoft program
> isn't
> going to go up that far because it will crash into hi-res page #1 first
> (Applesoft program lines build up from $800, typically. And I have had a
> few that overran the first hi-res page). Almost as safe is up around
> $6000 (24576) again, because Applesoft doesn't usually use much space up
Guys, guys, don't you know anything about programming the Apple? You
just can't POKE all over the place and hope you've stumbled on some
unused memory area!
If you want a piece of free space, you have got to make sure that it's
free, not blindly stumble in with your fingers crossed.
Ordinarily, all of the memory is reserved, with the exception of
$300-$3CF. But there are several areas where you can put your data, if
you prepare for it in the right way.
- Between the text screen and the Applesoft program: set the start of
the program to, for instance, $0A00 and you have 512 bytes of free space
between $0800 and $09FF:
POKE 103,1: POKE 104,10: POKE 2560,0: NEW
Hoever, this is something that must be done before loading your program,
so it isn't very popular. (There are ways to do it from inside a
program, but I'm not going to bore you with details.)
- Between the end of the program and the variables. You can achieve this
with doing a LOMEM and then loading your data, or you can glue your data
to the end of the program before you save it:
Check where the program ends with PEEK(175)+PEEK(176)*256. Load your
data at this address. Add the size of the data to the address and POKE
that value in 175~176. Then save the program.
And your data will stick there, even if you modify the program! (Note
that the location of the data may change by modifying, though.)
- Between the variables and the string space. Ordinarily, the strings
will use all of available memory, but you can restrict them to stay
above memory address, say, 32768, by doing a POKE 109,0: POKE 110,128.
Then you have room below 32768 to put your data.
Warning: do these POKEs only after the program has allocated all
variables, because creating new variables tends to push 109~110 up.
- Between the string space and the DOS buffers (note: DOS 3.x only): use
HIMEM to set the end of the string space to any value you want and load
your data above it.
- Between the first DOS buffer and the other DOS buffers (note: ProDOS
only): use HIMEM to set the end of the string space to any value you
want and load your data 1K above the value of it.
Of course, you can also load your data in other memory banks, but those
banks aren't always switched in, so you can't get to it directly. I'm
not about to do a discourse about the uses and pitfalls of bank switched
memory here...
--
Groetjes, Pim
Same excuse every time