i did that in grade 8
this works in win 98 and XP .. not sure about Vista and 7 ..
dowbload this and save it in system32 .. use regsvr to register..
http://geekhideout.com/downloads/io.dll
implement this code
Private Declare Sub PortOut Lib "IO.DLL" (ByVal Port As Integer, ByVal Data As Byte)
Private Declare Function PortIn Lib "IO.DLL" (ByVal Port As Integer) As Byte
example :
PortOut (port,value)
value = PortIn (port)
if u want to do this in win 7 .. use inpout32.dll