You can use wsprintf
for that purpose:
.data
format db "%X",0
.data?
buffer db 256 dup (?)
.code
invoke wsprintfA,ADDR buffer,ADDR format,eax
Note that there are safer alternatives to wsprintf
, but I don't know if they can be found in the masm32 include files and import libraries.