drhelius/gearlynx/gearlynx-debugging

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Debug and trace Atari Lynx games using the Gearlynx emulator MCP server. Provides workflows for 6502 CPU debugging, breakpoint management, hardware inspection, disassembly analysis, and execution tracing. Use when the user wants to debug a Lynx game, trace code execution, inspect CPU registers or hardware state, set breakpoints, analyze interrupts, step through 6502 instructions, reverse engineer game code, examine Mikey/Suzy registers, view the call stack, or diagnose rendering, audio, or timing issues. Also use when the user mentions Atari Lynx development, Lynx homebrew testing, or 6502 debugging with Gearlynx.

Install

npx vskill@latest install drhelius/gearlynx/gearlynx-debugging

SKILL.md

Atari Lynx Game Debugging with Gearlynx

Overview

Debug Atari Lynx games using the Gearlynx emulator as an MCP server. Control execution (pause, step, breakpoints), inspect the 6502 CPU and hardware (Mikey, Suzy), read/write memory, disassemble code, trace instructions, and capture screenshots — all through MCP tool calls. Hardware documentation is available in the references/ directory.

MCP Server Prerequisite

IMPORTANT — Check before installing: Before attempting any installation or configuration, you MUST first verify if the Gearlynx MCP server is already connected in your current session. In the default mode, call debug_get_status directly. If Gearlynx was intentionally started with --mcp-router, call get_tool_info with {"name":"debug_get_status"}, then call execute_tool with {"name":"debug_get_status","arguments":{}}. A valid response from either workflow means the server is active and ready.

Only if neither workflow is available or the call fails, you need to help install and configure the Gearlynx MCP server:

Installing Gearlynx

Run the bundled install script (macOS/Linux):

bash
bash scripts/install.sh

This installs Gearlynx via Homebrew on macOS or downloads the latest release on Linux. It prints the binary path on completion. You can also set INSTALL_DIR to control where the binary goes (default: ~/.local/bin).

Alternatively, download from GitHub Releases or install with brew install --cask drhelius/geardome/gearlynx on macOS.

Connecting as MCP Server

Configure your AI client to run Gearlynx as an MCP server via STDIO transport. For Claude Code:

bash
claude mcp add --transport stdio --scope user gearlynx -- /path/to/gearlynx --mcp-stdio

For Codex:

bash
codex mcp add gearlynx -- /path/to/gearlynx --mcp-stdio

Replace /path/to/gearlynx with the actual binary path from the install script. Add --headless before --mcp-stdio on headless machines.

Hardware Documentation (References)

Atari Lynx hardware documentation is available in the references/ directory. Load them into your context when investigating specific hardware.

ReferenceFileLoad when...
General Overviewreferences/lynx1_general_overview.mdSystem specs, feature set, overall architecture
Hardware Overviewreferences/lynx2_hardware_overview.mdSystem block diagram: CPU, Mikey, Suzy, RAM, cart
Hardware Quirksreferences/lynx3_software_hardware_perniciousness.mdUnsafe register operations, hardware gotchas
CPU/ROMreferences/lynx4_cpu_rom.md65C02 cycle timing, CPU sleep, ROM mapping
Displayreferences/lynx5_display.mdFrame rate, pen/palette colors, display buffer addresses
Sprite/Collisionreferences/lynx6_sprite_collision.mdSCB format, sprite types, collision depository
Audio/ROM Cartreferences/lynx7_audio_tape_romcart.md4 audio channels, feedback taps, stereo, ROM cart banking
Timers/Interruptsreferences/lynx8_timers_interrupts.md8 timer channels, linking, reload, IRQ sources
UARTreferences/lynx8a_uart.mdComLynx serial port, UART registers, baud rate, flow control
Other Hardwarereferences/lynx9_other_hardware.mdHardware multiply/divide, parallel port, upward compatibility
System Resetreferences/lynx10_system_reset.mdReset/power-up sequence, Suzy/Mikey init, boot ROM
System Bus Interplayreferences/lynx11_system_bus_interplay.mdBus masters, page mode, DMA timing, bus contention
Hardware Addressesreferences/hardware_addresses.md64K memory map, Mikey/Suzy register addresses ($FC00-$FCFF, $FD00-$FDFF)
Interrupts & CPU Sleepreferences/irq_interrupts_cpu_sleep.mdIRQ vector, interrupt enable/status bits, CPU sleep (JAM)
Sprite Enginereferences/sprite_engine.mdDisplay init, double-buffering, VIDBAS/COLLBAS macros

Debugging Workflow

1. Load and Orient
load_media → get_media_info → get_6502_status → get_screenshot

Start every session by loading the ROM, confirming it loaded correctly, then checking CPU state and taking a screenshot to understand the current game state. If a .sym, .elf, .lbl, or .noi file exists alongside the ROM, symbols are loaded automatically.

Load additional symbols with load_symbols or add individual labels with add_symbol.

2. Pause and Inspect

Always call debug_pause before inspecting state. While paused:

  • CPU state: get_6502_status — registers A, X, Y, S, P (flags), PC, interrupt status, MAPCTL visibility
  • Disassembly: get_disassembly with a start/end address range — only shows executed code paths
  • Call stack: get_call_stack — current subroutine hierarchy
  • Memory: read_memory with area name (RAM, Zero Page, Stack, Bank 0, Bank 0A, Bank 1, Bank 1A, BIOS, EEPROM) and address/length
3. Set Breakpoints

Use breakpoints to stop execution at points of interest:

Breakpoint TypeToolUse Case
Executionset_breakpoint (type: exec)Stop when PC reaches address
Readset_breakpoint (type: read)Stop when memory address is read
Writeset_breakpoint (type: write)Stop when memory address is written
Rangeset_breakpoint_rangeCover an address range (exec/read/write)
IRQset_breakpoint_on_irqStop on specific timer IRQ (Timer0-7: HBLANK, VBLANK, UART, etc.)

Important: Read/write breakpoints stop with PC at the instruction after the memory access.

Manage breakpoints with list_breakpoints, remove_breakpoint, list_breakpoints_on_irq, clear_breakpoint_on_irq.

4. Step Through Code

After hitting a breakpoint or pausing:

ActionToolBehavior
Step Intodebug_step_intoExecute one instruction, enter subroutines
Step Overdebug_step_overExecute one instruction, skip JSR calls
Step Outdebug_step_outRun until RTS/RTI returns from current subroutine
Step Framedebug_step_frameExecute until next VBLANK; use mode: "sync" before dependent calls
Run Todebug_run_to_cursorContinue until PC reaches target address
Continuedebug_continueResume normal execution

After each step, call get_6502_status and get_disassembly to see where you are.

5. Trace Execution

The trace logger records CPU instructions interleaved with hardware events (Suzy math/sprites, Mikey timers/audio/UART, cartridge access).

  1. set_trace_log with enabled: true to start recording (optionally filter event types)
  2. Let the game run or step through code
  3. set_trace_log with enabled: false to stop (entries are preserved)
  4. get_trace_log to read recorded entries

Tracing is essential for understanding timing-sensitive code, interrupt handlers, and hardware interaction sequences.


Hardware Inspection

Mikey (Display, Timers, Audio)
  • get_mikey_registers — all registers at $FD00-$FDFF, or filter by address
  • get_mikey_timers — Timer 0-7 status (HBLANK, VBLANK, UART, sample rate, etc.)
  • get_mikey_audio — audio channel 0-3 status (volume, feedback, output, etc.)
  • get_lcd_status — LCD pixel/DMA info (only on visible lines)
  • write_mikey_register — modify a Mikey register live
Suzy (Sprites, Math)
  • get_suzy_registers — all registers at $FC00-$FCFF, or filter by address
  • write_suzy_register — modify a Suzy register live
Other Hardware
  • get_uart_status — ComLynx serial port state
  • get_cart_status — cartridge address generation, bank info, AUDIN
  • get_eeprom_status — EEPROM type, size, mode, state, IO pins
Frame Buffers and Screenshots
  • get_screenshot — current rendered frame as PNG
  • get_frame_buffer — raw debug frame buffer (VIDBAS from Suzy or DISPADR from Mikey)

Use screenshots after stepping or continuing to see the visual impact of changes.


Common Debugging Scenarios

Finding an Interrupt Handler
  1. set_breakpoint_on_irq for the target IRQ (e.g., Timer0 for HBLANK, Timer2 for VBLANK)
  2. debug_continue to run until the IRQ fires
  3. get_6502_status + get_disassembly to see the handler code
  4. get_call_stack to see how deep you are
  5. add_symbol to label the handler address and any subroutines it calls
Diagnosing Graphics Corruption
  1. debug_pause → get_suzy_registers — check VIDBAS, COLLBAS, sprite control
  2. get_frame_buffer — capture both Suzy and Mikey buffers
  3. get_mikey_registers — check DISPADR, display DMA settings
  4. get_lcd_status — verify line-by-line rendering state
  5. Set read/write breakpoints on display buffer addresses to catch corruption source
Analyzing a Subroutine
  1. set_breakpoint at the subroutine entry point
  2. debug_continue → when hit, get_6502_status
  3. Step through with debug_step_into / debug_step_over
  4. After each step: check registers, read relevant memory
  5. add_symbol for the routine and any called subroutines
  6. add_disassembler_bookmark to mark interesting locations
Tracking a Variable
  1. add_memory_watch on the variable's address — watches are visible in the emulator GUI
  2. Set a write breakpoint with set_breakpoint (type: write) on that address
  3. When hit, get_disassembly reveals what code is modifying it
  4. get_call_stack shows the call chain leading to the write
Timing Analysis
  1. set_breakpoint_on_irq for Timer interrupts
  2. set_trace_log with enabled: true to start recording
  3. get_trace_log to see the interleaved CPU + hardware events
  4. Analyze timer reload values via get_mikey_timers
  5. Correlate timer fires with code execution in the trace
Debug Output for Homebrew Development

Homebrew games can send debug text to the Trace Logger via unused Mikey registers $FDC0–$FDC4 — a printf-style mechanism without breakpoints.

  1. set_trace_log with enabled: true and debug_output: true
  2. Run your game — text written through the registers appears in get_trace_log
RegisterWrite
$FDC0Flush buffer to Trace Logger (any non-zero value)
$FDC1Append byte as ASCII character
$FDC2Append byte as two hex digits
$FDC3Set string pointer low byte
$FDC4Set string pointer high byte (triggers copy)

ca65 example:

asm
; Print string + hex value in a single trace entry
; A/X = string pointer, Y = hex value
.proc debug_print
sta $FDC3 ; pointer low
stx $FDC4 ; pointer high (triggers copy)
sty $FDC2 ; append Y as hex
lda #1
sta $FDC0 ; flush
rts
.endproc
lda #<message
ldx #>message
ldy player_hp
jsr debug_print
message: .asciiz "Player HP: "

When disabled (the default), these registers are no-ops — safe to leave in shipping code.


Organizing Your Debug Session

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 85 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
70
Repository forks
8
7-day trend score
21

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/drhelius/gearlynx/gearlynx-debugging/badge)](https://verified-skill.com/skills/drhelius/gearlynx/gearlynx-debugging)

Something wrong with this skill or its page? Tell us.