| |
|
|
Frank Abbing | In another Thread watts the example called, a Own Assemblerfunktion a others aufzurufen: CompileMarkSeparation {$Clq}
Declare A&,B&,C&,D&
Cls
Print "Test Start:"
Asmstart Zweite
Parameters a&,b&
Return c&
mov eax,para1
mov ebx,para2
add eax,ebx
Asmend
Asmstart Erste
Return d&
Local Var1 :DWORD
Local Var2 :DWORD
mov Var1,6
mov Var2,3
Scall Zweite,Var1,Var2
Asmend
Print "Ergebnis (6+3=9): " + Str$(D&)
Waitkey
End
In my actually Program make is plenty of XPIA use, and there's me Fehlerquelle noticed. Übergibt one Parameter a function on another, so must before The own Parameter rescued go. this is too logical, because XPIA to Vereinfachung the Parameter Passing interne variables using. naturally must these global his. therefore can a aufgerufene function The Parameter the aufrufenden function change. These counts it means to appeal To saving! One example with Parameters, around the To explain: CompileMarkSeparation {$iq}
Declare z1&,z2&
Cls
Asmstart one (0,0)
mov eax,para1
add eax,para2
Asmend
-------------------------
Asmstart two (10,15)
Scall one,500,45
add eax,para1
add eax,para2
Asmend (z1&)
-------------------------
Asmstart three (10,15)
push para1
push para2
Scall one,500,45
pop para2
pop para1
add eax,para1
add eax,para2
Asmend (z2&)
Print "500 + 45 + 10 + 15 = " + Str $(z1&)+" wrong!"
Print "500 + 45 + 10 + 15 = " + Str $(z2&)+" correctly.!"
WaitInput
End
function two operates with incorrect Values moreover, during function three correctly. operates.
naturally functions The conventional manner the Parameter Passing - without The Vereinfachung - How dwelt: CompileMarkSeparation |
|
|
| |
|
|