Log in

View Full Version : Assembly Coding in Delphi Problem


Hero
July 30th, 2004, 02:04
Hi All
I'm trying to write a piece of Assembly code in Delphi.I know I should
do this by asm keyword.I want to return Flags value to a
variable.I use the following code in the start of my Main project file:

var
FlagsWord;
begin
asm
Pushf
Pop Flags
end;
......
end.

But this code make nothing for me and only hide caption bar and Border
of Main form.
why?How I can Do this?

sincerely yours

Lord8Bit
July 30th, 2004, 02:45
Try something like :

Function GetFlags: dword;
asm
push eax
pushfd
pop eax
mov Result,eax
pop eax
end;

Best regards
LordByte

TQN
July 30th, 2004, 03:15
Hi Lord8Bit !
Good code, but don't need to use Result. Function return number in Delphi always uses EAX. So the code will be:

function GetFlags: DWORD;
asm
pushfd
pop eax
end;

Regards !
TQN