logoalt Hacker News

Guide to making a CHIP-8 emulator (2020)

27 pointsby AlexeyBrin11/29/20255 commentsview on HN

Comments

jan_Satetoday at 12:31 PM

I've also made my own implementation of CHIP-8 emulator. I was surprised that it only took me a few hours to got it working. I reserved a week for the project.

One thing interesting about making emulator is that, it's all-or-nothing. You can't tell if your implementation's working until you finish it. For my case, I did end up having a few minor bugs, which I promptly fixed and got the whole thing working correctly.

Maybe I should try implementing extensions next, when I've got the time for that. :)

fluffettoday at 11:29 AM

Happy to see this :-)

This guy starring my chip-8 implementation was a moment of pride for me. It was buggy but before this guide there wasn't too much material out there that was made for stupid people like me.

It's a great starter project for emulation. You'll realise how all emulators work, and as a bonus, interpreted languages. Really recommend it.

spit2windtoday at 8:03 AM

I've wondered if there's a good "standard" project a person could use to get up to speed on a new language and get an intuitive sense for working with it. For example, plenty of Java programmers can write a working Python program, but it's not "pythonic".

Would writing a CHIP-8 emulator be such a project? It seems non-trivial, yet not too big, the kind of thing that if you implemented it once, implementing it again in another language would be much faster (apart from the language learning).

anthktoday at 10:00 AM

Nice; here there is one made in POSIX AWK:

https://git.luxferre.top/dale-8a/files.html

BTW, kudos for the author for playing Anchorhead too :D. The ZMachine is one of the things I love too among minimal VM's.

Another nice one it's mu808, but sadly it needs some quirky stuff to handle bufferings https://codeberg.org/luxferre/mu808

The author could rewrite in TCL/JimTCL and forget about buffering.

On the software for it (IV0 actually), the offer looks more limited than the CHIP8, but the opcodes and implementation are much easier to understand (no pixels, just raw I/O, even chars). Enough to implement Lunar Lander, some calculator, a Bulls and Cows game and so on.

Altough after trying something like EForth running under Subleq (Muxleq was tons faster), I can say Eforth offers you a much more powerful language having to thinker with Muxleq, altough the IV0 machine (and a few ones such as VTL-02) will run under 6502 based legacy microcomputers, such as the Kim-1 or the Apple1, C64, Apple 2 and so on. With mu808 I still coudln't output strings bigger than 9 chars. With EForth under Muxleq you can run a Sokoban like nothing.