Sunday, February 14, 2010

Red Screen of Death

Check it out!

That beautiful red screen is brought to you by the NedOS boot loader, and the NedOS kernel (which is currently just a rep stosq and an infinite loop).

I was able to fit all the boot loader functionality into one 512 B sector.

It has to:
  1. Retrieve the memory map from the BIOS
  2. Enable A20
  3. Get a list of video modes, pick one, and set it
  4. Transition the system into 64 bit paged mode
The memory map code is kind of a hog. Together with the logic for picking a video mode, the boot loader is nearly 500 B. That is after a lot of effort to minimize code size.

That is too big for a harddrive boot sector (which has 64 B of partition tables and a 2 B signature). I have a version where I strip out all the error checking, that brings the size of the memory map code down significantly. Still, it is currently 433 B - leaving about 10 B to actually load something. Not enough to walk the partition table and figure out on its own what to load. I will have to load something from a hard coded location.

I'd like to be able to draw a text window, and put some text in it...

No comments: