Re: Basic Floppy Disk loader help.




Benjamin David Lunt wrote:
> "Jean-François Michaud" <spamtrap@xxxxxxxxxx> wrote in message
> news:1135915163.385782.110730@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> > Does anybody see why this bombs if i put 3Ch or above in
> > nbSectorsTotal? This is a really old bug I can't seem to pinpoint. 3Ch
> > would put us at 60 decimal which would be, if I calculated correctly,
> > Track 1, head 1, sector 6. The code works fine below 3Ch.
>
> <snip code>
>
> If your code is at 0x07C00 and you load 60 512-byte sectors
> at 0x00500, wouldn't this overwrite your code?

Argh! Bingo! I completely forgot about where my bootloader gets loaded!
The addresses match exactly. It has to be it.

> 60 sectors = 0x7800
> plus the 0x0500 offset
>
> would place the start of the 60th sector at 0x07D00
> Whereas 59 sectors writes that last byte just before
> 0x07D00.
>
> If your code is at 0x07C00, reading the 59th sector
> overwrites your code. Since it doesn't "bomb" your
> code, I am assuming that your read_sector code is
> at least 0x00100 passed the start of your loader.
>
> Is this the case?

Absololutely!

All I have to say is: Very nice. I'm impressed ;-). Darn bootloader is
in the way of the kernel. Now I have to find a better place for it.

Warm regards
Jean-Francois Michaud


.