nes-test has the ability to read debug symbols created by ca65 and cc65, allowing you to access
things using the variable names in your code!
This is used in most of the memory Methods implemented in NesEmulator
How can I make it work?
This tool expects files in the same file/format as Mesen. As such,
Mesen's Documentation on emulator symbols
In short, when you run ca65 or cc65, pass the
--debug-info flag. When you run the linker, pass the
--dbgfile argument with the same name you use for the rom. Your link command might look something
cl65 -C config.conf -o mygame.nes --dbgfile mygame.dbg *.o nes.lib
You'll need a modern version of cc65 to make this work - older versions use an incompatible
If you are able to see all of your symbols in Mesen, they will also be available in the tool.
Assembly: In your game, you define a variable named
myVariable: .res 1
In your test you can do this:
C: In your game, you define a variable named
unsigned char myCVariable;
// Later, in some function
myCVariable = 25;
In your test, you can do this: