Add MEGA65 (native C65) and Commander X16 targets - #1
Open
jhonnaker1 wants to merge 2 commits into
Open
Conversation
- target=65: native MEGA65/C65 mode - screen $0800, BASIC $2001, C128-derived
KERNAL, self-contained print helpers, ROM-independent SYS-stub launcher.
New files mega65.def / mega65.asm.
- target=216: Commander X16 - VERA video (all drawing via CHROUT/PLOT, no direct
screen RAM, fast-scroll off), ISO charset so mixed-case SD/HostFS filenames
render as letters, SYS-stub launcher. New files x16.def / x16.asm.
- Both added to the shared CBM-FileBrowser.asm behind "!if target" guards, with
Makefile rules and prebuilt binaries in programs/ (fb65, fbx16).
- Fix a latent parseext infinite loop: its outer loop steps X by the 4-byte
slot size and stopped only on X == extensions_max, but the table is not a
whole multiple of 4 ("tcrt" is 5 bytes), so X could step past it. Terminate
on X >= extensions_max (bcs) instead of == (beq). Only bites when a filename
has a non-matching extension (e.g. the X16's HostFS "NAME.PRG"); safe for all
targets.
- Docs: MEGA65.md, X16.md.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The SYS-stub launcher runs machine-language programs (the bulk of the software) but cannot RUN a pure BASIC program: no SYS token means it resets, and a stray $9E byte can make the parse jump to a bad address. Document this shared limitation in X16.md and MEGA65.md; a proper LOAD-then-RUN hand-off into BASIC is future work. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds two new build targets to CBM-FileBrowser, plus one shared bug fix. Both new ports boot, browse directories, scroll, and launch programs, verified in their emulators (Xemu / x16emu). Existing targets are untouched and still build clean.
MEGA65 — native C65 mode (
target = 65)Runs in the MEGA65's native mode (not GO64): loads at
$2001with a BASIC-10SYSstub, screen$0800, colour RAM$D800. The C65 KERNAL is C128-derived, so the portable$FFxxjump table is reused; the C128 VDC/MMU code is replaced with C65-appropriate init, andPRNSTR/PRNINT/CLEARSCREENare provided locally (no C64 BASIC ROM). Two MEGA65-specific details were needed: zero the KERNAL's 32-bitLOADdestination bank bytes ($AF/$B0) so directory/program loads land in bank 0, and use an 80-column screen stride. Launch parses theSYSaddress out of the loaded program's$2001stub and jumps to it (ROM-independent).New:
sources/mega65.def,sources/mega65.asm,programs/fb65,MEGA65.md.Commander X16 (
target = 216)The X16 has a C64-derived KERNAL (standard
$FFxx, BASIC$0801, 65C02) but VERA video — the text screen is not in CPU address space. So all drawing goes through the KERNAL screen editor (CHROUT/PLOT), fast-scroll is off, andclearlistis reimplemented withPLOT+CHROUT. The browser sets 40x30 text mode and ISO mode (so mixed-case SD-card/HostFS filenames render as letters). Launch uses the same ROM-independentSYS-stub parser (from$0805).New:
sources/x16.def,sources/x16.asm,programs/fbx16,X16.md.Shared fix:
parseextinfinite loopparseext's outer loop steps X by the 4-byte slot size and terminated only onX == extensions_max, but the extensions table isn't a whole multiple of 4 ("tcrt"is 5 bytes), so X could step pastextensions_maxand loop forever. It only triggers when a selected filename has an extension that matches nothing — which never happens with CBM disk names (no extension) but does on the X16's HostFS names likeNAME.PRG. Fixed by terminating onX >= extensions_max(bcsinstead ofbeq) — a safe hardening for every target.Build
cd sources && makebuilds all targets includingfb65.prgandfbx16.prg. Both new targets sit behind!if target = 65/!if target = 216guards.🤖 Generated with Claude Code