z80:Free RAM

From Learn @ Cemetech
Jump to navigationJump to search

RAM Locations

   persst collat addr   name             size      what destroys it                how you should fix it        what it breaks
                                                                                
   *****  *****  8000   appData          256   v   APD (OFFSCRPT)                  -----
   ***    *****  8100   ramCode          119   |   flash activities                -----
   *****  *****  8177   smallEditCol     185   |   ----                            -----
   *****  ****   8230   baseAppBrTab      33   |   ----                            bcall(_fillBasePageTable)    multipage apps on 83+
   *****  *****  8251   bootTemp           8   |   receiving OS                    -----
   *****  *****  8259   MD5Stuff          74   |   MD5 calculations                -----
   ****   *****  82A3   appSearchPage      2   |   OS general app routines         -----
   ****   *****  82A5   tempSwapArea L4  232   |   archive stuff                   -----
   ****   *****  838D   appID              5   |   OS general app routines         -----
   ****   *****  8392   arcPageStuff       3   |   most archive operations         -----
   ****   *****  8395                     16   |   ???                             -----
   *      *****  83A5   MD5Buffer         12   |   Axe-subroutine arguments        -----
   **     *****  83B1   MD5Buffer         30   |   Axe-Archived variable pointers  -----  
   **     ***    83CF   MD5Buffer          2   |   Axe-random seed                 -----
   ***    *****  83D1   MD5Buffer          8   |   Axe-sprite rotation/flipping and hex printing -----
   ****   *****  83D9   MD5Buffer         12   |   Axe-axiom variables             ----- 
   *****  *****  83E5                      6   |   ???                             -----
   ***    *****  83EB   Abackup            1   |   flash operations and other?     -----
   ****   *****  83EC                      2   |   ???                             -----
   ****   *****  83EE   arcInfo           68   |   link routines and other?        -----
   ****   *****  8432   appInfo           13   ^   OS general app routines         -----
                 843F                         1087
   
   ****   *****  8452   prevDData          8   V   ???                             zero
   *      *****  845A   lFont_record       8   |   large font                      -----
   *      *****  8462   sFont_record       8   |   small font                      -----
   ****   ****   846A   tokVarPtr          4   |   ???                             zero
   ****   *****  846E   indicMem          10   |   run indicator                   -----
   *      *****  8478   OP1               11   |   Axe-AppVars, float{}, Ans, Text >Dec -----
   **     *****  8483   OP2               11   |   Axe-float{}, Ans, Text >Dec     -----
   ***    *****  848E   OP3               11   |   Text > Tok                      -----
   ***    *****  8499   OP4-OP6           38   |   random OS routines              -----
   ****   *****  84BF   progToEdit         8   |   running apps, editing progs     -----
   ****   *****  84C7   nameBuff          11   |   typing a name                   -----
   ****   *****  84D2   equ_edit_save      1   |   ??? opening an editor?          -----
   ****   *****  84D3   iMathPtrs         10   |   editing anything                -----
   ****   *****  84DD   stuff             14   |   ??? probably editing?           zero
   **     *****  84EB   asm_pointers       8   |   moving user memory              -----
   *****  *****  84F3   asm_ram           21   |   -----                           -----
   ****   ****   8508   textShadow L5    128   |   -----                           bcall(_clrTxtShd)
   ****   ****   8588   textShadPtrs       5   |   -----                           bcall(_clrTxtShd)
   ****   **     858D   cxVectors         25   |   -----                           manual restore                 changing apps (quitting)
   ****   *****  85A6                      4   |   -----                           -----            
   ****   *****  85AA   monQueue          18   |   ???                             -----
   ***    ***    85BC   onSP               2   |   -----                           manual restore                 homescreen errors
   ****   *****  85BE   promptStuff       18   |   ???                             -----
   ****   *****  85D0   varType           12   |   -----                           -----
   ****   ***    85DC   menuStuff          7   |   -----                           zero
   ****   ***    85E3   menuFlagBackups    4   |   -----                           zero
   ****   *****  85E7   progCurrent      120   |   -----                           -----
   *****  *****  865F   linkStuff        120   |   linking                         -----
   *      ****   86D7   penCol             2   |   small font, OS drawing          zero works
   ****   ****   86D9   rclQueuePtrs       4   |   -----                           ----- 
   ***    ***    86DD   errNo              1   |   OS errors (like appvar stuff)   zero
   ***    ***    86DE   errSP              2   |   OS errors                       manual restore
   ***    ***    86E0   errOffset          2   |   OS errors                       zero
   *****  *****  86E2                     10   |                                   -----
   *****  *****  86EC   saveSScreen L1   714   |   APD                             -----
   **     *****  89B6   saveSScreen L1    54   ^   Axe-A-Theta                     -----
                 89EC                         1434
                                                                                                        
   *****  *****  8A36                      4   V   -----                           -----
   *****  *****  8A3A   statVars L2      531   |   -----                           bcall(_delRes)
   *****  *****  8C4D   infVars          202   |   -----                           zero
   *****  ***    8D17   curGStyle          1   |   -----                           zero
   *****  ****   8D18   curGY            137   |   -----                           zero
   *****  **     8DA1   graphStuff         6   |   -----                           manual backup                  graphing
   *****  ****   8DA7   entryStackStuff  133   |   -----                           manual backup                  entry stack (2nd entry)
   *****  *****  8E2C                     59   |   ???                             -----
   *****  ****   8E67   graphVariables   494   |   -----                           bcall(_grReset)                graphing variables
   *****  ****   9055   financeVariables 126   |   -----                           bcall(_zeroFinanceVars)        finance variables
   *****  *****  90D3   smallEditRam     108   |   -----                           -----
   *****  ****   913F   moreGraphVars    157   |   -----                           bcall(_grReset)                graphing variables
   *****  ****   91DC   tableStuff       294   |   -----                           zero
   *****  ****   9302   entryStackStuff    5   |   -----                           manual restore                 entry stack (2nd entry)
   *****  *****  9307                     57   |   BASIC menus                     -----
   **     *****  9340   plotSScreen L6   768   |   most screen activities          -----
   *****  ****   9640   randomSeeds       18   |   -----                           bcall(_randInit)
   *****  ****   9652   parsingPtrs       28   |   -----                           manual restore                  quittting
   *****  ***    966E   cmdShadow        128   |   -----                           bcall(_clrTxtShd) then bcall(_saveCmdShadow)
                                                                                   LnReg and manual restore for MirageOS
   *****  ****   96EE   cmdShadowPtrs      6   |   -----                           bcall(_clrTxtShd) then bcall(_saveSmdShadow)
   ****   *****  96F4   editPtrs           8   |   opening edit buffer             -----                                                               
   *****  ****   96FC   listEditPtrs     121   |   -----                           zero  
   *****  ****   9775   graphTypes        48   |   -----                           zero
   *****  *      97A5   windowStuff       11   |   -----                           manual restore                 small and large text
   ****   *****  97B0   formatStuff       92   |   displaying OS formatted strings -----
   *****  *****  980C   equationStuff      9   |   ??? evaluating an equation?     zero
   ****   ****   9815                     11   |   ??? deleting stuff?             zero
   **     *      9820   stackPointers     20   |   user mem operations             manual restore                 appvars
   ****   *****  9834   pagedStuff         8   |   archive reading                 -----
   ****   *****  983C                     43   |   menus                           zero
   ****   *****  9867   flashTemp          9   |   reading flash                   -----
   ****   *****  9870   appRawKeyHandle    2   |   ???                             -----
   *****  *****  9872   appBakUpScrn L3  768   ^   -----                           -----
                 9B72                         4412                                                                        
                                                                                                              
   *****  ****   9C06   baseAppBrTab2    106   V   usb stuff                       bcall(_fillBasePageTable)      multi page apps on 83+SE
   *****  ****   9C70   usbStuff          62   |   usb stuff                       -----                                          
   ***    *****  9CAE   SESpeed            1   |   this might get randomly written to -----
   *****  *****  9CAF                    182   |   ???                             -----
   ****   *****  9D65   localTokStr       17   |   used by localization apps       -----
   ****   *****  9D76   keyToStr          18   |   ???                             -----
   *****  *****  9D88   sEdMonSp           2   |   small edit SP                   -----
   *****  *****  9D8A   bpSave            11   ^   usb stuff                       -----
                 9D95                         399
   
   Persistence:
   *****  barring obscure situations, this memory won't be touched by outside forces
   ****   some avoidable practices will overwrite this memory
   ***    normal operation may occasionally overwrite this memory 
   **     this memory location is not stable by any means, though, it's still memory
   *      this is hardly memory, it's only listed because it was in the way
   
   Collateral damage:
   *****  changing this memory has absolutely no effect on anything
   ****   there are some situations where changing this has an effect, though, you probably won't run into them
   ***    this makes some rather rare events fail, but it could happen
   **     this makes some common tasks fail
   *      honestly, the calculator basically crashed
   
   bcalls:
   bcall(_clrTxtShd)          Asm(EF4C45)         
   bcall(_delRes)             Asm(EF204A)
   bcall(_fillBasePageTable)  Asm(EF1150)
   bcall(_grReset)            Asm(EF3148)
   bcall(_randInit)           Asm(EF7F4B)
   bcall(_saveCmdShadow)      Asm(EF7345)
   bcall(_zeroFinanceVars)    Asm(EF2B51)

The collateral damage number is only correct if you follow my recommendations for cleanup. If you don't, then things might go very bad. What it breaks is what won't work when you are using that memory, it will work after you are done.

And when you clean up, I recommend you first zero all the memory you used, copy back the manual backup locations, and then run all the necessary bcalls.

Source: http://www.omnimaga.org/asm-language/8384-free-ram-areas/