Skip to content

Latest commit

ย 

History

History
689 lines (471 loc) ยท 18.7 KB

File metadata and controls

689 lines (471 loc) ยท 18.7 KB

๐ŸŒผ Pansy CLI Command Reference

Pansy - Program ANalysis SYstem format for comprehensive assembly metadata exchange

The ๐ŸŒผ Pansy command-line interface provides tools for inspecting, searching, and analyzing Pansy metadata files.

Installation

# Build the CLI
cd src/Pansy.Cli
dotnet build

# Run commands
dotnet run -- <command> [options]

# Or use the built executable
./bin/Debug/net10.0/Pansy.Cli <command> [options]

Global Options

All commands support:

  • --help - Show command-specific help
  • -v, --verbose - Enable verbose output (where applicable)

Commands

info - Display File Information

Shows comprehensive information about a Pansy file including header details, content statistics, and memory regions.

Usage:

dotnet run --project src/Pansy.Cli -- info <file> [-v|--verbose]

Arguments:

  • <file> - Path to the Pansy file

Options:

  • -v, --verbose - Show additional details

Example:

$ dotnet run --project src/Pansy.Cli -- info game.pansy

๐ŸŒผ Pansy File Viewer

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ Property       โ”‚ Value             โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Format Version โ”‚ 0100              โ”‚
โ”‚ Platform       โ”‚ NES               โ”‚
โ”‚ ROM Size       โ”‚ 32768 bytes (32K) โ”‚
โ”‚ ROM CRC32      โ”‚ 12345678          โ”‚
โ”‚ Flags          โ”‚ None              โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Content Statistics:
  โ€ข Symbols: 7
  โ€ข Comments: 3
  โ€ข Code Offsets: 7
  โ€ข Data Offsets: 0
  โ€ข Jump Targets: 2
  โ€ข Subroutines: 3
  โ€ข Memory Regions: 2
  โ€ข Cross-refs: 4

Memory Regions:
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ Start โ”‚ End   โ”‚ Bank โ”‚ Type โ”‚ Name           โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ $8000 โ”‚ $bfff โ”‚ 0    โ”‚ 1    โ”‚ PRG-ROM Bank 0 โ”‚
โ”‚ $c000 โ”‚ $ffff โ”‚ 1    โ”‚ 1    โ”‚ PRG-ROM Bank 1 โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Output:

  • File header (version, platform, ROM size/CRC, flags)
  • Content statistics (symbol counts, code/data coverage)
  • Memory regions table (if any)
  • Project metadata (if present)

symbols - List Symbols

Lists all symbols defined in a Pansy file with addresses and names.

Usage:

dotnet run --project src/Pansy.Cli -- symbols <file> [--sort address|name] [--filter <pattern>]

Arguments:

  • <file> - Path to the Pansy file

Options:

  • --sort address - Sort by address (default)
  • --sort name - Sort alphabetically by name
  • --filter <pattern> - Filter symbols by pattern (case-insensitive)

Example:

$ dotnet run --project src/Pansy.Cli -- symbols game.pansy

๐ŸŒผ Symbols in game.pansy
Total: 7 symbols

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ Address โ”‚ Name            โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ $8000   โ”‚ Reset           โ”‚
โ”‚ $8003   โ”‚ NMI_Handler     โ”‚
โ”‚ $8006   โ”‚ IRQ_Handler     โ”‚
โ”‚ $8010   โ”‚ Main_Loop       โ”‚
โ”‚ $8050   โ”‚ Update_Graphics โ”‚
โ”‚ $8100   โ”‚ Read_Controller โ”‚
โ”‚ $8150   โ”‚ Play_Sound      โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Output:

  • Table of addresses and symbol names
  • Total symbol count

find - Search Symbols and Comments

Searches for symbols and comments matching a pattern. Supports plain text, regex, and wildcard patterns.

Usage:

dotnet run --project src/Pansy.Cli -- find <file> <pattern> [options]

Arguments:

  • <file> - Path to the Pansy file
  • <pattern> - Search pattern

Options:

  • -c, --comments - Search comments only
  • -s, --symbols - Search symbols only
  • -i, --case-insensitive - Case-insensitive search
  • -r, --regex - Treat pattern as a regex
  • -w, --wildcard - Treat pattern as a wildcard (* and ?)

Pattern Modes:

  • Plain text (default): Matches if the pattern appears anywhere in the text
    • Example: Main matches Main_Loop, Update_Main
  • Regex (-r): Full regular expression support
    • Example: ^NMI_.*Handler$ matches exactly NMI_Handler
  • Wildcard (-w): Simple wildcard patterns
    • * matches any characters (zero or more)
    • ? matches any single character
    • Example: *Loop matches Main_Loop, Update_Loop

Examples:

# Plain text search
$ dotnet run --project src/Pansy.Cli -- find game.pansy "Handler"

๐ŸŒผ Search results for 'Handler' (text, case-sensitive)

Symbols:
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ Address โ”‚ Name        โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ $8003   โ”‚ NMI_Handler โ”‚
โ”‚ $8006   โ”‚ IRQ_Handler โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Found 2 match(es)

# Regex search
$ dotnet run --project src/Pansy.Cli -- find game.pansy "^NMI_.*" -r

# Wildcard search (case-insensitive)
$ dotnet run --project src/Pansy.Cli -- find game.pansy "*Main*" -w -i

# Search only symbols
$ dotnet run --project src/Pansy.Cli -- find game.pansy "Loop" -s

Output:

  • Matching symbols table (if searching symbols)
  • Matching comments table (if searching comments)
  • Total match count

xrefs - Show Cross-References

Displays cross-references for a specific address or performs cross-reference analysis across the entire file.

Usage:

# Show references for a specific address
dotnet run --project src/Pansy.Cli -- xrefs <file> <address>

# Analysis commands
dotnet run --project src/Pansy.Cli -- xrefs <file> --stats
dotnet run --project src/Pansy.Cli -- xrefs <file> --most-called [n]
dotnet run --project src/Pansy.Cli -- xrefs <file> --unreferenced
dotnet run --project src/Pansy.Cli -- xrefs <file> --type <type>

Arguments:

  • <file> - Path to the Pansy file
  • <address> - Address to query (decimal format, e.g., 32784 for $8010)

Options:

  • --stats - Show cross-reference statistics summary
  • --most-called [n] - Show top N most referenced addresses (default: 10)
  • --unreferenced - Show subroutines with no incoming references
  • --type <type> - Filter by reference type (Jsr, Jmp, Branch, Read, Write, DataRef)

Analysis Examples:

# Show overall cross-reference statistics
$ dotnet run --project src/Pansy.Cli -- xrefs game.pansy --stats

๐ŸŒผ Cross-Reference Statistics

Total cross-references: 47

By Type:
  โ€ข Jsr: 23 (48.9%)
  โ€ข Jmp: 12 (25.5%)
  โ€ข Branch: 8 (17.0%)
  โ€ข Read: 3 (6.4%)
  โ€ข Write: 1 (2.1%)

# Show top 5 most called addresses
$ dotnet run --project src/Pansy.Cli -- xrefs game.pansy --most-called 5

๐ŸŒผ Top 5 Most Referenced Addresses

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ Address โ”‚ Symbol           โ”‚ Refs  โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ $8100   โ”‚ Read_Controller  โ”‚ 12    โ”‚
โ”‚ $8050   โ”‚ Update_Graphics  โ”‚ 8     โ”‚
โ”‚ $8150   โ”‚ Play_Sound       โ”‚ 5     โ”‚
โ”‚ $8010   โ”‚ Main_Loop        โ”‚ 3     โ”‚
โ”‚ $8200   โ”‚ Wait_VBlank      โ”‚ 2     โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

# Show unreferenced subroutines (dead code detection)
$ dotnet run --project src/Pansy.Cli -- xrefs game.pansy --unreferenced

๐ŸŒผ Unreferenced Subroutines

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ Address โ”‚ Symbol       โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ $8300   โ”‚ Debug_Print  โ”‚
โ”‚ $8400   โ”‚ Old_Handler  โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Found 2 unreferenced subroutines (potential dead code)

# Filter by reference type
$ dotnet run --project src/Pansy.Cli -- xrefs game.pansy --type Jsr

๐ŸŒผ Cross-References of Type: Jsr

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ From โ”‚ To     โ”‚ Target Symbol    โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ $8015โ”‚ $8100  โ”‚ Read_Controller  โ”‚
โ”‚ $8020โ”‚ $8050  โ”‚ Update_Graphics  โ”‚
โ”‚ $8025โ”‚ $8150  โ”‚ Play_Sound       โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Found 23 Jsr references

Address Query Example:

$ dotnet run --project src/Pansy.Cli -- xrefs game.pansy 32784

๐ŸŒผ Cross-references for $8010
Symbol: Main_Loop

References TO this address:
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ From  โ”‚ Type โ”‚ Symbol โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ $8070 โ”‚ Jmp  โ”‚        โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Total: 1 incoming, 0 outgoing

Output:

  • Target address and symbol name (if any)
  • Incoming references table (FROM โ†’ TO this address)
  • Outgoing references table (FROM this address โ†’ TO)
  • Total counts

Note: Addresses must be specified in decimal. To convert hex to decimal:

  • $8000 = 32768
  • $8010 = 32784
  • $C000 = 49152

diff - Compare Files

Compares two Pansy files and shows differences in headers, symbols, comments, and cross-references.

Usage:

dotnet run --project src/Pansy.Cli -- diff <file1> <file2> [--summary]

Arguments:

  • <file1> - Path to first Pansy file
  • <file2> - Path to second Pansy file

Options:

  • --summary - Show only summary, not detailed differences

Example:

$ dotnet run --project src/Pansy.Cli -- diff original.pansy modified.pansy

๐ŸŒผ Comparing Pansy Files

Header Comparison:
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ Property โ”‚ File 1   โ”‚ File 2   โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Platform โ”‚ NES      โ”‚ NES      โ”‚
โ”‚ ROM Size โ”‚ 32768    โ”‚ 32768    โ”‚
โ”‚ ROM CRC  โ”‚ 12345678 โ”‚ 12345678 โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Symbol Changes:
  โ€ข Added: 3
  โ€ข Removed: 1
  โ€ข Modified: 0

Symbols Added:
  $8200: New_Function
  $8210: Helper_Routine
  $8220: Data_Table

Symbols Removed:
  $8150: Old_Function

Output:

  • Header comparison table
  • Change statistics
  • Added/removed/modified symbols

stats - Detailed Statistics

Shows detailed statistics and analysis of a Pansy file's contents.

Usage:

dotnet run --project src/Pansy.Cli -- stats <file>

Arguments:

  • <file> - Path to the Pansy file

Output:

  • Symbol count by type (Label, Function, Constant, etc.)
  • Comment count by type (Inline, Block, Todo)
  • Code/data map flag counts
  • Cross-reference counts by type
  • Memory region summary

merge - Merge Two Files

Merges two Pansy files using a base + overlay strategy with intelligent deduplication.

Usage:

dotnet run --project src/Pansy.Cli -- merge <base> <overlay> [-o|--output <file>]

Arguments:

  • <base> - Base Pansy file (provides ROM info and foundation)
  • <overlay> - Overlay Pansy file (adds or supplements data)

Options:

  • -o, --output <file> - Output path (default: merged.pansy)

Merge Strategies:

  • Symbols/Comments: Union of all entries, base-first ordering, duplicates removed
  • Code/Data Map: Flag union (OR of all flags)
  • Cross-references: Deduplicated by (from, to, type)
  • Memory Regions: Overlay wins on name conflicts
  • Metadata: Overlay wins with fallback to base

Example:

$ dotnet run --project src/Pansy.Cli -- merge base.pansy overlay.pansy -o merged.pansy

๐ŸŒผ Merging Pansy files
Base:    base.pansy
Overlay: overlay.pansy
Output:  merged.pansy

Merge Results:
  Symbols:     125 (base: 100, overlay: 50, merged: 125)
  Comments:    80 (base: 60, overlay: 30, merged: 80)
  Cross-refs:  200 (base: 150, overlay: 100, merged: 200)

โœ… Merged successfully: merged.pansy (4,521 bytes)

validate - Validate File Structure

Validates the internal structure and consistency of a Pansy file.

Usage:

dotnet run --project src/Pansy.Cli -- validate <file>

Arguments:

  • <file> - Path to the Pansy file

Output:

  • Header validation (magic, version, platform)
  • Section integrity checks
  • Content consistency verification
  • Pass/fail status

graph - Export Cross-Reference Graph

Exports cross-reference data as a DOT graph for visualization.

Usage:

dotnet run --project src/Pansy.Cli -- graph <file> [-o|--output <file>] [--format <format>]

Arguments:

  • <file> - Path to the Pansy file

Options:

  • -o, --output <file> - Output path (default: graph.dot)
  • --format <format> - Output format: dot (default), mermaid

analyze - ROM Coverage Analysis

Analyzes ROM coverage using CDL data and optionally detects data patterns in unclassified gaps.

Usage:

dotnet run --project src/Pansy.Cli -- analyze <pansy-file> [rom-file] [-p|--patterns]

Arguments:

  • <pansy-file> - Path to the Pansy file
  • [rom-file] - Optional path to the ROM file (enables full analysis)

Options:

  • -p, --patterns - Enable pattern detection in gaps (requires ROM file)

Without ROM file: CDL-only coverage analysis using code/data map flags.

With ROM file: Full analysis including gap detection and optional pattern detection.

Detected Patterns:

  • Fill regions - Blocks of repeated bytes (e.g., $ff padding)
  • ASCII strings - Text data with printable characters
  • Pointer tables - Arrays of addresses (platform-aware: NES 16-bit, SNES 24-bit, GBA 32-bit)
  • Tile data - Graphics tile patterns (NES 2bpp, SNES/SMS 4bpp)

Example:

$ dotnet run --project src/Pansy.Cli -- analyze game.pansy game.nes --patterns

๐ŸŒผ ROM Coverage Analysis
File: game.pansy

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ Metric             โ”‚ Value   โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Total Bytes        โ”‚ 32,768  โ”‚
โ”‚ Classified Bytes   โ”‚ 24,576  โ”‚
โ”‚ Unclassified Bytes โ”‚ 8,192   โ”‚
โ”‚ Coverage           โ”‚ 75.0%   โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Detected Patterns (3)
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ Offset  โ”‚ Kind         โ”‚ Length โ”‚ Confidence โ”‚ Description       โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ $006000 โ”‚ Fill         โ”‚ 4,096  โ”‚ 100%       โ”‚ Fill: $ff x 4096  โ”‚
โ”‚ $007000 โ”‚ PointerTable โ”‚ 512    โ”‚ 95%        โ”‚ 256 NES addresses โ”‚
โ”‚ $007200 โ”‚ Ascii        โ”‚ 128    โ”‚ 90%        โ”‚ ASCII: "HELLO..." โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
  • Added/removed comments
  • Cross-reference differences

Error Handling

All commands return exit codes:

  • 0 - Success
  • 1 - Error (file not found, invalid format, etc.)

Error messages are displayed in red with the Error: prefix.

Example:

$ dotnet run --project src/Pansy.Cli -- info missing.pansy
Error: File not found: missing.pansy

Advanced Usage

Piping Output

Commands output to stdout and can be piped:

# Count symbols
dotnet run --project src/Pansy.Cli -- symbols game.pansy | grep -c '^โ”‚'

# Search for specific pattern
dotnet run --project src/Pansy.Cli -- symbols game.pansy | grep "Handler"

# Save output to file
dotnet run --project src/Pansy.Cli -- info game.pansy > analysis.txt

Batch Processing

Process multiple files with shell scripting:

# PowerShell: Check all .pansy files
Get-ChildItem *.pansy | ForEach-Object {
	dotnet run --project src/Pansy.Cli -- info $_.FullName
}

# Bash: Find files with symbols count
for file in *.pansy; do
	echo "$file:"
	dotnet run --project src/Pansy.Cli -- info "$file" | grep "Symbols:"
done

Integration Examples

Mesen Integration

Export symbols to Mesen label file format (coming soon):

# Convert Pansy to Mesen MLB
dotnet run --project src/Pansy.Cli -- convert game.pansy --to mesen --output game.mlb

CI/CD Integration

Use in continuous integration to verify analysis:

# GitHub Actions example
- name: Verify Pansy metadata
  run: |
	dotnet run --project src/Pansy.Cli -- info game.pansy
	if [ $? -ne 0 ]; then
	  echo "Invalid Pansy file"
	  exit 1
	fi

Tips

  1. Use Tab Completion: Most shells support path completion for file arguments
  2. Verbose Mode: Add -v to see additional details during processing
  3. Hex Addresses: Remember to convert hex to decimal for the xrefs command
  4. Large Files: For ROMs over 1MB, expect slightly longer loading times
  5. Symbol Naming: Use consistent naming conventions for better searchability

Troubleshooting

Problem: Command not recognized

Error: Unknown command: infp

Solution: Check spelling - valid commands are info, symbols, find, xrefs, diff


Problem: File format error

Error: Invalid Pansy file: bad magic number

Solution: Verify the file is a valid Pansy file (not corrupted or different format)


Problem: Address out of range

Error: Invalid address: 0x8010

Solution: Use decimal addresses, not hex format:

  • Instead of 0x8010, use 32784
  • Instead of $C000, use 49152

See Also