Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uefix.s: add CHS mode #13

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

uefix.s: add CHS mode #13

wants to merge 3 commits into from

Conversation

sirocyl
Copy link
Contributor

@sirocyl sirocyl commented Jul 2, 2023

This should enable booting a sector payload from an FDD, and so enabling -D FLOPPY on the yasm line will switch to CHS drive logic.

sirocyl added 2 commits July 2, 2023 05:28
This should enable booting a sector payload from an FDD, and so enabling `-D FLOPPY` on the yasm line will switch to CHS drive logic.
Load the sector after the first one.
@sirocyl
Copy link
Contributor Author

sirocyl commented Jul 2, 2023

Note: This also opens the path for supporting vintage 8088-and-up IBM PC-compatibles, as they do not have INT13h/AH=42 capability, only the old-standard AH=02 CHS.

While I'm submitting this for uefix, as its changes are low-impact and enable the single-sector Forth to load on such machines (albeit without a functioning LOAD keyword on those machines; and AUTOLOAD disabled), I probably will maintain the vintage-and-floppy-compatible miniforth as a fork, since it changes a lot with regards to the LOAD keyword, and the way --> block continuation works. I'll see how it develops though! I might be able to do it without mucking up the codebase too much.

@meithecatte
Copy link
Owner

Nice! Though, uefix is only necessary to work around BIOSes that insist on parsing the partition table portion of the bootsector. In practice, it's only the new UEFI firmware. Floppies commonly didn't have a partition table, so you shouldn't ever need to use uefix on a floppy.

As long as you patch the filesystem code, that is ;3

Comment on lines +21 to +25
%ifdef FLOPPY
jmp load.chs
%else
jmp load.lba
%endif
Copy link
Owner

Choose a reason for hiding this comment

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

Perhaps check whether the drive number provided by BIOS is less than 0x80, instead of hardcoding this at compile time?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was quick and dirty, but honestly that's probably a better approach. I'll hop on this and the 8 = HDD comment when I get back from breakfast.

Register DL contains the disk number on boot, so test 0x80, dl and jnz load.lba seems correct here, right?

uefix.s Outdated Show resolved Hide resolved
@sirocyl
Copy link
Contributor Author

sirocyl commented Jul 4, 2023

Nice! Though, uefix is only necessary to work around BIOSes that insist on parsing the partition table portion of the bootsector. In practice, it's only the new UEFI firmware. Floppies commonly didn't have a partition table, so you shouldn't ever need to use uefix on a floppy.

I've dealt with funky vendorized vintage PC-compatible BIOSes that expect more than a 55 AA. Toshiba or Tandy acts like this, I believe.
To be clear, no modern BIOS is that weird - they all just see the 55AA signature, and load and run.

As long as you patch the filesystem code, that is ;3

I don't think I'll need to patch the filesystem code, if it's already LBA-aware.

I'll explain over in the #6 issue how I'll implement the load CHS compatibility.

Anyway, about to go in, fix and test the fixes here in a minute.

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.

2 participants