home *** CD-ROM | disk | FTP | other *** search
- PAGE 56,132
- TITLE IOCTL PERFORM IOCTL CALL FOR C MAIN PROGRAMS
- ; (c) Copyright 1984 by The Computer Entomologist
- ;
- ; Permission is hearby granted to use or distribute this software
- ;without any restrictions. You may make copies for yourself or your
- ;friends. You may include it in any hardware or software product that you
- ;sell for profit.
- ;
- ; This software is distributed as is, and is not guaranteed to work
- ;on any particular hardware/software configuration. Furthermore, no
- ;liability is granted with this software: the user takes responcibility for
- ;any damage this software may do to his system.
- ;
- ; Nasy notices aside, if you have any questions about this software, you
- ;can reach me at the address below. If you impliment any new features or
- ;find (and fix!) any bugs, I would be happy to hear from you.
- ;
- ; Mike Higgins
- ; The Computer Entomologist
- ; P.O. Box 197
- ; Duncans Mills, CA 95430
-
- PUBLIC IOCTL ;(ASYNC,BUF,LEN,FUNC)
-
- @CODE SEGMENT PUBLIC 'CODE'
- ASSUME CS:@CODE
-
- IOCTL PROC NEAR
- ;ARGUMENTS:
- ASYNC=4 ;ADDRESS OF ASCIZ DEVICE NAME.
- BUF=6 ;ADDRESS OF A BUFFER TO READ/WRITE FROM
- LEN=8 ;THE NUMBER OF BYTES IN BUFFER
- FUNC=10 ;2 FOR IOCTL READ, 3 FOR IOCTL WRITE
-
- PUSH BP ;DO THE NORMAL C LINKAGE
- MOV BP,SP
-
- MOV DX,ASYNC[BP] ;GET NAME OF DEVICE TO OPEN
- MOV AX,03D02H ;OPEN IT FOR READ/WRITE.
- INT 021H ;WELL, CAN DOS DO IT?
-
- MOV BX,AX ;STORE HANDLE IN BX
- MOV DX,BUF[BP] ;GET BUFFER ADDRESS
- MOV CX,LEN[BP] ;AND LENGTH.
- MOV AX,FUNC[BP] ;GET FUNCTION REQUESTED,
- MOV AH,68 ;TELL DOS THIS IS IOCTL CALL
- INT 021H ;WAKE UP DOS.
-
- MOV AH,62 ;SET UP TO CLOSE HANDLE WHEN DONE
- INT 021H ;ASK DOS REAL NICE.
-
- POP BP ;RECOVER BP
- RET ;RETURN TO C
-
- IOCTL ENDP
-
- @CODE ENDS
-
- END
-