{"name":"@mplx/d64","description":"Read, write, create and format Commodore 1541 D64 disk images: CBM DOS 2A directories, BAM allocation, PETSCII names, and the 40-track SpeedDOS / DolphinDOS / PrologicDOS extensions","versions":{"0.1.0":{"version":"0.1.0","kind":"git","url":"https://github.com/deckyard/deck-d64.git","ref":"0.1.0","commit":"8cf5c053fe2136088083e97a3681fa4462b5ed90","checksum":"","yanked":true,"license":"LGPL-3.0-only","requires":{},"engines":{"jennifer":"\u003e=0.25.0","jennifer-tiny":"\u003e=0.25.0"},"capabilities":[],"keywords":["d64","commodore","c64","1541","cbm-dos"],"description":"Read, write, create and format Commodore 1541 D64 disk images: CBM DOS 2A directories, BAM allocation, PETSCII names, and the 40-track SpeedDOS / DolphinDOS / PrologicDOS extensions","publishedAt":"1793208280","repoId":1398621326,"repoOwnerId":346943577,"repoOwner":"deckyard"}},"readme":"# @mplx/d64\n\n[![test](https://github.com/mplx/deck-d64/actions/workflows/test.yml/badge.svg)](https://github.com/mplx/deck-d64/actions/workflows/test.yml)\n[![Documentation](https://img.shields.io/badge/docs-github%20pages-blue)](https://mplx.github.io/deck-d64/)\n[![release](https://img.shields.io/github/v/release/mplx/deck-d64)](https://github.com/mplx/deck-d64/releases/latest)\n\nRead, write, create and format Commodore 1541 **D64 disk images** from\n[Jennifer](https://jennifer-lang.dev/).\n\nA D64 is a byte-for-byte copy of a 5.25\" floppy: 683 blocks of 256 bytes,\nholding CBM DOS 2.6 - a Block Availability Map in sector 18/0, a chain of\n32-byte directory slots from 18/1, one linked list of blocks per file. This\ndeck implements all of it in pure Jennifer: build images for an emulator or a\nreal drive, inspect or repair existing ones, bulk-extract an archive, without\n`c1541`.\n\n**[Read the documentation](https://mplx.github.io/deck-d64/)**\n\n## Usage\n\n```jennifer\nuse io;\nimport \"@mplx/d64/\" as d64;\n\ndef img as d64.Image init d64.formatDisk(\"sample disk\", \"01\");\n$img = d64.writeText($img, \"readme\", d64.FileType.Seq, \"hello from jennifer\\n\");\n$img = d64.writeProgram($img, \"demo\", 0x0801, $code);\n\nio.printf(\"%s\", d64.directoryText($img));\n# 0 \"sample disk     \" 01 2a\n#    1 \"readme\"            seq\n#    3 \"demo\"              prg\n# 660 blocks free.\n\nd64.save($img, \"sample.d64\");\n```\n\n## What it does\n\n- **Format** - `formatDisk` is `NEW0:NAME,ID`. `formatDiskWith` takes the\n  geometry (35/40/42 tracks, optional error table) and the BAM layout. Full\n  format wipes every block to a fill byte; `quickFormat` erases the BAM and\n  directory only, as `N0:NAME` does.\n- **Four BAM layouts** - stock 35-track, plus the three incompatible 40-track\n  extensions: **SpeedDOS**, **DolphinDOS**, **PrologicDOS**. Detected on load,\n  overridable.\n- **List** - `directoryText` renders `LOAD\"$\",8`; `listFiles` gives typed\n  entries; `findFiles` filters with the drive's `*` and `?` patterns.\n- **Read and write** - SEQ, PRG, USR as raw bytes, PETSCII text, or a program\n  split at its load address. `updateFile` replaces, `deleteFile` scratches;\n  rename and lock.\n- **PETSCII** - UTF-8 ↔ PETSCII in the `petcat` convention, exact round trip\n  for anything the character set can spell.\n- **Metadata** - `fileInfo` returns the directory entry, the block chain, the\n  real byte size and the PRG load address, and flags an entry whose recorded\n  length the chain does not back up.\n- **Edit** - `patchSector` and `patchFile` overwrite bytes in place,\n  `readAt` / `writeAt` give a flat byte view, and `findBytes` locates a\n  pattern anywhere on the disk.\n- **Blocks** - `readSector` / `writeSector` and `readBlocks` / `writeBlocks`\n  for runs, all independent of the BAM, plus the BAM calls themselves.\n\nValue-semantic throughout: a mutator returns a fresh `Image` and leaves its\nargument alone.\n\n## Install\n\n```sh\njvc add @mplx/d64\n```\n\nOr vendor the `src/` subtree by hand from a release archive.\n\n## Requirements\n\nJennifer 0.25.0 or newer. No network, subprocess or database: the filesystem\nis built from `bytes` and bitwise operations, so the deck runs unchanged on\n`jennifer-tiny`. Only `open` and `save` touch the disk, through `fs`.\n\n## Development\n\n```sh\ntools/version.sh                     # the version the git tags imply\ntools/inject-version.sh              # stamp it into src/topics/version.j\njennifer test src/d64_test.j         # the white-box overlay\njennifer lint src/d64.j              # the compilable unit\njennifer fmt -l src examples         # formatting\ntools/check-headers.sh               # SPDX + interpreter floor\ntools/check-overlays.sh              # every topic has a test\ntools/check-docs.sh                  # docs match the code: signatures,\n                                     #   docblocks, links, claimed values\ntools/check-examples.sh              # every example still runs\ntools/pack.sh dist                   # the release archive, as CI builds it\ngrimoire build                       # the documentation site\n```\n\n## Licence\n\nLGPL-3.0-only. Every source file carries the SPDX header, and\n`tools/check-headers.sh` keeps those in step with `deck.toml`.\n"}