flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Bootloader HELP!

Author
Thread Post new topic Reply to topic
Geek



Joined: 01 Jun 2005
Posts: 26
Geek
Hello to all.


I have been working on a simple FAT12 bootloader.

Windows will not let me write my kernel to the floppy after I have written the bootloader to the first sector. I have made sure to include the BPB, and have kept the bootloader at 512 bytes including the boot signature, but I still fail.

Is there anything special I must do to make my floppy usable in windows.

I must know this because I dont want my OS to load the kernel off the bare floppy, I want to load it from a file.


Can someone please help me?

_________________
Death is not the opposite of life, rather, it is the absence of it.
Post 16 Jun 2005, 16:43
View user's profile Send private message Reply with quote
DataHunter2009



Joined: 10 Jun 2005
Posts: 144
DataHunter2009
You have to copy your kernel to the floppy first. Then rawrite the bootloader after that. If you put the boot loader on first, then Windows knows it's a bootable disk so it won't let you do anything to it except format it. If you put the bootloader on last, then Windows treats it like a regular floppy until it's written. Very Happy
Post 16 Jun 2005, 18:10
View user's profile Send private message Reply with quote
Redragon



Joined: 27 Nov 2004
Posts: 101
Location: U.S.
Redragon
Actually, windows dosent know it is a bootable disk, the reason you cant read it is beacuse it was written to the floppy using rawrite, in a raw format, windows cannot read raw formats unless you use rawread.. its not because it is bootable
Post 16 Jun 2005, 19:18
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
Some people miss the bit next to the BPB, you should include all this:
Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Boot sector starts here ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;        jmp     short   start        nopbsOemName               DB      "YourOS  "      ; 0x03;;;;;;;;;;;;;;;;;;;;;;; BPB starts here ;;;;;;;;;;;;;;;;;;;;;;;bpbBytesPerSector       DW      ?               ; 0x0BbpbSectorsPerCluster    DB      ?               ; 0x0DbpbReservedSectors      DW      ?               ; 0x0EbpbNumberOfFATs         DB      ?               ; 0x10bpbRootEntries          DW      ?               ; 0x11bpbTotalSectors         DW      ?               ; 0x13bpbMedia                DB      ?               ; 0x15bpbSectorsPerFAT        DW      ?               ; 0x16bpbSectorsPerTrack      DW      ?               ; 0x18bpbHeadsPerCylinder     DW      ?               ; 0x1AbpbHiddenSectors        DD      ?               ; 0x1CbpbTotalSectorsBig      DD      ?               ; 0x20;;;;;;;;;;;;;;;;;;;;; BPB ends here ;;;;;;;;;;;;;;;;;;;;;bsDriveNumber           DB      ?               ; 0x24bsUnused                DB      ?               ; 0x25bsExtBootSignature      DB      ?               ; 0x26bsSerialNumber          DD      ?               ; 0x27bsVolumeLabel           DB      "NO NAME    "   ; 0x2BbsFileSystem            DB      "FAT12   "      ; 0x36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Boot sector code starts here ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;    
Post 16 Jun 2005, 21:28
View user's profile Send private message Reply with quote
THEWizardGenius



Joined: 14 Jan 2005
Posts: 382
Location: California, USA
THEWizardGenius
You have to put 55AAh at the end. I recommend using John Fine's PARTCOPY.EXE, and I use a batch file to copy the bootloader so I don't have to deal with the commandline options.
Post 17 Jun 2005, 04:17
View user's profile Send private message AIM Address Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
He says he has:
Quote:

have kept the bootloader at 512 bytes including the boot signature
Post 17 Jun 2005, 16:34
View user's profile Send private message Reply with quote
Geek



Joined: 01 Jun 2005
Posts: 26
Geek
Thanks again for all the help,


I have tryed putting the kernel file on the disk before I install the boot sector but I still have'nt been successfull.

I will try dex4u's tip next and see what I get.


Thanks again. Cool Cool Cool

_________________
Death is not the opposite of life, rather, it is the absence of it.
Post 21 Jun 2005, 11:59
View user's profile Send private message Reply with quote
Octavio



Joined: 21 Jun 2003
Posts: 366
Location: Spain
Octavio
The boot sector is not enought ,the fat tables must be initialized ,and also the root directory.
Post 21 Jun 2005, 13:28
View user's profile Send private message Visit poster's website Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
@Geek, Assemble your boot code as a bin file, with all the above BPB + the other bits , + the 0x55AA at the end.
Then format your floppy in windows and then get "bootprog.zip" from here: http://alexfru.chat.ru/epm.html#bootprog
in is a program called "BOOTABLE.EXE"
To use it do this:
Quote:

1. Put the diskette to a floppy drive ("A:" or "B:"). Let's say to "A:".
2. Run the BOOTABLE.EXE utility as follows:
BOOTABLE YOURFILE.BIN A:
This means read new boot sector from the BOOT12.BIN file and put it
directly to the diskette in the drive "A:".


Then you should be able to read it in windows.
Post 21 Jun 2005, 14:10
View user's profile Send private message Reply with quote
Geek



Joined: 01 Jun 2005
Posts: 26
Geek
I will try that tool, from dex4u.

But Octavio made a good point I hav'nt setup the FAT tables or to root directory yet, and I am unsure how to do that.

What happens is when I boot my system using the my OS disk, the computer executes the code in the boot sector, but it freazes when it tries to load the Kernel file.

Once again I thank all for the help.

_________________
Death is not the opposite of life, rather, it is the absence of it.
Post 21 Jun 2005, 16:18
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
If you use a fat12 formated floppy, that what the format does, you do not need to set them up, unless you are write to the floppy raw, which could over write them(some people use this method).
But i think its easer to write it like whats in BOOTPROG.ZIP.

Heres what to do get bootprog.zip and follow the read me in the zip, then you will be able to just put your kernel file on the floppy from windows just like any other file, and it will boot it.


Last edited by Dex4u on 21 Jun 2005, 19:07; edited 2 times in total
Post 21 Jun 2005, 18:09
View user's profile Send private message Reply with quote
zhak



Joined: 12 Apr 2005
Posts: 490
Location: Belarus
zhak
Bart Lagerweij's BFI.EXE is a good (even VERY good) tool to make FAT12 formatted floppy images. You can specify a bootsector code and a directory to write its contents to a virtual floppy.
Post 21 Jun 2005, 18:21
View user's profile Send private message Reply with quote
Geek



Joined: 01 Jun 2005
Posts: 26
Geek
Thanks dex4u!

I tryed the Bootable.exe program that you sugested and it worked.

Thank you so much.

Cool Cool Cool

_________________
Death is not the opposite of life, rather, it is the absence of it.
Post 23 Jun 2005, 13:01
View user's profile Send private message Reply with quote
Adam Kachwalla



Joined: 01 Apr 2006
Posts: 150
Adam Kachwalla
If you are using Windows, open up CMD and type this:


Code:
DEBUG
N bootloader.bin
L 0
W 0 0 0 1
Q    
Post 18 Jun 2006, 00:00
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.