flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
system error 21 Nov 2016, 21:58
I think the printf prints a double. Something like
Code: push dword[s+4] push dword[s] push f call [printf] add esp,12 call [getchar] invoke exit,0 f db '%f',0ah,0 s dq 3.43 Using 32-bit floats may complicate things further (promotion, multiple pushes etc). Try using all doubles for variables and see how it goes. Btw, printf's arguments like variables are passed by values, not by reference. If you are new, my suggestion is to test short codes first especially when dealing with Win API and high-level constructs. They are known to hide things and children. |
|||
![]() |
|
system error 21 Nov 2016, 22:52
Ok, here's a wild guess of what you are trying to achieve here
Code: cinvoke scanf,x,A cinvoke scanf,x,B cinvoke getchar ;for that classic "I can't see the output" cry. fld qword[A] ;the thing fld qword[B] fadd st0,st1 fstp qword[C] ;Split the double into two unit. printf dont like floats. cinvoke printf,f,dword[C],dword[C+4] cinvoke getchar ;don't fall asleep! invoke exit,0 x db '%lf',0 ;double needs a %lf specifier for scanf f db '%f',0ah,0 A dq ? B dq ? C dq ? I'm not interested in solving it for you but judging by the blasphemy of Win API that you are messing up with, I decided to throw in some clues. |
|||
![]() |
|
revolution 22 Nov 2016, 03:12
If you include win32ax then you can use the double keyword instead of manually pushing two dwords:
Code: cinvoke printf, tpo, double C |
|||
![]() |
|
UspenskiyKE 22 Nov 2016, 08:35
Problem solved! Thanks to all!
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.