Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Neuen Beitrag zur Code-Library hinzufügen (https://www.delphipraxis.net/33-neuen-beitrag-zur-code-library-hinzufuegen/)
-   -   assembler (https://www.delphipraxis.net/207960-assembler.html)

JJFCNC 20. Mai 2021 17:03

assembler
 
hi guy's

ich kann machen was ich will, die Abfrage: THEN_b
funktioniert nicht.

Weiß jemand einen Rat ?

Delphi-Quellcode:
              asm
                INC nZaehler
                JMP @start
              @start:
                FLD apX
                FMUL Rate
                FST sum_asm
                FLD apMin
                FCOM ST(1)
                JNA @THEN_a       // wenn nicht größer
                JMP @ELSE_a
              @THEN_a:
                FLD apMin
                FSTP apX
                JMP @END_a
              @ELSE_a:
                FLD apX
                FMUL Rate
                FSTP apX
                JMP @END_a
              @END_a:
                FLD Summe
                FADD apX
                FST sum_asm
                FLD H
                FCOM ST(1)
                JNB @THEN_b       // wenn nicht kleiner
                JMP @END_b
              @THEN_b:
                FLD H
                FSUB Summe
                FSTP apX
                JMP @END_b
              @END_b:
                FLD apX
                FMUL halbe_asm
                FADD D_ist
                FSTP D_Ist
                FLD Summe
                FADD apX
                FSTP Summe
              end;

JJFCNC 20. Mai 2021 17:12

AW: assembler
 
Liste der Anhänge anzeigen (Anzahl: 1)
habe debugger hardcopy erstellt.
siehe Anlage.

markus888 20. Mai 2021 18:24

AW: assembler
 
Ich nehme an du willst FCOM auswerten.
Falls ja, solltest du dir mal den Befehl genauer ansehen.
Der ändert ja keine Statusflags der ALU, folglich machen die conditional jumps auch keinen Sinn.

Arbeite persönlich nicht mit der FPU. Müsste das auch selbst nachlesen. Nur funktionieren kann es nicht, so viel ist sicher.

Da das vermutlich ja eh nur Übungskarakter hat, solltest du dich inhaltlich etwas damit beschäftigen.
Oder lass es einfach den Compiler machen und betrachte den Maschinencode den er erstellt.
Da kannst vermutlich viel lernen. :thumb:

Edit:
Hier schaue ich nach: https://www.felixcloutier.com/x86/index.html
FPU: http://website.masmforum.com/tutorials/fptute/

Amateurprofi 20. Mai 2021 22:52

AW: assembler
 
FCOM setzt nur die Flags C0, C2, C3 im FPU-Status-Word, nicht aber das EFlags-Register, welches von Jxx ausgewertet wird.
Verwende anstatt FCOMI oder FUCOMI

Aus Intel® 64 and IA-32 Architectures Software Developer’s Manual

FCOM/FCOMP/FCOMPP—Compare Floating Point Values
Description
Compares the contents of register ST(0) and source value and sets condition code
flags C0, C2, and C3 in the FPU status word according to the results (see the table
below). The source operand can be a data register or a memory location. If no source
operand is given, the value in ST(0) is compared with the value in ST(1). The sign of
zero is ignored, so that –0.0 is equal to +0.0.

FCOMI/FCOMIP/ FUCOMI/FUCOMIP—Compare Floating Point Values and Set EFLAGS
Description
Performs an unordered comparison of the contents of registers ST(0) and ST(i) and
sets the status flags ZF, PF, and CF in the EFLAGS register according to the results
(see the table below). The sign of zero is ignored for comparisons, so that –0.0 is
equal to +0.0.


Alle Zeitangaben in WEZ +1. Es ist jetzt 02:13 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz