Skip to content

Implement the boot menu#195

Merged
Konamiman merged 4 commits intov3.0from
implement-boot-menu
Feb 11, 2026
Merged

Implement the boot menu#195
Konamiman merged 4 commits intov3.0from
implement-boot-menu

Conversation

@Konamiman
Copy link
Copy Markdown
Owner

@Konamiman Konamiman commented Feb 11, 2026

This pull request implements a boot menu that's activated by pressing the N key during boot:

image

This menu shows:

  • All the existing Nextor 3 kernels, activated by default.
  • All the existing numeric key modifiers. By default those that are included in the key inverter bytes in ROM show as activated.

The user can:

  • Deactivate kernels, activate/deactivate key modifiers, then press ENTER to boot with these. It's as if the equivalent keys were physically pressed, or had been configured for one-time boot with the NEXBOOT.COM tool.
  • Press N, that's equivalent to the above but all the Nextor kernels will be disabled.
  • Press ESC, any changes made in the menu are undone and boot continues as if the menu had never been shown.

The result of the changes made in the menu is stored as simulated keypresses in memory, exactly in the same way as the one-time boot keys mechanism does.

In order to enumerate all the Nextor kernels without initializing them, a scan is made for all the existing slots: those having the "AB" ROM signature at address 4000h and a new NXT3 signature at address 407Bh are considered Nextor 3 kernels.

Additionally:

  • Small improvements are also made to the "Initializing kernel..." messages.
  • The code for the KABR and KDERJ hooks are moved to page 3 RAM for improved ROM space usage.

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:

This menu allows to disable Nextor 3 kernels before they initialize,
and also allows to simulate the pressing of various boot keys.

Also define a mandatory "NXT3" signature at address 407Bh
for all the NExtor 3 kernels.
The KABJ/KDERJ hooks act as intermediaries between the KBDOS error
vectors and the KABR/KDERR handlers in bank 0, switching to bank 0
via CHGBNK so they work when bank 4 is paged in. Previously these
hooks lived in ROM at matching addresses in banks 0 and 4 (dskab.mac),
which forced the free area start from 7BD0h to 7E90h as the boot menu
code grew. Moving the hooks to page 3 RAM eliminates the matching
address requirement, restoring the full 1K free area at 7BD0h.
@Konamiman Konamiman added this to the v3.0.0 alpha 1 milestone Feb 11, 2026
@github-project-automation github-project-automation bot moved this to Backlog in Nextor 3 Feb 11, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 11, 2026

📝 Walkthrough

Walkthrough

Adds a new boot menu subsystem and message printer in bank 4, integrates menu invocation into the boot/init flow, moves disk-abort hooks to RAM templates, extends boot-time RAM layout and jump table entries, updates build rules, and adds design documentation. No behavioral changes outside the new boot-menu integration.

Changes

Cohort / File(s) Summary
Documentation
\.ai/CONVERSATION.md, \.ai/PLAN.md, \.ai/SESSION.md
New design-review, plan, and session documents describing the boot menu design, flows, and validation notes.
Boot menu implementation
source/kernel/bank4/bootmenu.mac
New comprehensive boot menu module: slot scanning, kernel detection (Nextor3 signature), driver queries, UI for 40/80 cols, input loop, toggle/write RAM keys, and exported BOOT_MENU.
Boot message module
source/kernel/bank4/bootmsg.mac
New PRINT_KERNEL_MSG and helpers to format/print kernel initialization messages for 40/80 columns; integrates driver name/version queries.
Boot/init integration
source/kernel/bank0/init.mac, source/kernel/bank0/bdos.mac
Init flow updated: new INIT_SCREEN_AND_VERSION, SHOW_BOOT_MENU, CALL_PRINT_KERNEL_MSG; copies KABJ_HOOKS_TEMPLATE to RAM and integrates boot-menu invocation and control flags.
RAM hooks & disk abort refactor
source/kernel/drv.mac, source/kernel/bank4/dskab.mac, source/kernel/bank0/bdos.mac
Removed hard-coded KABJ/KDERJ in ROM/bank4; introduced RAM hook template (KABJ_HOOKS_TEMPLATE) that gets copied to page 3 RAM; removed bank4/dskab.mac.
Boot-time RAM layout
source/kernel/kvar.mac
Added ALL_KERNELS_DISABLED, KABJ_CODE, and KDERJ_CODE fields to boot/work RAM area.
Jump table & exports
source/kernel/bank4/jump.mac, source/kernel/data.mac
Added BOOT_MENU and PRINT_KERNEL_MSG entries/vars to bank4 jump table and data exports.
Build & Makefile
source/kernel/Makefile
Makefile updated to include bootmenu.rel and bootmsg.rel in bank4 build and final B4.BIN; standalone driver path corrected.
Signatures, constants, and small edits
source/kernel/bank0/doshead.mac, source/kernel/bank0/betainfo.mac, source/kernel/condasm.inc
Added NXT3_SIGNATURE ("NXT3",0); removed ALPHAL constant; adjusted betainfo defb parameter list.
Auxiliary updates
source/kernel/drivers/StandaloneASCII8/driver.mac, source/kernel/bank4/partit.mac, source/kernel/macros.inc
Minor driver message/origin tweaks; partit.mac uses printchar; added printchar macro.
Large additions / new data
source/kernel/bank4/..., source/kernel/data.mac
New data tables and KERNEL_ENTRIES structure, RAM key signature/data, strings, and many helper routines in bank4 bootmenu/msg modules.

Sequence Diagram(s)

sequenceDiagram
    participant Boot as Boot Flow
    participant Init as Bank0 Init
    participant Menu as Bank4 BOOT_MENU
    participant Driver as Driver Query (CALDRV/CALSLT)
    participant RAM as RAM (BOOTKEYS/A100h)
    Boot->>Init: start INIT_SCREEN_AND_VERSION
    Init->>Init: copy KABJ_HOOKS_TEMPLATE -> page3 RAM
    Init->>RAM: check SCANKEYS_RAM_AVAILABLE?
    alt RAM keys / menu enabled
        Init->>Menu: C4PBK BOOT_MENU
        Menu->>Menu: SCAN_SLOTS (detect kernels, signature)
        Menu->>Driver: CALDRV / CALSLT for names/versions
        Driver-->>Menu: driver info
        Menu->>Menu: DISPLAY_MENU
        Menu->>User: MENU_INPUT_LOOP (N/num/ENTER/ESC)
        alt ENTER
            Menu->>RAM: WRITE_RAM_KEYS (persist)
        else ESC
            Menu->>Menu: discard changes
        end
        Menu-->>Init: return (menu result)
    else no RAM keys
        Init->>Init: continue normal boot
    end
    Init->>Boot: continue kernel init (CALL_PRINT_KERNEL_MSG used)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Poem

I hopped into startup light,
Counting kernels through the night,
Press N, press numbers, toggle free,
I wrote your keys to A-one-oh-oh—tee! 🐇✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Implement the boot menu' directly and clearly summarizes the main change: adding a new boot menu feature to the Nextor system during startup.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch implement-boot-menu

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.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Fix all issues with AI agents
In @.ai/PLAN.md:
- Around line 5-11: Fix the two typos in the design doc: replace the string
"bootin" with "booting" (occurs in the sentence about keys users can press while
booting) and replace "rigth" with "right" (occurs in the sentence introducing
"The Nextor boot menu"); update those exact words in the .ai/PLAN.md content so
the text reads "booting" and "right".

In `@source/kernel/bank0/init.mac`:
- Around line 867-877: When SCANKEYS_RAM_AVAILABLE returns Z (keys sourced from
RAM) the code jumps to AFTER_BOOT_MENU without initializing
ALL_KERNELS_DISABLED, which can leave it set from a prior boot; modify the boot
path so that when SCANKEYS_RAM_AVAILABLE yields Z you explicitly clear
ALL_KERNELS_DISABLED before jumping to AFTER_BOOT_MENU (i.e., insert the same
xor a / ld (ALL_KERNELS_DISABLED##),a sequence in the branch taken after
SCANKEYS_RAM_AVAILABLE) while preserving the existing N-key check (BOOTKEYS##+2
and subsequent SHOW_BOOT_MENU behavior).

In `@source/kernel/Makefile`:
- Around line 187-189: The StandaloneASCII8 make target creates a prefixed file
"_driver.bin" but then incorrectly passes the unprefixed "driver.bin" to
MKNEXROM; update the MKNEXROM invocation in the StandaloneASCII8 target to use
/d:drivers/StandaloneASCII8/_driver.bin (so MKNEXROM gets the 256-byte-prefixed
file) and keep the existing $(call copy_to_bin,$@) invocation unchanged;
reference symbols: MKNEXROM, $(call copy_to_bin,$@), and the StandaloneASCII8
driver filenames.
🧹 Nitpick comments (3)
.ai/SESSION.md (1)

43-50: Add a language specifier to the fenced code block.

Static analysis flags this code block as missing a language identifier. Since this is pseudo-code describing an init flow, consider using ```text or similar.

.ai/PLAN.md (1)

13-35: Add a language specifier to the fenced code block.

The code block at line 13 (the menu mockup) lacks a language identifier. Consider using ```text.

source/kernel/bank4/bootmenu.mac (1)

1236-1239: Unnecessary push de / pop de around ld hl,STR_BOOT_MENU_SUFFIX.

ld hl,... doesn't clobber DE, so the push/pop is redundant.

Suggested simplification
-	push de
 	ld hl,STR_BOOT_MENU_SUFFIX
-	pop de
 	call COPY_STRING

@Konamiman Konamiman merged commit 6e0ba63 into v3.0 Feb 11, 2026
1 of 2 checks passed
@github-project-automation github-project-automation bot moved this from Backlog to Done in Nextor 3 Feb 11, 2026
Konamiman added a commit that referenced 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