You can help CodeWalrus stay online by donating here. | New CodeWalrus | Old (dark mode) | Old (light) | Discord server

CHIP-8 emulator

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

0
b/Consoles publicado por u/Ivoah February 23, 2016, 03:51:04 AM
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
Inicia sesión o crea una cuenta para dejar un comentario
u/Dudeman313 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?
u/Ivoah February 23, 2016, 04:23:35 AM
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 ;)
u/Max Leiter February 23, 2016, 04:29:04 AM
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
u/Dudeman313 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. ;)
u/Ivoah February 23, 2016, 04:34:38 AM
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.
u/Dream of Omnimaga February 23, 2016, 05:47:03 AM
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=
u/Jim Bauwens February 23, 2016, 09:43:59 AM
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)
Last Edit: February 23, 2016, 09:49:04 AM by Jim Bauwens
u/Dudeman313 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
u/Ivoah February 23, 2016, 02:39:04 PM
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
u/Dudeman313 February 23, 2016, 02:56:02 PM
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...
u/aetios February 23, 2016, 03:36:31 PM
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.
u/Dudeman313 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:
u/Ivoah February 23, 2016, 11:22:20 PM
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
u/Dudeman313 February 23, 2016, 11:52:48 PM
Figures and placeholders are essential in any evil scheme. Did I say evil scheme? I meant elaborate plot.... >:D
Start a Discussion

b/Consoles

Game console programming, homebrew development and hacking.

40
Topics
Explore Board
Website statistics


MyCalcs | Ticalc.org | Cemetech | Omnimaga | TI-Basic Developer | MaxCoderz | TI-Story | Casiocalc.org | Casiopeia | The Museum of HP Calculators | HPCalc.org | CnCalc.org | Music 2000 Community | TI Education | Casio Education | HP Calcs | NumWorks | SwissMicros | Sharp Calculators
Powered by EzPortal