新的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}