Delphi6 problem 1

zhaozj2021-02-08  252

In Delphi, you can directly access some registers such as EAX, and perform the following code in Delphi6 will not jump loop.

Procedure delphi6eaxbug; // loops forever with delphi 6

VAR

i: integer;

Begin

For i: = 0 to 15 do

ASM

MOV Eax, 2

END;

END;

Solution

Procedure delphi6eaxbug;

VAR

i: integer;

Begin

For i: = 0 to 15 do

ASM

Push EAX

MOV Eax, 2

POP EAX

END;

END;

转载请注明原文地址:https://www.9cbs.com/read-2774.html

New Post(0)