flat assembler
Message board for the users of flat assembler.

Index > Main > breaking up source code

Author
Thread Post new topic Reply to topic
tabs



Joined: 29 Aug 2006
Posts: 2
tabs
How would I go about breaking up source code into multiple files with FASM? From what I can understand all it is is a compiler and that's it. I need to be able to split up source code into modules/multiple files so that it's easier to manage. Smile

Right now I'm using WinASM Studio.
Post 03 Sep 2006, 23:29
View user's profile Send private message Reply with quote
UCM



Joined: 25 Feb 2005
Posts: 285
Location: Canada
UCM
Unfortunately there is no way to split up a project into multiple files in "C" style (i.e. "cc file1.c file2.c file3.c file4.c file41_2.c"), but you can use the "include" directive to include other files. Or, you could use object output and link them together, like most C projects do.
Post 04 Sep 2006, 00:33
View user's profile Send private message Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1605
Location: Ukraine
shoorick
it is possible also to use COFF format and later linking. then you may use many asm-files - in WinAsm Studio in project explorer they have to be switched into "Module" mode: then when you will press "go all" they all will be assembled with fasm one bye one - i'll try to do example, but later - in few days.
Post 04 Sep 2006, 04:54
View user's profile Send private message Visit poster's website Reply with quote
RedGhost



Joined: 18 May 2005
Posts: 443
Location: BC, Canada
RedGhost
Hmm, for C I have multiple C files but do "#include file.C", same with asm, but like the others said you will need a third party linker, GoLink or ALink aren't bad.

_________________
redghost.ca
Post 04 Sep 2006, 19:30
View user's profile Send private message AIM Address MSN Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
you can precompile procedure to pure code and use
Code:
MyProc:
file 'MyProc.bin'
    


but with FASM's speed i don't see reason why not just break one source into modules.
Post 05 Sep 2006, 07:35
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1605
Location: Ukraine
shoorick
here is example of three asm-files of COFF format with later linking. needs scan.exe by Vortex and polink to link (based on example by Vortex).
linker is complaigning on some ".data" sections with different attributes - i had not understand it yet because i did it first time by myself Smile
anyway it works Smile "go all" log placed into "from_out.txt"

enjoy!


Description:
Download
Filename: modula.0.1.1.1.zip
Filesize: 6.1 KB
Downloaded: 175 Time(s)


_________________
UNICODE forever!


Last edited by shoorick on 07 Sep 2006, 04:40; edited 1 time in total
Post 06 Sep 2006, 09:30
View user's profile Send private message Visit poster's website Reply with quote
RedGhost



Joined: 18 May 2005
Posts: 443
Location: BC, Canada
RedGhost
shoorick wrote:

linker is complaigning on some ".data" sections with different attributes
enjoy!


POLINK does this if the sections are merged, a '.flat' section could cause this but it is nothing to worry about.

_________________
redghost.ca
Post 06 Sep 2006, 13:30
View user's profile Send private message AIM Address MSN Messenger Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1605
Location: Ukraine
shoorick
i found the reason the linker complagning to:
in main.asm:
Code:
section '.data' data readable writeable
hInstance   dd ?    

in message.asm:
Code:
section '.data' data readable writeable
hello   db "Hello!",0    

first had attribute "uninitialized" due tu "?", second - "initialized"
i had renamed first section to ".udata":
Code:
section '.udata' data readable writeable
hInstance   dd ?    

and there will be no warnings more. as well as we can not sort initialized and not initialized data in section, combined from different objects, it is better to place them in separate sections. (".flat" section good for small applications.)
also, i agree: this way does not give us any advantage then usual "incs" if all asms will be assembled each time. this way can give advantage if make utility used, which checks if there is need to reassemble object or not.

regards!
Post 07 Sep 2006, 04:48
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.