home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / comos2.zip / PORTIOPL.ASM < prev    next >
Assembly Source File  |  1992-11-30  |  2KB  |  90 lines

  1. ;
  2. ;  PORTIOPL
  3. ;
  4. ;  This procedure provide io priviledge routines for reading from
  5. ;  or writting to a port.
  6. ;
  7. ;  This procedure was compiled with MASM 6.0 using the default flags.
  8. ;
  9. ;  Copyright (c) 1992 by ASH Software, Inc.
  10. ;
  11.  
  12. .286c
  13. memL equ 1                              ; Use large memory module
  14. ?DF=1                                   ; Do not define default groups
  15. ?PLM=1                                  ; Use Pascal calling convention
  16. ?WIN=0                                  ; Not using Windows
  17.  
  18. include cmacros.inc
  19.  
  20. ;
  21. ;  Create a segment which will be given IOPL priviledge
  22. ;
  23.  
  24. createSeg _portiopl, portiopl, byte, public, CODE
  25. IOPLGROUP GROUP _portiopl
  26.  
  27. sBegin  portiopl
  28. assumes cs,_portiopl
  29.  
  30. ;
  31. ;  This procedure provides IOPL access to read a single byte from
  32. ;  a data port.
  33. ;
  34.  
  35. cProc   ioplinp,<FAR,PUBLIC>,<es,si>
  36.         parmW     portaddr
  37.  
  38. cBegin
  39.         mov       dx,portaddr
  40.         in        al,dx
  41.         mov       ah,0
  42. cEnd
  43.  
  44. ;
  45. ;  This procedure provides IOPL access to write a single byte to
  46. ;  a data port.
  47. ;
  48.  
  49. cProc   ioplout,<FAR,PUBLIC>,<es,si>
  50.         parmW     portaddr
  51.         parmB     outbyte
  52.  
  53. cBegin
  54.         mov       al,outbyte
  55.         mov       dx,portaddr
  56.         out       dx,al
  57. cEnd
  58.  
  59. ;
  60. ;  This procedure provides IOPL access to read a single word from
  61. ;  a data port.
  62. ;
  63.  
  64. cProc   ioplinpw,<FAR,PUBLIC>,<es,si>
  65.         parmW     portaddr
  66.  
  67. cBegin
  68.         mov       dx,portaddr
  69.         in        ax,dx
  70. cEnd
  71.  
  72. ;
  73. ;  This procedure provides IOPL access to write a single word to
  74. ;  a data port.
  75. ;
  76.  
  77. cProc   ioploutw,<FAR,PUBLIC>,<es,si>
  78.         parmW     portaddr
  79.         parmW     outword
  80.  
  81. cBegin
  82.         mov       ax,outword
  83.         mov       dx,portaddr
  84.         out       dx,al
  85. cEnd
  86.  
  87. sEnd    portiopl
  88. end
  89.  
  90.