+ check for local var

This commit is contained in:
pierre 2000-04-06 06:52:04 +00:00
parent 61b61fd36d
commit f0ea08740f

View File

@ -16,6 +16,30 @@ asm
end;
function get_local_value : longint;
var
x : longint;
begin
x:=66;
asm
mov eax,dword ptr [x]
mov @result,eax
end;
end;
function get_local_addr : pointer;
var
x : longint;
begin
x:=66;
asm
mov eax,x
mov @result,eax
end;
end;
const
program_has_error : boolean = false;
{$endif CPU86}
begin
@ -23,13 +47,25 @@ begin
sti:=56;
if get_sti_value<>sti then
begin
Writeln(' "mov eax,sti" does not get the address of sti var');
Halt(1);
Writeln(' "mov eax,dword ptr [sti]" does not get the value of static sti var');
program_has_error:=true;
end;
if get_sti_addr<>@sti then
begin
Writeln(' "mov eax,sti" does not get the address of sti var');
Halt(1);
program_has_error:=true;
end;
if get_local_value<>66 then
begin
Writeln(' "mov eax,dword ptr [x]" does not get the value of local x var');
program_has_error:=true;
end;
if longint(get_local_addr)=66 then
begin
Writeln(' "mov eax,x" gets the value of local x var');
program_has_error:=true;
end;
if program_has_error then
Halt(1);
{$endif CPU86}
end.
end.