Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Improved description for OS_Axm

Register parameters

Code Block
languagenone
titleRST 20H, DEFW $C406$C206
IN:
      A7IX = evenmemory bankhandle needed (forfrom segment 0 allocationprevious OS_Mop)
      A6B = fixedbank memory requested (no subject to swappingslot ORed)
      A5H = frompage anyaddress slothigh       A0-A1 = slot number if A5=0

      H = page offset byte ($00-$3F)
      L = number of pages to be wantedallocated (1 to 64)

OUT:  Fc = 0 if empty, memory foundhas atbeen bankallocated
B       Fc = 1, A = RC_Room if not enough space in slot(s)
              A = RC_Fail if bad argument

Registers changed after return:
     ..BCDE..DE..L/IXIY same
     AFBCAF....H.HL/.... different

Notes

This call tells application in which bank the memory area requested is free for allocationallocates a large contiguous memory area at explicit address. Refer to explicit memory allocation for further informationsinformation. This system call is only available in OZ release V4.6 and newer.

Related calls

...

This call does not return H modified for OS_Mop MM_Sx segment. The caller must preserve/restore H after call, then perform segment adjustment, for example:
Code Block
titleManually adjust allocated offset pointer to specific segment
...
        ld      h,0                             ; any bank offset
        ld      l,b                             ; B pages requested
        ld      a, FM_FIX | FM_ANY | FM_NOF     ; OS_Fma allocates an address from any slot
        oz      OS_Fma
        ret     c
        ld      d,h
        oz      OS_Axm                          ; allocate L pages at BH00
        ld      h,d
        ret     c
        res     7,h
        set     6,h                             ; link offset to S1, where allocated memory will be bound (see below)
        ld      l,0                             ; allocation is on page boundary
        ld      c,MS_S1                         ; bind successfully BHL allocated memory into local S1 address space
        oz      OS_Mpb
...

Applications should use OS_Mal for multiple page allocation, all convenience is provided there.

Related calls

OS_Axp, Allocate explicit page
OS_Bix, Bind in extended address 
OS_Box, Restore bindings after OS_Bix 
OS_Fc, Select fast code (fast bank switching) 
OS_Fma, Find memory for allocation 
OS_Fxm, Free explicit memory   
OS_Mal, Allocate memory
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