local variable error
this works fine , note well , right is global variable here
program WIN32CUI 'test';
#include 'console.zir';
#include 'zirutils.zir';
char right[5100];
dword indx;
char tmp[255];
indx = 2;
eax = indx
imul eax,255
Edx = @right
add eax,Edx
push eax
IntToStr(indx,@tmp);
print(@tmp,'\r\n');
pop eax
IntToStr(eax,@tmp);
print(@tmp,'\r\n');
indx = 3;
eax = indx
imul eax,255
Edx = @right
add eax,Edx
push eax
IntToStr(indx,@tmp);
print(@tmp,'\r\n');
pop eax
IntToStr(eax,@tmp);
print(@tmp,'\r\n');
wait_key(nil);
ExitProcess(0);
but this does not work correctly , try compile the 2 examples and see the results
not well right is local variable here
program WIN32CUI 'test';
#include 'console.zir';
#include 'zirutils.zir';
procedure main()
{
char right[5100];
dword indx;
char tmp[255];
indx = 2;
eax = indx
imul eax,255
Edx = @right
add eax,Edx
push eax
IntToStr(indx,@tmp);
print(@tmp,'\r\n');
pop eax
IntToStr(eax,@tmp);
print(@tmp,'\r\n');
indx = 3;
eax = indx
imul eax,255
Edx = @right
add eax,Edx
push eax
IntToStr(indx,@tmp);
print(@tmp,'\r\n');
pop eax
IntToStr(eax,@tmp);
print(@tmp,'\r\n');
}
main();
wait_key(nil);
ExitProcess(0);
i think getting address of local variable has some problem.
http://www.freewebs.com/ogremagic/index.htm