In Borland Pascal and Delphi 1, there is a predefined pseudo variable Port.
In the 32bit versions of Delphi you need 2 lines of assembler code..
function InPort(PortAddr:word): byte;
{$IFDEF WIN32}
assembler; stdcall;
asm
mov dx,PortAddr
in al,dx
end;
{$else}
begin
Result := Port[PortAddr];
end;
{$ENDIF}