home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS 1992 September / Simtel20_Sept92.cdr / msdos / sysutl / async_ce.arc / IOCTL.ASM < prev    next >
Assembly Source File  |  1987-08-31  |  2KB  |  61 lines

  1. PAGE 56,132
  2. TITLE    IOCTL    PERFORM IOCTL CALL FOR C MAIN PROGRAMS
  3. ;   (c) Copyright 1984 by The Computer Entomologist
  4. ;
  5. ;    Permission is hearby granted to use or distribute this software
  6. ;without any restrictions.  You may make copies for yourself or your
  7. ;friends. You may include it in any hardware or software product that you
  8. ;sell for profit.
  9. ;
  10. ;    This software is distributed as is, and is not guaranteed to work
  11. ;on any particular hardware/software configuration.  Furthermore, no 
  12. ;liability is granted with this software: the user takes responcibility for
  13. ;any damage this software may do to his system.
  14. ;
  15. ;    Nasy notices aside, if you have any questions about this software, you
  16. ;can reach me at the address below.  If you impliment any new features or
  17. ;find (and fix!) any bugs, I would be happy to hear from you.
  18. ;
  19. ;    Mike Higgins
  20. ;    The Computer Entomologist
  21. ;    P.O. Box 197
  22. ;    Duncans Mills, CA 95430
  23.  
  24.     PUBLIC    IOCTL    ;(ASYNC,BUF,LEN,FUNC)
  25.  
  26. @CODE    SEGMENT    PUBLIC 'CODE'
  27.     ASSUME    CS:@CODE
  28.  
  29. IOCTL    PROC    NEAR
  30. ;ARGUMENTS:
  31. ASYNC=4    ;ADDRESS OF ASCIZ DEVICE NAME.
  32. BUF=6    ;ADDRESS OF A BUFFER TO READ/WRITE FROM
  33. LEN=8    ;THE NUMBER OF BYTES IN BUFFER
  34. FUNC=10    ;2 FOR IOCTL READ, 3 FOR IOCTL WRITE
  35.  
  36.     PUSH    BP        ;DO THE NORMAL C LINKAGE
  37.     MOV    BP,SP
  38.  
  39.     MOV    DX,ASYNC[BP]        ;GET NAME OF DEVICE TO OPEN
  40.     MOV    AX,03D02H        ;OPEN IT FOR READ/WRITE.
  41.     INT    021H            ;WELL, CAN DOS DO IT?
  42.  
  43.     MOV    BX,AX            ;STORE HANDLE IN BX
  44.     MOV    DX,BUF[BP]        ;GET BUFFER ADDRESS
  45.     MOV    CX,LEN[BP]        ;AND LENGTH.
  46.     MOV    AX,FUNC[BP]        ;GET FUNCTION REQUESTED,
  47.     MOV    AH,68            ;TELL DOS THIS IS IOCTL CALL
  48.     INT    021H            ;WAKE UP DOS.
  49.  
  50.     MOV    AH,62            ;SET UP TO CLOSE HANDLE WHEN DONE
  51.     INT    021H            ;ASK DOS REAL NICE.
  52.  
  53.     POP    BP            ;RECOVER BP
  54.     RET                ;RETURN TO C
  55.  
  56. IOCTL    ENDP
  57.  
  58. @CODE    ENDS
  59.  
  60.     END
  61.