Hello,
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.

Best Regards,
Nathan Paulino Campos
Posted on 2010-06-27 20:31:09 by nathanpc
Posted on 2010-06-27 22:57:54 by SpooK
Mmmm... "times" is good for "padding" up to the "new org" (if you call it that), but attempting to "pad" from 7Cxxh "up" to 1000h is going to be an error. I think what ya want, Nathan, is the "vstart" directive (if I understand what you mean by "the 1000h part of the floppy).


%include "boot.asm"
; I ASSume this is padded to 512 bytes

section code_to_move vstart 1000h
%include "kernel.asm"


This, too, is covered in the Friendly Manual:

http://www.nasm.us/doc/nasmdoc7.html#section-7.1.3

This is actually a good example of *why* Nasm won't let you use two "org"s. Ambiguity whether you want to "pad" to the would-be "new org", or merely "restart the count" at the "new org".

Another way to handle this situation is to put the "org 1000h" in "kernel.asm", assemble it separately, and "%include "kernel.bin".

Or perhaps I misunderstand what you're trying to do...

Best,
Frank

Posted on 2010-06-28 23:53:57 by fbkotler

Another way to handle this situation is to put the "org 1000h" in "kernel.asm", assemble it separately, and "%include "kernel.bin".


%incbin
Posted on 2010-06-29 03:21:42 by SpooK
Right, %incbin. Thanks!

Best,
Frank

Posted on 2010-06-29 03:53:49 by fbkotler

Right, %incbin.


It's the method I use for "sparse" binaries... nasm -f bin the files to be %incbin'ed first, then nasm -f bin the master asm file that includes those binaries with %incbin along with ORG + TIMES.
Posted on 2010-06-29 16:07:13 by SpooK