Skip to content

Conversation

@Alex105178
Copy link
Contributor

Description

This pull request changes how the code is written in the boot sector to allow a greater range of hardware to boot mOS. In short, changes were made to use the INT 13H BIOS interrupt to load mOS one sector at a time, rather than trying to load 42 sectors all at once, which did not work on some systems when loading mOS off of a 1.44M floppy disk

The issue with the old method may be that multi-track reads are not supported on the affected systems. The old method tried to read 42 sectors all at once, and since a 1.44M floppy only has 18 sectors per track, the old method requires multi-track reads to load correctly (see https://www.ctyme.com/intr/rb-0607.htm).

There were also changes to the makefile for how the mOS.bin binary is created due to changes in the boot sector code that now check the return codes of calling the INT 13H BIOS interrupt when performing reads. The issue was that QEMU stopped booting since there where technically errors when reading that were ignored before (due to the fact that mOS.bin was smaller than the number of sectors (42) that the boot sector code was trying to load). Thus the makefile was changed to pad mOS.bin to 42 (512-byte) sectors.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Testing

Please describe tests that you ran to verify your changes. Provide instructions so that we can reproduce. Please also list any relevant details for your test configuration.

Test Configurations:

  • QEMU
  • Medion Tower PC (2003) with Pentium 4 (32-bit HW), booted off of a 1.44M floppy disk
  • e-Machine Tower PC (~1999) with Celeron 400MHz (32-bit HW), booted off of a 1.44M floppy disk

On each of these systems I checked that mOS booted correctly and that the keyboard functioned as expected.

Checklist:

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

Alex105178 and others added 8 commits December 20, 2024 23:29
On QEMU, the new error handling code in the boot sector will fail since the file
generated is not 512*42 bytes large (some calls to the INT 0x13/AH=0x02
interrrupt will fail, due to the size of the drive created/mounted by
QEMU).

The Makefile was updated both to make the mOS.bin file large enough if
necessary (using truncate), and to give an error if the generated mOS.bin file
is too large (larger than 512*42 bytes).

Note: This has not been an issue though for booting off of floppy disks on real
hardware.
@Alex105178 Alex105178 changed the title Changes to the boot sector to allow mOS to boot on a greater range of harder. Changes to the boot sector to allow mOS to boot on a greater range of hardware. Aug 27, 2025
@Sploder12 Sploder12 self-requested a review August 27, 2025 02:59
Copy link
Member

@Sploder12 Sploder12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really great work! All my comments are very minor since everything works (on qemu)!

@Alex105178
Copy link
Contributor Author

Hello Trevor, thank you for your great feedback.

I have made 4 small commits to address the issues that you pointed out.

I have tested the changes in QEMU and it still boots correctly (I also tested forcing the error code to run to ensure that that code prints the errors).

Copy link
Collaborator

@Real-Septicake Real-Septicake left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All looks good to me! I'll get this merged in!

@Real-Septicake Real-Septicake merged commit 51fa98d into makeopensource:main Sep 12, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants