Alternatively, join us on Discord.

CHIP-8 emulator

Started by Ivoah, February 23, 2016, 03:51:04 am

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ivoah

So as some people lurking in IRC already know, I started work on a CHIP-8 emulator a little under a year and a half ago. I just picked it back up a couple days ago, and have made some major progress. It was originally written in C++, and I wanted to first write it for the computer using SDL, and then port it to the Nspire, hence the name "nCHIP-8." The C++ to C conversion was surprisingly easy! I'm not sure I did it the right way, but at least it works. Basically, I put all the data stuff in a struct, and renamed the functions to
chip8_blah()
All the functions take a pointer to a chip8 struct as their first argument, and then just edit that.

I've ported it to the GBA, and it runs great, except for a few bugs in the actual core that I need to fix.


As the CHIP-8 has 16 buttons and the GBA only has 10, I have to make a keymap for each game. If you want to try out Space Invaders here's a ROM you can run on an emulator (or real hardware): https://sr.ht/MfIH.gba
I personally recommend mGBA

Next steps are (in no particular order):

  • Make a pretty border
  • Port to the CE (it'd be easier if I actually had a CE)
  • Port to the Nspire (the repo is called nCHIP-8 after all)
  • Fix emulation bugs so it can actually run everything.
  • Port to KOS (It might run too slowly for this)
  • Port to Arduino


The emulator core is pretty easy to use, and as such makes it a breeze to port to other platforms. The GBA port only took about an hour to go from SDL to GBA.
Source for everything is here: https://github.com/Ivoah/nCHIP-8

Jkolade936

Cool! As for the CE port, which I hope I can look forward to, maybe CEmu could be of assistance?
Does this qualify as a signature? 
The answer is "Sure."


Ivoah

Quote from: Dudeman313 on February 23, 2016, 04:18:43 am
Cool! As for the CE port, which I hope I can look forward to, maybe CEmu could be of assistance?

Well, if I don't have a CE, then I don't have a CE ROM.
If any generous soul wants to donate a CE for the good of mankind, I certainly wouldn't turn them away ;)

Max Leiter

I think the problem is he needs a ROM, @Dudeman313


Looks super cool Ivoah, it's nice to finally see a topic after seeing you mention it in IRC all the time :)

@Ivoah ninja'd

Jkolade936

If it's illegal to transport a ROM file, is it also illegal to transport those ROM dump data segments that compiled into a ROM image? 'Cause I have those. ;)
Does this qualify as a signature? 
The answer is "Sure."


Ivoah

Quote from: Dudeman313 on February 23, 2016, 04:32:59 am
If it's illegal to transport a ROM file, is it also illegal to transport those ROM dump data segments that compiled into a ROM image? 'Cause I have those. ;)


Yeah, it's illegal to share anything that has the ROM data in it.

DJ Omnimaga

Nice work Ivoah and the speed is impressive so far. There was a 83+ one by Benryves so I assume a CE version of your emulator would run fast enough. I remember there was also an HP Prime CHIP-8 emulator but it was much slower, partly due to being written in HP PPL (although still impressive per proprietary calculator language standards). Keep up the good work on this :3=

Jim Bauwens

February 23, 2016, 09:43:59 am #7 Last Edit: February 23, 2016, 09:49:04 am by Jim Bauwens
If you want I have a small CHIP-8 'decompiler' I made in (PC) Lua, I used it understand what some games were doing when debugging an emulator.

Edit: all the files are here: https://github.com/jimbauwens/chip-8 (you might have to change the offset at the end of the decompiler)

Jkolade936

@Ivoah : Go to Walmart, but a CE for about $125(If you have that money...) make a ROM, and return it. :P
Does this qualify as a signature? 
The answer is "Sure."


Ivoah

Quote from: Dudeman313 on February 23, 2016, 02:38:07 pm
@Ivoah : Go to Walmart, but a CE for about $125(If you have that money...) make a ROM, and return it. :P

I believe it'd be illegal to continue using the ROM

Jkolade936

Why? That's not fair!  :banghead: I don't know how else I can help you, other than that. Unless you can finish the CE port within 90 days...
Does this qualify as a signature? 
The answer is "Sure."


aeTIos

You can borrow my ROM! I won't use my CE in the meantime! Honest!

:trollface:

Kidding aside, this looks pretty impressive! I really should get myself a flashcart for the GBA.
ceci n'est pas une signature

Jkolade936

Okay, @Ivoah . Here's the plan... you gotta think like a  :ninja: . Maybe a  :ninja: :walrii: . Go to Walmart. Buy a CE. Use it to create a ROM. Do some testing and such. Eat food. 90 days later, delete the ROM. Return the CE. Buy another one. Keep being a  :ninja: . Create a new ROM. Think like a :walrii: . Eat food. Repeat until you finish the CE port. It's the perfect  :ninja: plan!  >:D

:walrii:
Does this qualify as a signature? 
The answer is "Sure."


Ivoah

Quote from: Dudeman313 on February 23, 2016, 06:38:06 pm
Okay, @Ivoah . Here's the plan... you gotta think like a  :ninja: . Maybe a  :ninja: :walrii: . Go to Walmart. Buy a CE. Use it to create a ROM. Do some testing and such. Eat food. 90 days later, delete the ROM. Return the CE. Buy another one. Keep being a  :ninja: . Create a new ROM. Think like a :walrii: . Eat food. Repeat until you finish the CE port. It's the perfect  :ninja: plan!  >:D

:walrii:


O.O das a lotta emoticons

Jkolade936

Figures and placeholders are essential in any evil scheme. Did I say evil scheme? I meant elaborate plot.... >:D
Does this qualify as a signature? 
The answer is "Sure."


Powered by EzPortal