C02 v1.0.0: Complete Single-File Language
C02 has reached its v1.0 milestone. Per the goal set out in docs/roadmap.md:
someone can sit down and write a non-trivial 65C02 program without hitting an
"unimplemented" wall. Every must-have and should-have feature on the v1.0
checklist is now implemented and tested.
Highlights
breakandcontinuenow work insidewhileandforloops.- Local string literal initializers:
u8 *p = "...";works inside
function bodies, not just at global scope. - 16-bit multiply, divide, and modulo (
__mul16,__div16,__sdiv16). __heap_startand__memory_topimplicit globals for bump allocators
and RAM top queries, injected automatically into every translation unit.- Embedded ROM symbol table: compiled binaries now carry function names,
soc02-objdumpshows real labels instead of auto-generated ones.
Correctness fixes
- Variable shadowing is now a semantic error instead of a silent miscompile.
Codegen identifies variables by name only, with no scope qualifier, so a
shadowed inner declaration could alias the same storage as its outer
namesake (this is what caused abreakbug fixed this cycle). Shadowing an
enclosing scope is now rejected at analysis time. - Signed 8-bit division and modulo (
i8) previously routed through the
unsigned helper and produced wrong results for negative operands. Fixed
with a new__sdiv8wrapper. - Binary operations with mixed width or mixed signedness (
u8 + u16,
i8 < u8) derived their result type from the left operand only, silently
dropping high bytes or producing inconsistent comparisons depending on
operand order. Both operands now normalize to a common type first.
Safety and robustness
- ROM writes are now bounds checked. A program that exceeds the 32 KB ROM
fails with a clear diagnostic instead of silently corrupting the output. - Zero page exhaustion now fails codegen cleanly instead of warning and
continuing.
Testing
285 tests passing: golden tests, smoke tests, emulator tests, and valgrind
leak checks, all under make test. New coverage this cycle includes
emulator tests for break, continue (in both loop forms), 16-bit
multiply/divide, and mixed-width/mixed-sign binary operations.
What's not in v1.0
A short, deliberate list of nice-to-haves the roadmap explicitly allows v1.0
to ship without: short-circuit &&/|| evaluation outside a boolean
context, and the bitwise/shift compound assignment operators (&=, |=,
^=, <<=, >>=). Arrays and multi-file linking are scoped for later
milestones (v1.2+).
What's next
v1.1 is planned to bring interrupt handlers and inline assembly. See
docs/roadmap.md for the full plan through v2.0.