Home Type definitionsType definitions MacVersionMacVersion Memory Descriptor (MD) in TOSMemory Descriptor (MD) in TOS

I.10 Memory-Control-Block (MCB) in MagiC

typedef struct
{
    int32_t mcb_magic;        /* 'ANDR' or 'KROM' (last)       */
    int32_t mcb_len;          /* Nett length                   */
    int32_t mcb_owner;        /* Pointer to PD structure       */
    int32_t mcb_prev;         /* Previous block, or NULL       */
    int8_t mcb_data[0];
} MCB;

Note: The component mcb_magic has the value 'KROM' if no futher MCB follows, else the value 'ANDR'. In the latter case the next MCB lies mcb_len bytes behind the currrent MCB. The list is chained backwards with mcb_prev which considerably speeds up many operations.

With all memory operations the component mcb_magic is always checked, and if an error is found the system is halted immediately. For a halt due to a memory error the address of the faulty MCB as well as the data (4 LONGwords) are output. Subsequently one is asked on which

drive one would like a core dump to be saved. If one specifies a valid drive, then the whole ST memory from 0 to phystop is written to the root directory of the specified drive, and is assigned the

name '_sys_'. The file, depending on the ST model, can be up to 4 or even 16 MB long, of course.

Memory-resident programs (terminating themselves with Ptermres) now work - unlike earlier - in a way that the blocks are not released, all MCBs remain intact and continue to be used (each time one clicks in the menu-bar the free memory is output, for which the whole list is run through once and during this all MCBs are checked). Those who wish to do so can therefore release memory-resident programs (or also parts of them) subsequently.

See also: GEMDOS   MagiC   MD   Memory management


Home Type definitionsType definitions MacVersionMacVersion Memory Descriptor (MD) in TOSMemory Descriptor (MD) in TOS