qdosmsq:vectors:alhp

MM_ALLOC/MEM_ALHP - Vector $D8

This vector allocates space in a user heap.

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.L Pointer to pointer to free space A0.LAddress of allocated area.
A1.LUnused A1.LCorrupted.
A2.LUnused A2.LCorrupted.
A3.LUnused A3.LCorrupted.
ERR_OMOut of memory.
  • All registers not shown above are not used on entry and are preserved on exit.
  • The space allocated contains in its first long word the size of the space. Provided the user has a copy of this size the whole of the space can be used.

The example below shows how to obtain space from a user heap.

It is assumed that A6 points to the data space and that the address of the pointer to free space is in heapad(a6). See MM_LNKFR/MEM_REHP.

        move.l  #504,d1         ; Number of bytes needed
        lea     heapad(a6),a0   ; Pointer to pointer to free space
        movea.w MM_ALLOC,a2     ; address of MM_ALLOC
	jsr	(a2)		; Make the call
	bne.s	Error_handler	; Oops!
  • qdosmsq/vectors/alhp.txt
  • Last modified: 2009/02/12 14:46
  • by george.gwilt