Page 1 of 1
How to include files from different folders with Assembly
Posted: Sat Apr 24, 2010 6:49 pm
by HitmanYesman
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
Posted: Sat Apr 24, 2010 7:14 pm
by TylerH
What assembler? That's a preprocessor command that will likely be different for every assembler. It's "include" in Fasm dialect.
Re: How to include files from different folders with Assembl
Posted: Sat Apr 24, 2010 7:17 pm
by HitmanYesman
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.
Re: How to include files from different folders with Assembl
Posted: Sat Apr 24, 2010 7:52 pm
by TylerH
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.
Re: How to include files from different folders with Assembl
Posted: Sat Apr 24, 2010 8:10 pm
by HitmanYesman
Thanks it worked