Retr0id 2 days ago

A common mistake when implementing a CHIP-8 emulator is to allow the nominally 12-bit "I" register to overflow, leading to out-of-bounds memory accesses. When the emulator is written in a memory-unsafe language like C, this can lead to an emulator escape exploit - I wrote about one here: https://www.da.vidbuchanan.co.uk/blog/bggp3.html

  • stevekemp a day ago

    That was a lovely writeup, thanks for sharing.

63 2 days ago

I wrote an emulator in Python in college and recently redesigned and rewrote it in rust. It was a pretty fulfilling experience. I spent several weeks writing a long program just to get data to sufficiently test performance. After all was said and done, my rust emulator still ran the program so fast I could barely get enough samples for a flame graph.

If anyone reading is working on a chip-8 emulator for the first time, a word of warning: for instructions that affect the vF register, be sure to check whether the register should be set before running the instruction but actually set it after. This is subtle but affects several popular roms.

My test program if anyone wants to marvel at my inefficient assembly: https://github.com/dreary-dugong/fib8_benchmark

There's some fun stuff in there though, animated graphics and self modifying code. Highly recommend hacking on chip-8.

boguscoder a day ago

I think goal of the article series is admirable, but content choice for the very first one is somewhat strange. Why primer on representing numbers? If thats desired level of details, would the rest of CS101 take next 100ish posts?

bena 2 days ago

Writing a chip8 emulator is a fun project