Veröffentlicht 5. Juli 200817 j Hallo, ich bekomme folgende Ausgabe: c=a+b*c, a=4.94066e-324, b=9.88131e-324, c=0 c=a+b*c, a=4.94066e-324, b=9.88131e-324, c=0 nach der Ăbersetzung (Netwide Assembler und MinGW gcc): nasm -fwin32 z1.s gcc -o z1.exe z1.obj woran kann dss liegen, das so komische werte rauskommen??? hier der code (auch nachzulesen unter: Sample nasm programs ) BITS 32 extern _printf %macro pabc 1 ; a "simple" print macro section .data .str db %1,0 ; %1 is macro call first actual parameter section .text ; push onto stack backwards push dword [c+4] ; double c (bottom) push dword [c] ; double c push dword [b+4] ; double b (bottom) push dword ; double b push dword [a+4] ; double a (bottom) push dword [a] ; double a push dword .str ; users string push dword fmt ; address of format string call _printf ; Call C function add esp,32 ; pop stack 8*4 bytes %endmacro section .data fmt: db "%s, a=%g, b=%g, c=%g",10,0 a: dq 1 b: dq 2 five: dq 5.0 ; constant 5.0 section .bss ; unitialized space c: resq 1 ; reserve a 64-bit word section .text global _main _main: @l1: fld qword [a] fld qword fld qword [c] fmulp faddp pabc "c=a+b*c" mov eax, 0 leave ret Am Ende der Anwendung wird auch ein Speicherzugriffs Meldung von Windows ausgespuckt *pfui ...
6. Juli 200817 j Du initialisierst a und b mit Integerwerten, und c gar nicht. AuĂerdem speicherst du das Ergebnis nicht wieder in c.
Archiv
Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.