yes yes..i know this isnt strictly speaking a bmax question,
but im using assembly language with bmax..so i guess
its kinda ok to post here ;)
first up..im 8086 newbie..so the following code is probably
a joke..but id like folks to look at it + make suggestions
and perhaps show me alternatives...
both of these functions set the elements of 16 element
float array to match that of a unit matrix..the first uses
basic movement & immediate values - the 2nd uses
the fpu instructions..which one is faster?, are there
better ways to do this?
_mat_unit4x4:
push ebp
mov ebp,esp
mov eax,[esp+4+4]
mov dword [eax],1.0
mov dword [eax+4],0.0
mov dword [eax+8],0.0
mov dword [eax+12],0.0
mov dword [eax+16],0.0
mov dword [eax+20],1.0
mov dword [eax+24],0.0
mov dword [eax+28],0.0
mov dword [eax+32],0.0
mov dword [eax+36],0.0
mov dword [eax+40],1.0
mov dword [eax+44],0.0
mov dword [eax+48],0.0
mov dword [eax+52],0.0
mov dword [eax+56],0.0
mov dword [eax+60],1.0
mov esp,ebp
pop ebp
ret
_mat2_unit4x4: ;;;FPU version
push ebp
mov ebp,esp
mov eax,[esp+4+4]
fldz
fst qword [eax+4]
fst qword [eax+12]
fst qword [eax+24]
fst qword [eax+32]
fst qword [eax+44]
fstp qword [eax+52]
fld1
fst dword [eax]
fst dword [eax+20]
fst dword [eax+40]
fstp dword [eax+60]
mov esp,ebp
pop ebp
ret
thanks ;)
but im using assembly language with bmax..so i guess
its kinda ok to post here ;)
first up..im 8086 newbie..so the following code is probably
a joke..but id like folks to look at it + make suggestions
and perhaps show me alternatives...
both of these functions set the elements of 16 element
float array to match that of a unit matrix..the first uses
basic movement & immediate values - the 2nd uses
the fpu instructions..which one is faster?, are there
better ways to do this?
_mat_unit4x4:
push ebp
mov ebp,esp
mov eax,[esp+4+4]
mov dword [eax],1.0
mov dword [eax+4],0.0
mov dword [eax+8],0.0
mov dword [eax+12],0.0
mov dword [eax+16],0.0
mov dword [eax+20],1.0
mov dword [eax+24],0.0
mov dword [eax+28],0.0
mov dword [eax+32],0.0
mov dword [eax+36],0.0
mov dword [eax+40],1.0
mov dword [eax+44],0.0
mov dword [eax+48],0.0
mov dword [eax+52],0.0
mov dword [eax+56],0.0
mov dword [eax+60],1.0
mov esp,ebp
pop ebp
ret
_mat2_unit4x4: ;;;FPU version
push ebp
mov ebp,esp
mov eax,[esp+4+4]
fldz
fst qword [eax+4]
fst qword [eax+12]
fst qword [eax+24]
fst qword [eax+32]
fst qword [eax+44]
fstp qword [eax+52]
fld1
fst dword [eax]
fst dword [eax+20]
fst dword [eax+40]
fstp dword [eax+60]
mov esp,ebp
pop ebp
ret
thanks ;)