Hi VishalPawale,
We may need more information before we can answer your question. Exactly how is %include "not working"? Errors from Nasm? Or does it assemble and the resulting binary not work as intended? Maybe what you "intended" and what happened instead, too...
The %include directive is essentially an automated "cut-and-paste" operation - as if you had pasted the %included file into the first file, at the point of the %include directive. This "should work" in most cases, I would think. Multiple "org" directives or multiple uses of the same symbol name (variables or labels in code) would screw it up.
Another approach might be to assemble "file2.asm" first and use the incbin directive to include the result into "file1.asm"...
http://www.nasm.us/xdoc/2.09.10/html/nasmdoc3.html#section-3.2.3This will probably work best (at all?) if "file2" is "Position Independent Code" (PIC). We can discuss what is, and is not, PIC, if necessary...
Another possible approach might be to assemble both files into linkable object formats, link 'em, and use an "exe2bin"-type utility to convert the result back into a binary file. This is probably not what you want.
Knowing how Nasm handles the "known" names, ".text", ".data", and ".bss" (case sensitive!) might help. If there are multiple ".text" (and/or ".data" and/or "bss") sections, they are combined (in "source-code order"), then ".text" comes first, followed by ".data", followed by ".bss'". ".bss" sections do not become part of the file - essentially Nasm just defines offsets to variable names.
Using "arbitrary" section names allows more flexibility. See:
http://www.nasm.us/xdoc/2.09.10/html/nasmdoc7.html#section-7.1.3In particular, "vstart=" has the effect of a second "org" (which Nasm does not allow), if that's what you need.
I suspect that a plain %include is your best bet, so we should probably start by knowing how/why that's "not working". If you need "fancier" tricks, we can get into that...
If you wish to post some code, please use "code tags" - put the word "code" between square brackets ("[]" - just like a Nasm memory reference) at the beginning of your code, and "/code" (in "[]"s) at the end. If your code is "too long to paste"... I think you have to have made some minimum number of posts (5?) before you can "attach" anything (spam prevention). Partial code may suffice...
Talk to ya soon!
Best,
Frank