News:

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

Declare "data" after "code" ?

Started by WYVERN666, December 27, 2011, 03:45:12 PM

Previous topic - Next topic

Magnum

Quote from: jj2007 on December 27, 2011, 05:37:52 PM
Dave is on the right track - this works:

include \masm32\include\masm32rt.inc

.code
start: push MB_OK
push offset AppName
push chr$("Hello World")
push 0
call MessageBox
exit

.data
AppName db "Masm32:", 0

end start


From what I compiled, this puts the data in the same position as the data that is declared "normally."

A file compare does show the programs have some differences.

Have a great day,
                         Andy

dedndave

true - it is in the same position in the resultant EXE file
however, the forward reference issue is strictly a source file problem
the assembler chokes because MS has simplified the first pass, compared to older MASM versions

PBrennick

It would seem to me that the point of this issue is because the DATA section makes the liistimg look ugly when dealing with programs that use a lot of data. The solution of using an INC file as mentioned above is a good one. Don't forget, though, that you can use the NOLISTING directive  around the datat section also.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

vanjast

Isn't there an option to coagulate all the data sections in the assembler ?
:8)

dedndave

you can combine sections
i believe PoLink does this by nature
or with Link, use the /MERGE option