Re: [stella] 6502 hardware register writes

Subject: Re: [stella] 6502 hardware register writes
From: "Eckhard Stolberg" <Eckhard_Stolberg@xxxxxx>
Date: Fri, 2 Nov 2001 15:37:51 +0100
> Being somewhat interested in working on a '2600 emulator, I thought I'd
> start by asking if writes to hardware (ie: graphics) registers occur on
> last cycle of the instruction.  That is, in, say, a 3-cycle store, does
> effect of writing to the register become visible on the first pixel
> immediately drawn after the end of the 3rd cycle?  Or is it apparent at
> start of the 3rd cycle (ie: end of 2nd cycle)?

That depends on the instruction you are using. A 'STA COLUP0' will
take effect after the third cycle. But some games get quite tricky.
Pole Position for example puts the stack pointer over the RESxx
registers and then does a BRK. There are three write cycles in a BRK
instruction, so the three position registers for the objects that make
up the road in PP, get accessed in three consecutive cycles. This is
how PP managed to get the road to meet so closely in the horizon.

If you want to get an acurate VCS emulator, you'll need a cycle-
perfect 6502 emulator. The people who wrote the VICE C64 emulator
wrote a nice document about the 6510 processor, which also includes
information about the exact cycle usage of each instruction. A quick
websearch should take you to their site. But I think the text about
the processor might have been posted to the Stella list once or twice

Emulating each cycle in the 6502 can also be usefull for some of
the bankswitching formats, like the Supercharger, which counts
the number of address changes after an access to a hotspot address.
So this is something worth considering, even if it takes some
processor time on the emulating system.

> In general, I'm interested in discussing '2600 emulation - perhaps those
> the list who have tackled this, and can help when tricky problems show up,
> might hold up their hands.

Well, John Saeger and I have been figuring out many of the strange
things, that the VCS games do, for the z26 emulator. I'm not sure
how many of the details I still remember, but if you think there's
somthing that z26 handles better than your own emulator, and you
don't know why, please feel free to ask.

BTW, since you mentioned that you are now mainly programming for
the GBA and that you were interested in VCS emulators for that
console, can we all speculate about the target platform for this
project now? ;-)

Ciao, Eckhard Stolberg

Archives (includes files) at
Unsub & more at

Current Thread