Applesoft Disassembly

If you want to understand how Applesoft works, the most detailed information available is in Bob Sander-Cederlof's disassembly of the Apple ][+ ROM code. This is currently available on his web site as S-C Documentor: Applesoft.

The disassembly is presented as source code for the S-C Assembler, which runs on the Apple II. Due to the constraints of 8-bit computers, the sources are split into 26 separate files, which is somewhat inconvenient on a modern system.

As an exercise, I converted the entire disassembly to a 6502bench SourceGen project. This allows perusal of the entire program as a single entity, and provides full cross-reference data. It does have a few drawbacks, notably that the limitations on operands don't allow it to fully express the equations in some places.

Since not everyone has a Windows PC, I've used SourceGen's "export" feature to generate HTML output. This is not expected to assemble. (If you want sources you can assemble, SourceGen can generate code for 64tass, ACME, cc65, and Merlin 32.) The HTML generator creates links and anchors for symbols, as well as a table of exported symbols at the bottom, but it's still pretty rudimentary. (Note: I found the links visually distracting, so I tweaked the style to make them look like plain text until you hover your mouse over them.)

The HTML output uses default settings for delimiters, pseudo-op codes, and expression syntax. The latter merits further explanation. The original disassembly has code like this:

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 how it's configured:

The HTML output was generated with the default "common" expression style, used by 64tass and ACME, because it's the closest to what higher-level languages like C use. If you're used to Merlin-style expressions, you can change the setting and export the project to HTML yourself. (This is a fairly simple example; things get messier when 16-bit code is involved.)

Copyright 2019 by Andy McFadden

Back to list of disassembly projects