First, use hex for the values, it's easier to understand.
In MBR formatted disks, only the first partition is set as bootable, this makes things a lot easier. The first partition resides at LBA 0x3F.
FAT32 Bootloader
Re: FAT32 Bootloader
More misinformation, unfortunately. Any partition on an MBR disk can be set to be the active partition. And you can never assume that a partition will start at a particular sector; that's why you have a partition table.trinopoty wrote:First, use hex for the values, it's easier to understand.
In MBR formatted disks, only the first partition is set as bootable, this makes things a lot easier. The first partition resides at LBA 0x3F.
- Brynet-Inc
- Member
- Posts: 2426
- Joined: Tue Oct 17, 2006 9:29 pm
- Libera.chat IRC: brynet
- Location: Canada
- Contact:
Re: FAT32 Bootloader
trinopoty wrote:In MBR formatted disks, only the first partition is set as bootable, this makes things a lot easier. The first partition resides at LBA 0x3F.
Code: Select all
Disk: wd0 geometry: 60801/255/63 [976773168 Sectors]
Offset: 0 Signature: 0xAA55
Starting Ending LBA Info:
#: id C H S - C H S [ start: size ]
-------------------------------------------------------------------------------
0: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused
1: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused
2: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused
*3: A6 0 1 2 - 12269 254 63 [ 64: 197117486 ] OpenBSD
Re: FAT32 Bootloader
"Never attribute to malice that which is adequately explained by stupidity."Brynet-Inc wrote:Liar.
Every good solution is obvious once you've found it.
- Firestryke31
- Member
- Posts: 550
- Joined: Sat Nov 29, 2008 1:07 pm
- Location: Throw a dart at central Texas
- Contact:
Re: FAT32 Bootloader
Sorry, like I said it's been a long time since I've even last seen the code (and I still haven't looked at it). If I were to need a FAT32 bootsector today I'd probably end up starting over from scratch. It wouldn't surprise me if I had made plenty of stupid mistakes in that code.jbemmel wrote:If you read the code, you will see that the first thing pushed is bx, followed by a bunch of 32-bit pushes. The stack is currently misaligned for the latter cases.Firestryke31 wrote:0x8002 % 4 != 0, so 0x8002 is not 4-byte aligned. 0x8000 is, though.jbemmel wrote:Could consider to align the stack by 4 by using 0x8002 instead of 0x8000
Owner of Fawkes Software.
Wierd Al wrote: You think your Commodore 64 is really neato,
What kind of chip you got in there, a Dorito?