News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

wsprintf word

Started by jimg, June 13, 2017, 01:47:52 AM

Previous topic - Next topic

jimg

Is this a known bug in masm I've missed all these years?  (Or is it just another thing I've forgotten with age)

When trying to print an integer using wsprintf, the stack pointer gets screwed up.  Works properly in uasm and variants.

.data
xsp  dd 0
x2p  dd 0
bux db 100 dup (0)
fmt db 'wordtest = %u',0
wtst dw 7
smt db 'before=%li, after=%li',0
.code
mov xsp,esp

inv wsprintf,addr bux,addr fmt, wtst

mov x2p,esp
inv wsprintf,addr bux,addr smt,xsp,x2p
inv MessageBox,0,addr bux,0,0
mov esp,xsp  ; fix



qWord

yep, it is a well known bug of the INVOKE directive for BYTE- and WORD-sized parameters that had been fixed with later versions  of MASM (7+ IIRC)
MREAL macros - when you need floating point arithmetic while assembling!

jimg

Thank you.  Now that you mention it, I remember something from the dark day before jwasm.  For some reason I was focused on wsprintf rather than invoke.