The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: boon on September 12, 2008, 11:18:36 AM

Title: help : how to print this?
Post by: boon on September 12, 2008, 11:18:36 AM
i have a question on outputting character..if i put many lines of characters in an identifier, how can i print it out ?
just like this..
                                _char     db   " hello world",13,10
                                             db   " welcome to masm32",13,10
                                            db   " Please input ur name",13,10

i can do this in 16-bits but when come to 32-bits, which operator should i use ? And how to declare the identifier ? Is it the same way as 16-bits ?
Title: Re: help : how to print this?
Post by: Rainstorm on September 12, 2008, 11:30:57 AM
you can do it without seclaring it in the data section
print addr _char,13,10

[Edit] the above code is if you declared the variable like you did in the .data section

Title: Re: help : how to print this?
Post by: Mark Jones on September 12, 2008, 12:02:32 PM
Something along these lines should work, experiment with it:


include masm32rt.inc

.data
_char   db   "Hello World!",13,10
        db   "Welcome to MASM32.",13,10
        db   "Please input your name: ",0

.code
main:
        print ADDR _char
        ; other code here...
        ret
Title: Re: help : how to print this?
Post by: hutch-- on September 12, 2008, 12:16:22 PM
boon,

The only thing you need to modify is on your last data line you need to add a terminating zero.

You can use the library procedure StdOut using ADDR _char or you can use the print macro that automates the procedure call.
Title: Re: help : how to print this?
Post by: boon on September 12, 2008, 05:54:42 PM
okok...thanks a lot..
by the way,what is the difference between print " " and print chr$(" ") ?
and is it possible for us to play video file in masm32 such as .rm or .rmvb ?