Bootsector help
Posted: Sun Jun 16, 2002 6:58 pm
[attachment deleted by admin]
Well, to be honest, you could start by simplifying the code. Rather than having a single boot loader that works for both floppies and HDs, it might be better to have specific version for each. You know, for example, that a FAT12 disk will always have 1 cluster per sector and two heads, and uses no sector remapping, so why handle the alternative cases? Similarly, there are instances with floppies which never apply to hard drives (I hope you'll forgive me if I can't think of any off the top of my head), whihc can then be removed form the HD boot code.beyondsociety wrote: How would I go about deleting the extra 15 bytes from my bootsector. Where would I even start?
This is sort of a "hack" and really isn't very good coding pratice... but you can do it by changing:beyondsociety wrote: How would I go about deleting the extra 15 bytes from my bootsector. Where would I even start?
Not an option, in this case. The goal of this design, based on the comments, is to implement FAT12. In that case, the second sector must contain the beginning of the first File Allocation Table (the same holds true for Fat16; only under FAT32 can you normally have a reserved area larger than 1 sector). For more info on the FAT12 filesystem, see the 'FIle Systems' page at the Operating Systems Resource Center.DynatOS wrote: The best thing you can do with such an overly-complicated boot process is to initially load the next sector, or next few sectors, and use that/them as a continuation of the program.
If you're referring to the DIB (the DIsk Information Block, the group of variables at the start of the code, also called the BIOS Parameter Block)., there's nothing that can be done about that;. It is a required data structure for any FAT-compatible filesystem, and has to be in the specific location and order that it appears in. That 56 bytes is simply part of the price you pay for a familiar and relatively easy-to-implement filesystem. Again, a few comments marking the DIB off and explaining it for those unfmiliar with FAT12 might be called for here.DynatOS wrote: Finally, from the sight of your "variable" list, most of them are extra code because they are most likely constants, and are less than one DWORD. You are better off saving the "extra" space for ASCII data instead of redundant simplistic variables.
DynatOS wrote: From a practical point of view, a quick glance at your code shows the ASCII text "Executing Boot Sector", that right there isn't necessary and probably will be ignored by most people, and probably not even seen on some computers... the faster the computer, the shorter the timeframe for the displayed message. There is your 15+ bytes, and believe me, you won't miss it