Page 1 of 1

Old hardware and boot sequences

Posted: Sat Mar 10, 2018 10:28 am
by BenLunt
A fellow reader and I were discussing a few things about booting in another thread and we thought it best to move it over here.
Antti wrote:I just did my El Torito "no-emulation" tests with the FAT12/16 boot chain and it looks like there were no "512-byte sectors" hard-coded anywhere. Perhaps this does not sound very impressive but it was a feeling of success for me. If you add all the components together, I was really expecting that there were bugs that prevented the boot. Of course, there might be hidden bugs but this proves that it could work.

It is possible to have many boot floppy disks (perhaps a feature that is not very common in hobby systems) and I am planning to try (just for fun) this kind of boot sequence:
  • Floppy #1, the "standard" format with 512-byte sectors that BIOSs should boot. First databases are read from this.
  • Floppy #2, the "almost standard" format with 1024-byte sectors. More databases are read from this.
  • Floppy #3, the "almost standard" format with 1024-byte sectors. More databases are read from this.
  • etc.
This is not very practical because it is not trivial to format those floppies. The common scenario is to use standard formats. The final test is to try the boot sequence on an ancient "160KB" floppy to test whether my 8086 compatible code really works or not... perhaps this is enough for now. :)
I think the key words here are (just for fun). That's why we do it anyway, right?

I have multiple boot sectors, (at least) one for each file system I support, then one for each type of media within that file system.

As for the boot sector, I believe that assuming a 512 byte sector, on a Legacy BIOS, is acceptable, because it won't work with any other size. However, as soon as your loader or kernel take over, dropping the BIOS services, you should be sector size independent. I believe most of my code is sector size independent, but I have yet to run into a machine that uses 4096-byte sectors to verify it.

I haven't looked to closely if Qemu or even Bochs has a setting to allow a sector size change. If I remember correctly, and the code hasn't changed much since I last worked with it, I think the Bochs code could easily be changed to use a specified sector size with little efforts. Something I might look into adding.

Back to "160k" floppies. I too, for the fun of it, created boot sectors to load from this size floppy, as well as the other common sizes.

Anyway, thanks for checking my images[1] on your machines. Glad to hear that they work.

-Ben
[1]http://www.fysnet.net/blog/2018/03/

Re: Old hardware and boot sequences

Posted: Sat Mar 10, 2018 12:49 pm
by Antti
BenLunt wrote:As for the boot sector, I believe that assuming a 512 byte sector, on a Legacy BIOS, is acceptable, because it won't work with any other size.
I definitely agree. There were a couple of reasons why I wanted to try that boot sequence I wrote about: it might be really fun as an experiment, it could prove that the boot code can do that, and it would create interesting topics like this. More importantly, the 1024-byte sector experiment is more like a "quality test" than a feature I would like to highlight too much. What I do like to highlight is a multi-floppy booting option (that is, like I said, relatively uncommon in hobby operating systems).
BenLunt wrote:Back to "160k" floppies. I too, for the fun of it, created boot sectors to load from this size floppy, as well as the other common sizes.
There is one thing I should probably point out in general is that I am not planning or designing to write another version of the boot sector. I am just testing what is already written. :)

Here is one experiment, I followed the https://www.dosbox.com/wiki/4.77_MHz instructions and booted in DOSBox with "cycles=300" etc. so that it emulated IBM PC XT speeds. VGA was unavailable so the boot loader used text-mode (does not look very familiar anymore because I am so used to seeing it in VGA or VBE modes).

EDIT: I did not read the instructions careful enough. Perhaps the "cycles=300" is not accurate enough but should be fine-adjusted according to a benchmark tool that was not available. I made another test with "cycles=100" and it took about thirty seconds.

Re: Old hardware and boot sequences

Posted: Sat Mar 10, 2018 2:16 pm
by BenLunt
I haven't used DosBox at all and just installed it on one of my WinXP machines. My OS doesn't get very far because there is no RDTSC instruction support. :-) I don't blame it though, since it is not designed to run anything more than a later x486.

-Ben