1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-12-26 04:30:52 +00:00
A workbench for developing 6502 code
Go to file
Andy McFadden 356492d6da Add Atari AVG visualizer
This converts AVG commands to wireframes.  We don't try to track
color or intensity.  (This is a disassembler, not a graphics
converter; perfection is not required.)  The various rotation and
animation options are still enabled, though they're not terribly
useful for this.

Commands that are meant to be used in series, such as font glyphs,
tend to use (0,0) as their left edge and baseline.  This puts the
shape in the upper-right corner of the thumbnail, which makes
everything smaller.  The change adds a "re-center" option to the
wireframe renderer that computes the visible bounds and adjusts
the coordinates so that the center of the object is at (0,0) for
display.
2020-04-11 17:24:21 -07:00
Asm65 Fix hex format string initialization 2020-02-11 16:38:51 -08:00
CodeLab Initial file commit 2018-09-28 10:05:11 -07:00
CommonUtil Add support for points in wireframe meshes 2020-04-11 11:23:16 -07:00
CommonWPF Add a progress bar to HTML export 2020-03-15 14:07:05 -07:00
ImageSrc Render the animation overlay image instead of loading from a file 2019-12-22 14:02:39 -08:00
MakeDist Include cc65 .cfg files when copying regression tests 2019-08-02 12:54:26 -07:00
PluginCommon Add Atari AVG visualizer 2020-04-11 17:24:21 -07:00
SourceGen Add Atari AVG visualizer 2020-04-11 17:24:21 -07:00
.gitignore Framework for Apple /// (#4) 2018-09-28 16:10:05 -07:00
LICENSE Initial commit 2018-09-26 16:42:52 -07:00
NOTICE.txt Add a NOTICE 2018-10-02 15:16:21 -07:00
README.md Update README with v1.5 features 2020-01-27 13:32:41 -08:00
SourceNotes.md Update README and SourceNotes 2020-01-01 18:04:06 -08:00
WorkBench.sln Add animated GIF generation to HTML export 2019-12-24 18:15:03 -08:00

6502bench

Features - Installation - Getting Started - About the Code

6502bench is a code development "workbench" for 6502, 65C02, and 65802/65816 code. It currently features one tool, the SourceGen disassembler, and runs on Windows 7 or later.

You can download the source code and build it yourself, or click the Releases tab for downloads with pre-built binaries.

SourceGen

SourceGen converts machine-language programs to assembly-language source code. It has most of the features you will find in other 6502 disassemblers, as well as many less-common ones.

Key Features

  • 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 graphics and animated sequences.
  • 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 correct analysis of 65816 code with variable-width registers.
  • Easy generation of assembly source code for popular cross-assemblers (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.
  • Project files are designed for sharing and collaboration.

A demo video is available on YouTube.

Additional Features

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 summaries, including CPU cycles and flags modified, are shown along with a description of the opcode's function.
  • 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.

Miscellaneous:

  • All data files are 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.

Limitations

Support for 65816 code is largely complete, lacking only a way to specify the data bank register. However, the current user interface tries to keep everything in a single list, which works poorly for large multi-bank binaries.

To learn about other areas for improvement, visit the wiki section for the current "TO DO" list.

To learn about the past, check the change log.

Installation

There is currently no installer -- just unzip the archive and run the "SourceGen.exe" executable. The data files used by the program are found automatically in the directory where the .EXE lives.

You need to have Microsoft .NET Framework v4.6.2 or later installed. Most people will already have this. If SourceGen doesn't seem to want to start, download the latest version (currently v4.7.2) directly from Microsoft. The framework requires Win7 SP1, Win8.1, or Win10 updated through at least the Anniversary Update (1607). (One user who had trouble with the 4.7.2 installer was able to get the 4.6.2 installer to work.)

SourceGen does not currently run on Linux or Mac OS X. My understanding is that .NET apps don't work under WINE, so it can only be run on a full Windows system emulation.

(SourceGen Versions 1.0 and 1.1 used the WinForms API, which has been implemented for Mono, but after encountering significant bugs that I wasn't able to work around I abandoned the approach and switched to WPF. Besides working better under Windows, WPF uses a more modern approach (XAML) that may ease the transition to a cross-platform GUI API like Avalonia.)

Getting Started

The best way to get started is by working through the tutorial. Launch SourceGen, hit F1 to open the user manual in your web browser, then look for the Tutorial link in the index. Click it and follow the instructions there.

I strongly recommend doing this. Some aspects of SourceGen are non-obvious.

The tutorial is one of several examples included in the SourceGen distribution. The other directories contain project and data files for completed disassembly projects alongside the original source code, allowing a direct comparison between how the code was written and how SourceGen can display it.

About the Code

The source code is licensed under Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0), which makes it free for use in both open-source programs and closed-source commercial software. The license terms are similar to BSD or MIT, but with some additional constraints on patent licensing. (This is the same license Google uses for the Android Open Source Project.)

Images are licensed under Creative Commons ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/).

For additional details, see the source code notes.