Guide to making a CHIP-8 emulator #100
Replies: 15 comments
-
This was a great write-up - I found that it provided a good level of detail while leaving enough of the implementation details for me to figure out. Two things that were a little unclear to me, both in the
My attempt (seems to be working, sans sound) is in Rust: https://github.com/cbreezier/rchip8 |
Beta Was this translation helpful? Give feedback.
-
@cbreezier Hey, thanks for the feedback!
Again, thanks for the feedback, and I'm glad you found it useful! |
Beta Was this translation helpful? Give feedback.
-
Thanks for writing this great article! I’m sure it helped many people get into the topic of emulators, as it did with me. But there is one thing I’m still not sure about (it has to do with Maybe this is something you find worth clarifying in your article. Thanks for your time! Here is my attempt in Rust for anyone interested: https://github.com/DasStone/chip8emu_rs |
Beta Was this translation helpful? Give feedback.
-
@DasStone Thanks for the kind words and the feedback! You're right, this is definitely worth clarifying in the blog post. In the meantime, I can confirm that yes, you're correct, the timers should continue while the In the CHIP-8 interpreter on the COSMAC VIP, |
Beta Was this translation helpful? Give feedback.
-
Hi @tobiasvl, thanks for posting this excellent guide. I referenced it many times while writing my own interpreter. I have a question regarding one of your statements:
But this reference says:
For example, paddles in Pong seem to wrap in other interpreters I tried (e.g. Octo IDE), but based on your instructions, they shouldn't. Am I missing something here? Edit: Just found out Octo IDE has an option for wrapping/clipping sprites. I think I'll make it configurable too. |
Beta Was this translation helpful? Give feedback.
-
@jakubito Thanks, interesting! I can confirm that my statement is correct – sprites shouldn't partially wrap in either the original CHIP-8 interpreter (source) or in CHIP-48/S-CHIP (source). However! By "Pong", I assume you're referring to David Winter's Pong game. It was written for his own DOS interpreter, which was based on the CHIP-48 specification. This specification seems to be what Cowgod's reference is based on as well. It's possible David Winter introduced sprite wrapping himself, and this is the reason for the disparity. |
Beta Was this translation helpful? Give feedback.
-
Thanks for this helpful post on creating a CHIP-8 emulator! I just developed an interest in emulator creation and, after a little research, discovered that writing a CHIP-8 emulator (/interpreter) is apparently a rite of passage. With the help of this guide, I put together a working CHIP-8 emulator in Java that passes the BonCoder test, and it only took around 8 hours. I'm planning to try to make an NES emulator next. I expect that to be a big step up in complexity! |
Beta Was this translation helpful? Give feedback.
-
Hello! Love the article and I've been working on my own interpreter, however I noted you said for the IBM logo program only the opcodes you mentioned were needed, but there are several opcodes starting with "F" in the versions of the IBM logo I can find, so I'm quite confused if more opcodes are needed or if I'm messing up something. Any clarity would be appreciated! Thanks in advance. |
Beta Was this translation helpful? Give feedback.
-
@jasonnelson618 Thanks for the kind words! There should be no FXXX opcodes in the IBM program. How are you reaching those opcodes? My guess is that you're reading the graphics data (for the IBM logo) as code somehow, ie. that you have a bug that has caused your Program Counter to point into the graphics, attempting to execute it. If you push your code to GitHub, I could have a look at it and see if I spot the bug. Otherwise, good luck bug hunting! Might be a good idea to write some debug stuff to the terminal, such as the current PC and opcode at each step, so you see what's happening. |
Beta Was this translation helpful? Give feedback.
-
A small spelling error
I guess you meant |
Beta Was this translation helpful? Give feedback.
-
@minchopaskal Thanks, fixed! |
Beta Was this translation helpful? Give feedback.
-
I cannot seem to find this IBM logo file that you are talking about. The ones I can find all have different instructions that require implementing a much larger portion of the CHIP-8 instruction set to run. It would be nice if you could link the ROM that you are referring to. Thanks! |
Beta Was this translation helpful? Give feedback.
-
@bloodandcoffee Sure, I can put a link in the guide. In the meantime, it's this one: https://loktar00.github.io/chip8/roms/IBM%20Logo.ch8 (I'm not aware of any other IBM logo programs with more instructions - are you sure you weren't looking at the correct one, but interpreted the graphics data as instructions?) |
Beta Was this translation helpful? Give feedback.
-
This is a nice guide, it really helps me a lot while implementing a Chip-8 interpreter in (microcontroller-less) hardware. Thanks. I found a small omission in the pseudocode for DXYN - The X variable should be reset in the outer loop after incrementing Y, or else the sprite would smeared out towards the right. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the guide. |
Beta Was this translation helpful? Give feedback.
-
Guide to making a CHIP-8 emulator - Tobias V. Langhoff
A high-level guide to making a CHIP-8 emulator.
https://tobiasvl.github.io/blog/write-a-chip-8-emulator/
Beta Was this translation helpful? Give feedback.
All reactions