Direct I/O in Windows 95, 98 and Me

The routines below demonstrate how you can use direct I/O in Windows 95, 98, Me. This approach does not work in a fully protected Operating System environment like Windows NT, 2000 or XP. In fact, doing direct I/O is not recommended. If you have a need to communicate directly with the hardware, you should write a device driver.

function PortInByte(PortAddress: Word): Byte;
asm
  mov dx, ax
  in  al, dx
end;

procedure PortOutByte(PortAddress: Word; Data: Byte);
asm
  xchg dx, ax
  out  dx, al
end;

Source: www.guidogybels.net.