EM_survey Function (ROM Call 0x165)

flash.h

void EM_survey (unsigned long *inUse, unsigned long *freedByGC, unsigned long *free, unsigned long *unusedSectors, unsigned long *badSectors, unsigned long *allExceptBaseCode);

Collects some useful information about the archive memory.

EM_survey collects some useful information about the archive memory and stores them in six variables pointed to by arguments. *inUse is the number of used bytes. *freedByGC is the number of bytes which will be freed by performing garbage collection (see EM_GC). free is the number of free bytes (not counting bytes occupied by "deleted" blocks, which will become "free" only after the garbage collection). *unusedSectors is the number of bytes in "unused" sectors. I don't know why the archive memory contains usually one unused sector (i.e. sector which is never used for archiving purposes). The program called "MoreMem" just marks such unused sectors as "sectors in use" to get more archive memory (?). *badSectors is the number of bytes in bad sectors, but I am not so sure what "bad sectors" really means. *allExceptBaseCode is the number of all bytes in the Flash ROM which are not occupied by TIOS. This argument is new in AMS 2.xx, but you must use six arguments even on AMS 1.xx. If you don't need a particular information, you may pass NULL as the argument. TIOS will see it's a null pointer and will not save anything in it.

TIOS uses only freedByGC and free and always passes NULL to everything else. *freedByGC + *free is used to tell the user how much archive memory is available. Thanks to Johan Eilert for information how EM_survey should be used correctly on both AMS 1.xx and AMS 2.xx.


Uses: FlashMemoryEnd, ROM Call 0x3CF, ROM Call 0x3D1, ROM Call 0x4F3