My previous personal project was a NES emulator. I thought it would be cool to use the Visibility Jam to program some features that provide visibility into the system. The ideas I had were:

  • visualizing the CHR memory on a cartridge (basically showing the sprites used in the game)
  • writing a disassembler, displaying 6502 assembly you can step through as the game runs
  • nametable viewer (basically showing the backgrounds that the NES builds in memory, especially as the screen scrolls)
  • memory viewer / editor
  • wave form visualizer for the audio that the NES generates (NES has 2 square wave channels, a triangle wave, noise, and a channel for playing DPCM samples)

Recent Activity

I did a lot of work today on the memory viewer.
I implemented scrolling the viewer with mouse wheel, as well as a "goto address" command window that lets you jump to any address.
The first video shows the navigation features and the second video demonstrates load and store instructions moving data to and from memory.
&bitwitch-nes

Day 2

My tasks for today were:

  • get the disassembler working
  • implement simple text rendering of ttf fonts
  • start the memory viewer window

i got the very beginnings of a memory viewer working. its kind of cool to watch data fly around in memory with a game running.
&bitwitch-nes

i got my disassembler working and you can step through instructions.
the current instruction that the program counter is pointing to is highlighted.
you can also step by frame.
&bitwitch-nes

Day 1

I had to work today so I only got a few hours of jammin in. I was mainly focused on trying to figure out how to write a disassembler. I want to be able to display a games' assembly and let the user step through it as the game runs. I also want to be able to display a certain number of instructions before the current instruction that the cpu's program counter is pointing to. The 6502 has variable length instructions so this is not straight forward to seek backwards from the current program counter to determine previous instructions.

I also cannot disassemble the whole memory up front, because there are chips called "mappers" inside NES cartridges that dynamically remap addresses. The part of the address space visible by the cpu that is occupied by cartridge memory can be remapped by the mapper to any arbitrary memory within the cartridge.

I think a viable approach will be to just cache a certain number of instruction addresses. The program counter can be cached before each instruction that the cpu executes, replacing the oldest address in cache. This should make it possible to disassemble code from a few instructions prior to a few instructions following the current instruction.

I had to do some refactoring work just to get the code into a place where this is possible. It has been awhile since I touched this codebase as well. I wasn't able to get it working tonight, so I will go at it again tomorrow.

A few days leading up to the jam I did some prep work. I created a second window where all the visibility stuff will go, and displayed pattern table memory in it. I posted some screenshots of pattern tables for various games in #project-showcase.

I am playing around with my NES emulator for the Visibility Jam (&bitwitch-nes).
Here are some examples of pattern table memory dumped from some NES cartridges and visualized.
Tomorrow I hope to get a disassembler working, so you can step through code as a game is running.