SourceGen Disassembly Projects

6502bench SourceGen is a disassembler for projects written in 6502, 65C02, and 65816 assembly language. Unlike most disassemblers, it allows you to develop the disassembly interactively in an assembler-neutral format, and can generate working assembler code for multiple cross-assemblers.

Since not everyone has a Windows PC, I've used SourceGen's "export to HTML" feature to generate listings. These are not expected to assemble. All references to labels are links, but I found it visually distracting so I tweaked the page style to make them look like plain text. See the notes, below, for additional details.

Apple II projects:

SourceGen Listing Notes

SourceGen allows you to customize the on-screen listing to your personal tastes, configuring mnemonic capitalization, pseudo-opcode names, text delimiters, cycle count annotations, and expresson syntax. The HTML output reflects those choices. Most of the listings here use the default settings.

One area where this can be confusing is the expression style. LDA #>FOO+4*3 is evaluated in completely different ways by different assemblers. SourceGen's default presentation (called "common") assumes C language operators and precedence. It's useful to consider an example.

The Applesoft BASIC disassembly is based on a much older disassembly that was developed in S-C assembler format. The original has code like this for setting the high and low bytes of a pointer:

D592- A9 D0    1650        LDA #TOKEN.NAME.TABLE-$100
D594- 85 9D    1660        STA FAC      MAKE PNTR FOR SEARCH
D596- A9 CF    1670        LDA /TOKEN.NAME.TABLE-$100
D598- 85 9E    1680        STA FAC+1

Where TOKEN.NAME.TABLE symbol is a label at address $D0D0. The order of operations imposed by the assembler matters. SourceGen can generate three different things, depending on what it's generating code for:

This is a fairly simple example; things get messier when 16-bit code is involved. If you find the "common" style to be too different from what you're used to, remember that you can load the project into SourceGen and re-export it with your preferred options.