pointfree.net everything must go.

the boot process.

    $ cat < boot.asm
    mov cx, 0xFF
    times 510-($-$$) db 0
    dw 0xAA55
    EOF


    $ cat < Makefile
    default: image
    
    assemble:
    	nasm boot.asm -f bin -o boot.bin
    
    image: assemble
    	dd if=boot.bin of=boot.img
    EOF


    $ make
    nasm boot.asm -f bin -o boot.bin
    dd if=boot.bin of=boot.img
    1+0 records in
    1+0 records out
    512 bytes (512 B) copied, 7.6306e-05 s, 6.7 MB/s


    $ xd boot.img
    0000000  b9ff0000 00000000 00000000 00000000
    0000010  00000000 00000000 00000000 00000000
    0000020  00000000 00000000 00000000 00000000
    0000030  00000000 00000000 00000000 00000000
    0000040  00000000 00000000 00000000 00000000
    0000050  00000000 00000000 00000000 00000000
    0000060  00000000 00000000 00000000 00000000
    0000070  00000000 00000000 00000000 00000000
    0000080  00000000 00000000 00000000 00000000
    0000090  00000000 00000000 00000000 00000000
    00000a0  00000000 00000000 00000000 00000000
    00000b0  00000000 00000000 00000000 00000000
    00000c0  00000000 00000000 00000000 00000000
    00000d0  00000000 00000000 00000000 00000000
    00000e0  00000000 00000000 00000000 00000000
    00000f0  00000000 00000000 00000000 00000000
    0000100  00000000 00000000 00000000 00000000
    0000110  00000000 00000000 00000000 00000000
    0000120  00000000 00000000 00000000 00000000
    0000130  00000000 00000000 00000000 00000000
    0000140  00000000 00000000 00000000 00000000
    0000150  00000000 00000000 00000000 00000000
    0000160  00000000 00000000 00000000 00000000
    0000170  00000000 00000000 00000000 00000000
    0000180  00000000 00000000 00000000 00000000
    0000190  00000000 00000000 00000000 00000000
    00001a0  00000000 00000000 00000000 00000000
    00001b0  00000000 00000000 00000000 00000000
    00001c0  00000000 00000000 00000000 00000000
    00001d0  00000000 00000000 00000000 00000000
    00001e0  00000000 00000000 00000000 00000000
    00001f0  00000000 00000000 00000000 000055aa
    0000200 
    0000200 


    mov cx, 0xFF

empty space.

    times 510-($-$$) db 0
db 0 is declare byte 0, fills the empty space with zeros. Zero means no power, false and null terminator. times tells the asembler we want the following to be done several times. Current address, "$" to the beginning of the section out of 510 bytes (we have 2 extra bytes at the end). This adds up to exactly 512 bytes which is the size of a sector by definition.

boot signature.

    dw 0xAA55
declare word(2 bytes). The boot signature 0xAA55 must appear at the end of the boot sector for older bios at least. This assembles to the 55aa at the end of boot.img.
Access: (0644/-rw-r--r--) Uid: ( 1000/ andreas) Gid: ( 100/ users) Access: 2012-10-16 19:00:31.718018473 -0400 Modify: 2012-09-09 12:50:52.559004803 -0400