(back to project list)

Budge 3D Module Disassembly

In 1980, California Pacific Computer published Bill Budge's 3-D Graphics System and Game Tool. The program let you enter 3D shapes as a collection of points and edges (no faces), then generated a "module" that provided a graphics library along with the encoded shape data.

The graphics library allowed you to scale, rotate, position, and draw 3D shapes on the hi-res screen. Support for page-flipping was automatic. The transformations used clever table lookups to avoid multiplication, and supported only orthographic projection to avoid having to do the perspective divide.

cube shuttle

The module can be configured to work with arrays in Applesoft BASIC, Integer BASIC, or directly from assembly language. Rendering can be done with simple draw/erase or with "XOR" mode, which flips bits (so if you draw the same line twice, it disappears). You can also add a hi-res character generator (HRCG).

I created a module with a couple of shapes, configured for Applesoft interface, XOR drawing, and HRCG enabled. This particular listing is formatted with cycle counts and Merlin-style pseudo-ops and expressions.

This project has a starring role in SourceGen development. Back in September 2015, while working on fdraw, I disassembled a few programs to see how their line-drawing code compared to mine. I created a test module with the tool, and generated an assembly listing using CiderPress, but quickly got frustrated. Even though there's not a lot of code, much of it is self-modifying and makes extensive use of tables, and jumping around in the file to keep track of everything was annoying.

Three years later, when I was finishing up the first version of SourceGen, I created a project for the test module. This went much better, but I ran into a different problem: zero-page locations are used for different purposes in different parts of the code. I couldn't give them one global name and still make sense of what I was looking at.

Another year later, in September 2019, SourceGen v1.3 added local variable tables. The disassembly finally looked the way it should. In v1.4 I can mark the dead areas as "junk" so they don't clutter the listing, in v1.5 I can create a visualization of the font, and in v1.6 I can render the shapes as wireframe animations.

Copyright 2019 by Andy McFadden