Atari Assembler Course --------------------------------- 7.0 Atari Memory Map So far, we have covered Assembly Language without a great deal of emphasis on the Atari O/S and hardware. In the last session, we covered Interrupts and began to see the power of the Atari for real-time applications. But, this aspect is a small portion of what both the O/S and the hardware are capable of doing. The following Memory Map summarizes the system's use of memory. Remember that the 6502 microprocessor can address only 64K (0-$FFFF) of unique memory (or hardware) locations. The best source of details for the Atari's memory usage is "Mapping the Atari" from Compute Books. I recommend this book as a "Bible" for any serious Atari programmer. For each allocated memory address, it explains the purpose of the location and many "tricks" associated with it. Also, there are cross-references by alphabetical order and subject and the entries are shown in both decimal and hex. 7.1 Atari 800/400 Memory Map *----------------------------. $0000 | O/S Zero Page | *----------------------------* $0080 | User Zero Page (fp) | *----------------------------* $0100 | Stack !!!!!!! | *----------------------------* $0200 | Interrupt RAM | *----------------------------* $0230 | O/S Variables | | and | | Hardware Shadows | *----------------------------* $0300 | Device I/O RAM | *----------------------------* $0340 | I/O Control Blocks | *----------------------------* $03C0 | 40 Col. Printer RAM | | (or spare user RAM) | *----------------------------* $03FD | Cassette Buffer | | (or spare user RAM) | *----------------------------* $0480 | FREE User RAM | *----------------------------* $0500 | FREE User RAM (fp) | *----------------------------* $0600 | "Page Six" | | User RAM | *----------------------------* $0700 | DOS (or free RAM) | *----------------------------* $1CFC | FREE RAM | | | | | | | | ???? | ???? | $4000 | v | *----------------------------* $8000 | (Right Cart.) or Free RAM | *----------------------------* $A000 | (Left Cart.) or Free RAM | *----------------------------* $C000 | (Unused Addresses) | *----------------------------* $D000 | CTIA/GTIA | *----------------------------* $D200 | POKEY | *----------------------------* $D300 | PIA | *----------------------------* $D400 | ANTIC | *----------------------------* $D500 | (Unused Addresses) | *----------------------------* $D800 | 10K | | Operating System ROM | *----------------------------* $FFFF 7.1 Memory Usage and Allocation When programming in BASIC, we were usually concerned with the size of the program but not where in memory it was located. The BASIC cartridge handled the allocation of memory for variables and program instructions. If you ever worked with Player/Missile graphics or Character Sets in BASIC, you began to see the need for more control over this. In Assembler, we need to be concerned with memory usage throughout our program. While using the Assembler/Editor cartridge, we are limited somewhat by the Editor's use of memory and the cartridge itself. The SIZE command in the EDIT mode shows us the present limits of memory. The first number is the value of MEMLO after booting the cartridge and comes right after DOS. The second number shows the next free byte of RAM after the source program in the EDIT buffer. Free RAM exists from this location to the value given by the third number which designates MEMTOP. For small programs, this is no problem because we can locate the origin of our program in high memory above the editor buffer. For large programs, it will be necessary to assemble to (or from) disk. Also, by using the LOMEM command in the EDIT mode, you can save low memory for your program by forcing the editor buffer higher in RAM. The trick here is to be sure that you have over-estimated the size of the assembled code. Read: Pages 5-7,35-41 in the ASM/ED manual. "DE RE Atari" pages A1-A2. Begin "skimming" thru "Mapping the Atari".