Author Topic: Sample FAT12 boot code  (Read 1562 times)

Offline debs3759

  • Jr. Member
  • *
  • Posts: 32
  • Country: gb
    • GPUZoo
Sample FAT12 boot code
« on: August 31, 2016, 10:33:50 PM »
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.
« Last Edit: September 01, 2016, 08:31:43 PM by debs3759 »
My graphics card database: www.gpuzoo.com

Offline johnfound

  • Jr. Member
  • *
  • Posts: 5
  • Country: bg
    • Fresh IDE
Re: Sample FAT12 boot code
« Reply #1 on: September 01, 2016, 01:04:13 PM »
Oh, is she a bot?  :o

Offline debs3759

  • Jr. Member
  • *
  • Posts: 32
  • Country: gb
    • GPUZoo
Re: Sample FAT12 boot code
« Reply #2 on: September 01, 2016, 01:43: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.

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.
My graphics card database: www.gpuzoo.com

Offline debs3759

  • Jr. Member
  • *
  • Posts: 32
  • Country: gb
    • GPUZoo
Re: Sample FAT12 boot code
« Reply #3 on: September 01, 2016, 08:32:37 PM »
I just updated the attachment - I forgot I had commented out an important line of code :)
My graphics card database: www.gpuzoo.com

Offline JennTT

  • New Member
  • Posts: 1
Re: Sample FAT12 boot code
« Reply #4 on: February 28, 2018, 06:10:00 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.

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.

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.  :)


 


Offline debs3759

  • Jr. Member
  • *
  • Posts: 32
  • Country: gb
    • GPUZoo
Re: Sample FAT12 boot code
« Reply #5 on: April 22, 2018, 11:31:47 PM »
Thanks JennTT.
My graphics card database: www.gpuzoo.com