Autor: Arndt Lindner (---.dip0.t-ipconnect.de)
Datum: 06.10.18 17:09
Inline-Assembler-Routinen werden bei einem Aufruf mit PExec/PExecWait nicht gefunden (Fehlermeldung: Funktion unbekannt: MUL64 ).
Codebeispiel (XProfanX4):
struct complex = a!,b!
' Bildung von Complex (a,b)
proc c_build_ab
parameters double za, zb
declare memory rw : dim rw, complex
float rw,0 = za
float rw,8 = zb
return rw
endproc
' Multiplikation in Assembler
ASM "Mul64", 2
JMP Start
Ergebnis_Re:
DQ 0
Ergebnis_Im:
DQ 0
Start:
MOV EAX, par1
MOV EBX, par2
FLD QWORD PTR [EAX]
FLD QWORD PTR [EBX]
FMUL
FLD QWORD PTR [EBX+8]
FLD QWORD PTR [EAX+8]
FMUL
FSUB
FSTP QWORD PTR [Ergebnis_Re]
FLD QWORD PTR [EAX+8]
FLD QWORD PTR [EBX]
FMUL
FLD QWORD PTR [EBX+8]
FLD QWORD PTR [EAX]
FMUL
FADD
FSTP QWORD PTR [Ergebnis_IM]
MOV EAX, Ergebnis_RE
ENDASM
proc c_mulass
parameters memory zx1,zx2
declare pointer P
P = Mul64(zx1,zx2)
return c_build_ab(Float(P,0),Float(p,8))
endproc
' Multiplikation in XProfanX4
proc c_mul
parameters memory zx1, zx2
return c_build_ab(float(zx1,0)*float(zx2,0) - float(zx1,8)*float(zx2,8), float(zx1,0)*float(zx2,8) + float(zx1,8)*float(zx2,0))
endproc
' Ausgabeformatierung
proc c_str
parameters memory zx1
return "("+format$("%e",float(zx1,0))+","+format$("%e",float(zx1,8))+")"
endproc
proc berechnung
parameters string Filemapname, rea, ima
struct complex = a!, b!
declare memory zi : dim zi, complex
declare memory ci_feld : dim ci_feld,100
declare handle fmhnd
fmhnd = FileMap("Open",Filemapname)
ci_feld = FileMap("Map",fmhnd)
zi = c_build_ab(val(rea),val(ima))
zi = c_mul(zi,zi)
float ci_feld,0 = float(zi,0)
float ci_feld,8 = float(zi,8)
Filemap("Close",fmhnd)
dispose ci_feld
dispose zi
endproc
proc berechnungass
parameters string Filemapname, rea, ima
struct complex = a!, b!
declare memory zi : dim zi, complex
declare memory ci_feld : dim ci_feld,100
declare handle fmhnd
fmhnd = FileMap("Open",Filemapname)
ci_feld = FileMap("Map",fmhnd)
zi = c_build_ab(val(rea),val(ima))
zi = c_mulass(zi,zi)
float ci_feld,0 = float(zi,0)
float ci_feld,8 = float(zi,8)
Filemap("Close",fmhnd)
dispose ci_feld
dispose zi
endproc
' Hauptprogramm
declare memory c_feld : dim c_feld,100
declare memory zn : dim zn, complex
declare handle fmhnd, thnd1, thnd2
WindowTitle "Test"
WindowStyle 15
Window 10,10-600,300
Set("AsmMode", 0)
fmhnd = create("FileMap","Feld",100)
c_feld = FileMap("Map",fmhnd)
print "Test im Hauptprozess ohne Assembler"
clear c_feld
berechnung("Feld","2.8","7.5")
print c_str(c_feld)
print "Test im Hauptprozess mit Assembler"
clear c_feld
berechnungass("Feld","2.8","7.5")
print c_str(c_feld)
print "Test im Parallelprozess ohne Assembler"
clear c_feld
thnd1 = PExecWait("|berechnung","Feld","2.8","7.5")
print c_str(c_feld)
Print "Test im Parallelprozess mit Assembler"
clear c_feld
thnd2 = PExecWait("|berechnungass","Feld",2.8,7.5)
print c_str(c_feld)
FileMap("Close",fmhnd)
dispose zn
dispose c_feld
waitinput
end
Der Code ist aus einem größeren Projekt "herausgekürzt" aber immer noch ziemlich lang.
Geht das nicht oder mache ich etwas falsch?
|
|