6502bench SourceGen
6502bench is a code development "workbench" for the 65xx family of processors, including the 6502, 65C02, and 65802/65816. It currently features one tool, the SourceGen disassembler.
Quick links:
- Watch a 9-minute video of basic product features (from v1.0)
- See an 8-minute demonstration of visualizers in a disassembly of the Apple II game Space Eggs
- Download source & binaries for the latest version from the Releases page
- Check out the GitHub project
- SourceGen has been used to disassemble software for the Apple II, NES (Nintendo Entertainment System), Atari 2600 VCS, and coin-op arcade systems. Visit 6502disassembly.com to see some disassembly project examples.
SourceGen is an industrial-strength disassembler for 6502, 65C02, and 65816 programs. It runs on Windows 7 or later. Key features include:
- Fully interactive point-and-click GUI. Define labels, set addresses, add comments, and see the results immediately. Add multi-line comments and have them word-wrapped automatically. Create inline visualizations of embedded bitmaps and wireframe data, and define animated sequences.
- Sophisticated static analysis. The disassembly engine traces code execution, automatically finding all instructions reachable from a given starting point. Changes to the processor status flags are tracked, allowing identification of branches that are always/never taken, accurate cycle count listings, and easier analysis of 65816 code with variable-width registers.
- Easy generation of assembly source code in popular formats (currently 64tass, ACME, cc65, and Merlin 32). Cross-assemblers can be invoked from the GUI to verify correctness.
- Symbols and constants are provided for ROM and operating system entry points on several popular systems (Apple, Atari, Commodore, others).
- Project files are designed for sharing and collaboration.
Features in Detail:
- Analyzer:
- Support for 6502, 65C02, and 65816, including undocumented opcodes.
- Hinting mechanism allows manual identification of code, data, and inline data.
- Editable labels are generated for every branch destination and data target.
- Automatic detection and classification of character strings and runs of identical bytes.
- Symbol files for ROM entry points, operating system constants, and other platform-specific data are stored in plain text files loaded at runtime.
- Extension scripts can be defined that automatically reformat code and identify inline data that follows a JSR, JSL, or BRK.
- User interface:
- "Infinite" undo/redo of all operations.
- Cross-reference tables are generated for every branch and data target address, as well as for external platform symbols.
- Instruction operand formats (hex, decimal, binary, character, symbol) can be set for individual instructions. References to nearby symbols are offset, allowing simple expressions like "addr + 1".
- Data areas can be formatted in various formats, including individual bytes, 16-bit and 24-bit words, addresses, or strings. Multiple character encodings are supported, including ASCII, high ASCII, C64 PETSCII, and C64 screen codes.
- Zero-page variables can be given different labels at different points in the program.
- Multi-line comments can be "boxed" for an authentic retro feel.
- Notes can be added that aren't included in generated output. These also function as color-coded bookmarks. Very useful for marking up a work in progress. Similarly, symbols can be marked as uncertain by adding a '?' that is automatically stripped away during code generation.
- Instruction reference data, such as CPU cycles and flags modified, are shown along with a description of the opcode's function. Very useful when encountering rarely-used undocumented instructions.
- Various aspects of the code display can be reconfigured, including upper/lower case, pseudo-opcode naming, and expression formats. These choices are not part of the project definition, so everyone can view a project according to their own personal preferences.
- Code generation:
- Labels can be global or local. Use non-unique labels like "@Loop" for clarity. Labels will be promoted from local to global or renamed to be unique as required by each assembler.
- Symbols may be exported from one project and imported into another to facilitate multi-binary disassembly.
- Listings can be generated in HTML form for publication on the web. Many aspects of the output format can be configured. Inline visualizations are exported as GIF or animated GIF.
- Miscellaneous:
- All project data is stored in text formats (primarily JSON).
- The project file includes nothing from the data file but a CRC. This may allow the project to be shared without violating copyrights (subject to local laws).
- Handy tools: file slicer, file concatenator, CPU instruction reference chart, ASCII chart, file hex dump.
- The OMF converter tool can be used to disassemble Apple IIgs executables.
SourceGen is written in C# .NET, using the (free to download) Visual Studio Community 2019 IDE as the primary development environment. The user interface uses the Windows Presentation Foundation (WPF) API. The full source code for the project is available on GitHub, licensed under Apache 2.0.