6502-debugging

6502-debugging is a skill for Claude Code, Codex from nschneir/PET-Project. It costs 53 tokens per session (1,306 once invoked), scanned A, original, MIT.

A symptom-based debugging guide for Commodore PET programs written in 6502 assembly. It uses pet-tools commands to check the running binary and investigate crashes, corrupted data, wrong values, unresponsive input, and display problems.

In plain words
What is it for?
Checking program status, confirming loaded code bytes, rebuilding and reloading programs, and tracing common PET runtime failures before forming a diagnosis.
Why use it?
It helps distinguish a real program bug from an old binary that was never rebuilt or reloaded. The procedures provide an evidence-based order for checking runtime problems.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/nschneir/pet-project/6502-debugging
Any agent
npx skills add nschneir/PET-Project --skill 6502-debugging
Clone the repo
git clone --depth 1 https://github.com/nschneir/PET-Project

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for 6502-debugging

README.md
[![agentmods](https://agentmods.dev/badge/skills/nschneir/pet-project/6502-debugging.svg)](https://agentmods.dev/skills/nschneir/pet-project/6502-debugging)
Your own site
<a href="https://agentmods.dev/skills/nschneir/pet-project/6502-debugging"><img src="https://agentmods.dev/badge/skills/nschneir/pet-project/6502-debugging.svg" alt="Measured on agentmods" height="20"></a>
Per session 53 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,306 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00053 $0.01306
Opus 5 $0.00026 $0.00653
Sonnet 5 $0.00011 $0.00261
Haiku 4.5 $0.00005 $0.00131

Measured 3d ago against content hash 95b14edd17d6, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

6502-debugging scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/6502-debugging/SKILL.md · 116 lines

How it starts

The opening of the file, as written. The whole thing — 116 lines — stays where its author put it; the contents beside it link to each section on GitHub.

6502 debugging playbook

Procedures that turn a symptom into a verified cause using pet commands. Follow the procedure before forming theories — each one exists because improvising in its situation reliably wastes time. The companion references are the pet-development skill's diagnosis table (quick symptom→cause lookups) and the 6502-assembly skill's gotchas (the bugs you write, rather than find).

Rule zero: prove you are debugging the binary you think you are

The most expensive class of debugging failure is the hunt for a "bug" that does not exist: a rebuild failed silently and every observation is of the previous binary. Before trusting any runtime evidence:

  1. pet status — read the program: line and look for STALE (source changed since load). Stale means rebuild and reload before doing anything else.
  2. If in doubt, spot-check code bytes: pet mem read <label> 8 and compare against the assembler listing. Two minutes here beats hours of fiction-driven debugging.
  3. A failed pet run says loudly that the emulator still runs the previous program. Believe it.

Triage: the first three commands

For any misbehavior, in order: pet status (running or stopped? stale?), pet screen (what does the program think is happening?), pet reg (where is PC — in your code, in ROM, or in the weeds?). If PC is in unmapped or BSS space, the crash already happened; the question becomes "what jumped here," not "what is wrong here."

Something is corrupting memory

Symptom: a variable changes that "nothing writes to"; code bytes change; behavior degrades over time. Do not read code looking for the writer — trap it:

pet watch add <addr> --store
pet wait --break <ID>

The machine halts ON the writing instruction; pet reg and the PC symbol name the culprit. Pass the watchpoint's ID to --break so a leftover breakpoint cannot intercept the wait. One watchpoint routinely finds in seconds what an hour of code-reading cannot. If the writes are legitimate but wrong (right routine, wrong index), add a condition: pet break add <label> --condition 'X > 4'.

Read the full file on GitHub · 116 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 116 lines · 53 tokens per session scan A 95b14edd17d6

Subscribe to this mod's changes

6502-debugging is a skill published in the GitHub repository nschneir/PET-Project (1 stars, last pushed 11d ago), licensed MIT. It adds 53 tokens to every session and 1,306 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

c64-development

Use when developing, running, or debugging Commodore 64 software (Commodore BASIC or 6510/6502 assembly) on the VICE emulator with the c64 CLI or the c64-tools MCP server. Covers the build/run/observe/debug loop, the stopped-state discipline, C64 text encodings, graphics and sprites, and the memory map.

nschneir/Project64 · 78 tokens

6502-assembly

Use when writing or debugging 6502 assembly for the Commodore 64 with ca65/ld65 via c64 build or c64 run. Covers the C64 program skeleton, the BASIC SYS stub, calling ROM routines, and 6502 gotchas.

nschneir/Project64 · 58 tokens

cartridge-programming

Use when writing, building, or debugging a Commodore 64 cartridge — plain 8K/16K/Ultimax or bank-switched EasyFlash — with the c64 CLI or the c64-tools MCP server. Covers the two boot mechanisms (CBM80 vs the $FFFC reset vector), the memory modes, cart-native code in ROM, the EasyFlash banking discipline from…

nschneir/Project64 · 96 tokens

disk-io-programming

Use when a Commodore 64 program has to touch a disk while it runs — loading levels, music or graphics on demand, saving a high-score file, or streaming a data file byte by byte. Covers the KERNAL LOAD/SAVE and channel calls, device and secondary-address conventions, reading the DOS error channel, and the…

nschneir/Project64 · 89 tokens

6502-debugging

Use when a C64 program misbehaves at runtime — crashes, corruption, wrong values, dead input, visual glitches — and you need a procedure, not a guess. Symptom-indexed playbook of runtime debugging procedures using c64-tools.

nschneir/Project64 · 55 tokens

git-workflow-and-versioning

Structures git workflow practices. Use when making any code change. Use when committing, branching, resolving conflicts, or when you need to organize work across multiple parallel streams.

shashankswe2020-ux/whoop-mcp · 40 tokens