hi all,

for the first time i've decided to divide a project in several different asm modules, since it is coming big (o9ver 4000 lines), and also to have a more professional modular project. I've put all the images in a "resource" folder, leaving all the .asm in the main folder. As someone of you already know I'm a "Tasm" :) ( :( )
But here is the mess...
1) I've difficult to find some correct makefile example to compile several asm files togheter... I've put up one looking at dos borland sample "WhereIs", it work but not correctly... find the .rc file.. sometimes don't recompile modified .asm... a strange behaviour, seems really thereis something wrong.
2) Is there any Tasm32/Tlink option good for big projects ?
3) How is now for the global variables that i need to share between all the asm modules ? I'm trying to use GLOBAL definition in the .inc file, something like

GLOBAL g_szBuffer:BYTE:200

and only in main.asm module

g_szBuffer db 200 dup (0)

it Seems work, but it dont work for

GLOBAL g_szFormat:BYTE:4

in main.asm

g_szFormat db "%lu",0

I get an icompatibility error between the 2 g_szFormat definitions....
Also for this GLOBAL string declaration i can't find any Tasm sintax example :(

4) Then, is GLOBAL correct? Is better use PUBLIC ? The two directives seems give the same effect...


Thanks B7
Posted on 2003-09-13 03:31:50 by Bit7
ok, ive solved :)

make file, there was an error !

variables, defined as GLOBAL in the inc file, for the string i just define GLOBAL strTring : BYTE

then i allocate memory in the module.

Thx in any case
Posted on 2003-09-13 11:03:49 by Bit7
BTW, in my case I never use GLOBAL, PUBLIC, EXTERN, EXTERNDEF etc., I put all the code using INCLUDE in main module, as follows (I use MASM):


.686p
.model flat, stdcall

include includes.inc

include module1.asm
include module2.asm
include module3.asm
include Module4\module4.asm

.data?
include SharedData\SharedData.inc

.code
Start:
...
Posted on 2003-09-13 11:38:35 by MazeGen
thanks mazegen,

this is a nice idea, i will try your way.

Actually I'm doing "include 'project.inc' inside every module... and i'm not sure of what the linker do to make the final exe... seems my executable size is bigger than before i divided my project in several modules (it was a big single .asm file). Probably i'm doing something wrong...


B7
Posted on 2003-09-15 01:49:50 by Bit7
yeah i have used the same method as MazeGen with a project that was over 20,000 lines of code it works well... you can even do this with the data and data? sections so that you only work on the present code once you perfect the old code you move it over to the other files..
Posted on 2003-09-15 02:45:40 by devilsclaw

Actually I'm doing "include 'project.inc' inside every module... and i'm not sure of what the linker do to make the final exe... seems my executable size is bigger than before i divided my project in several modules (it was a big single .asm file). Probably i'm doing something wrong...


I can't tell you what's wrong, but I had the same problem and I think the best solution is as I mentioned above. Additional I made data visibility as global as much as possible (using address-overriding - when one variable isn't used, is overrided with another) and I put these data in one file 'SharedData.inc'. Now is data more clear.
Posted on 2003-09-16 11:27:51 by MazeGen
I will guess in this post, so bare with me ;).


Like i understand, for example masm can only assemble one file by call.

If the anterior is true, then.....
if you use:

include xdata.inc

then will be some files obj that have its own space for xdata.inc, ok.

now wehn you link the obj files, the linker will merge the named equal sections, or if not, they will be tacked like separate space of memory, and will be not merged, instead they will be inserted in order in the data or data? section.


I think is some like that, also you can try some like C #ifndef sharedData_inc ?define sharedData.inc ..... #endif in the file sharedData.inc, also name this section for by merged for the linker???

or call by a special name.



Also a posible option if this dont work... what about make a separate obj file for the sharedData, and put the names(labels) as global, extern or any that mas can understand to be global, and that indicate let a mark for the linker, then instead of include directly the file sharedData.inc (that now have a obj only containing the space), make a file like namesOfSharedData.inc, in that file you have some like:

import label1
import label2

and include in each file (yuo can use the same as #ifndef for this file), but see that you are only saying to the assembler, that this names will be imported, and the final computation is not done by the assembler, instead is done by the linker that reads the messages that let the assembler for it. Get the idea?




And a final thing, i dont see for what is growing up :o the file, the shareddata is not shared, instead is a secuence in .data section?

Nice day.
Posted on 2003-09-16 15:03:00 by rea