Web64 logo Web64 Documentation Web64-native c64lib Compatibility

Web64-native c64lib Compatibility

Compatibility version: 3

Web64 provides a curated, browser-native adaptation of useful public c64lib contracts. It does not run the KickAssembler Java application, Gradle, Java plugins, native command processors, or the original build graph in the browser. An explicitly selected KickAssembler Compatibility Mode can compile only the evidence-backed direct-source subsets documented here. The adapted release contract is c64lib-compatibility-v3.json, and the direct-source checkpoint is c64lib-kick-direct-v1.json. The v1 and v2 adapted manifests remain available as frozen legacy contracts.

Authority and Scope

Planning and verification use these exact official revisions. Updating an upstream repository does not silently change Web64 behavior.

Official projectVersionPinned commitEvidence used
c64lib/common0.5.1d9b508f62649a9e15d4b3dbee2ae99b3f402bd5ePublic constants, macros, hosted routines, examples, and tests.
c64lib/chipset0.5.1e91455ba6f4f87e2d0d4e7604215e52db9e96ee2CIA, MOS 6510, VIC-II, sprites, raster, and IRQ contracts.
c64lib/text0.5.1b5fa872d2a43c1690666444d223603728b346a14Text, screen movement, and Tile2 behavior.
c64lib/copper640.6.06d4b0920db0b0ddfd42976dc7c9ddc77c766244dDisplay-list records, handlers, examples, and IRQ behavior.
Gradle Retro Build Tool1.8.03644230ef3ba3eea99eddcdde8cdb179db2adaedProcessor parameters, task behavior, and project conventions.
64spec0.7.0prbbf79e7b76a407725b0ba827e52e8372cf3aea69Assertion vocabulary, counters, and test workflow.
Magic Desk CRT1.0.06bc42e54efe0d1fac616a3848f8e7060348935f8CBM80 bootstrap, bank loader, and CRT conventions.
Bitmapunreleased 2021-08-269754d2c372a4c875c2ebbad8aa0f846699ce9c61Six-field BitmapTileConfig; no runtime implementation exists upstream at this revision.
Fontsunreleased 2020-02-117904f538ab0f50e64d403d23365d7b20aca84509Repository inventory; no distributable font data or public runtime contract exists at this revision.
GoatTracker 22.77 / GTS3-GTS5 / GTI3-GTI5release archiveSong, instrument, order, command, table, and gt2reloc contracts; GoatTracker itself is not bundled.
Exomizer3.1.2ba91318e02bc0f69e437379a84348d416c4a19aaRaw codec, backward P39 stream, and 6502 decrunch contract.

The official site and repositories remain the authority where names differ. Web64 records ambiguity in the compatibility ledger rather than guessing. Licensing and attribution are in C64LIB_COMPATIBILITY_NOTICES.md.

Compatibility Classifications

Every assessed facility is classified as native compatible, source compatible, semantically compatible, adapted Web64 implementation, requires ABI shim, replaced by an existing Web64 feature, compile-time only, import/conversion only, deferred, or intentionally unsupported. The generated ledger separately records API, source, binary, semantic, and workflow compatibility.

No general binary compatibility with KickAssembler output is claimed. A facility is not considered complete because an include parses or a similarly named routine exists; implemented entries require executable evidence.

Direct Kick Source Compatibility

Direct-source support is opt-in through KickAssembler Compatibility Mode (v5.25) and is classified independently from the established Web64-native adapters. The machine-readable authority is c64lib-kick-direct-v1.json.

SurfaceClassificationEvidence and boundary
c64lib/chipset 0.5.1 lib/mos6510.asm and lib/mos6510-global.asm at commit e91455ba6f4f87e2d0d4e7604215e52db9e96ee2Direct-source compatible P0Verbatim sources compile from the project VFS. SHA-256 is 2b37a5bf221a7f790ad542141047cd27f2f56afaba4ab0f866e1d326d636feee and 5d64c2d17cad490da3aee5f1a25493b512f92efc82d62f791dcab5741f3feab1, respectively.
MOS 6510 labels, .filenamespace, configureMemory, and the root-exported c64lib_configureMemory macroDirect-source compatible P0The minimal client emits exactly 00 01 06 a5 01 29 f8 09 06 85 01 a5 01 29 f8 09 02 85 01 60, exports c64lib.direct at $200b, preserves nested macro provenance, and converges with replay.
web64/c64lib/chipset.inc and web64_c64lib_configure_memoryAdapted Web64 compatibleThe adapter remains supported. Its tested eight-byte memory-configuration expansion is byte-identical to the corresponding direct upstream macro call. Existing projects are not migrated implicitly.
Generic assembled-code assertion syntaxSupported compatibility adapter; outside direct P0The Slice 15 layout assertion adapter compares governed assembled byte streams after physical/logical layout. That adapter is verified for general Compatibility Mode, but no c64lib assertion source is promoted by this narrow direct-source corpus.
Other c64lib Common, Chipset, Text, Copper64, Tile2, 64spec, Magic Desk, processor, and host-build facilitiesAdapted, deferred, or intentionally unsupportedUse the adapted v3 ledger unless a later direct-source manifest explicitly promotes a facility. Common/string conversions are not part of this P0 claim. Gradle, Java plugins, and native host commands remain intentionally unsupported.

This checkpoint proves exact Web64 output for the pinned minimal program, not general equivalence with every KickAssembler-produced binary. disableNMI parses in the imported source but is not executed by the P0 fixture and is classified accordingly. The optional KickAss.jar oracle and a broader licensed upstream corpus were unavailable for this gate, so the release makes no blanket c64lib source or upstream-binary claim.

Modules

Modules are selected per Build Target. Dependencies are automatic and runtime routines are linked only when referenced.

ModuleDependenciesAssembly includeC headersTarget kinds
c64lib.commonNoneweb64/c64lib/common.incc64lib/common.hPRG, test, Magic Desk CRT
c64lib.chipsetCommonweb64/c64lib/chipset.incc64lib/chipset.h, vic2.h, sprites.hPRG, test, Magic Desk CRT
c64lib.textCommon, Chipsetweb64/c64lib/text.incc64lib/text.hPRG, test, Magic Desk CRT
c64lib.copper64Common, Chipsetweb64/c64lib/copper64.incc64lib/copper64.hPRG, Magic Desk CRT
c64lib.bitmapChipsetweb64/c64lib/bitmap.incc64lib/bitmap.hPRG, test, Magic Desk CRT
c64lib.magic-desk-crtCommon, Chipsetweb64/c64lib/magic-desk-crt.incc64lib/magic-desk.hMagic Desk CRT
c64lib.64specCommon, Textweb64/c64lib/64spec.incc64lib/64spec.hPRG, test

The Project tree exposes exact virtual sources under Web64 SDK > ASM includes > web64 > c64lib and headers under Web64 SDK > C headers > c64lib. Browsing a virtual file does not select its module. Compiling a compatibility include or header without the corresponding target module produces a diagnostic.

Assembly Surface

Web64 keeps hardware constants and bounded source forms that map safely to the native Web64 assembler. Adapted macros use explicit web64_c64lib_* names and remain the default compatibility path. Guided migration translates supported official invocations without requiring Kick mode. Separately, explicitly selected KickAssembler Compatibility Mode provides the governed v5.25 evaluator and adapters documented in KickAssembler Compatibility Mode, but direct c64lib compatibility is claimed only for facilities promoted by the pinned direct manifest. The presence or successful parsing of any other upstream include never promotes it automatically.

Common provides byte/word assignment, arithmetic, far branches, comparison, shifts, rotation, multiplication/addition, memory copy/fill, RLE decompression, and explicit hardware-call stack helpers. Chipset provides CIA and VIC-II declarations, memory configuration, VIC bank selection, PAL/NTSC detection, complete nine-bit raster values, raster IRQ helpers, display-mode setup, character transforms, and nine-bit sprite positioning. Text provides text increment/copy and screen/Color RAM movement primitives. Copper64 provides the four-byte list format and handler IDs 1 through 22.

.include "web64/c64lib/chipset.inc"

start:
    web64_c64lib_disable_cia_interrupts
    web64_c64lib_set_vic_bank C64LIB_BANK_1
    web64_c64lib_set_raster 250

C and Mixed-language ABI

The Web64 compiler owns one mixed-language ABI. Compatibility code does not introduce a second calling convention.

All declared C compatibility routines are compile/link tested through the dependency-selected runtime. Register clobbers and interrupt safety remain routine-specific; callers must not infer preservation from short source. V3 adds the complete stateful Tile2 boundary and the Exomizer P39 decrunch call.

Zero Page and Memory Governance

Selected compatibility modules participate in the same declarative memory governance as the compiler, runtime, user assembly, assets, IRQ owners, and target linker. The registry records owner, range, width, lifetime, scratch/persistent use, interrupt visibility, reentrancy, overlay eligibility, and initialization.

The stack ABI owns $02-$17. Call-scoped compatibility scratch may overlay the compiler call scratch $fb-$fe only where lifetime rules prove that the uses cannot overlap. Copper64 stores its list pointer in installed code operands and has no persistent zero-page claim. Conflicts are diagnostics; Web64 does not silently relocate fixed hardware, VIC-visible data, vectors, or user reservations.

Build Targets govern origin, translation units, C mode, compatibility modules, and target format. Magic Desk CRT targets require origin $8000. PRG/test output is packaged with the selected entry point, while CRT output is split into deterministic 8 KiB CHIP banks with 0xff padding and an optional strict CBM80 bootstrap check.

Interrupt Interoperability

Copper64 V3 installs through the KERNAL IRQ vector $0314/$0315, owns the raster IRQ while active, and returns through the KERNAL path. Disable conflicting CIA sources before start; the Web64 helper also drains pending CIA interrupt flags, and Copper acknowledges a stale VIC raster request before enabling raster IRQs. Direct jump-table dispatch implements all 22 handlers. Handlers 1-7, 9, 11-15, and 18 use the upstream-style double-IRQ stabilizer. The stabilizer preserves the outer KERNAL stack pointer in private runtime state because the nested KERNAL IRQ prologue uses X itself. Handlers 16, 17, and 19 are line-sequenced; 8 and 10 are byte-semantic; and 20-22 synchronize to raster transitions. PAL uses the 6569 63-cycle contract and NTSC uses the 6567R8 65-cycle contract. Handler 21 is PAL-specific and handler 22 is NTSC-specific. Full raster bars remain explicitly badline-sensitive, matching the upstream warning; there is no blanket cycle guarantee beyond each handler's recorded class.

The guarded callback wrapper is pay-for-use. It preserves Web64-C stack ABI zero page around an approved no-argument callback. Nested interrupts, arbitrary runtime calls, banking changes, unbounded C execution, and cycle-critical callbacks remain prohibited unless the program establishes and verifies a stronger contract.

Browser-native Processors

The compatibility worker implements deterministic, cancellable byte transformations with transferable buffers:

Existing Web64 systems replace Gradle processors for CharPad/CTM, SpritePad, Koala, native Char/Block/Map/Sprite assets, generated C headers, assembly includes, descriptors, dimensions, offsets, and byte counts. Those replacements use fixture-backed Web64 contracts instead of reproducing JVM task wrappers.

GoatTracker files are interchange codecs, not a second tracker project type. Import maps supported songs and instruments into editable W64SID v3 data, including typed orders, commands, instrument flags, and four raw tables. Export rebuilds the file from current W64SID state; it never substitutes a hidden stale source document. Untouched supported imports round-trip byte-for-byte. The gt2reloc compatibility option mapper covers relocation addresses, SFX/volume/optimization switches, ghost registers, and metadata as explicit options around the existing modular W64SID runtime. Exomizer is a lazy optional codec: selecting no Exomizer operation causes no Wasm load or build work. Arbitrary external command execution remains intentionally unsupported; Web64 never invokes host commands as a hidden fallback.

Tile2 Runtime

The Tile2 adapter consumes canonical Web64 Block and Map descriptors. It validates 2x2 blocks, one-byte indices, map bounds, and optional Color RAM/material planes, then emits the four 256-byte character planes, block metadata, map planes, and row offsets expected by the runtime. c64lib_tile2_init, explicit render, four directional scroll calls, and material lookup are available to C and assembly. Scrolling shifts the existing Screen and Color RAM regions and decodes only the newly exposed edge. A partial playfield uses startRow/endRow without changing the map-coordinate origin.

64spec Test Targets

The browser-native 64spec module provides reset; byte, 16/24/32-bit constant, byte-range, unsigned-order, masked-bit, processor-status, A/X/Y/XY, zero/nonzero, and explicit pass/fail assertions; and finish operations. Assembly assertions preserve caller A/X/Y/status where their contract observes transient CPU state. C exposes data-oriented equality, ordering, mask, and byte-range assertions. A test target must reference the result runtime. The artifact publishes the address of a seven-byte result block containing the W6 magic, status, passed count, and failed count so the emulator/debugger or automation can inspect deterministic machine results. Official hosted presentation/configuration options are replaced by target settings, the debugger, and machine-readable results rather than emulated as KickAssembler configuration objects.

.include "web64/c64lib/64spec.inc"

start:
    web64_64spec_reset
    lda #3
    web64_64spec_assert_a_equal 3
    web64_64spec_finish
    rts

Magic Desk CRT Targets

The Magic Desk module provides the $de00 bank register contract, a CBM80 bootstrap macro, register-ABI bank-copy entry points, and C wrappers. The browser-native writer validates bank range and uniqueness, writes standard CRT/CHIP headers, pads each bank, and parses generated images for verification.

Selecting a Magic Desk target changes only that target. Run lazily packages the current compile snapshot, attaches the CRT through the emulator cartridge API, and power-resets the C64. Save writes .crt. Ordinary PRG and test targets keep their existing paths. Live memory patching is deliberately disabled for a running banked cartridge.

Project Migration

Project Tree > Manage > Migrate c64lib Project performs non-destructive guided migration:

  1. Inspect source and build conventions without changing the original.
  2. Create a Web64-native project copy.
  3. Preserve original files under legacy-c64lib/.
  4. Translate recognized includes, constants, macro calls, compile-time text increment, and 64spec pseudo commands.
  5. Infer modules and record each transformation.
  6. Emit actionable diagnostics for unsupported hosted constructs.

The migration does not approximate KickAssembler structural DSL, compile-time host loaders, full Tile2 configuration DSL, memory-mode irqExit, dynamic copper handler selection, native GoatTracker/Exomizer tasks, or arbitrary Gradle commands.

Performance Isolation

Compatibility is strictly opt-in. No compatibility wrapper may become the default path for an existing native Web64 routine when the native path is smaller or faster. Shims remain boundary adapters.

Executable gates verify both Web64 ABIs:

These rules apply to native projects that do not request c64lib compatibility and to native operations inside compatibility-enabled projects.

Reference Projects and Evidence

Focused tests cover source pins, module dependency closure, includes and headers, all declared C routines, macro expansion, migration, processors, both ABIs, zero-page conflicts, target validation, CRT round trips, 64spec metadata, deterministic output, native-path byte identity, and compilation of every reference project. The direct-source checkpoint additionally uses test/fixtures/kick-assembler/language/c64lib-direct-p0.asm, verbatim upstream sources under test/fixtures/kick-assembler/upstream/c64lib/chipset/e91455ba6f4f87e2d0d4e7604215e52db9e96ee2/, and test/web64-kick-assembler-compatibility.test.mjs to prove source integrity, exact bytes and symbols, provenance, replay, and adapted-macro equivalence.

Explicit Unsupported Boundaries

V3 / Web64 IDE 1.0 Completion Rule

V3 closes only when the ordered stage gate reports Foundation, Tile2, GoatTracker/gt2reloc, Exomizer, Copper PAL/NTSC, and Release as closed. A later stage cannot begin while an earlier stage exposes an unresolved contract defect that invalidates downstream assumptions. Native-path purity remains a release invariant: compatibility modules cannot alter PRG bytes, compiler decisions, symbols, or dependencies unless selected and referenced.