News:

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

Macro like .code/.data/.data?/.const, etc?

Started by asmftw, September 20, 2008, 01:24:14 AM

Previous topic - Next topic

asmftw

hello, I have a macro like this for creating text strings and moving them into registers / pushing them onto the stack:

TEXT macro pszText:VARARG                    ; Macro for creating text strings
local szText
    .const
szText db pszText,0
    .code
    exitm <offset szText>
endm


How can I make a custom label in my program where all the data will fall under, instead of .const?


For example, normally if I do:
invoke MessageBoxA,0,TEXT("TEST"),TEXT("TEST!!"),0

my .const section will have
"TEST",0
"TEST!!",0

I want the text to appear under a user defined label, for instance:

.code
start:
  invoke MessageBoxA,0,TEXT("TEST"),TEXT("TEST!!"),0
  invoke ExitProcess,0
ConstantStrings: ;<-- strings should appear under here
;other data is here

japheth

Hi,

it has to be done this way then:


    .386
    .model flat, stdcall
    option casemap:none
    option dotname

TEXT macro s
local xxx
    .code .text$2
xxx db s,0
    .code
    exitm <offset xxx>
    endm
   
    .code .text$2
StartStrings:

    .code
start:
    mov eax, TEXT("abc")
    mov ecx, TEXT("def")
    ret

    end start