Abt. XPIA-Funktionstest
===============
Läuft's oder nicht? Wenn nicht, sollte man das XPIA-Arbeitsverzeichnis im LemonEd prüfen sowie erfordelrichenfalls Zugriffsrechte auf die Arbeitsverzeichnisse gewähren. Bei mir hat's grad geklappt.
Gruss
Code
WindowTitle "Mit Frank Abbing's XPIA Max() und Min() eines Float-Arrays suchen"
Window 0,0-%maxx,%maxy
declare anzahl&
print "\n Gewünschte Anzahl an Fließkommazahlen im Array ?: ";
input anzahl&
case anzahl&=0:anzahl&=25
Declare Tabelle_1![anzahl&],Tabelle_2![2],x&,y&,z&,text$
Print " ";anzahl&;" zufällige Fließkommazahlen werden generiert."
Randomize
Tabelle_1![]=Rnd(100000)/1.09-50000
Print " Bereit für die Suche. Drücken Sie eine Taste!"
'Assemblerfunktions-Parameters:
' Adresse von Tabelle mit Floats, Adresse der Zieltabelle, Anzahl Floats
Waitinput
$MAKE CLE
AsmStart FindEdge
Parameters addr(Tabelle_1![0]), addr(Tabelle_2![0]), anzahl&,0
jmp weiter
flo1 dq 0
flo2 dq 0
weiter:
;
; Höchste Floatzahl ermitteln
;
mov edx,para1
mov ecx,para3
lea ebx,flo1
mov eax,[edx]
mov [ebx],eax
mov eax,[edx+4]
mov [ebx+4],eax
schleifei:
lea ebx,flo2
mov eax,[edx]
mov [ebx],eax
mov eax,[edx+4]
mov [ebx+4],eax
push ecx
push edx
fld flo2
fcomp flo1
fnstsw ax
shr ah,1
jc is_less
is_more:
pop edx
pop ecx
lea ebx,flo1
mov eax,[edx]
mov [ebx],eax
mov eax,[edx+4]
mov [ebx+4],eax
jmp is_ready
is_less:
pop edx
pop ecx
is_ready:
add edx,8
sub ecx,1
jne schleifei
mov edx,para2
lea ebx,flo1
mov eax,[ebx]
mov [edx],eax
mov eax,[ebx+4]
mov [edx+4],eax
;
; niedrigste Zahl ermitteln
;
mov edx,para1
mov ecx,para3
lea ebx,flo1
mov eax,[edx]
mov [ebx],eax
mov eax,[edx+4]
mov [ebx+4],eax
xschleifei:
lea ebx,flo2
mov eax,[edx]
mov [ebx],eax
mov eax,[edx+4]
mov [ebx+4],eax
push ecx
push edx
fld flo2
fcomp flo1
fnstsw ax
shr ah,1
jc xis_less
xis_more:
pop edx
pop ecx
jmp xis_ready
xis_less:
pop edx
pop ecx
lea ebx,flo1
mov eax,[edx]
mov [ebx],eax
mov eax,[edx+4]
mov [ebx+4],eax
xis_ready:
add edx,8
sub ecx,1
jne xschleifei
mov edx,para2
lea ebx,flo1
mov eax,[ebx]
mov [edx+8],eax
mov eax,[ebx+4]
mov [edx+12],eax
AsmEnd
Print
Print " Größe des Arrays: ";anzahl&;" Float-Werte"
Print " Höchster Wert aus dem Array = " + Str$(Tabelle_2![0])
Print " Niedrigster gefundener Wert = " + Str$(Tabelle_2![1])
Print " Fertig.":beep
WaitInput
End
Alles anzeigen