8 comments

[ 2.3 ms ] story [ 18.7 ms ] thread
I'm not sure if this can be technically defined as cycle accurate, since cpu instructions are still executed atomically, instead of executing each instruction cycle independently... I guess the end result is what matters and not the actual implementation?

EDIT: I suck at c++

It's not atomical. Note that the PPU is constantly updated in the middle of the CPU instructions in a way that respects the timing of the original hardware. The relative order of operations between CPU and PPU is respected.
You're right, sorry ^^ Too many meta-programming tricks for me
Such pregunta. Very clever. Many condense. Such switch. WOW. So emulator.
This is one example of how powerful and expressive C++ can be in the hands of the right person. I love (plain) C for its openness and the apparent ease of use but keep being amazed at how much more powerful as a language C++ is - to the point that C starts looking like a children's toy tool that should be abandoned as soon as the hand is strong enough to hold the real one.
Thanks (for calling me the right person). There is a price to pay for power in C++ though. Keeping the code beautiful and readable is often a challenge, as the syntax gets convoluted very quickly. I'm not the biggest fan of the Standard Template Library either.

Lately I've been experimenting with D (https://dlang.org), created by Walter Bright and Andrei Alexandrescu, both well known expert C++ programmers. D feels a lot like C++ should have been had it dropped some C compatibility in exchange for clarity. Its meta-programming capabilities are also far more powerful. I can think of features (like template mixins) that would make this project even more compact.

This is insanely good. I remember studying the code of other NES emulators and all of them easily passed the 10k lines mark. Makes you wonder how much repeated code is there.
To be fair I don't implement all the mappers, but I'm pretty confident the core parts of the emulator (CPU and PPU) are as small as it gets.