nesgodisasm

command module
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 6, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

README

nesgodisasm - a tracing disassembler for NES ROMs

Build status go.dev reference Go Report Card codecov

nesgodisasm allows you to disassemble programs for the Nintendo Entertainment System (NES).

Features

  • Outputs asm6/ca65/nesasm compatible .asm files that can be used to reproduce the same original NES ROM
  • Translates known RAM addresses to aliases
  • Traces the program execution flow to differentiate between code and data
  • Supports undocumented 6502 CPU opcodes
  • Supports branching into opcode parts of an instruction
  • Does not output trailing zero bytes of banks by default
  • Batch processing mode to disassembling multiple ROMs at once
  • Flexible architecture that allows it to create output modules for other assemblers

Support for mappers that use banking is currently experimental.

Installation

The tool uses a modern software stack that does not have any system dependencies beside requiring a somewhat modern operating system to run:

  • Linux: 2.6.32+
  • Windows: 10+
  • macOS: 10.15 Catalina+

There are 2 options to install nesgodisasm:

  1. Download and unpack a binary release from Releases

or

  1. Compile the latest release from source:
go install github.com/retroenv/nesgodisasm@latest

Compiling the tool from source code needs to have a recent version of Golang installed.

To use the -verify option, the chosen assembler needs to be installed.

Usage

Disassemble a ROM:

nesgodisasm -a ca65 -o example.asm example.nes

The generated assembly file content will look like:

...
Reset:
  sei                            ; $8000 78
  cld                            ; $8001 D8
  lda #$10                       ; $8002 A9 10
  sta PPU_CTRL                   ; $8004 8D 00 20
  ldx #$FF                       ; $8007 A2 FF
  txs                            ; $8009 9A

_label_800a:
  lda PPU_STATUS                 ; $800A AD 02 20
  bpl _label_800a                ; $800D 10 FB

...
.segment "VECTORS"

.addr NMI, Reset, IRQ

Assemble an .asm file back to a ROM:

ca65 example.asm -o example.o
ld65 example.o -t nes -o example.nes 

Options

usage: nesgodisasm [options] <file to disassemble>

  -a string
    	Assembler compatibility of the generated .asm file (asm6/ca65/nesasm)
  -batch string
    	process a batch of given path and file mask and automatically .asm file naming, for example *.nes
  -cdl string
    	name of the .cdl Code/Data log file to load
  -debug
    	enable debugging options for extended logging
  -nohexcomments
    	do not output opcode bytes as hex values in comments
  -nooffsets
    	do not output offsets in comments
  -o string
    	name of the output .asm file, printed on console if no name given
  -q	perform operations quietly
  -verify
    	verify the generated output by assembling with ca65 and check if it matches the input
  -z	output the trailing zero bytes of banks

Documentation

Overview

Package main implements a NES ROM disassembler

Directories

Path Synopsis
Package disasm provides an NES program disassembler.
Package disasm provides an NES program disassembler.
assembler
Package assembler defines the available assembler output formats.
Package assembler defines the available assembler output formats.
assembler/asm6
Package asm6 provides helpers to create asm6 assembler compatible asm output.
Package asm6 provides helpers to create asm6 assembler compatible asm output.
assembler/ca65
Package ca65 provides helpers to create ca65 assembler compatible asm output.
Package ca65 provides helpers to create ca65 assembler compatible asm output.
assembler/nesasm
Package nesasm provides helpers to create nesasm assembler compatible asm output.
Package nesasm provides helpers to create nesasm assembler compatible asm output.
options
Package options contains the program options.
Package options contains the program options.
program
Package program represents an NES program.
Package program represents an NES program.
verification
Package verification verifies that the generated output file recreates the input.
Package verification verifies that the generated output file recreates the input.
writer
Package writer implements common assembly file writing functionality.
Package writer implements common assembly file writing functionality.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL