NASM Forum > Example Code

Sample FAT12 boot code

(1/2) > >>

debs3759:
This will hopefully be the first in a series of sample code I post here.

This is a FAT12 boot sector (ie for a 1.44 MB floppy). It moves itself to a new place in memory then loads a file named LOADER.BIN (not included). It then jumps to the start of the loader to run it. LOADER.BIN can be anywhere on disc, and does not need to be in contiguous sectors (ie it doesn't matter how fragmented it is).

Any questions? Feel free to ask, I'll try to answer your questions.

johnfound:
Oh, is she a bot?  :o

debs3759:

--- Quote from: IsabellaClements on September 01, 2016, 12:11:08 PM ---Hey!
Well, I think, it is all about syntax. A lot of devs just don't doublecheck the grammar, while programming at so low-level languages and platforms. One of the possible ways to struggle this is to improve your level of the syntax. You can make your best at my blog that is totally about writing and everything around it.

--- End quote ---

If you are trying to tell me there is something wrong with my code, tell me what it is. It has been tried successfully on several machines, is well documented, and has room for another 39 bytes of code! Before you criticise me, prove that you know what you are talking about, and don't spam me.

debs3759:
I just updated the attachment - I forgot I had commented out an important line of code :)

JennTT:

--- Quote from: debs3759 on September 01, 2016, 01:43:08 PM ---
--- Quote from: IsabellaClements on September 01, 2016, 12:11:08 PM ---Hey!
Well, I think, it is all about syntax. A lot of devs just don't doublecheck the grammar, while programming at so low-level languages and platforms. One of the possible ways to struggle this is to improve your level of the syntax. You can make your best at my blog that is totally about writing and everything around it.

--- End quote ---

If you are trying to tell me there is something wrong with my code, tell me what it is. It has been tried successfully on several machines, is well documented, and has room for another 39 bytes of code! Before you criticise me, prove that you know what you are talking about, and don't spam me.

--- End quote ---

Wow, when you said "is well documented" you weren't kidding  ;D.

If you run Linux, you won't be able to run partcopy unless you install wine and execute it from there, you can do this instead,
from the terminal;

dd if=/dev/zero of=fd_osloader.img bs=512 count=2880
mkfs.fat -D 0 -F 12 -s 1 fd_osloader.img
dd if=bootsect.bin of=fd_osloader.img seek=0 count=1 conv=notrunc

the first command creates an empty (zero-filled) floppy image of 1.44 MB

The second creates a File Allocation Table (FAT) with:
'-D 0' set drive number to 0, as in 'DriveNum    db   00h' from BPB
'-F 12' creates a FAT with 12 bits entries (FAT12).
'-s 1' creates clusters of 1 sector each, as in 'nSecPerClust   db   01h' from BPB

the last command loads 'bootsect.bin' into the first sector of our newly formated floppy image. 'conv=notrunc' is specified so the dd program won't resize out image to the size of our bootsector.

Thanks, Debs.  :)


 

Navigation

[0] Message Index

[#] Next page

Go to full version