Post by ErdemalPost by ***@earthlink.netPost by ErdemalUnder Windows in assembler, I would like to display *floating point*
values. So, I need to convert the dword, qword and tword to strings.
I tried many of the sprintf, snprintf, wsprintf, ... from Msvcrt.dll
and got no significant :) result.
Check out the HLA Standard Library at http://webster.cs.ucr.edu.
It contains hundreds of routines that do things like what you're
requesting.
Cheers,
Randy Hyde
I dreamt of an example :(.
After that help, we figured you could do the example yourself. This
displays 1.5:
C:\Tmp>type x.asm
.586
.model flat, stdcall
.data
quotient qword 0
buffer byte 80 dup (0)
format byte 'Quotient: %f',0
titler byte 'Divide',0
.code
ExitProcess PROTO :DWORD
MessageBoxA PROTO :DWORD, :DWORD, :DWORD, :DWORD
extern C sprintf: proc
_Start proc public
push 3
fild dword ptr [esp]
mov dword ptr [esp], 2
fild dword ptr [esp]
add esp, 4
fdivp st(1),st(0)
fstp qword ptr [quotient]
push dword ptr [quotient+4]
push dword ptr [quotient]
push offset format
push offset buffer
call sprintf
add esp, 12
invoke MessageBoxA, 0, offset buffer, offset titler, 0
invoke ExitProcess, 0
_Start endp
end _Start
C:\Tmp>ml /c /coff x.asm
Microsoft (R) Macro Assembler Version 7.10.3077
Copyright (C) Microsoft Corporation. All rights reserved.
Assembling: x.asm
C:\Tmp>link /out:x.exe /subsystem:console x.obj msvcrt.lib kernel32.lib
user32.lib
Microsoft (R) Incremental Linker Version 7.10.3077
Copyright (C) Microsoft Corporation. All rights reserved.
C:\Tmp>x.exe
C:\Tmp>
--
- Tim Roberts, ***@probo.com
Providenza & Boekelheide, Inc.