News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Number -N to String -N MACRO Q?

Started by Ficko, July 02, 2010, 06:40:50 PM

Previous topic - Next topic

Ficko

How to convert a minus number to string retaining the format. -SDWORD-
MASM seems to convert it to "DWORD" except for "%echo" :eek

I need "-20.0" and not "4294967276.0" ::)


.686p
.model flat, stdcall
option casemap :none

pushf4 MACRO Num:REQ
push dword ptr 0
    ORG $-4
    REAL4 Num
ENDM

First MACRO Num:REQ
LOCAL Fl,StrFl
Fl EQU Num
%echo @CatStr(<%Fl>)
StrFl CATSTR %(&Fl),<.0>
%echo StrFl
pushf4 StrFl
ENDM

.code
start:
int 3
First -10*2
fld dword ptr [esp]
end start

jj2007

include \masm32\include\masm32rt.inc

pushf4 MACRO Num:REQ
  push dword ptr 0
  ORG $-4
  REAL4 Num
ENDM

First MACRO Num:REQ
  pushf4 @CatStr(%Num, <.0>)
ENDM

.code
start:
int 3
First -10*2
fld dword ptr [esp]
exit
end start

Ficko

Damn! 
Thanks :clap:

I wish I could understand why something works and why not. :red  :green