Yes Mike, both data and code are automatically aligned. At least that is my intention.
arrays with a constant index, like a[40] are resolved to a fixed offset at compile time, so it looks exactly like a simple variable.
[EBX+offset]
arrays with a simple index variables, like a[ i] are generally SIB encoded, with the indexer loaded into the ESI register, thus:
[EBX+ESI*4+offset]
All other types of indexes are pre-calculated and held in temp variables before the main expression is performed.
It is possible to extract blocks of both o2 script (unlinked partial machine code) and corresponding assembly code. This is best done with the exo2 compiler in a dos console:
t.o2bas
###
function f(sys a) as sys
return a*2
end function
f 3
###
exo2 -b t.o2bas>t.txt
t.txt
' '_2
' 'FUNCTION F
E9 gf _over_ ' jmp fwd _over_
!10
.f#sys ' .f#sys
( ' (
55 ' push ebp
8B EC ' mov ebp,esp
83 C4 F0 ' add esp,-16
8D 7D F0 ' lea edi,[ebp-0x10]
33 C0 ' xor eax,eax
89 07 ' mov [edi],eax
8B 45 08 ' mov eax,[ebp+0x8]
6B C0 02 ' imul eax,eax,2
E9 gf _return_ ' jmp fwd _return_
' '_4
._exit_ ' ._exit_
8B 45 F0 ' mov eax,[ebp-0x10]
._return_ ' ._return_
8B E5 ' mov esp,ebp
5D ' pop ebp
C2 04 00 ' ret 4
) ' )
._over_ ' ._over_
' '_6
6A 03 ' push 3
E8 gl f#sys ' call f#sys
' '_7
._end_
This is more useful for compiler checking than developing user code.