News:

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

How to use sas macro

Started by DavidJohn, October 14, 2007, 05:21:13 AM

Previous topic - Next topic

DavidJohn

I can able to use sas macro for normal single lined string. How can i use this for multilined string.

David

MichaelW

I'm not sure whether you mean a string that is defined on multiple lines or one that includes line breaks, so it displays on multiple lines, so I did both. (build as console app)

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
    include \masm32\include\masm32rt.inc
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
    .data
    .code
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
testproc proc
    LOCAL xxx:DWORD
    sas xxx, "Hello, I'm Larry,",13,10,\
             "this is my brother Darryl,",13,10,\
             "and this is my other brother Darryl.",13,10
    print xxx,13,10
    ret
testproc endp
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
start:
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
    call testproc

    inkey "Press any key to exit..."
    exit
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
end start


Hello, I'm Larry,
this is my brother Darryl,
and this is my other brother Darryl.
eschew obfuscation

DavidJohn

Thanks MichaelW, thats exactly what i was looking for. Is there any limit to the no. of characters can be entered. Bcoz i can enter upto a limit after that i'm getting the message that " string or text literal too long". This is not a problem i was just asking.

David

MichaelW

According to Chapter 5 of the MASM Programmer's Guide available here, under Declaring and Initializing Strings: "An initialized string can be no longer than 255 characters." The value 255 appears to be an upper limit with the actually limit depending on the form of the declaration. For a test string defined on a single line and inside a single pair of double quotes the limit was 248 bytes. Line continuations, additional pairs of quotes, and comma separators all seem to reduce the limit, by something like 2-4 bytes each.
eschew obfuscation