Amos Professional Manual  Contents  Index

Memory Banks


Deleting memory banks
During the course of a program, it may be necessary to define temporary memory banks for specific purposes. For instance, a title screen may need to be enhanced by an animation sequence or some background music. Since this data would only be needed at the beginning of the program, it would serve very little purpose to hold it in memory permanently, and the extra memory space could be better used for additional graphics and sound in the actual program. AMOS Professional allows you to delete memory banks directly from inside your programs.

The Amiga's memory system is notoriously wasteful, so care should be taken not to overuse this technique, otherwise although the CHIP FREE and FAST FREE functions may insist that there is plenty of memory available, you can still run out! If this should happen, it would be necessary to quit the program and re-start the Amiga, but providing you are aware of the potential problem and provided that memory banks are kept as small as is practical, all should be well.

ERASE
instruction: clear a single memory bank
Erase bank number

The ERASE command clears the memory space used by the specified bank number, and returns this memory to the main program, for future use. For example:

E> Reserve as Chip Work 5,1000: Rem Reserve temporary work bank 5
   Print "Free Chip Memory = ";Chip Free
   Wait Key
   Erase 5
   Print "There is now ";Chip Free; "available bytes."

ERASE ALL
instruction: clear all current memory banks
Erase All

This command is used to erase all memory banks that are assigned to the current program, quickly and completely!

Memory banks allocated to certain types of computer games can often become much larger than the actual program listings. In this case, it is sensible to store all Objects in separate files on disc, and only load them into memory when they are specifically needed in the game. This dramatically reduces the size of program files and makes it very easy to change the Objects independently of the main routines. It also allows the same Objects to be used for several different programs.

In order to exploit this system, all the memory banks used by the program need to be carefully erased before the program is saved to disc, otherwise masses of useless data could be stored as part of the program listing. Use the ERASE ALL command carefully to save large amounts of valuable disc space.

Back    Next
05.09.06