...
Code Block | ||
---|---|---|
| ||
IN: A = 0, always (see notes below) BC = requested size of reserved memory in bytes (2 to 25616384) IX = memory handle (returned from OS_Mop) OUT, if call successful: Fc = 0 HL = address of memory allocated (H14 & H15 are memory mask) B = bank number of allocated memory C = segment specifier implied by HL (H14 & H15) OUT, if call failed: Fc = 1 A = error code: RC_HAND ($08), IX is not a valid memory handle RC_ROOM ($07), no room to allocate block in MEMORY POOL RC_ERR ($0F), if BC > 256 bytes, fatal error Registers changed after return: ....DE../IXIY same AFBC..HL/.... different |
Notes
If a large block is requested (more than 256 bytes), MM_MUL has to be specified in OS_Mop.
Remember "No Room" means the pool is exhausted, and not the whole of memory. If a subsequent OS_Mop cannot allocate a pool, then memory is definitively exhausted.
...
Normally memory is allocated from slots 1-2-3-0 in that order.
If you specified If MM_MUL is not specified in OS_Mop, you can force slot 1-3 during first
OS_Mal by loading A with slot numberIf you didn't specify MM_MUL, all memory allocated from that pool is
guaranteed to be in same bank. Additionally, memory area returned from
OS_Mal is guaranteed to be in single page.
If MM_MUL is specified in OS_Mop, slot 1-3 can be forced during first OS_Mal by loading A with slot number.
Related calls
OS_Bix, Bind in extended address
OS_Box, restore bindings after OS_Bix
OS_Fc, select fast code (fast bank switching)
OS_Mcl, close memory (free memory pool)
OS_Mfr, free (previously allocated block) memory
OS_Mgb, get current bank binding in segment
OS_Mop, open memory (allocate memory pool)
OS_Mpb, set new bank binding in segment
OZ_Mgb, get current bank binding in segment
OZ_Mpb, set new bank binding in segment