home *** CD-ROM | disk | FTP | other *** search
- ; ************
- ; * CRIT.asm *
- ; *******************************************
- ; * Copyright TimeSlice, Inc. 1985, 86, 87. *
- ; *******************************************
- ;
- include ts.inc
- ;
- extern_code critend
- ifdef MICROSOFT
- extern_code critstart
- else
- extern_code critstar
- critstart equ critstar
- endif
- ;
- start_data
- end_data
- ;
- start_code
- ;
- ;***
- ;* CRIT( CLNUM, FP , ARGLIST , , , )
- ;* Crit is used when function FP is critical. You call crit and give as 1st
- ;* argument, a pointer to the critical function to execute, and then, the
- ;* list of arguments to pass to f().
- ;* REMARK : CRIT() assumes that the calling function had BP pointing to the
- ;* base of its local frame.
- ;***
- start_struct
- mbr _ax d_int ?
- mbr _bx d_int ?
- mbr _cx d_int ?
- mbr _dx d_int ?
- ifdef MICROSOFT
- mbr _di d_int ?
- mbr _si d_int ?
- endif
- mbr _bp d_int ?
- mbr _ret d_ret ?
- mbr clnum d_int ?
- mbr fp f_ptr ?
- mbr args d_int ?
- ;
- routine crit
- push bp
- push_sdi
- sub sp,8 ;area to save regs returned by fp
- mov bp,sp
- push [bp].clnum ;make proc critical for class clnum
- call critstart
- mov sp,bp
- lea si,[bp].args ;SI <-- begining of argument list
- ldint cx,[bp]._bp ;CX <-- old BP, 4 bytes past last arg
- sub cx,si ;CX <-- size of arglist in bytes
- mov di,bp
- sub di,cx ;base of new argument list
- mov sp,di ;SP <-- ptr to base of new arglist
- mov ax,ss ;DS = ES <== SS
- mov ds,ax
- mov es,ax
- cld
- repz movsb ;copy old arglist to new
- mov ax,dgroup
- mov ds,ax
- fncall [bp].fp ;execute critical function
- mov sp,bp
- stint [bp]._ax,ax ;save registers
- stint [bp]._bx,bx
- stint [bp]._cx,cx
- stint [bp]._dx,dx
- push [bp].clnum ;make proc not critical for class clnum
- call critend
- mov sp,bp
- ldint ax,[bp]._ax ;restore registers
- ldint bx,[bp]._bx
- ldint cx,[bp]._cx
- ldint dx,[bp]._dx
- add sp,8 ;restore stack
- pop_sdi
- pop bp
- return crit
- ;
- end_code
- ;
-
-