home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c065 / 2.ddi / CLIB2.ZIP / OUTPORT.CAS < prev    next >
Encoding:
Text File  |  1990-06-07  |  1.7 KB  |  60 lines

  1. /*-----------------------------------------------------------------------*
  2.  * filename - outport.cas
  3.  *
  4.  * function(s)
  5.  *        outport  - output to a hardware port
  6.  *       outportb - output to a hardware port
  7.  *-----------------------------------------------------------------------*/
  8.  
  9. /*[]------------------------------------------------------------[]*/
  10. /*|                                                              |*/
  11. /*|     Turbo C Run Time Library - Version 3.0                   |*/
  12. /*|                                                              |*/
  13. /*|                                                              |*/
  14. /*|     Copyright (c) 1987,1988,1990 by Borland International    |*/
  15. /*|     All Rights Reserved.                                     |*/
  16. /*|                                                              |*/
  17. /*[]------------------------------------------------------------[]*/
  18.  
  19. #pragma inline
  20. #include <dos.h>
  21.  
  22. #undef outportb
  23.  
  24. /*-----------------------------------------------------------------------*
  25.  
  26. Name        outport    - output to a hardware port
  27.  
  28. Usage        void outport(int port, int val);
  29.  
  30. Prototype in    dos.h
  31.  
  32. Description    see inport
  33.  
  34. *------------------------------------------------------------------------*/
  35. void outport(int port, int val)
  36. {
  37. asm    mov    dx, port
  38. asm    mov    ax, val
  39. asm    out    dx, ax
  40. }
  41.  
  42. /*-----------------------------------------------------------------------*
  43.  
  44. Name        outportb - output to a hardware port
  45.  
  46. Usage        #include <dos.h>
  47.         void outportb(int port, unsigned char val);
  48.  
  49. Prototype in    dos.h
  50.  
  51. Description    see inport
  52.  
  53. *------------------------------------------------------------------------*/
  54. void outportb(int port, unsigned char val)
  55. {
  56. asm    mov    dx, port
  57. asm    mov    al, val
  58. asm    out    dx, al
  59. }
  60.