Help with FAT12 bootloader

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
me239
Member
Member
Posts: 25
Joined: Thu Jul 29, 2010 10:36 pm
Contact:

Help with FAT12 bootloader

Post by me239 »

I've been searching all over the Internet and found several examples of FAT12 boot loaders, but when I've written my own, nothing works. I've compared each function and BPB space and everything checks out, but alas it fails to boot. Please help
Attachments
boot.asm
bootloader
(3.97 KiB) Downloaded 79 times
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Help with FAT12 bootloader

Post by Combuster »

I count 10 bytes to the start of the actual BPB data, where I expect 11.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
me239
Member
Member
Posts: 25
Joined: Thu Jul 29, 2010 10:36 pm
Contact:

Re: Help with FAT12 bootloader

Post by me239 »

Thank you for responding. You said you counted 10 bytes to the bpb when it should have been 11. Would this actually affect the boot process if still jumps to the beginning of the boot code?
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Help with FAT12 bootloader

Post by Combuster »

It means you either don't have a valid FAT filesystem and that disk image utilities can't read it, or they override your bad attempt at a filesystem which means your code looks for data in the wrong places.

In any case, it isn't a FAT12 bootloader anymore.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
me239
Member
Member
Posts: 25
Joined: Thu Jul 29, 2010 10:36 pm
Contact:

Re: Help with FAT12 bootloader

Post by me239 »

I made sure it was valid by testing in Windows by putting files on it, taking them off, etc. and everything worked. The tool I used was called 'BOOTABLE.EXE' and it came with MiniDOS from Dex4u. It stated that everything was in order. Is my code itself fine?
U238
Posts: 5
Joined: Fri Jan 14, 2011 8:13 pm

Re: Help with FAT12 bootloader

Post by U238 »

You're not setting up DI or the loop counter for the root directory search routine. Therefore your bootloader is not searching the root directory, but rather a completely different location in memory, which generates an error because the file is not found.

Code: Select all

mov     CX, word[maxrootentries]
mov     DI, 0x0200
Adding this before the searching routine should fix the problem you've been having.

Hope I helped. - U238
me239
Member
Member
Posts: 25
Joined: Thu Jul 29, 2010 10:36 pm
Contact:

Re: Help with FAT12 bootloader

Post by me239 »

thanks, I'll be sure to try it
Post Reply