6502bench SourceGen: Advanced Topics

Back to index

Working With Multiple Binaries

Sometimes a program is split into multiple files on disk. They may be all loaded at once, or some may be loaded into the same place at different times. In such situations it's not uncommon for one file to provide a set of interfaces that other files use. It's useful to have symbols for these interfaces be available to all projects.

There are two ways to do this: (1) define a common platform symbol file with the relevant addresses, and keep it up to date as you work; or (2) declare the labels as global and exported, and import them as project symbols into the other projects.

Support for this is currently somewhat weak, requiring a manual symbol-import step in every interested project. This step must be repeated whenever the labels are updated.

A different but related problem is typified by arcade ROM sets, where files are split apart because each file must be burned into a separate PROM. All files are expected to be present in memory at once, so there's no reason to treat them as separate projects. Currently, the best way to deal with this is to concatenate the files into a single file, and operate on that.

Overlapping Address Spaces

Some programs use memory overlays, where multiple parts of the code run in the same address in RAM. Others use bank switching to access parts of the program that reside in separate physical RAM, but appear at the same address.

SourceGen allows you to set the same address on multiple parts of a file. Branches to a given address are resolved against the current segment first. For example, consider this:

         .ORG    $1000
         JMP     L1100

         .ORG    $1100
L1100    BIT     L1100
L1103    LDA     #$11
         BRA     L1103

         .ORG    $1100
L1100_0  BIT     L1100_0
L1103_0  LDA     #$22
         JMP     L1103_0

Both sections start at $1100, and have branches to $1103. The branch in the first section resolves to the label in the first version of that address chunk, while the branch in the second section resolves to the label in the second chunk. When branches originate outside the current address chunk, the first chunk that includes that address is used, as it is with the JMP $1000 at the start of the file.

Debug Menu Options

The DEBUG menu is hidden by default in release builds, but can be exposed by checking the "enable DEBUG menu" box in the application settings. These features are used for debugging SourceGen. They will not help you debug 6502 projects.

Features: