Tuesday, January 26, 2010

NedOS on CD

Booting from a floppy is a good start. But there's just not much you can do with 1.44MB.

I looked into bootable CDs, and they are really nice!
  • You get >600 MB of storage for your OS and app code + read-only data.
  • Writable CDs are cheap and portable, potentially allowing you to run on any machine
  • You don't risk messing up your hard drive (particularly the boot sector)
Best of all, the boot CD spec (El Torito) allows you to load multiple sectors immediately. That means no messing with BIOS read disk routines in the boot loader.

Of course, switching my boot floppy code to CD ran into multiple problems (all stupid ones).
  • The boot code can load into any address. 0 will get you the default (7c00), but just to make sure I could write whatever I want when I need to, I set it to 7c00.
  • Of course, it is a segment address, so I got 7c000, which is near 512K, not 32K, so I was executing uninitialized RAM.
  • Then, when I fixed the segment, I forgot that my makecd program only writes those sectors for new disks, so I still had the old values.
  • The boot floppy code is org 7c3e (to skip the Bios Param Block), but the CD code needs org 7c00.
It took longer than it should of, but I can now boot from CD!

No comments: