qdosmsq:traps:trap_1:schp

SMS_SCHP

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.
D2.LUnused.D2.LCorrupted.
D3.LUnused.D3.LCorrupted.
A0.LBase address of area.A0.LPreserved.
A1.LUnused.A1.LCorrupted.
A2.LUnused.A2.LCorrupted.
A3.LUnused.A3.LCorrupted.
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