I have a return value in AL and but it's way too big: No matter if put and eax,0FFFFh or and eax,0FFh for output with dwtoa it leaves me with a value of 4207308 in eax either way. mov temp,eax invoke dwtoa,addr temp,addr CharBuffer invoke lstrcat,addr buffer,addr CharBuffer invoke MessageBox,addr buffer,addr AppName,MB_OK Also CharBuffer holds only one byte, so how come ther is a value above 255 ?
Posted on 2001-05-08 14:02:00 by goofee
well first let me explain what is dwtoa doing for you... i am not sure but i suppose is that dwtoa that uses wsprintf and a fixed format string (MASM) ? well it will take the valuein eax and convert it to a string, (a null terminated string) now such a string can barely be 2 bytes: -one for a single digit and a zero/null as a terminator :D but usually there are much many digits even in a "255" string there are 4 bytes (3 ascii codes and a null terminator) ... so a buffer passed by addr to dwtoa MUST be greater then 1 byte ;) then again i beliwe you are sending the addr of the temp variable as the first parameter instead of the contents of the variable (ie eax) so its just normal to get the same number allways: its the damn address you are printing an not the contents at that adress ;) hope this helps...
Posted on 2001-05-08 19:59:00 by BogdanOntanu
Yes, thanks, last thing you said was actually it. I get a return value, that's one digit in charbuffer (no matter what the size of charbuffer (it's the number scsi hostadapters). I know that dwtoa gives you a ascii value in return for a dword. It's in the m32lib dir. I don't understand it's code yet cause I still got a few problems with addresses and bit operations (or and the like). Have to admit that I didn't look at its code very thoroughly ;-). goofee This message was edited by goofee, on 5/9/2001 12:12:52 PM This message was edited by goofee, on 5/9/2001 2:12:10 PM
Posted on 2001-05-09 12:06:00 by goofee