home *** CD-ROM | disk | FTP | other *** search
- /* ThinkCallCompletion.c */
- /*
- * ThinkCallCompletion.c
- * Copyright © 1992-93 Apple Computer Inc. All Rights Reserved.
- *
- * This function is called by the driver when the request
- * completes. If the user has defined a completion routine,
- * it restores A5 and calls the user's routine as if it
- * were defined as
- * void
- * UserCompletion(
- * ParmBlkPtr pb
- * );
- * For convenience, the ioResult code is in D0, and the condition
- * codes are set on the ioResult.
- *
- * This file is compiled by Think C. See MPWCallCompletion.a
- * for the original (definitive) source
- *
- * Author: Martin Minow
- * Apple Computer Inc.
- * Cupertino, CA, USA
- * InterNet: minow@apple.com
- * AppleLink: MINOW
- */
- #include "DTSSampleCSAM.h"
-
- typedef struct AuthDirParamBlock {
- AuthDirParamHeader
- } AuthDirParamBlock;
-
- void CallCompletion(
- ParmBlkPtr pb
- )
- {
- asm {
- move.l pb,a0 ; a0 -> parameter block
- move.w AuthDirParamBlock.ioResult(a0),d0 ; d0 == ioResult
- move.l AuthDirParamBlock.ioCompletion(a0),d1 ; User's completion
- beq.s @exit ; Exit if none
- move.l a5,-(sp) ; Save current A5
- move.l AuthDirParamBlock.saveA5(a0),a5 ; Restore user A5
- link a6,#0 ; Establish a stack frame context
- move.l a0,-(sp) ; Push call parameter
- move.l d1,a1 ; Locate the function
- tst.w d0 ; Set condition codes
- jsr (a1) ; Call user completion
- unlk a6 ; Clean out the stack
- move.l (sp)+,a5 ; Restore current A5
- @exit: ;
- }
- }