EdouardBERGE / rasm

RASM powerful Z80 assembler
129 stars 16 forks source link

How do I have header files and source files in the same project? #39

Closed Reymon-Real closed 1 week ago

Reymon-Real commented 1 week ago

I have problems redefining labels. I want to modularize my code into source files and header files. I haven't seen that in the documentation (I may have missed it) and wanted to know, how do I have header files and source files in the same project?

Reymon-Real commented 1 week ago

J'ai des problèmes avec la redéfinition des balises. Je souhaite modulariser mon code en fichiers source et fichiers d'en-tête. Je n'ai pas vu cela dans la documentation (je l'ai peut-être manqué) et je voulais savoir comment avoir des fichiers d'en-tête et des fichiers source dans le même projet ?

Reymon-Real commented 1 week ago

Si vous préférez le français, je l'écris en français.

EdouardBERGE commented 1 week ago

i don't know what you mean for "header files" assembly does not need header and cannot duplicate labels if you want to split your code in multiple file, simply use include

include 'var_definition.asm'
include 'first_source.asm'
include 'other_source.asm'
Reymon-Real commented 1 week ago

@EdouardBERGE I was saying this because I am used to assemblers where I can split code into header files and source files. Thanks for answering my question.

cpcitor commented 1 week ago

I was saying this because I am used to assemblers where I can split code into header files and source files.

Hi @Reymon-Real, can you elaborate? Can you point to some documentation of such an assembler? What is put in a assembly header file? Variables and not code? Something else?

Even in C, #include<myfile.h> is a fairly low-level operation, just like include here. The mechanism of header files, etc, is obtained by using this feature with a specific pattern, with the #ifdef / #define / #endif to allow multiple inclusions without conflict.

All in all, my feeling is that @EdouardBERGE's answer should allow what you had in mind, yet I'd like to know more precisely what you meant. Cheers!

Reymon-Real commented 1 week ago

@cpcitor

What happens is that in MASM and another Assembler I used some time ago (I don't remember the name of the Assembler) allow you to use things like extern and externdef which allow you to define things in “.inc” extension files and implement them in “.asm” extension files.

In NASM which I use sometimes, you can do similar things and that allows me to modularize my code in a more comfortable way. I know it is not a global feature and not seeing that in the documentation I imagined that it did not exist in RASM, but I asked so I would not be left with doubts.