This trap returns part of an allocation to the common heap. See MT_ALCHP.

Call ParametersReturn Parameters
D0.B$38D0.LError return.
D1.LNew size required. D1.LNew size allocated.
A0.LBase address of area.A0.LPreserved.
ERR_NJInvalid Job.
  • All registers not shown above are not used on entry and are preserved on exit.
  • The new, reduced, size of the area still starts at the original address. It is the higher portion which is returned to the heap. This trap is useful when you want to have a smaller area than before. It is better to reduce the size this way than to return the whole area to the heap and allocate a new area of the smaller size.

The example below shows an allocation being reduced to $800 bytes. It is assumed that A0.L contains the address of the original allocation.

alloc   moveq   #$38,d0         ; SMS_SCHP
        move.l  #$800,d1        ; New allocation
        trap    #1              ; Reduce the allocation
        ...                     ; Do something here.
  • qdosmsq/traps/trap_1/schp.txt
  • Last modified: 2011/02/28 16:13
  • by george.gwilt