Saturday, March 14, 2020

ASM: Convert int to string in Assembly

This post shows how to convert int (DWORD) to string using MASM library dwtoa. There seems to be a bug in dwtoa as it can only handle 2147483647 instead of 4294967295 which is the maximum size of DWORD (32-bit). The code for dwtoa checks for a negative number which is not needed for DWORD. Note that DWORD is defined as 32-bit unsigned.



Pre-requisite:



To assemble:
\masm32\bin\ml /c /Zd /coff int2string.asm

To link:
\masm32\bin\Link /SUBSYSTEM:CONSOLE int2string.obj

2 comments:

DevManiac said...

This code does not even compile in VS2019!

Techno Scavenger said...

I haven't tried this using Visual Studio at all. This compiles if using MASM, see this link http://www.masm32.com/

Fedora install screen chronicle

Fedora install screen chronicle Below are links to Fedora installation screens. It is interesting to see how it has evolved over time. Fe...