How to include files from different folders with Assembly
-
- Member
- Posts: 47
- Joined: Fri Apr 23, 2010 8:27 am
How to include files from different folders with Assembly
The title says it all. I want to separate my files so I can navigate around easily, but then my files that use %include from different places get errors. How to I load the files from a different folder?
Re: How to include files from different folders with Assembl
What assembler? That's a preprocessor command that will likely be different for every assembler. It's "include" in Fasm dialect.
-
- Member
- Posts: 47
- Joined: Fri Apr 23, 2010 8:27 am
Re: How to include files from different folders with Assembl
I'm using NASM as my assembler. And my kernel is in entirely Assembly so I keep my Kernel out in the open (for now) and I say put my IDT and GDT files in a folder.
I then try to include HAL.inc which initializes my IDT and GDT. But it says it can't find the file and I don't know how to find it using include.
Code: Select all
%include "HAL.inc"
Re: How to include files from different folders with Assembl
Just use the path to the GDT and IDT files. Remember that leaving off the "/"(or "\") causes the path to be relative to the file the include directive is found in and to go up the directory structure use "..\".
Say hal.inc is in C:\(root directory), IDT.inc was in C:\IDTandGDT\, in hal.inc you would use "%include "IDTandGDT\IDT.inc" Or at least that(w/o th "%") would work with Fasm which is very similar to Nasm.
Say hal.inc is in C:\(root directory), IDT.inc was in C:\IDTandGDT\, in hal.inc you would use "%include "IDTandGDT\IDT.inc" Or at least that(w/o th "%") would work with Fasm which is very similar to Nasm.
-
- Member
- Posts: 47
- Joined: Fri Apr 23, 2010 8:27 am
Re: How to include files from different folders with Assembl
Thanks it worked