News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Str$ (db) ?

Started by ookami, February 18, 2011, 11:50:58 AM

Previous topic - Next topic

ookami

Str$ macro works only with dd variables, but not less or more.

What should I do to display with  print db, dw, ax, etc ?

Thanks

Sorry for all my noob's questions...

dedndave

there are a few different ways to do it
one way is to use MOVSX, assuming you want to treat them as signed values
;for a byte
        movsx   eax,byte ptr MyByte
        print   str$(eax)
;for a word
        movsx   eax,word ptr MyWord
        print   str$(eax)

MOVSX converts signed bytes or words to dwords by sign-extending them
MOVZX is similar - it converts unsigned bytes or words to dwords by zero-extending them

jj2007

Quote from: ookami on February 18, 2011, 11:50:58 AM
Str$ macro works only with dd variables, but not less or more.

The Masm32 library macro is lowercase str$() and is indeed meant for dwords.
In contrast, the MasmBasic Str$ macro swallows almost everything, including byte and word registers, xmm regs, REAL vars, qwords etc.

ookami