The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
From novice to tech pro — start learning today.
But try my example.
What you need to do is put DB $66; infront of the instruction "MOV AnyVar,AX"
If "AnyVar" is of type longint, you have to make the compiler beleive that it is a 16bit variable, that's done by putting, "word ptr" infront of the variable name (see example).
The example simulates a "MOV AnyVar,AX" and then converts it to "MOV AnyVar,EAX" by putting "db $66" as a prefix to the instruction.
Program RegIntoVar;
uses crt;
var A,B : longint;
begin
A := 123456789;
B := 0;
asm
DB $66; MOV AX,word ptr A { Move A into EAX }
DB $66; MOV word ptr B,AX { Move EAX into B }
end;
Writeln(B);
end.
Is it clear?