I'm building a boot loader that boots the content that is located at the 1000h
part of the floppy. I was doing that using Fasm(because my friend only uses Fasm, and he was helping me with this), but I prefer to use Nasm, and now I'm having problems with the syntax, then I want to know how could I do this in Nasm:
org 7C00h
%include "boot.asm"
org 1000h
%include "kernel.asm"
PS: I already put the %include
directive using Nasm-syntax style, on Fasm it should be just include
.
See here for the description of your problem or what I think it is since it's a little hard to tell from the question. It's a good idea when posting questions with "I'm having problems with the syntax" to actually show what the syntax problem is :-)
See here for the solution (but it may not work, see below).
Basically, the org
statement in NASM is meant to set the base address for the section and cannot be used to arbitrarily insert bytes into the stream. It suggests you use something like:
org 1000h
%include "kernel.asm"
times 7c00h-($-$$) db 0 ; pad it out with zero bytes
%include "boot.asm"
However, have you thought about what you're trying to do. If you're creating a flat binary file to load into memory, I don't think you want both the boot sector and kernel in a single file anyway.
The BIOS will want to load your boot sector as a single chunk at 7c00:0 and will almost certainly be confused when it has the kernel at the start of that chunk. I think what you will need to do is to create two totally separate flat binary files, one for the boot sector and another for the kernel. BIOS will load your boot sector, then your boot sector will load your kernel.
Then you can put the relevant org
statement in the two source files and your problem should hopefully be solved.