Allocate one drive per available active partition at boot time#196
Allocate one drive per available active partition at boot time#196
Conversation
When booting in DOS 1 mode (1 or 2 key pressed), take in account FAT12 partitions only. Otherwise, take in account FAT16 partitions too. For devices that don't have valid partitions, or that are offline and removable, assign only one drive as usual.
This replaces the previous "Note enough memory" message
📝 WalkthroughWalkthroughThis PR enhances kernel boot initialization across two files: it adds pre-allocation memory safety checks in dos1ker.mac to prevent FAT buffer allocation when insufficient HIMEM remains, and refactors boot-time device/partition discovery in partit.mac with a new partition-counting routine that enumerates suitable FAT12/FAT16 partitions on devices during startup. Changes
Sequence Diagram(s)sequenceDiagram
participant Boot as Boot Process
participant Dev as Device
participant PT as Partition Table
participant PS as Partition Scanner
participant Type as Type Checker
Boot->>Dev: Enumerate Device
Dev->>PT: F_GPART_INNER (Get Partition)
PT-->>Dev: Partition Data
Dev->>PS: COUNT_DEVICE_PARTITIONS
PS->>PT: CDP_GPART_PRI (Primary Partition)
PT-->>PS: Partition Entry
PS->>Type: IS_SUITABLE_PART_TYPE
Type-->>PS: FAT12/FAT16?
alt Suitable
PS->>PS: Increment Count
end
PS->>PT: CDP_SCAN_EXTENDED (Check Extended)
PT-->>PS: Extended Chain Entries
PS-->>Dev: Total Partition Count
Dev->>Boot: Drive Count Updated
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Previously Nextor would allocate one drive per device allocated to a Nextor kernel at boot time; and if there were partitions with the "active" bit set in the partition table (bit 7 of the first byte), the first of these would be the partition that was assigned to the drive. The active status of a partition can be changed with FDISK.
With this change, the suitable active partitions for each device are counted at boot time and each get a drive. "Suitable partitions" are FAT12 and FAT16 partitions, except when booting in DOS 1 mode via pressing the 1 key (or the 2 key in Turbo-R): in these cases only FAT12 partitions are considered:
There are a couple of edge cases when booting in DOS 1 mode:
In these cases there will be drives assigned to the device that won't get mapped to any partition at boot time: one for each FAT12 partition over 16MB in the second case, and additionally, one for each FAT16 partition in the first case.
Additional change: if DOS detects that it's running out of available page 3 space when booting in DOS 1 mode, it will stop allocating new drives instead of displaying a "Not enough memory" message and freezing.
Closes #196.
AI usage
The development of this feature has been assisted by an AI agent (Claude). For educational purposes, a transcript of the initial session with the agent is included in this pull request: