Reputation: 949
I'm starting to learn the Assembly language. I'm familiar with it in the basic level. I wonder, how big application in the Assembly are organized, that is, how can I split them into modules/packages and include them into other modules? I'm talking about NASM in particular.
Upvotes: 4
Views: 644
Reputation: 44116
You can either:
Use %include
To include an external file into the current one.
This can be further controlled with the -i
command line switch.
You can also force NASM to pre-include a file using the -p
switch.
Assemble multiple files
Since NASM is not a linker, you can take advantage of the linkers' ability to... well, link files together.
Use the GLOBAL
directive to make a set of symbols visible to other modules.
Use the EXTERN
directive to import a set of symbols from other modules.
You can pass all the object files to the linker.
NASM (as today) can only assemble one file at a time, so a build script is needed.
The two above are not mutually exclusive but you have to basically understand the NASM output file formats to see when the latter is applicable.
Upvotes: 5