Skip to content

Fixes for DOS 1 mode and more#194

Merged
Konamiman merged 4 commits intov3.0from
fix-compatibility-with-dos-1
Feb 8, 2026
Merged

Fixes for DOS 1 mode and more#194
Konamiman merged 4 commits intov3.0from
fix-compatibility-with-dos-1

Conversation

@Konamiman
Copy link
Copy Markdown
Owner

@Konamiman Konamiman commented Feb 8, 2026

  • Various parts of the code were assuming that the size of KERNEX_DOS1 entries (UD1_SIZE constant) was still 8 (so including the LUN number), causing crashes and incorrect behavior in DOS 1 mode. Fixed, and modified the code to use the UD1_* contants instead of hardcoded structure sizes and offsets.
  • Fix: same temporary buffer being used for the boot keys information and for building the KERNEX_DOS1 table, causing ghost key pressings.
  • Fix: any BASIC command crashing the computer after FDISK in DOS 1 mode.
  • Fix: kernel makefile not taking in account changes in b0labels.inc.

@Konamiman Konamiman added this to the v3.0.0 alpha 1 milestone Feb 8, 2026
@github-project-automation github-project-automation bot moved this to Backlog in Nextor 3 Feb 8, 2026
@Konamiman Konamiman changed the title Fixes for DOS 1 mode Fixes for DOS 1 mode and more Feb 8, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 8, 2026

📝 Walkthrough

Walkthrough

This pull request refactors DOS1 partition table handling by introducing symbolic constants (UD1_*) to replace hard-coded offsets, updates the build system to include a new partit.rel object, modifies memory layout with padding to prevent overlap in the boot area, and adjusts DOS1 FDISK invocation flow to properly manage bank state restoration.

Changes

Cohort / File(s) Summary
Build System
source/kernel/Makefile
Added bank4/partit.rel as a public build target with assembly rule and dependencies; updated B4.BIN linking stage to include the new partit.rel object.
DOS1 Partition Table Refactoring
source/kernel/bank4/partit.mac, source/kernel/drv.mac
Replaced hard-coded offsets (2, 3, 4, 5, 6, 7, 8) with symbolic UD1_* constants (UD1_SLOT##, UD1_DEVICE_NUMBER##, UD1_FIRST_ABSOLUTE_SECTOR##, UD1_SIZE##) throughout partition table access logic and iteration loops.
DOS1 FDISK Control Flow
source/kernel/bank0/dskbasic.mac, source/kernel/bank3/dos1ker.mac
Modified DO_FDISK_OK to return early when in DOS1 mode (non-zero MAIN_BANK##); updated DO_FDISK to execute NEW statement and transfer to CALBAS for proper bank state restoration; updated BOOTKEYS constant from 0F992h to 0F9B9h.
Memory Layout & Initialization
source/kernel/bank0/init.mac, source/kernel/kvar.mac
Added 40-byte padding in kvar.mac to prevent KERNEX_DOS1 table overlap with BOOT_TMP area; adjusted MK_DVB_TBL calculation in init.mac to use B\*7 and UD1_SIZE instead of fixed multipliers.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 With constants named UD1, the offsets now gleam,
No magic numbers cluttering the FDISK dream!
Memory padding keeps tables apart,
Bank states restored with DOS1 in the heart.
Partition paths cleared—a refactor so fine! 🎉

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The PR title 'Fixes for DOS 1 mode and more' is vague and generic, using non-descriptive language ('and more') that obscures the specific changes made to the codebase. Refine the title to be more specific about the primary changes, such as 'Fix KERNEX_DOS1 structure handling and DOS 1 mode compatibility' or similar, removing vague qualifiers like 'and more'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-compatibility-with-dos-1

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
source/kernel/Makefile (1)

365-365: partit.rel in the generic assembly rule may be unnecessary.

The generic .SECONDEXPANSION rule lists bare partit.rel (no directory prefix), but the actual build target is bank4/partit.rel (line 487). Since no target depends on the bare partit.rel, this entry is never triggered. It's harmless but could be removed to avoid confusion. The existing specific rule at line 487–491 already fully covers bank4/partit.rel.

source/kernel/bank0/init.mac (1)

2701-2705: Avoid hardcoding the entry size in the B*7 computation.

This still bakes in 7 even though the comment references UD1_SIZE##. Consider deriving the size from UD1_SIZE## to prevent drift if the entry size changes again.

♻️ Suggested refactor using UD1_SIZE##
-	add	a,a
-	add	a,a
-	add	a,a ;A = B*8
-	sub b ;Now A = B*7
-	ld	l,a
-	ld	h,0
-	inc	hl	;HL = Size of table = (entries * UD1_SIZE) + 1
+	ld	hl,0
+	ld	de,UD1_SIZE##
+MK_DVB_SIZE_LOOP:
+	add	hl,de
+	djnz	MK_DVB_SIZE_LOOP
+	inc	hl	;HL = Size of table = (entries * UD1_SIZE) + 1

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Konamiman Konamiman merged commit 58ce6bb into v3.0 Feb 8, 2026
1 of 2 checks passed
@github-project-automation github-project-automation bot moved this from Backlog to Done in Nextor 3 Feb 8, 2026
Konamiman added a commit that referenced this pull request Feb 10, 2026
@coderabbitai coderabbitai bot mentioned this pull request Feb 11, 2026
@coderabbitai coderabbitai bot mentioned this pull request Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant