在delphi里可以内嵌汇编语言直接访问一些寄存器如EAX,而在delphi6里执行下面代码会跳不出循环
procedure Delphi6EAXBug; // loops forever with Delphi 6
var
i: integer;
begin
for i := 0 to 15 do
asm
mov eax,2
end;
end;
解决办法
procedure Delphi6EAXBug;
var
i: integer;
begin
for i := 0 to 15 do
asm
push eax
mov eax,2
pop eax
end;
end;