QDOS Internals

Anything you never knew you wanted to know about the Sinclair QL.

User Tools

Site Tools



This vector allocates memory on the common heap. It should only be called in supervisor mode. The vector call is atomic.

Call ParametersReturn Parameters
D0.LUnusedD0.LError code.
D1.LNumber of bytes required. D1.LNumber of bytes allocated.
D2.LUnused D2.LCorrupted.
D3.LUnused D3.LCorrupted.
A0.LUnused A0.LAddress of allocated area.
A1.LUnused A1.LCorrupted.
A2.LUnused A2.LCorrupted.
A3.LUnused A3.LCorrupted.
A6.LSystem variables address A6.LPreserved.


ERR_OMOut of memory.


  • All registers not shown above are not used on entry and are preserved on exit.
  • Must be called in supervisor mode only.
  • Mainly used in device driver 'open' routines to allocate space for channel definition blocks and so on.
  • The area allocated is filled with $00. (Zeroised.)
  • This vector call is atomic.


The example below shows the use of this vector to allocate an area of 16 bytes for use by the routine.

Get_hp  move.w  MM_ALCHP,A2     ; MM_ALCHP vector address.
        moveq   #16,d1          ; Number of bytes required.
                                ; Assume A6 is correct already
        jsr     (a2)            ; Make the call
        bne.s   Error_handler   ; Oops!

All_ok	cmpi.b  #16,d1          ; Did we get 16 bytes?
	bne.s   Error_handler   ; No, oops!

Got_hp  ...                     ; Do something here.
qdosmsq/vectors/achp.txt · Last modified: 2010/10/25 16:42 by george.gwilt