Trouble with creating include file in nasm

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
beyondsociety

Trouble with creating include file in nasm

Post by beyondsociety »

I am having trouble with trying to create a include file for my program.

If someone could help me out with these questions, I would appreciate it.

What does a include file have to have in it to work?
How would I compile it in nasm?
How would I include it in my program?
How would I compile my program in nasm to include that file?
Then how would I run the program?

I want to have the include file run with my bootsector.
crazybuddha

Re:Trouble with creating include file in nasm

Post by crazybuddha »

The include file is only code which is inserted whereever the %include "myfile" is located.

It is not assembled separately.

See my web page for an example:

http://www.crazybuddha.com/setup.php
Warmaster199

Re:Trouble with creating include file in nasm

Post by Warmaster199 »

I am pretty sure that an assembler include file is named "file.inc".

You either include it by using the line %include "file.inc"

Include files can have anything from variables to labels with code, to equates, to proceedures. You can even add macros to make an instruction that you processor supports, but the assembler won't! I never made assembler programs that need includes (I've only made assembler bootsectors and partial start-up codes)

But in C/C++, includes are essential!

From what I can guess, as long as the .inc is in the same folder as the source, you can assemble the code as "nasm code.asm code.bin"...
Post Reply