Cli: headless 6502 frontend (assemble/run/disasm/hexdump) - #166
Merged
Conversation
A command-line frontend for Learn6502 — the "fourth frontend" alongside the
GNOME, web and Android apps, built on the SAME shared libraries rather than
sitting underneath them: `@learn6502/core` (assembler + simulator) and
`@learn6502/common-ui` (the `DisplayWidget` contract, `createSimulatorStack`,
`DEFAULT_COLOR_PALETTE`). It doubles as an executable proof that the core is
genuinely UI-independent.
Commands (`packages/cli/src/`):
- `assemble <file.asm>` — assemble and print the assembler's own result message
- `run <file.asm>` — assemble, run to completion (via `debugExecStep`, with
a step cap for programs that loop/await input), and
render the display
- `hexdump <file.asm>` — assemble and print a hexdump
- `disasm <file.asm>` — assemble and print the disassembly
`AnsiDisplay` implements the shared `DisplayWidget` interface — the terminal is
just another platform. The 32×32 grid of memory `$0200-$05FF` prints as
truecolor ANSI using the upper half-block `▀` (foreground = top pixel,
background = bottom), so the screen stays roughly square. Built node-free-ready
via `gjsify build --app node`.
The batch commands (assemble/disasm/hexdump) are thin wrappers over core; only
`run` reaches for common-ui — an honest split between batch and interactive use.
The GUIs remain library consumers; nothing depends on this CLI.
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.
A command-line frontend for Learn6502 — the "fourth frontend" alongside the GNOME, web and Android apps. The key idea (per discussion): it is built on the same shared libraries rather than sitting underneath them —
@learn6502/core(assembler + simulator) and@learn6502/common-ui(theDisplayWidgetcontract,createSimulatorStack,DEFAULT_COLOR_PALETTE). The GUIs remain library consumers; nothing depends on this CLI. It doubles as an executable proof that the core is genuinely UI-independent.Commands
The display is just another platform
AnsiDisplayimplements the sameDisplayWidgetinterface the GTK (Gtk.DrawingArea+cairo), web (<canvas>) and Android displays implement. The 32×32 grid of memory$0200-$05FFprints as truecolor ANSI using the upper half-block▀(foreground = top pixel, background = bottom), so the screen stays roughly square in a terminal.rundrives the simulator synchronously viadebugExecStep()(with a step cap for programs that loop or await input) rather than the GUI'ssetIntervalloop.Verified
Built with
gjsify build --app node(node-free-ready) and exercised end-to-end:assemble→ "Code assembled successfully, 11 bytes."runon a colour-chart program → renders all 16 palette colours as vertical bands, "Program completed after 1026 steps."hexdump→0600: a2 00 a5 fe 9d 00 02 e8 d0 f8 00disasm→ full annotated disassembly tableThe batch commands (assemble/disasm/hexdump) are thin wrappers over core; only
runreaches for common-ui — an honest split between batch and interactive use. This is a spike: it validates the decoupling and the ANSI-display approach. Natural follow-ups: an interactivedebugREPL (readline stepper over the existingdebuggerController), stdin gamepad input, binary I/O (-o out.bin), and a--app gjsbuild.