News:

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

help : how to print this?

Started by boon, September 12, 2008, 11:18:36 AM

Previous topic - Next topic

boon

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 ?

Rainstorm

#1
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


Mark Jones

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
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

hutch--

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.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

boon

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 ?