Hi Charles,
I try to run \examples\Asm32\AddrVar.o2bas in 64-bit mode. It seems I cannot replace the number of [ecx+4] with a constant or variable. Is there a way how I could make function f1 or f2 work correctly?
Roland
$ filename "AddrVar1.exe"
'uses rtl32
'uses rtl64
uses console
function f(sys*a) as sys
sys p=@a
mov ecx,p
#ifndef mode64bit
return [ecx+4]
#else
return [ecx+8]
#endif
end function
% ofs=sizeof(sys)
function f1(sys*a) as sys
sys p=@a
mov ecx,p
return [ecx+ofs]
end function
function f2(sys*a) as sys
sys p=@a
int offs=sizeof(sys)
mov ecx,p
return [ecx+offs]
end function
indexbase 1
sys aa[10]={1,2,3,4,5,6,7,8,9,10}
printl "f aa[2] = " f aa[2] 'result: 3
printl "f1 aa[2] = " f1 aa[2] 'result: 2
printl "f2 aa[2] = " f2 aa[2] 'result: 2
printl "Enter..." : waitkey