Remix.run Logo
Show HN: I wrote a custom assembler for CHIP-8 in C++(github.com)
23 points by tack1234 2 days ago | 4 comments

I'm writing a custom assembler for CHIP-8 and just finished adding support for the DB/.byte directive so I can embed sprites in the ROM and finally get something drawn on the screen. It SHOULD support all OG CHIP-8 instructions, but still a ton of rough edges that I'm ironing out.

This is my first ever C++ project, just like the CHIP-8 emulator was my first ever C (and emudev) project. It's so satisfying to write assembly and have your program spit out a ROM that actually runs in the emulator you wrote.

All code is written by me (a lot of it livestreaming) as evident by the quality, no AI.

Retr0id 3 hours ago | parent | next [-]

Nice, chip8 is a lot of fun. I looked at your emulator implementation too, and it looks like you have an OOB access bug in the "I" register (it can be incremented beyond the RAM array bounds). This is a very common chip8 emulator bug, which can (in some cases) be exploited to allow a malicious ROM to escape the emulator. I wrote about this here: https://www.da.vidbuchanan.co.uk/blog/bggp3.html

Stevenrojas888 3 hours ago | parent | prev | next [-]

Awesome milestone! As someone diving into C and C++ right now, what was the steepest part of the learning curve for you when structuring the assembler compared to writing the emulator in C?

adityamishra241 2 hours ago | parent | prev | next [-]

Really cool project. How much harder did the assembler feel compared to writing the emulator?

rfgplk 3 hours ago | parent | prev [-]

Nice job!