ATR: appdx.C: Memory Use

From: Craig Lisowski (aa853@cleveland.Freenet.Edu)
Date: 01/04/94-02:58:44 PM Z


From: aa853@cleveland.Freenet.Edu (Craig Lisowski)
Subject: ATR: appdx.C: Memory Use
Date: Tue Jan  4 14:58:44 1994



                                  APPENDIX C
     
     
                                  MEMORY USE
     
     
                                    Page 0
     
     $00-$7F
     
     Operating system zero-page.  The entire first half of page zero is
     reserved for the operating system.
     
     $80-$FF
     
     Free zero-page.  The top half of page zero is free if BASIC is
     disabled.  BASIC uses all but $CB-$D1.  The floating point math
     routines use $D4-$FF.  If the floating point arithmetic package is not
     used this memory is free.
     
                                    Page 1
     
     $100-1FF
     
     This is the 6502 stack.  The stack pointer initialized to $1FF and
     moves downward as the stack is filled.
     
                                   Pages 2-5
     
     $200-$47F
     
     This area is used for operating system database variables.  Parts
     which are not used in some particular programs, such as the cassette
     buffer or printer buffer, may then be used for other purposes.  See
     the O.S. equate listing for these locations.
     
     $480-$57D ($480-$6FF if no floating point)
     
     This is called the user work space.  It is free to be used by
     programs.  If the floating point arithmetic package is not used the
     user work space extends to $6FF.  This area is used by BASIC.
     
     $57E-$5FF
     
     This area is used by the floating point arithmetic package.  It is
     free if the package is not used.
     
                                    Page 6
     
     $600-6FF
     
     Atari has solemnly sworn never to put anything in this page of
     memory.
     
                           Page 7-the screen region
     
     $700
     
     This is called the boot region.  Most machine language programs which
     don't use DOS load at this address.  DOS extends from $700-$1CFB.
     
                                     MEMLO
     
     The address pointed to by the O.S. database variable MEMLO [$02E7,2
     (743)] is the first byte of free memory.  This pointer is usually
     changed by any program's initialization routine.  For example, upon
     power-up, MEMLO points to $700.  When DOS loads in, DOS changes MEMLO
     to point to $2A80.  If an AUTORUN.SYS program then loads in just above
     DOS, such as DISKIO, it will usually change MEMLO to point above
     itself.  One important reason for this is to protect the program from
     BASIC.  BASIC uses memory starting at MEMLO.
     
     MEMTOP
     
     MEMTOP [$2E5,2 (741)] is set by the O.S. whenever a graphics mode is
     entered.  The graphics region is at the very top of ram and extends
     downward.  The address MEMTOP points to depends on how much memory the
     screen region uses.
     
     APPMHI
     
     APPMHI [$0E,2 (14)] should be set by any program to point to the
     highest address required by the program.  If the O.S. cannot set up a
     screen without going below APPMHI it will return a
     not-enough-memory-for-screen-mode error.
     
                              The cartridge slots
     
     $8000 (32768)
     
     This is the beginning of the 8K bytes used by the right cartridge slot
     of the 800.  This is also where 16K cartridges begin.  If there is no
     cartridge here it is ram.
     
     $A000 (40960)
     
     This is the beginning of the left cartridge of the 800 or the only
     cartridge slot on all other models.  This is where the BASIC ROM
     resides in the XL/XE models.  This area is RAM is there is no
     cartridge or BASIC is disabled on XL/XE models.
     
                             above the cartridges
     
     $C000-$CFFF (49152-53247)
     
     This area is empty on the 800.  Sometimes special ROM chips, such as
     Omnimon are wired in here.  On the XL/XE models $C000-C7FF is free ram
     if there are no cartridges.  On XL/XE models, the O.S. ROM starts at
     $C800
     
     $D000-$D7FF (53248-57373)
     
     This area is taken up by the hardware chips.  The chips actually take
     only a fraction of this space.  If these addresses are further decoded
     there is space for many, many more hardware chips.  For example, The
     PIA chip uses 256 bytes of memory but needs only 4 bytes.  There is
     room for 64 PIA chips in this reserved memory.
     
     $E000-E3FF (57344-58367)
     
     This is the location of the ATASCII character set.
     
     $E400-FFF7 (58368-65527)
     
     This is the operating system ROM
     
     $FFF8-$FFFF (65528-65535)
     
     These last 8 bytes contain the addresses of the interrupt vectors. 
     Upon power up the 6502 gets a reset pulse and looks up the reset
     routine here.
                                                                           


-----------------------------------------
Return to message index