mirror of
https://github.com/elliotnunn/mac-rom.git
synced 2024-12-22 23:29:27 +00:00
4325cdcc78
Resource forks are included only for .rsrc files. These are DeRezzed into their data fork. 'ckid' resources, from the Projector VCS, are not included. The Tools directory, containing mostly junk, is also excluded.
1461 lines
37 KiB
Plaintext
1461 lines
37 KiB
Plaintext
;
|
|
; File: MemMgrGlue.a
|
|
;
|
|
; Contains: 68xxx assembly language glue for Memory Manager traps.
|
|
;
|
|
; Written by: Jeff Crawford
|
|
;
|
|
; Copyright: © 1993 by Apple Computer, Inc., all rights reserved.
|
|
;
|
|
; Change History (most recent first):
|
|
;
|
|
; <29> 8/5/93 BT <BT, JC> We came, we saw, we initialed...
|
|
; <28> 7/9/93 JC Fixed HSetStateQ interface bug #1095338.
|
|
; <27> 7/7/93 BT <EPT> Continuation of Radar #1095398. I forgot to put in D1 trap
|
|
; parameter for native glue calling conventions some time back,
|
|
; now that it is used it needs to be there. This file needs the
|
|
; proper naming convention to do the right thing.
|
|
; <26> 6/9/93 JC Removed outdated comments.
|
|
; <25> 6/9/93 JC Rearranged _HeapDispatchSelectors to be in order. This requires
|
|
; a change to the ProcessMgr. Took out extra save and restore of
|
|
; A0 for GetHandleSize and EmptyHandle.
|
|
; <24> 6/4/93 JC Cleaned up Glue for ReallocHandle & SetHandleSize.
|
|
; <23> 5/25/93 BT Change routines named "_Å" to "__Å". This supports native
|
|
; naming conventions for shared libraries.
|
|
; <22> 5/21/93 JC Support for QuickTime 1.6 now worked. Fixed but where error
|
|
; code was return when any QT routine was called.
|
|
; <21> 5/20/93 JC Cleaned up call back procs. Removed c_MoreMastersHi. Added
|
|
; c_RegisterDisposeProc API for ProcessMgr.
|
|
; <20> 5/20/93 JC Added support for QuickTime 1.6. QT 1.6 does not work
|
|
; yet until I get some initialization info from Peter.
|
|
; <19> 5/19/93 JC Added comment for ReallocHandle. The interface to ReallocHandle
|
|
; needs to be fixed later.
|
|
; <18> 5/18/93 BT Added prefix "FIG_" to all trap entry points to distinguish
|
|
; between old and new heap managers.
|
|
; <17> 5/2/93 JC Added 2 new calls, GetZoneCompatibilityFlags and
|
|
; SetZoneCompatibilityFlags.
|
|
;
|
|
;
|
|
;
|
|
;
|
|
; Notes:
|
|
; 1) Since C sign extends all chars and shorts to 32 bit values, we always push
|
|
; longwords on the stack.
|
|
;
|
|
;
|
|
;
|
|
; for Most MM calls:
|
|
;
|
|
; 1) Receive stuff from trap dispatched
|
|
; 2) Reorganize to C calling conventions
|
|
; 3) Jump To it.
|
|
; 4) Put parameters back for trap dispatcher
|
|
;
|
|
; for new MM calls: (ie.- NewHandleHi)
|
|
; 1) check to the select to see if its in my range
|
|
; 2) if not return paramErr
|
|
; 3) get routine address from selector
|
|
; 4) adjust parameters to call C routine
|
|
; 5) jump to it.
|
|
; 6) Put parameters back for trap dispatcher
|
|
|
|
CASE ON
|
|
MACHINE MC68020
|
|
|
|
INCLUDE 'SysEqu.a'
|
|
INCLUDE 'SysErr.a'
|
|
INCLUDE 'Traps.a'
|
|
|
|
IF PATCHEDIN THEN
|
|
SEG 'Figment'
|
|
ENDIF
|
|
|
|
|
|
MMGlueCode PROC
|
|
import c_InitZone
|
|
import c_SetApplLimit
|
|
import c_MaxApplZone
|
|
import c_MoreMasters
|
|
import c_GetZone
|
|
import c_SetZone
|
|
import c_NewHandle
|
|
import c_NewEmptyHandle
|
|
import c_DisposeHandle
|
|
import c_GetHandleSize
|
|
import c_GetHandleSize
|
|
import c_HandleZone
|
|
import c_SetHandleSize
|
|
import c_RecoverHandle
|
|
import c_ReallocHandle
|
|
import c_NewPtr
|
|
import c_DisposePtr
|
|
import c_GetPtrSize
|
|
import c_SetPtrSize
|
|
import c_PtrZone
|
|
import c_FreeMem
|
|
import c_MaxMem
|
|
import c_CompactMem
|
|
import c_ReserveMem
|
|
import c_PurgeMem
|
|
import c_EmptyHandle
|
|
import c_HLock
|
|
import c_HUnlock
|
|
import c_HPurge
|
|
import c_HNoPurge
|
|
import c_SetGrowZone
|
|
import c_MoveHHi
|
|
import c_MoveHLow
|
|
import c_MaxBlock
|
|
import c_PurgeSpace
|
|
import c_StackSpace
|
|
import c_HSetRBit
|
|
import c_HClrRBit
|
|
import c_HGetState
|
|
import c_HSetState
|
|
|
|
import c_InitProcessMgrHeap
|
|
import c_ShrinkSysHeap
|
|
import c_LowerProcessMgrZoneBottom
|
|
import c_ShrinkProcessMgrZone
|
|
import c_ExtendSystemZone
|
|
import c_ReclaimSpaceIfSysHeapLow
|
|
import c_StraddleBlockSize
|
|
import c_ProcessMgrMaxBlock
|
|
import c_GetProcessMgrLoFreeBytes
|
|
import c_GetSystemHiFreeBytes
|
|
import c_RegisterDisposeProc
|
|
import c_NewHandleHi
|
|
import c_GetNextBlockInHeap
|
|
import c_DisposeZone
|
|
import c_SetZoneCompatibilityFlags
|
|
import c_GetZoneCompatibilityFlags
|
|
|
|
import c_RegisterHandleTrashNotification
|
|
import c_UnregisterHandleTrashNotification
|
|
import c_TrashZone
|
|
import c_TrashProcess
|
|
import c_TrashMemoryArea
|
|
import c_NewHandleSystemSafe
|
|
import c_NewPtrSystemSafe
|
|
import c_EnoughSystemHeapSlop
|
|
|
|
|
|
IF PATCHEDIN THEN
|
|
export a_InitZone
|
|
export a_SetApplLimit
|
|
export a_MaxApplZone
|
|
export a_MoreMasters
|
|
export a_GetZone
|
|
export a_SetZone
|
|
export a_NewHandle
|
|
export a_NewEmptyHandle
|
|
export a_DisposeHandle
|
|
export a_GetHandleSize
|
|
export a_SetHandleSize
|
|
export a_HandleZone
|
|
export a_RecoverHandle
|
|
export a_ReallocHandle
|
|
export a_NewPtr
|
|
export a_DisposePtr
|
|
export a_GetPtrSize
|
|
export a_SetPtrSize
|
|
export a_PtrZone
|
|
export a_FreeMem
|
|
export a_MaxMem
|
|
export a_CompactMem
|
|
export a_ReserveMem
|
|
export a_PurgeMem
|
|
export a_EmptyHandle
|
|
export a_HLock
|
|
export a_HUnlock
|
|
export a_HPurge
|
|
export a_HNoPurge
|
|
export a_SetGrowZone
|
|
export a_MoveHHi
|
|
export a_MoveHLow
|
|
export a_MaxBlock
|
|
export a_PurgeSpace
|
|
export a_StackSpace
|
|
export a_HSetRBit
|
|
export a_HClrRBit
|
|
export a_HGetState
|
|
export a_HSetState
|
|
export a_MemoryDispatch
|
|
ELSE
|
|
export FIG_INITZONETRAP
|
|
export FIG_SETAPPLLIMIT
|
|
export FIG_MAXAPPLZONE
|
|
export FIG_MOREMASTERS
|
|
export FIG_GETZONE
|
|
export FIG_SETZONE
|
|
export FIG_NWHANDLE
|
|
export FIG_NEWEMPTYHANDLETRAP
|
|
export FIG_DSPOSEHANDLE
|
|
export FIG___GETHANDLESIZE
|
|
export FIG_SETHANDLESIZETRAP
|
|
export FIG_HANDLEZONETRAP
|
|
export FIG_RECOVERHANDLETRAP
|
|
export FIG_REALLOCHANDLETRAP
|
|
export FIG_NEWPTRTRAP
|
|
export FIG_DISPOSEPTR
|
|
export FIG_GETPTRSIZETRAP
|
|
export FIG_SETPTRSIZETRAP
|
|
export FIG_PTRZONETRAP
|
|
export FIG_FREEMEM
|
|
export FIG_MAXMEMTRAP
|
|
export FIG_COMPACTMEMTRAP
|
|
export FIG_RESRVMEM
|
|
export FIG_PURGEMEM
|
|
export FIG_EMPTYHANDLE
|
|
export FIG_HLOCK
|
|
export FIG_HUNLOCK
|
|
export FIG_HPURGE
|
|
export FIG_HNOPURGE
|
|
export FIG_SETGROWZONE
|
|
export FIG_MOVEHHI
|
|
export FIG_MOVEHLOW
|
|
export FIG_MAXBLOCKTRAP
|
|
export FIG_PURGESPACETRAP
|
|
export FIG_STACKSPACETRAP
|
|
export FIG_HRSRC
|
|
export FIG_HNORSRC
|
|
export FIG_HGETFLAGS
|
|
export FIG_HSETFLAGS
|
|
export HEAPDISPATCH
|
|
ENDIF
|
|
|
|
; ** offsets for new MM calls **
|
|
PreTable
|
|
dc.l $6a656666
|
|
Table
|
|
; This is the selector range for the QT compatibility traps.
|
|
dc.w a_HLockQ-Table ; $0 = HLockQ
|
|
dc.w a_HUnlockQ-Table ; $1 = HUnlockQ
|
|
dc.w a_HPurgeQ-Table ; $2 = HPurgeQ
|
|
dc.w a_HNoPurgeQ-Table ; $3 = HNoPurgeQ
|
|
dc.w a_HGetStateQ-Table ; $4 = HGetStateQ
|
|
dc.w a_HSetStateQ-Table ; $5 = HSetStateQ
|
|
|
|
dc.w a_RegisterHandleTrashNotification-Table ; $6
|
|
dc.w a_RegisterPtrTrashNotification-Table ; $7
|
|
dc.w a_UnregisterHandleTrashNotification-Table ; $8
|
|
dc.w a_UnregisterPtrTrashNotification-Table ; $9
|
|
dc.w a_TrashZone-Table ; $A = TrashZone
|
|
dc.w a_TrashMemoryArea-Table ; $B = TrashMemoryArea
|
|
dc.w a_TrashProcess-Table ; $C = TrashProcess
|
|
|
|
dc.w a_NewHandleSystemSafe-Table ; $D = NewHandleSystemSafe
|
|
dc.w a_EnoughSystemHeapSlop-Table ; $E = EnoughSystemHeapSlop
|
|
dc.w a_NewPtrSystemSafe-Table ; $F = NewPtrSystemSafe
|
|
|
|
; This is the table for Traps provided by the new heap manager. Most but not
|
|
; all of these traps are to support the ProcessMgr....
|
|
dc.w a_InitProcessMgrHeap-Table ; $10 = InitProcessMgrHeap (internal use only)
|
|
dc.w a_ShrinkSysHeap-Table ; $11 = ShrinkSysHeap (internal use only)
|
|
dc.w a_LowerProcessMgrZoneBottom-Table ; $12 = LowerProcessMgrZoneBottom (internal use only)
|
|
dc.w a_ShrinkProcessMgrZone-Table ; $13 = ShrinkProcessMgrZone (internal use only)
|
|
dc.w a_ExtendSystemZone-Table ; $14 = ExtendSystemZone (internal use only)
|
|
dc.w a_ReclaimSpaceIfSysHeapLow-Table ; $15 = ReclaimSpaceIfSysHeapLow (internal use only)
|
|
dc.w a_StraddleBlockSize-Table ; $16 = StraddleBlockSize (internal use only)
|
|
dc.w a_ProcessMgrMaxBlock-Table ; $17 = ProcessMgrMaxBlock (internal use only)
|
|
dc.w a_GetProcessMgrLoFreeBytes-Table ; $18 = GetProcessMgrLoFreeBytes (internal use only)
|
|
dc.w a_GetSystemHiFreeBytes-Table ; $19 = GetSystemHiFreeBytes (internal use only)
|
|
dc.w a_NewHandleHi-Table ; $1A = NewHandleHi
|
|
dc.w a_GetNextBlock-Table ; $1B = GetNextBlock
|
|
dc.w a_RegisterDisposeProc-Table ; $1C = RegisterDisposeProc
|
|
dc.w a_DisposeZone-Table ; $1D = DisposeZone
|
|
dc.w a_SetZoneCompatibilityFlags-Table ; $1E = SetZoneCompatibilityFlags
|
|
dc.w a_GetZoneCompatibilityFlags-Table ; $1F = GetZoneCompatibilityFlags
|
|
TableSize equ *-Table ; table size in bytes
|
|
PostTable
|
|
dc.l $6a656666
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_InitZone. Interface for InitZone
|
|
;
|
|
; Input A0 = pointer to parameter block,
|
|
; Output D0 = result code (word)
|
|
;
|
|
; Comment: This is not the most efficient implementation, but it allows
|
|
; a similar calling convention
|
|
;
|
|
IF PATCHEDIN THEN
|
|
a_InitZone
|
|
ELSE
|
|
FIG_INITZONETRAP
|
|
ENDIF
|
|
|
|
move.l (A0),-(SP) ; put zone start on the stack
|
|
move.l 4(A0),-(SP) ; put zone limit on the stack
|
|
sub.l D0,D0 ; make MP count a 32 bit value
|
|
move.w 8(A0),D0 ; for C calling conventions
|
|
move.l D0,-(SP) ; put MP count on the stack
|
|
move.l $A(A0),-(SP) ; put grow zone ptr on the stack
|
|
jsr c_InitZone ; call C implementation
|
|
lea $10(SP),SP ; clean up 16 bytes off the stack
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_SetApplLimit. Interface for SetApplLimit
|
|
;
|
|
; Input A0 = Zone limit
|
|
; Output D0 = result code (word)
|
|
;
|
|
IF PATCHEDIN THEN
|
|
a_SetApplLimit
|
|
ELSE
|
|
FIG_SETAPPLLIMIT
|
|
ENDIF
|
|
|
|
move.l A0,-(sp) ; put parameter block ptr on stack
|
|
jsr c_SetApplLimit ; call C implementation
|
|
addq #4,sp ; clean up stack
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_MaxApplZone. Interface for MaxApplZone
|
|
;
|
|
; Inputs none;
|
|
; Output D0 = result code (word)
|
|
;
|
|
IF PATCHEDIN THEN
|
|
a_MaxApplZone
|
|
ELSE
|
|
FIG_MAXAPPLZONE
|
|
ENDIF
|
|
|
|
jsr c_MaxApplZone ; call C implementation
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_MoreMasters. Interface for MoreMasters
|
|
;
|
|
; Input none;
|
|
; Output D0 = result code (word)
|
|
;
|
|
IF PATCHEDIN THEN
|
|
a_MoreMasters
|
|
ELSE
|
|
FIG_MOREMASTERS
|
|
ENDIF
|
|
|
|
jsr c_MoreMasters ; call C implementation
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_GetZone. Interface for GetZone
|
|
;
|
|
; Input none;
|
|
; Outputs D0 = result code (word)
|
|
; A0 = the zone (long)
|
|
;
|
|
IF PATCHEDIN THEN
|
|
a_GetZone
|
|
ELSE
|
|
FIG_GETZONE
|
|
ENDIF
|
|
|
|
jsr c_GetZone ; call C implementation
|
|
move.l D0,A0 ; move result into A0
|
|
sub.l D0,D0 ; result = noErr
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_SetZone. Interface for SetZone
|
|
;
|
|
; Input A0 = the zone (long)
|
|
; Output D0 = result code (word)
|
|
;
|
|
IF PATCHEDIN THEN
|
|
a_SetZone
|
|
ELSE
|
|
FIG_SETZONE
|
|
ENDIF
|
|
|
|
move.l A0,-(SP) ; put new zone ptr on the stack
|
|
jsr c_SetZone ; call C implementation
|
|
addq #4,SP ; cleanup 4 bytes from the stack
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_NewHandle. Interface for NewHandle
|
|
;
|
|
; Inputs D0 = size (long)
|
|
; D1 = trap word (word)
|
|
; Outputs D0 = result code (word)
|
|
; A0 = the handle (long)
|
|
;
|
|
IF PATCHEDIN THEN
|
|
a_NewHandle
|
|
ELSE
|
|
FIG_NWHANDLE
|
|
ENDIF
|
|
|
|
subq #4,SP ; make space for handle
|
|
move.l D0,-(SP) ; put size on the stack
|
|
move.l D1,-(SP) ; put trap word on the stack
|
|
pea 8(SP) ; push pointer to handle on stack
|
|
jsr c_NewHandle ; call C implementation
|
|
lea 12(SP),SP ; cleanup 12 bytes from the stack
|
|
move.l (SP)+,A0 ; put handle in A0
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_NewEmptyHandle. Interface for NewEmptyHandle
|
|
;
|
|
; Inputs D1 = trap word (word)
|
|
; Outputs D0 = result code (word)
|
|
; A0 = the handle (long)
|
|
;
|
|
IF PATCHEDIN THEN
|
|
a_NewEmptyHandle
|
|
ELSE
|
|
FIG_NEWEMPTYHANDLETRAP
|
|
ENDIF
|
|
|
|
subq #4,SP ; make space for handle
|
|
move.l D1,-(SP) ; put trap word on the stack (C requires long)
|
|
pea 4(SP) ; push pointer to handle on stack
|
|
jsr c_NewEmptyHandle ; call C implementation
|
|
addq #8,SP ; cleanup 8 bytes from the stack
|
|
move.l (SP)+,A0 ; put handle in A0
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_DisposeHandle. Interface for DisposeHandle
|
|
;
|
|
; Input A0 = handle to dispose
|
|
; Output D0 = result code (word)
|
|
;
|
|
IF PATCHEDIN THEN
|
|
a_DisposeHandle
|
|
ELSE
|
|
FIG_DSPOSEHANDLE
|
|
ENDIF
|
|
|
|
move.l A0,-(SP) ; put handle on stack
|
|
jsr c_DisposeHandle ; call C implementation
|
|
addq #4,SP ; clean up stack
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_GetHandleSize. Interface for GetHandleSize
|
|
;
|
|
; Input A0 = handle to get
|
|
; Output D0 = if >= 0, size of handle (long), this is handled by c_GetHandleSize
|
|
; if < 0, result code (word)
|
|
;
|
|
; Note: The extra note in IM about GetHandleSize returning 0 is handled in the
|
|
; the MPW glue to this routine. We can't do it here.
|
|
;
|
|
;
|
|
IF PATCHEDIN THEN
|
|
a_GetHandleSize
|
|
ELSE
|
|
FIG___GETHANDLESIZE
|
|
ENDIF
|
|
|
|
move.l A0,-(SP) ; put handle on stack
|
|
jsr c_GetHandleSize ; call C implementation
|
|
addq #4,SP ; clean up stack
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_SetHandleSize. Interface for SetHandleSize
|
|
;
|
|
; Inputs D0 = requested size
|
|
; A0 = handle to set
|
|
; Output D0 = result code (word)
|
|
;
|
|
;
|
|
;
|
|
IF PATCHEDIN THEN
|
|
a_SetHandleSize
|
|
ELSE
|
|
FIG_SETHANDLESIZETRAP
|
|
ENDIF
|
|
|
|
move.l D0,-(SP) ; put size on stack
|
|
move.l A0,-(SP) ; put handle on stack
|
|
jsr c_SetHandleSize ; call C implementation
|
|
addq #8,SP ; clean up stack
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_HandleZone. Interface for c_HandleZone
|
|
;
|
|
; Inputs A0 = handle (long)
|
|
; Outputs D0 = result code (word)
|
|
; A0 = the handle (long)
|
|
;
|
|
IF PATCHEDIN THEN
|
|
a_HandleZone
|
|
ELSE
|
|
FIG_HANDLEZONETRAP
|
|
ENDIF
|
|
|
|
subq #4,SP ; make space for the zone
|
|
move.l A0,-(SP) ; put handle on the stack
|
|
pea 4(SP) ; push pointer to the zone on stack
|
|
jsr c_HandleZone ; call C implementation
|
|
addq #8,SP ; cleanup 8 bytes from the stack
|
|
move.l (SP)+,A0 ; put handle in A0
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_RecoverHandle. Interface for RecoverHandle
|
|
;
|
|
; Inputs A0 = handle (long)
|
|
; Outputs A0 = the handle (long)
|
|
; *Warning*, D0 is unchanged
|
|
;
|
|
IF PATCHEDIN THEN
|
|
a_RecoverHandle
|
|
ELSE
|
|
FIG_RECOVERHANDLETRAP
|
|
ENDIF
|
|
|
|
move.l D0,-(SP) ; Save D0 for some stupid reason
|
|
move.l A0,-(SP) ; put client ptr on the stack
|
|
move.l D1,-(SP) ; put trap word on the stack (C requires long)
|
|
jsr c_RecoverHandle ; call C implementation
|
|
addq #8,SP ; cleanup 8 bytes from the stack
|
|
move.l D0,A0 ; move the handle to A0
|
|
move.l (SP)+,D0 ; restore D0
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_ReallocHandle. Interface for ReallocHandle
|
|
;
|
|
; Inputs D0 = size to allocate (long)
|
|
; A0 = original handle
|
|
; Output D0 = result code (word)
|
|
;
|
|
;
|
|
;
|
|
IF PATCHEDIN THEN
|
|
a_ReallocHandle
|
|
ELSE
|
|
FIG_REALLOCHANDLETRAP
|
|
ENDIF
|
|
|
|
move.l D0,-(SP) ; put size on stack
|
|
move.l A0,-(SP) ; put handle on stack
|
|
jsr c_ReallocHandle ; call C implementation
|
|
addq #8,SP ; cleanup 8 bytes from the stack
|
|
rts
|
|
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_NewPtr. Interface for NewPtr
|
|
;
|
|
; Inputs D0 = size (long)
|
|
; D1 = trap word (word)
|
|
; Outputs D0 = result code (word)
|
|
; A0 = thePtr (long)
|
|
;
|
|
IF PATCHEDIN THEN
|
|
a_NewPtr
|
|
ELSE
|
|
FIG_NEWPTRTRAP
|
|
ENDIF
|
|
|
|
subq #4,SP ; make space for handle
|
|
move.l D0,-(SP) ; put size on the stack
|
|
move.l D1,-(SP) ; put trap word on the stack (C requires long)
|
|
pea 8(SP) ; push pointer to thePtr on stack
|
|
jsr c_NewPtr ; call C implementation
|
|
lea $C(SP),SP ; cleanup 12 bytes from the stack
|
|
move.l (SP)+,A0 ; put thePtr in A0
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_DisposePtr. Interface for DisposePtr
|
|
;
|
|
; Input A0 = ptr to dispose
|
|
; Output D0 = result code (word)
|
|
;
|
|
IF PATCHEDIN THEN
|
|
a_DisposePtr
|
|
ELSE
|
|
FIG_DISPOSEPTR
|
|
ENDIF
|
|
|
|
move.l A0,-(SP) ; put ptr on stack
|
|
jsr c_DisposePtr ; call C implementation
|
|
addq #4,SP ; clean up stack
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_GetPtrSize. Interface for GetPtrSize
|
|
;
|
|
; Input A0 = handle to get
|
|
; Output D0 = if >= 0, size of handle (long), this is handled by c_GetHandleSize
|
|
; if < 0, result code (word)
|
|
;
|
|
; Note: The extra note in IM about GetPtrSize returning 0 is handled in the
|
|
; the MPW glue to this routine. We can't do it here.
|
|
;
|
|
IF PATCHEDIN THEN
|
|
a_GetPtrSize
|
|
ELSE
|
|
FIG_GETPTRSIZETRAP
|
|
ENDIF
|
|
|
|
move.l A0,-(SP) ; put handle on stack
|
|
jsr c_GetPtrSize ; call C implementation
|
|
addq #4,SP ; clean up stack
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_SetPtrSize. Interface for SetPtrSize
|
|
;
|
|
; Inputs D0 = requested size
|
|
; A0 = handle to set
|
|
; Output D0 = result code (word)
|
|
;
|
|
IF PATCHEDIN THEN
|
|
a_SetPtrSize
|
|
ELSE
|
|
FIG_SETPTRSIZETRAP
|
|
ENDIF
|
|
|
|
move.l D0,-(SP) ; put size on stack
|
|
move.l A0,-(SP) ; put handle on stack
|
|
jsr c_SetPtrSize ; call C implementation
|
|
addq #8,SP ; clean up stack
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_PtrZone. Interface for PtrZone
|
|
;
|
|
; Inputs A0 = handle (long)
|
|
; Outputs D0 = result code (word)
|
|
; A0 = the handle (long)
|
|
;
|
|
IF PATCHEDIN THEN
|
|
a_PtrZone
|
|
ELSE
|
|
FIG_PTRZONETRAP
|
|
ENDIF
|
|
|
|
subq #4,SP ; make space for the zone
|
|
move.l A0,-(SP) ; put ptr on the stack
|
|
pea 4(SP) ; push pointer to the zone on stack
|
|
jsr c_PtrZone ; call C implementation
|
|
addq #8,SP ; cleanup 8 bytes from the stack
|
|
move.l (SP)+,A0 ; put zone in A0, cleanup stack
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_FreeMem. Interface for FreeMem
|
|
;
|
|
; Input D1 = trap word (word)
|
|
; Output D0 = function result (long word)
|
|
;
|
|
IF PATCHEDIN THEN
|
|
a_FreeMem
|
|
ELSE
|
|
FIG_FREEMEM
|
|
ENDIF
|
|
|
|
move.l D1,-(SP) ; put trap word on the stack (C requires long)
|
|
jsr c_FreeMem ; call C implementation
|
|
addq #4,sp ; clean up stack
|
|
rts
|
|
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_MaxMem. Interface for MaxMem
|
|
;
|
|
; Inputs D1 = trap word (word)
|
|
; Outputs D0 = function result (long)
|
|
; A0 = grow size (long)
|
|
;
|
|
IF PATCHEDIN THEN
|
|
a_MaxMem
|
|
ELSE
|
|
FIG_MAXMEMTRAP
|
|
ENDIF
|
|
|
|
subq #4,SP ; make space for grow size
|
|
pea (SP) ; push pointer to grow size on stack
|
|
move.l D1,-(SP) ; put trap word on the stack (C requires long)
|
|
jsr c_MaxMem ; call C implementation
|
|
addq #8,SP ; cleanup 6 bytes from the stack
|
|
move.l (SP)+,A0 ; put grow size in A0, adjust stack
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_CompactMem. Interface for CompactMem
|
|
;
|
|
; Inputs D0 = size needed (long)
|
|
; D1 = trap word (word)
|
|
; Outputs D0 = function result (long)
|
|
;
|
|
IF PATCHEDIN THEN
|
|
a_CompactMem
|
|
ELSE
|
|
FIG_COMPACTMEMTRAP
|
|
ENDIF
|
|
|
|
move.l D0,-(SP) ; put sizeNeeded of stack
|
|
move.l D1,-(SP) ; put trap word on the stack (C requires long)
|
|
jsr c_CompactMem ; call C implementation
|
|
addq #8,SP ; cleanup 6 bytes from the stack
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_ReserveMem. Interface for ReserveMem
|
|
;
|
|
; Inputs D0 = size needed (long)
|
|
; D1 = trap word (word)
|
|
; Outputs D0 = function result (long)
|
|
;
|
|
IF PATCHEDIN THEN
|
|
a_ReserveMem
|
|
ELSE
|
|
FIG_RESRVMEM
|
|
ENDIF
|
|
|
|
move.l D0,-(SP) ; put sizeNeeded of stack
|
|
move.l D1,-(SP) ; put trap word on the stack (C requires long)
|
|
jsr c_ReserveMem ; call C implementation
|
|
addq #8,SP ; cleanup 6 bytes from the stack
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_PurgeMem. Interface for PurgeMem
|
|
;
|
|
; Inputs D0 = size needed (long)
|
|
; D1 = trap word (word)
|
|
; Outputs D0 = function result (long)
|
|
;
|
|
IF PATCHEDIN THEN
|
|
a_PurgeMem
|
|
ELSE
|
|
FIG_PURGEMEM
|
|
ENDIF
|
|
|
|
move.l D0,-(SP) ; put sizeNeeded of stack
|
|
move.l D1,-(SP) ; put trap word on the stack (C requires long)
|
|
jsr c_PurgeMem ; call C implementation
|
|
addq #8,SP ; cleanup 6 bytes from the stack
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_EmptyHandle. Interface for EmptyHandle
|
|
;
|
|
; Input A0 = handle to empty
|
|
; Output D0 = result code (word)
|
|
; A0 = handle to empty
|
|
;
|
|
; note: The Handle does not change, however the MP does.
|
|
;
|
|
IF PATCHEDIN THEN
|
|
a_EmptyHandle
|
|
ELSE
|
|
FIG_EMPTYHANDLE
|
|
ENDIF
|
|
|
|
move.l A0,-(SP) ; put handle on stack
|
|
jsr c_EmptyHandle ; call C implementation
|
|
addq #4,SP ; clean up stack
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_HLock. Interface for HLock
|
|
;
|
|
; Input A0 = handle to lock
|
|
; Output D0 = result code (word)
|
|
;
|
|
IF PATCHEDIN THEN
|
|
a_HLock
|
|
ELSE
|
|
FIG_HLOCK
|
|
ENDIF
|
|
|
|
move.l A0,-(SP) ; put handle on stack
|
|
jsr c_HLock ; call C implementation
|
|
addq #4,SP ; clean up stack
|
|
rts
|
|
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_HUnlock. Interface for HUnlock
|
|
;
|
|
; Input A0 = handle to unlock
|
|
; Output D0 = result code (word)
|
|
;
|
|
IF PATCHEDIN THEN
|
|
a_HUnlock
|
|
ELSE
|
|
FIG_HUNLOCK
|
|
ENDIF
|
|
|
|
move.l A0,-(SP) ; put handle on stack
|
|
jsr c_HUnlock ; call C implementation
|
|
addq #4,SP ; clean up stack
|
|
rts
|
|
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_HPurge. Interface for HPurge
|
|
;
|
|
; Input A0 = handle to purge
|
|
; Output D0 = result code (word)
|
|
;
|
|
IF PATCHEDIN THEN
|
|
a_HPurge
|
|
ELSE
|
|
FIG_HPURGE
|
|
ENDIF
|
|
|
|
move.l A0,-(SP) ; put handle on stack
|
|
jsr c_HPurge ; call C implementation
|
|
addq #4,SP ; clean up stack
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_HNoPurge. Interface for HNoPurge
|
|
;
|
|
; Input A0 = handle to not purge
|
|
; Output D0 = result code (word)
|
|
;
|
|
IF PATCHEDIN THEN
|
|
a_HNoPurge
|
|
ELSE
|
|
FIG_HNOPURGE
|
|
ENDIF
|
|
|
|
move.l A0,-(SP) ; put handle on stack
|
|
jsr c_HNoPurge ; call C implementation
|
|
addq #4,SP ; clean up stack
|
|
rts
|
|
|
|
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_SetGrowZone. Interface for SetGrowZone
|
|
;
|
|
; Input A0 = pointer to grow zone proc
|
|
; Output D0 = result code (word)
|
|
;
|
|
IF PATCHEDIN THEN
|
|
a_SetGrowZone
|
|
ELSE
|
|
FIG_SETGROWZONE
|
|
ENDIF
|
|
|
|
move.l A0,-(SP) ; put handle on stack
|
|
jsr c_SetGrowZone ; call C implementation
|
|
addq #4,SP ; clean up stack
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_MoveHHi. Interface for MoveHHi
|
|
;
|
|
; Input A0 = handle to move
|
|
; Output D0 = result code (word)
|
|
;
|
|
IF PATCHEDIN THEN
|
|
a_MoveHHi
|
|
ELSE
|
|
FIG_MOVEHHI
|
|
ENDIF
|
|
|
|
move.l A0,-(SP) ; put handle on stack
|
|
jsr c_MoveHHi ; call C implementation
|
|
addq #4,SP ; clean up stack
|
|
rts
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_MoveHLow. Interface for MoveHLow
|
|
;
|
|
; Input A0 = handle to move
|
|
; Output D0 = result code (word)
|
|
;
|
|
IF PATCHEDIN THEN
|
|
a_MoveHLow
|
|
ELSE
|
|
FIG_MOVEHLOW
|
|
ENDIF
|
|
|
|
move.l A0,-(SP) ; put handle on stack
|
|
jsr c_MoveHLow ; call C implementation
|
|
addq #4,SP ; clean up stack
|
|
rts
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_MaxBlock. Interface for MaxBlock
|
|
;
|
|
; Inputs D1 = trap word (word)
|
|
; Outputs D0 = function result (long)
|
|
;
|
|
IF PATCHEDIN THEN
|
|
a_MaxBlock
|
|
ELSE
|
|
FIG_MAXBLOCKTRAP
|
|
ENDIF
|
|
|
|
move.l D1,-(SP) ; put trap word on the stack (C requires long)
|
|
jsr c_MaxBlock ; call C implementation
|
|
addq #4,SP ; cleanup 8 bytes from the stack
|
|
rts
|
|
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; c_PurgeSpace. Interface for PurgeSpace
|
|
;
|
|
; Input D1 = trap word (word)
|
|
; Outputs D0 = total (long)
|
|
; A0 = contig (long)
|
|
;
|
|
IF PATCHEDIN THEN
|
|
a_PurgeSpace
|
|
ELSE
|
|
FIG_PURGESPACETRAP
|
|
ENDIF
|
|
|
|
subq #4,SP ; make space for contig parameter
|
|
pea (SP) ; push pointer to contig on the stack
|
|
move.l D1,-(SP) ; put trap word on the stack (C requires long)
|
|
jsr c_PurgeSpace ; call C implementation
|
|
addq #8,SP ; pop parameters off stack
|
|
move.l (SP)+,A0 ; put contig in A0
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_StackSpace. Interface for StackSpace
|
|
;
|
|
; Input none;
|
|
; Output D0 = function result (long)
|
|
;
|
|
IF PATCHEDIN THEN
|
|
a_StackSpace
|
|
ELSE
|
|
FIG_STACKSPACETRAP
|
|
ENDIF
|
|
|
|
; Note: as a otimization, we a now implementing this short trap right here
|
|
; since its called very often and is very small.
|
|
moveq #30,D0 ;fudge factor (changed from 20 to support figment)
|
|
add.l SP,D0 ;
|
|
andi.w #$FFFC,D0 ;round down to multiple of 4
|
|
sub.l HiHeapMark,D0 ;
|
|
clr.w MemErr ;no problem here
|
|
rts
|
|
|
|
; This is the way to call high level glue
|
|
; jsr c_StackSpace ; call C implementation
|
|
; rts
|
|
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_HSetRBit. Interface for HSetRBit
|
|
;
|
|
; Input A0 = handle to modify
|
|
; Output D0 = result code (word)
|
|
;
|
|
IF PATCHEDIN THEN
|
|
a_HSetRBit
|
|
ELSE
|
|
FIG_HRSRC
|
|
ENDIF
|
|
|
|
move.l A0,-(SP) ; put handle on stack
|
|
jsr c_HSetRBit ; call C implementation
|
|
addq #4,SP ; clean up stack
|
|
rts
|
|
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_HClrRBit. Interface for HClrRBit
|
|
;
|
|
; Input A0 = handle to modify
|
|
; Output D0 = result code (word)
|
|
;
|
|
IF PATCHEDIN THEN
|
|
a_HClrRBit
|
|
ELSE
|
|
FIG_HNORSRC
|
|
ENDIF
|
|
|
|
move.l A0,-(SP) ; put handle on stack
|
|
jsr c_HClrRBit ; call C implementation
|
|
addq #4,SP ; clean up stack
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_HGetState. Interface for HGetState
|
|
;
|
|
; Input A0 = handle to get
|
|
; Output D0 = handle state (byte)
|
|
;
|
|
;
|
|
IF PATCHEDIN THEN
|
|
a_HGetState
|
|
ELSE
|
|
FIG_HGETFLAGS
|
|
ENDIF
|
|
|
|
move.l A0,-(SP) ; put handle on stack
|
|
jsr c_HGetState ; call C implementation
|
|
addq #4,SP ; clean up stack
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_HSetState. Interface for HSetState
|
|
;
|
|
; Inputs D0 = new flags (byte)
|
|
; A0 = handle to set
|
|
; Output D0 = result code (word)
|
|
;
|
|
;
|
|
IF PATCHEDIN THEN
|
|
a_HSetState
|
|
ELSE
|
|
FIG_HSETFLAGS
|
|
ENDIF
|
|
|
|
move.l D0,-(SP) ; put flags on stack, its a longword not a byte
|
|
move.l A0,-(SP) ; put handle on stack
|
|
jsr c_HSetState ; call C implementation
|
|
addq #8,SP ; clean up stack
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; HeapDispatch. Interface for HeapDispatch (Trap $A0A4)
|
|
;
|
|
; Inputs D0 = selector
|
|
; Outputs It depends
|
|
;
|
|
;
|
|
IF PATCHEDIN THEN
|
|
a_MemoryDispatch
|
|
ELSE
|
|
HEAPDISPATCH
|
|
ENDIF
|
|
|
|
|
|
tst.w D0 ; normalize selector to 0..n
|
|
bmi.s @selectorOutOfRange ; selector is out of range...
|
|
cmp.w #TableSize/2,d0 ; is there a table entry for this one?
|
|
bhi.s @selectorOutOfRange ; no, selector is out of range...
|
|
lea Table,a2 ; get the address of the selected routine
|
|
add.w (a2,d0.w*2),a2
|
|
jsr (a2) ; call the selected routine
|
|
rts
|
|
|
|
@selectorOutOfRange
|
|
_debugger
|
|
move.l #paramErr,d0 ; abort: return error code
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_InitProcessMgrHeap. Interface for InitProcessMgrHeap
|
|
;
|
|
; Inputs A0 = old ProcessMgr zone
|
|
; Output D0 = new ProcessMgr zone
|
|
;
|
|
;
|
|
a_InitProcessMgrHeap
|
|
move.l A0,-(SP) ; put old ProcessMgr zone on the stack
|
|
jsr c_InitProcessMgrHeap ; call C implementation
|
|
addq #4,SP ; clean up stack
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_ShrinkSysHeap. Interface for ShrinkSysHeap
|
|
;
|
|
; Inputs A0 = Amount to shrink
|
|
; Output D0 = Actual size it shrank
|
|
;
|
|
;
|
|
a_ShrinkSysHeap
|
|
move.l A0,-(SP) ; put size needed on the stack
|
|
jsr c_ShrinkSysHeap ; call C implementation
|
|
addq #4,SP ; clean up stack
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_LowerProcessMgrZoneBottom. Interface for LowerProcessMgrZoneBottom
|
|
;
|
|
; Inputs A0 = Amount to lower
|
|
; A1 = ptr to ProcessMgr zone
|
|
; Outputs none.
|
|
;
|
|
;
|
|
a_LowerProcessMgrZoneBottom
|
|
move.l A1,-(SP) ; put PM zone pointer on the stack
|
|
move.l A0,-(SP) ; put size needed on the stack
|
|
jsr c_LowerProcessMgrZoneBottom ; call C implementation
|
|
addq #8,SP ; clean up stack
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_ShrinkProcessMgrZone. Interface for ShrinkProcessMgrZone
|
|
;
|
|
; Inputs A0 = Amount to lower
|
|
; A1 = ptr to ProcessMgr zone
|
|
; Output D0 = Actual size it shrank
|
|
;
|
|
;
|
|
a_ShrinkProcessMgrZone
|
|
move.l A1,-(SP) ; put PM zone pointer on the stack
|
|
move.l A0,-(SP) ; put size needed on the stack
|
|
jsr c_ShrinkProcessMgrZone ; call C implementation
|
|
addq #8,SP ; clean up stack
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_ExtendSystemZone. Interface for ExtendSystemZone
|
|
;
|
|
; Inputs A0 = size to extend
|
|
; Outputs none
|
|
;
|
|
;
|
|
a_ExtendSystemZone
|
|
move.l A0,-(SP) ; put size needed on the stack
|
|
jsr c_ExtendSystemZone ; call C implementation
|
|
addq #4,SP ; clean up stack
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_ReclaimSpaceIfSysHeapLow. Interface for ReclaimSpaceIfSysHeapLow
|
|
;
|
|
; Inputs A0 = ptr to handle
|
|
; A1 = ptr to ProcessMgr zone
|
|
; Outputs none
|
|
;
|
|
;
|
|
a_ReclaimSpaceIfSysHeapLow
|
|
move.l A1,-(SP) ; put PM zone pointer on the stack
|
|
move.l A0,-(SP) ; put pointer to the new handle on the stack
|
|
jsr c_ReclaimSpaceIfSysHeapLow ; call C implementation
|
|
addq #8,SP ; clean up stack
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_StraddleBlockSize. Interface for StraddleBlockSize
|
|
;
|
|
; Input A0 = pointer to parameter block,
|
|
; Output D0 = result code (word)
|
|
;
|
|
; Comment: This glue is very similar to InitZone
|
|
;
|
|
a_StraddleBlockSize
|
|
move.l (A0),-(SP) ; put zone start on the stack
|
|
move.l 4(A0),-(SP) ; put sawInterestingBlock on stack
|
|
move.l 8(A0),-(SP) ; put blockOfInterest on stack
|
|
move.l $C(A0),-(SP) ; put highSysStorage
|
|
move.l $10(A0),-(SP) ; put lowPMStorage
|
|
jsr c_StraddleBlockSize ; call C implementation
|
|
lea $14(SP),SP ; clean up 20 bytes off the stack
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_ProcessMgrMaxBlock. Interface for ProcessMgrMaxBlock
|
|
;
|
|
; Inputs A0 = ptr to ProcessMgr zone
|
|
; Output D0 = Max size
|
|
;
|
|
;
|
|
a_ProcessMgrMaxBlock
|
|
move.l A0,-(SP) ; put size needed on the stack
|
|
jsr c_ProcessMgrMaxBlock ; call C implementation
|
|
addq #4,SP ; clean up stack
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_GetProcessMgrLoFreeBytes. Interface for GetProcessMgrLoFreeBytes
|
|
;
|
|
; Inputs A0 = Handle of interest
|
|
; A1 = Saw interesting block pointer
|
|
; Output D0 = Low free bytes
|
|
;
|
|
;
|
|
a_GetProcessMgrLoFreeBytes
|
|
move.l A1,-(SP) ; put sawInterestingBlock ptr on the stack
|
|
move.l A0,-(SP) ; put handle of interest on the stack
|
|
jsr c_GetProcessMgrLoFreeBytes ; call C implementation
|
|
addq #8,SP ; clean up stack
|
|
rts
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_GetSystemHiFreeBytes. Interface for GetSystemHiFreeBytes
|
|
;
|
|
; Inputs none.
|
|
; Output D0 = Size we got
|
|
;
|
|
;
|
|
a_GetSystemHiFreeBytes
|
|
jsr c_GetSystemHiFreeBytes ; call C implementation
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_RegisterDisposeProc. Interface for RegisterDisposeProc
|
|
;
|
|
; Inputs A0 = Proc to register
|
|
; A1 = Zone Ptr
|
|
; Output D0 = Result code (could be memFullErr)
|
|
;
|
|
;
|
|
a_RegisterDisposeProc
|
|
move.l A1,-(SP) ; put zone pointer on the stack
|
|
move.l A0,-(SP) ; put proc ptr on the stack
|
|
jsr c_RegisterDisposeProc ; call C implementation
|
|
addq #8,SP ; clean up 8 bytes off the stack
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_NewHandleHi. Interface for NewHandleHi
|
|
;
|
|
; Inputs A0 = size (long) since selector is in D0
|
|
; D1 = trap word (word)
|
|
; Outputs D0 = result code (word)
|
|
; A0 = the handle (long)
|
|
;
|
|
; note: Trap dispatcher will not preserve A0 recause the routine passes it back.
|
|
;
|
|
a_NewHandleHi
|
|
subq #4,SP ; make space for handle
|
|
move.l A0,-(SP) ; put requested size on the stack
|
|
move.l D1,-(SP) ; put trap word on the stack
|
|
pea 8(SP) ; push pointer to handle on stack
|
|
jsr c_NewHandleHi ; call C implementation
|
|
lea 12(SP),SP ; cleanup 12 bytes from the stack
|
|
move.l (SP)+,A0 ; put handle in A0
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_GetNextBlock. Interface for GetNextBlock
|
|
;
|
|
; Inputs A0 = Ptr to currrent block
|
|
; A1 = Zone Ptr
|
|
; Output D0 = Ptr to next block
|
|
;
|
|
;
|
|
a_GetNextBlock
|
|
move.l A1,-(SP) ; put zone pointer on the stack
|
|
move.l A0,-(SP) ; put currentBlock ptr on the stack
|
|
jsr c_GetNextBlockInHeap ; call C implementation
|
|
addq #8,SP ; clean up 8 bytes off the stack
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_DisposeZone. Interface for DisposeZone
|
|
;
|
|
; Inputs A0 = Zone to dispose (long)
|
|
; Output D0 = result code (word)
|
|
;
|
|
;
|
|
a_DisposeZone
|
|
move.l A0,-(SP) ; put zone pointer on the stack
|
|
jsr c_DisposeZone ; call C implementation
|
|
addq #4,SP ; clean up 4 bytes off the stack
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; c_SetZoneCompatibilityFlags. Interface for SetZoneCompatibilityFlags
|
|
;
|
|
; Inputs A1 = new flags (word)
|
|
; A0 = zone to set
|
|
; Output D0 = result code (word)
|
|
;
|
|
;
|
|
a_SetZoneCompatibilityFlags
|
|
move.l A1,-(SP) ; put flags on stack, its a longword not a short
|
|
move.l A0,-(SP) ; put the zone on stack
|
|
jsr c_SetZoneCompatibilityFlags ; call C implementation
|
|
addq #8,SP ; clean up stack
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; a_GetZoneCompatibilityFlags. Interface for GetZoneCompatibilityFlags
|
|
;
|
|
; Input A0 = zone to get
|
|
; Output D0 = flags state
|
|
;
|
|
;
|
|
a_GetZoneCompatibilityFlags
|
|
move.l A0,-(SP) ; put zone on stack
|
|
jsr c_GetZoneCompatibilityFlags ; call C implementation
|
|
addq #4,SP ; clean up stack
|
|
rts
|
|
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; QuickTime compatibility calls.. Hopefully these will go away
|
|
;
|
|
;
|
|
; Stage I, Quick Handle calls....
|
|
;
|
|
;
|
|
a_HLockQ
|
|
_HLock
|
|
rts
|
|
|
|
a_HUnlockQ
|
|
_HUnlock
|
|
rts
|
|
|
|
a_HPurgeQ
|
|
_HPurge
|
|
rts
|
|
|
|
a_HNoPurgeQ
|
|
_HNoPurge
|
|
rts
|
|
|
|
a_HGetStateQ
|
|
_HGetState
|
|
rts
|
|
|
|
a_HSetStateQ
|
|
move.l A1,D0 ;move state into D0
|
|
_HSetState
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; QuickTime compatibility calls.. Hopefully these will go away
|
|
;
|
|
;
|
|
; Stage II, "Butt ugly" memory area notification scheme.....
|
|
;
|
|
;
|
|
a_RegisterHandleTrashNotification
|
|
;move.l A1,-(SP) ; put handle on the stack
|
|
move.l A0,-(SP) ; put Trash Proc Ptr on the stack
|
|
jsr c_RegisterHandleTrashNotification
|
|
addq #4,SP ; clean up 4 bytes off the stack
|
|
rts
|
|
|
|
a_RegisterPtrTrashNotification
|
|
; not implemented, dont need to support
|
|
;move.l A1,-(SP) ; put ptr on the stack
|
|
;move.l A0,-(SP) ; put Trash Proc Ptr on the stack
|
|
;jsr c_RegisterPtrTrashNotification
|
|
;addq #8,SP ; clean up 8 bytes off the stack
|
|
rts
|
|
|
|
a_UnregisterHandleTrashNotification
|
|
;move.l A1,-(SP) ; put handle on the stack
|
|
move.l A0,-(SP) ; put Trash Proc Ptr on the stack
|
|
jsr c_UnregisterHandleTrashNotification
|
|
addq #4,SP ; clean up 4 bytes off the stack
|
|
rts
|
|
|
|
a_UnregisterPtrTrashNotification
|
|
; not implemented, dont need to support
|
|
;move.l A1,-(SP) ; put ptr on the stack
|
|
;move.l A0,-(SP) ; put Trash Proc Ptr on the stack
|
|
;jsr c_UnregisterPtrTrashNotification
|
|
;addq #8,SP ; clean up 8 bytes off the stack
|
|
rts
|
|
|
|
a_TrashZone
|
|
move.l A0,-(SP) ; put psn ptr on stack
|
|
jsr c_TrashZone
|
|
addq #4,SP ; clean up 4 bytes off the stack
|
|
rts
|
|
|
|
a_TrashMemoryArea
|
|
move.l A1,-(SP) ; put end address on stack
|
|
move.l A0,-(SP) ; put start address on stack
|
|
jsr c_TrashMemoryArea
|
|
addq #8,SP ; clean up 8 bytes off the stack
|
|
rts
|
|
|
|
a_TrashProcess
|
|
move.l A0,-(SP) ; put psn ptr on stack
|
|
jsr c_TrashProcess
|
|
addq #4,SP ; clean up 4 bytes off the stack
|
|
rts
|
|
|
|
|
|
;-------------------------------------------------------------------------------
|
|
; QuickTime compatibility calls.. Hopefully these will go away
|
|
;
|
|
;
|
|
; Stage III, Safe System Heap memory allocations.....
|
|
;
|
|
;
|
|
a_NewHandleSystemSafe
|
|
move.l A0,-(SP) ; put size on the stack
|
|
jsr c_NewHandleSystemSafe
|
|
addq #4,SP ; clean up 4 bytes off the stack
|
|
move.l D0,A0 ; move return result into A0
|
|
rts
|
|
|
|
a_EnoughSystemHeapSlop
|
|
jsr c_EnoughSystemHeapSlop
|
|
; return result returned in D0
|
|
rts
|
|
|
|
a_NewPtrSystemSafe
|
|
move.l A0,-(SP) ; put size on the stack
|
|
jsr c_NewPtrSystemSafe
|
|
addq #4,SP ; clean up 4 bytes off the stack
|
|
move.l D0,A0 ; move return result into A0
|
|
rts
|
|
|
|
END
|
|
|
|
|