Zum Inhalt springen

Empfohlene Beiträge

Geschrieben

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 ... :(

Erstelle ein Benutzerkonto oder melde Dich an, um zu kommentieren

Du musst ein Benutzerkonto haben, um einen Kommentar verfassen zu können

Benutzerkonto erstellen

Neues Benutzerkonto für unsere Community erstellen. Es ist einfach!

Neues Benutzerkonto erstellen

Anmelden

Du hast bereits ein Benutzerkonto? Melde Dich hier an.

Jetzt anmelden

Fachinformatiker.de, 2024 by SE Internet Services

fidelogo_small.png

Schicke uns eine Nachricht!

Fachinformatiker.de ist die größte IT-Community
rund um Ausbildung, Job, Weiterbildung für IT-Fachkräfte.

Fachinformatiker.de App

Download on the App Store
Get it on Google Play

Kontakt

Hier werben?
Oder sende eine E-Mail an

Social media u. feeds

Jobboard für Fachinformatiker und IT-Fachkräfte

×
×
  • Neu erstellen...