I am trying to output decimals (int and floats) in almost all datatypes from byte
to real10
line by line in MB, but for some reason almost none of them are displayed correctly (image below), most of them are broken, can someone explain why is that happening and what is my mistake?
.386
.model flat, stdcall
option casemap: none
include \masm32\include\masm32rt.inc
.data
titletext db 'Title',0
frmt db 'A (Byte) = %d',10
db '-A (Byte) = %d',10
db 'A (Word) = %d',10
db 'B (Word) = %d',10
db '-A (Word) = %d',10
db '-B (Word) = %d',10
db 'A (ShortInt) = %d',10
db 'B (ShortInt) = %d',10
db 'C (ShortInt) = %d',10
db '-A (ShortInt) = %d',10
db '-B (ShortInt) = %d',10
db '-C (ShortInt) = %d',10
db 'A (LongInt) = %d',10
db 'B (LongInt) = %d',10
db 'C (LongInt) = %d',10
db '-A (LongInt) = %d',10
db '-B (LongInt) = %d',10
db '-C (LongInt) = %d',10
db 'D (Single) = %g',10
db '-D (Single) = %g',10
db 'E (Double) = %g',10
db '-E (Double) = %g',10
db 'F (Extended) = %g',10
db '-F (Extended) = %g',0
buff db 1024 dup (?)
Abyte db 6
nAbyte db -6
Aword dw 6
Bword dw 603
nAword dw -6
nBword dw -603
Ashort dd 6
Bshort dd 603
Cshort dd 6032000
nAshort dd -6
nBshort dd -603
nCshort dd -6032000
Along dq 6
Blong dq 603
Clong dq 6032000
nAlong dq -6
nBlong dq -603
nClong dq -6032000
Dsingle real4 0.001
nDsingle real4 -0.001
Edouble real8 0.074
nEdouble real8 -0.074
Fextended real10 735.430
nFextended real10 -735.430
.code
start:
invoke crt_sprintf, addr buff, addr frmt,
Abyte, nAbyte,
Aword, Bword, nAword, nBword,
Ashort, Bshort, Cshort, nAshort,nBshort, nCshort,
Along, Blong, Clong, nAlong, nBlong, nClong,
Dsingle, nDsingle,
Edouble, nEdouble,
Fextended, nFextended
invoke MessageBox, 0, addr buff, addr titletext, MB_OK
invoke ExitProcess, 0
end start
current result: