Hallo, guten Tag.
Ich habe jetzt mal die ASM in eine Proc reingepack und die funktionieren mit dem Procaufruf:
Code
$MAKE CLE
Declare wo&
Window 20,20-400,400
Cls RGB(255,255,255)
fliesskomma
print " ",float(wo&,0)
fpi2
print " ",float(wo&,0)
WaitInput
End
Proc fliesskomma
AsmStart fliesskomma()
' senkrechter Wurf nach oben:
' h = (v0-0.5*g*t)*t
.data
v0 dq 13.5
g dq 9.81
einhalb dq 0.5
t dq 1.3
Hoehe dq ?
.code
finit
fld t ' t in st(0)
fst st(1) ' Kopie nach st(1)
fmul g ' st(0)=g*t
fmul einhalb ' st(0)=0.5*g*t
fsubr v0 ' st(0)=v0 - 0.5*g*t
fmulp st(1),st(0) ' st(1)=st(1)*st(0), pop
fstp Hoehe ' zurueckschreiben
LEA eax,Hoehe
AsmEnd (wo&)
EndProc
Proc fpi2
AsmStart fpi2()
.data
einhalb1 dq 0.5
zahl dq ?
.code
finit
fldpi
fmul einhalb1
fstp zahl
LEA eax,zahl
AsmEnd (wo&)
EndProc
Alles anzeigen
Auch diese mit der Übergabe einer Variablen funktioniert:
Code
$MAKE I
Declare x&,z&
Cls
x&=33
schleife x&
Print Str$(z&)
WaitInput
End
Proc schleife
AsmStart Funktionsname1(x&)
mov eax,0
mov ebx,para1
mov ecx,0
.while ecx<12
add eax,ebx
Inc ecx
.endw
AsmEnd (z&)
EndProc
Alles anzeigen
Was ist jetzt der Unterschied mit diesem aufruf wenn die ASM in eine if 0/Endif ist:
wo&=Call(GetXpiaProcAddress(XpiaModule&,"fliesskomma"))
Danke.
Gruss