                .386

FLAT		GROUP	CODE32

CODE32          SEGMENT DWORD PUBLIC USE32 'CODE'
                ASSUME  CS:FLAT,DS:FLAT

; Performs Input/Output from/to hardware ports

; EXPECTS:      ecx     = 0,4,8,12,16,20 => Type of IO operation
;               eax     = Value (Output only)
;               dx      = Port number

System@__IOPort PROC    Near
                PUBLIC  System@__IOPort
                jmp     @@JmpTable[ecx]
ALIGN 4
@@JmpTable      dd      InputByte
                dd      InputWord
                dd      InputDWord
                dd      OutputByte
                dd      OutputWord
                dd      OutputDWord

InputByte:      in      al,dx
                ret
ALIGN 4
InputWord:      in      ax,dx
                ret
ALIGN 4
InputDWord:     in      eax,dx
                ret
ALIGN 4
OutputByte:     out     dx,al
                ret
ALIGN 4
OutputWord:     out     dx,ax
                ret
ALIGN 4
OutputDWord:    out     dx,eax
                ret
System@__IOPort ENDP

CODE32          ENDS

                END
