Someone help me out.:( I want a routine to convert float 4,8,10 bytes to ascii and ascii back to 4,8,10 bytes float. I want this kind of custom float routine for my asm project. If anyone could give me sourcecode for this routine, i would be thankful.:confused:
Posted on 2002-06-13 07:59:56 by Wonder Mage
I already replied a answer to this question to you in another thread.
Look in the masm32.lib for such routines.
Posted on 2002-06-13 08:06:25 by bazik
Bazik: You replied me about the conversion routine. That's only fixed to 64bit 8 byte conversion. I want a routine which can convert 32 bit float to 80 bit float and viceversa. Please send me reply?:rolleyes:
Posted on 2002-06-13 08:15:00 by Wonder Mage
Write your own (like a REAL MAN) :tongue:
Posted on 2002-06-13 08:35:52 by bazik
Posted on 2002-06-13 08:45:09 by Wonder Mage
If speed isn't all that important and you don't have the mad-a$$-skillz ;)
to write a REAL4 routine, use the REAL8 routine, and store the
REAL8 value to a REAL4 variable - presto, you have a ascii->REAL4
routine :]
Posted on 2002-06-13 11:33:30 by f0dder
Look at the source code for FloatToStr & StrToFloat, they contains comments on how to change them to work for Real10 instead. :alright:
Posted on 2002-06-13 12:15:16 by Eóin

Bazik everyone hates you here, do you want newcomers to hate you more than that? But you cannot be angry, as you have got anger in your head already.:grin: sorry for that.

What is this all about? Do you value your stay on this board? If so, change your attitude, none of these people owes you anything and yes, some things have to be done by yourself or you'll have to accept that it's not available.
Posted on 2002-06-13 12:30:42 by Hiroshimator
I am sorry about that. You did not saw what he has replied to me? I am really sorry to bazik and also all. i was some how angry for what bazik replied. Yeah i am trying to make a sourcecode myself but i have no clue how i can work with it, i am new to asm. Please do not be angry. i apologise to all espeacially bazik. i have send him a private message about this. :(
Posted on 2002-06-14 07:35:42 by Wonder Mage
No problem, WM. Just look more for

:tongue: <---------- this :)

That indicates, not to take a reply to serious! :alright: ;)


P.S.: You shouldn't call our big boss "Heroshmiter" (subject of your post) :tongue: (<--- here it is)
Posted on 2002-06-14 07:40:16 by bazik
I haven't call heroshmiter. i do not know him as i am new here. Thanks for the reply, now i am satisfied.:)
Posted on 2002-06-14 07:47:38 by Wonder Mage
BTW, please clear your PM inbox AND sent messages.
Else I can't reply =)
Posted on 2002-06-14 07:49:25 by bazik
I have removed all the messages from there. I forgot to look at this folder called pm send list. now you can send me messages.
Posted on 2002-06-14 07:54:56 by Wonder Mage
sorry i forgot to say that heroshmiter called upon me so i gave him a reply.
Posted on 2002-06-14 08:13:52 by Wonder Mage
here's a copy of two routines I did some time back for a logis simulator. They are in no way optimized but they do work.

PrintTime proc InitTime:DWORD,

fld fNotch_X ; Load Notch pointer
fimul StateCnt ; get percentage states
fimul ClkPer ; Scale to clock time
fiadd InitTime ; Add Initial time offset
fbstp NotchBCD ;Store BCD NotchPntr Offset

invoke BCDToString,
pDestStr,pLenDestStr, ;String length returned
pScale, ;convert notch distance to time
ret 36

PrintTime endp
BCDToString proc pSrcBCD:DWORD,

push ebx
push ecx
push edx
push esi
push edi

mov esi, pSrcBCD ;point to real number
add esi, LenSrcBCD ;point to end of BCD
dec esi ; binary len = decimal len - 1
dec esi ; point to end less sign bit
mov edi, pDestStr ; point to Dest string
mov ebx, 0
mov ecx, 0

.WHILE (ecx < 9)
mov al, ; get packed byte
mov ah, al
shr al, 4
and al, 0fh ; mask to lsnibble
mov edx, 2
.WHILE (edx > 0)
.IF (al > 0)
inc ebx ; first non-zero char.
.IF (ebx > 0) ; trim off leading zero's
.IF (al == 0)
inc ebx ; account for embedded zero char's .ENDIF
add al, 30h ; add ascii base for numbers
mov , al ; store ascii char
inc edi ; increment char count
mov al, ah ; get packed byte
and al, 0fh ; mask to msnibble
dec edx
dec esi ; point to next packed byte
inc ecx ; do 9 bytes

.IF (ebx == 0) ; account for zero (0)
mov eax, 30h
mov , eax
inc edi
inc ebx

mov esi, pStrSuff ; load TimeScale pointer
mov ecx, LenStrSuff ; load string length
.WHILE (ecx > 0)
mov al, ; add it to the end of the TimeString
mov , al
inc esi
inc edi
inc ebx
dec ecx
mov eax, 0 ; finish string with a zero termination
mov , eax
mov esi, pLenDestStr ; load destination string length pointer
mov , ebx

pop edi
pop esi
pop edx
pop ecx
pop ebx

ret 24

BCDToString endp

hope it helps. sometimes folks in here would rather pee in yer coffee than actually fork over an idea or two. Maybe they forgot their beginnings now that they are all high and mighty eh?
Posted on 2002-06-14 18:16:19 by sceptor
well as bazik told me to do it myself i converted base to ascii successfuly! but i am not able to convert float 4 byte to ascii and back. Can someone tell me with an example what instructions are to be processessed to do this?:alright:
Posted on 2002-06-17 07:54:07 by Wonder Mage