Apple2 memory map for Cubbyhole optimizations?

7 posts / 0 new
Last post
Offline
Last seen: 4 months 1 week ago
Joined: Nov 12 2022 - 16:50
Posts: 202
Apple2 memory map for Cubbyhole optimizations?

Hi!  When I program in cc65 C, I usually use an optimization technique.  It states that I can use parts of the OS's memory, a.k.a. Low memory, that aren't used during the course of a cc65 program can be used for a program's code and data.  I like this technique, as it buys me a little extra space.  AFAIK, the range from $0200-$02FF is used to read a line of keyboard input and can be used if a program doesn't use the ROM's routines for such, and the range $0300-$03FF is used by DOS 3.3 and is available when using ProDOS.  Am I right?  Where can I find a memory map for the Apple2 series?

Offline
Last seen: 2 months 2 weeks ago
Joined: Jul 5 2018 - 09:44
Posts: 2587
Apple ][+ or //e Reference
Offline
Last seen: 1 week 1 day ago
Joined: May 31 2022 - 18:18
Posts: 360
+1 to SJ's suggestions, in

+1 to SJ's suggestions, in addition if you want  a good understanding of how the system works on a hardware level gotta take a look at James Sather's books on the II, and IIe. It's hardware but he does have some good examples of code that shows how to take advantage of the hardware in software. Likely WAAAAY more than you need but seriously, this is my go-to. Beneath Apple ProDos is another of my go tos.

 

Understanding the Apple II : Sather, James Fielding : Free Download, Borrow, and Streaming : Internet Archive

Understanding the Apple IIe : Sather, James Fielding : Free Download, Borrow, and Streaming : Internet Archive

Offline
Last seen: 4 months 1 week ago
Joined: Nov 12 2022 - 16:50
Posts: 202
Thank you.  :)

Thank you.  :)

Offline
Last seen: 4 months 1 week ago
Joined: Nov 12 2022 - 16:50
Posts: 202
Right now, I'm looking for a

Right now, I'm looking for a memory map of all the used zeropage and Low memory locations.  This is for a port of my AdvSkel65 program, which is a "skeleton" code around which one can create a text adventure.  It is created with cc65 and uses my A2SimpleIO library.  Now, I want to optimize it better.  I don't quite remember the location aliased by "tabx," but I want to do better than functions such as gotoy() and wherey().  WHere can I find such a memory map?  I prefer both a short description and full documentation but in two different files.  I also want the addresses of the Apple2's OS routines.  I have them for DOS 3.3 and ProDOS and so don't need them.  Thank you.

S.Elliott's picture
Offline
Last seen: 1 day 3 hours ago
Joined: Jun 23 2022 - 16:26
Posts: 247
Clarification of page 2 and page 3 memory availability
Harry Potter wrote:

AFAIK, the range from $0200-$02FF is used to read a line of keyboard input and can be used if a program doesn't use the ROM's routines for such, and the range $0300-$03FF is used by DOS 3.3 and is available when using ProDOS. 

Some refinement of those address ranges:

$0200-$02FF - yes this is the keyboard line-input buffer, so your subroutines can use it for temporary scratch memory that may probably be overwritten after your routine returns.  You can use it even in programs that use the ROM's input routines, so long as you're done parsing that last line of input.  The input routines fill it from the lowest address first, so user input will eventually overwrite the higher addresses if the user types a LOT on a single input line.

$0300-$03FF - The first three-quarters is free, but the last quarter is used by the ROM, DOS 3.3, ProDOS, and Applesoft BASIC.  (eg: JMP vectors for cold-start, warm-start, USR, interrupts, etc.)  The boundary is a little fuzzy, but free to use the range $0300-$03C0.

Offline
Last seen: 4 months 1 week ago
Joined: Nov 12 2022 - 16:50
Posts: 202
S.Elliott: I thank you for

S.Elliott: I thank you for your information.  However, I also want to work on my A2SimpleIO library and AdvSkel65, both for cc65, and want to optimize them a little better.  I'm obsessed with optimizing.  :)  BTW, the next version of AdvSkel65 is almost ready: I just need to fix a bug with the Atari8 version not displaying the cursor, make sure it's working then finish the manual and info file, then I should be ready to upload it.  :)

Log in or register to post comments