3 ms·
Here's a very clean and clever NES emulator in C++ by Bisqwit of TAS fame: https://www.youtube.com/watch?v=y71lli8MS8s https://www.youtube.com/watch?v=y71lli8MS
by atesti 12y ago
Here's a very clean and clever NES emulator in C++ by Bisqwit of TAS fame:
https://www.youtube.com/watch?v=y71lli8MS8s https://www.youtube.com/watch?v=y71lli8MS8s
He presents the code in the style of a tool assisted run, typing it in in high speed.
I never saw templates used like that to create the unrolled CPU dispatcher
- kibwen 12y agoThe code for the CPU dispatcher begins at 1:26 in the linked video, for those not willing to watch the whole thing. A comment elsewhere in the thread mentions Sprocketnes, written in Rust, which takes a different tack here: it uses a hygienic macro to implement opcode dispatching, which allows the giant block of dispatching logic to be reused for both the emulator and the disassembler: https://github.com/pcwalton/sprocketnes/blob/master/cpu.rs#L111-L319 https://github.com/pcwalton/sprocketnes/blob/master/cpu.rs#L...