top of page
  • Writer's picturerehsd

Booting FreeDOS

Updated: May 3, 2023

At this stage of my homebrew 286 system build, I have an IDE interface to a compact flash (CF) card. I have begun implementing disk services (INT 13h) in my BIOS. I also have a build environment that is successfully building FreeDOS. Now, I need to close the gap of raw disk access and getting the FreeDOS kernel and FreeCOM loaded and running. I have not yet figured out all the details to close this gap, but I will use this running post to capture my learning.

What I Think I Understand So Far

I expect some/much of this is inaccurate. If you have suggestions to improve the accuracy and clarity, please let me know (thank you!).

  1. In my boot sector (sector zero of the CF card), or volume boot record (VBR), I need to include a BIOS parameter block (BPB) to describe the volume partition. Looking at the source code for boot loader, I see %defines for disk info. From what I can tell, I need to have specific disk information at certain offsets from BP (which is at 0x7C00).

    1. Looking at disk.asm and orgs.asm from a sample 286 BIOS, I need to load the disk info into a structure at a specific location.

    2. YouTube user @pvc mentioned that this information is populated as part of the format utility. I am currently reviewing the source for format. I am also reading through the Microsoft Extensible Firmware Initiative File System Specification (fatgen103).

  2. I will need to format my CF card with a FAT file system.

    1. As part of this, the format utility will place drive information (e.g., geometry) in the boot sector.

    2. The first sector of my CF card will need to contain a boot loader. The last two bytes of this sector should contain 0xAA55. I plan to use this boot loader: kernel/boot at master · FDOS/kernel · GitHub.

  3. The boot loader can be placed on the CF card with from FreeDOS running on another system.

  4. The kernel and command interpreter should also be copied to the CF card, using FAT[12/16/32]. Sys can also do this, along with the boot loader above.

  5. When my system powers on, my BIOS will need to initialize the CF card and provide INT 13h disk services, along with INT services for video, keyboard, etc.

  6. From BIOS, I need to load the boot drive number into the DL register.

  7. My BIOS will need to load the boot loader from the first sector of the CF card into RAM and jump to it.

  8. I need to make sure that the boot loader does not step on RAM that supports my BIOS (e.g., interrupt vector table and variables in RAM).

  9. The boot loader will load the FreeDOS kernel into memory at 0x7C00 and jump to it. This may require that the boot loader is first moved in memory to an alternate address. I expect the FreeDOS boot loader already does this.

  10. ...

I have compiled a debug version of the kernel. Output on startup:

This is where the process gets hungs up. I will need to dig into the FreeDOS code to better understand what code is being processed when it stops here.

Additional Resources

118 views2 comments

Recent Posts

See All

2 comentários

Hi, in your video you asked about the parameters, these are in the beginning of the bootsector. I know that FAT12 the bootloader is saved starting at byte 62 in the sector. That is why you see the defines in the source code, they are apart of de first sector (bootsector).

Cheers, Maarten.

17 de abr. de 2023
Respondendo a

Thanks, Maarten!

bottom of page