home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ddrivers.zip / VDD / IOSEG.ASM < prev    next >
Assembly Source File  |  1993-02-23  |  1KB  |  50 lines

  1. ; Version 1.0 01 January 1993
  2. ; IO segment for VDD I/O
  3. ;
  4. ; by: Steve Mastrianni
  5. ;
  6.         PUBLIC    outp
  7.         PUBLIC  inp
  8.  
  9.         .386P
  10.  
  11. _IOSEG    segment    dword public use32 'CODE'
  12.  
  13.     assume    CS: _IOSEG
  14. ;
  15. ;  inp( ULONG port)
  16. ;
  17. inp    proc    far
  18.     ;
  19.         push    bp             ;set up stack frame
  20.         mov     bp,sp          ;save bp
  21.         push    dx             ;save dx
  22.     mov     dx,[bp+10]     ;get port address
  23.         in      al,dx          ;do input
  24.         pop     dx             ;restore regs
  25.         pop     bp             ;return in ax
  26.     ret     4              ;remove from IOPL stack
  27. ;
  28. inp    endp
  29.  
  30. ; outp (ULONG port, USHORT data)
  31.  
  32. outp   proc    far
  33. ;
  34.         push    bp             ;set up stack frame
  35.         mov     bp,sp          ;save it
  36.         push    ax             ;save ax
  37.         push    dx             ;and dx
  38.     mov     ax,word ptr[bp+10] ;get data
  39.         mov     dx,[bp+14]     ;get port
  40.         out     dx,al          ;do output
  41.         pop     dx             ;restore regs
  42.         pop     ax
  43.         pop     bp
  44.     ret     8                ;remove off local stack
  45. ;
  46. outp   endp
  47.  
  48. _IOSEG   ends
  49.      end 
  50.