How to include files from different folders with Assembly

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
HitmanYesman
Member
Member
Posts: 47
Joined: Fri Apr 23, 2010 8:27 am

How to include files from different folders with Assembly

Post 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?
TylerH
Member
Member
Posts: 285
Joined: Tue Apr 13, 2010 8:00 pm
Contact:

Re: How to include files from different folders with Assembl

Post by TylerH »

What assembler? That's a preprocessor command that will likely be different for every assembler. It's "include" in Fasm dialect.
HitmanYesman
Member
Member
Posts: 47
Joined: Fri Apr 23, 2010 8:27 am

Re: How to include files from different folders with Assembl

Post 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.

Code: Select all

%include "HAL.inc"
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.
TylerH
Member
Member
Posts: 285
Joined: Tue Apr 13, 2010 8:00 pm
Contact:

Re: How to include files from different folders with Assembl

Post 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.
HitmanYesman
Member
Member
Posts: 47
Joined: Fri Apr 23, 2010 8:27 am

Re: How to include files from different folders with Assembl

Post by HitmanYesman »

Thanks it worked
Post Reply