;
;	File:		VMPatches.a
;
;	Contains:	patches related to VM; all of these are currently non-VM versions of VM calls
;
;	Written by:	Darin Adler and Jim Reekes
;
;	Copyright:	© 1990-1991 by Apple Computer, Inc., all rights reserved.
;
;	Change History (most recent first):
;
;		 <3>	 9/10/91	JSM		Cleanup header.
;		 <2>	12/14/90	dba		<JDR> get rid of VMCalls.a; save fewer registers (deferred
;									functions can trash D0-D3/A0-A3, just like interrupt handlers)
;		 <1>	 10/8/90	JDR		First checked in.  Patch DeferUserFn when not running VM.
;

		load	'StandardEqu.d'
		include	'LinkedPatchMacros.a'

;ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
; This is a handy patch that only happens when VM is not running.  The Sound Manager needs to call
; DeferUserFn very often and it seems silly to constantly check if VM is running before making the
; call.  So I thought it would be a good idea to have the trap implemented even when VM isn't.
; This way you can always make the call and it will immediately call the user function, which is nice.

NonVMDeferUserFn PatchProc _DeferUserFn,(Plus,SE,II,Portable,IIci,notVM)

; parameters:
;	a0 = pointer to function to call (no need to defer if there is no VM)
;	d0 = parameter to pass to function (must be in A0 when function is called)

		movem.l	d1-d3/a0-a3,-(sp)
		move.l	a0,a1		; move proc. pointer into another register
		move.l	d0,a0		; get parameter into register for proc.
		jsr		(a1)		; call proc. with parameter
		movem.l	(sp)+,d1-d3/a0-a3

		moveq	#noErr,d0	; return success
		rts

		EndProc

;ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ

		End