Join us on Discord!
You can help CodeWalrus stay online by donating here.

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
  • Calculators owned: TI-86 (now broken), TI SR-56, TI-Nspire CX CAS, TI-84+ SE, TI-84+ SE, TI-85, TI-73 Explorer VS, ViewScreen, TI-84+ CSE, TI-83+ SE

Dudeman313

Cool! As for the CE port, which I hope I can look forward to, maybe CEmu could be of assistance?
  • Calculators owned: TI-84 PCE
  • Consoles, mobile devices and vintage computers owned: Android O Phone
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 ;)
  • Calculators owned: TI-86 (now broken), TI SR-56, TI-Nspire CX CAS, TI-84+ SE, TI-84+ SE, TI-85, TI-73 Explorer VS, ViewScreen, TI-84+ CSE, TI-83+ SE

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

Dudeman313

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. ;)
  • Calculators owned: TI-84 PCE
  • Consoles, mobile devices and vintage computers owned: Android O Phone
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.
  • Calculators owned: TI-86 (now broken), TI SR-56, TI-Nspire CX CAS, TI-84+ SE, TI-84+ SE, TI-85, TI-73 Explorer VS, ViewScreen, TI-84+ CSE, TI-83+ SE

Dream of 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=
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Jim Bauwens

#7
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)

Dudeman313

@Ivoah : Go to Walmart, but a CE for about $125(If you have that money...) make a ROM, and return it. :P
  • Calculators owned: TI-84 PCE
  • Consoles, mobile devices and vintage computers owned: Android O Phone
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
  • Calculators owned: TI-86 (now broken), TI SR-56, TI-Nspire CX CAS, TI-84+ SE, TI-84+ SE, TI-85, TI-73 Explorer VS, ViewScreen, TI-84+ CSE, TI-83+ SE

Dudeman313

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...
  • Calculators owned: TI-84 PCE
  • Consoles, mobile devices and vintage computers owned: Android O Phone
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

Dudeman313

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:
  • Calculators owned: TI-84 PCE
  • Consoles, mobile devices and vintage computers owned: Android O Phone
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
  • Calculators owned: TI-86 (now broken), TI SR-56, TI-Nspire CX CAS, TI-84+ SE, TI-84+ SE, TI-85, TI-73 Explorer VS, ViewScreen, TI-84+ CSE, TI-83+ SE

Dudeman313

Figures and placeholders are essential in any evil scheme. Did I say evil scheme? I meant elaborate plot.... >:D
  • Calculators owned: TI-84 PCE
  • Consoles, mobile devices and vintage computers owned: Android O Phone
Does this qualify as a signature? 
The answer is "Sure."


Powered by EzPortal