新的Delphi開發平臺可以編譯x64位程序,但其內嵌彙編代碼與x86不一樣,內嵌彙編就要整個函數都用會編寫,而x86不需要整個函數都是彙編,如下所示:
function PortIn(Address: Word): Byte;
{-Use this instead of Port since it works in both 16 and 32-bit mode}
{$IFDEF CPUX86}
begin
asm
mov dx,Address
in al,dx
mov @Result,al
end;
end;
{$ELSE}
// CPU64, x64
asm
mov dx,Address
in al,dx
mov @Result,al
end;
{$ENDIF CPUX86}