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
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)
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.