C1/C2 corresponds to node numbers - between both chips, they range from 0 to 33000 (though some numbers are unused).
In other news, I was trying to get the simulator to display the PPU's actual output (based on the VRAM's content) and found out the writes to the PPU don't seem to be working as expected. Writing to $2000 to enable NMIs doesn't appear to work, and a simple program like:
Code:
LDA #$77
STA $2007
JMP $0000
Ends up writing garbage to VRAM instead of $77. Writing to CPU RAM works as expected, though, so the problem seems to be the communication between both chips. It's probably a silly mistake, but I've been looking at this for a few hours already and I haven't been able to figure it out.
If anyone's willing to check if they see something that's obviously wrong, it'd probably be around here:
halfstep()clk0 is the master clock, cpu_clk0 is the cpu's clock (e.g clk0 / 12) and io_ce is the chip enable input on the PPU (which is based on the cpu's address bus & phi2)
I'm unsure if the logic I'm using to replicate the 74139's behavior (io_ce) is correct, among other things.
Everything else is pretty much copy/pasted from the original javascript simulators, though. The major difference being that the original Visual 2C02 uses the function
handleIoBus() to emulate a CPU (this used to work in the C# version too, before I integrated the 2A03 into it).