NES emulator written in D

blahness nospam at blah334.net
Tue Nov 13 09:38:14 UTC 2018


On Tuesday, 13 November 2018 at 08:24:05 UTC, Manu wrote:
> A great test is to emulate an Atari2600; you'll know your 6502 
> is 100%
> perfect if you can play pitfall or some other complex 2600 
> games ;)
> I can't see how your cycle counting logic works, it looks like 
> it's
> missing a lot of cycles. How do you clock your scanlines 
> against your
> CPU?
> Can you run Battletoads or Super Mario Bros? They're pretty 
> sensitive
> to proper timing.

Every cycle is accounted for via a memory read or write. Notice 
both memoryRead & memoryWrite call nextCycle. In nextCycle you'll 
notice after every CPU cycle the PPU gets 3 cycles (equivalent to 
1 CPU cycle) & the APU gets 1 cycle. Super Mario Bros runs fine 
but Battletoads has some issues unrelated to the CPU. It is 
highly dependent on correct sprite 0 collision detection timing. 
It's a PPU timing issue.

I'm relying on these CPU tests: 
https://wiki.nesdev.com/w/index.php/Emulator_tests. Notice one of 
the authors of one of the most extensive tests is kevtris who's 
most famous for his FPGA recreations of the NES & Super Nintendo 
for Analogue (https://www.analogue.co/). I'm pretty confident 
about the CPU being cycle accurate at least as far as the NES is 
concerned.


More information about the Digitalmars-d-announce mailing list