* WalrusIRC

You need to have 5 posts and not be part of restricted usergroups in order to use the WalrusIRC embedded shoutbox. However, you can also access our IRC channel called #CodeWalrus via EFnet.

Author Topic: CHIP-8 emulator  (Read 2661 times)

0 Members and 1 Guest are viewing this topic.

Offline Ivoah

  • Super User
  • Join Date: Dec 2014
  • Location:
  • Posts: 523
  • Post Rating Ratio: +6/-0
    • @NoahRosamilia
    • Ivoah
    • @UCmgDyh_AeaHALohvR7PKXIw
    • /u/Ivoah
    • Ivoah
    • 114/11421
    • View Profile
    • Codinghobbit
  • Gender: Male
  • WalriiPoints: 100
CHIP-8 emulator
« on: 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
Code: [Select]
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

Offline Jkolade936

  • All Around Coolio
  • Super User
  • Join Date: Jan 2016
  • Location: Horseheads, NY
  • Posts: 1515
  • Post Rating Ratio: +9/-1
  • I'm an unknown loner. I try to change that.
    • Jkolade936
    • View Profile
    • My Sprites and Walrii Collection
  • Gender: Male
Re: CHIP-8 emulator
« Reply #1 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?
  • Calculators owned: None of them. :'(
Does this qualify as a signature? 
The answer is "Sure."


Offline Ivoah

  • Super User
  • Join Date: Dec 2014
  • Location:
  • Posts: 523
  • Post Rating Ratio: +6/-0
    • @NoahRosamilia
    • Ivoah
    • @UCmgDyh_AeaHALohvR7PKXIw
    • /u/Ivoah
    • Ivoah
    • 114/11421
    • View Profile
    • Codinghobbit
  • Gender: Male
  • WalriiPoints: 100
Re: CHIP-8 emulator
« Reply #2 on: February 23, 2016, 04:23:35 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

Offline Max Leiter

  • Full User
  • Join Date: Oct 2015
  • Location: California
  • Posts: 85
  • Post Rating Ratio: +0/-0
    • View Profile
Re: CHIP-8 emulator
« Reply #3 on: 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

Offline Jkolade936

  • All Around Coolio
  • Super User
  • Join Date: Jan 2016
  • Location: Horseheads, NY
  • Posts: 1515
  • Post Rating Ratio: +9/-1
  • I'm an unknown loner. I try to change that.
    • Jkolade936
    • View Profile
    • My Sprites and Walrii Collection
  • Gender: Male
Re: CHIP-8 emulator
« Reply #4 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. ;)
  • Calculators owned: None of them. :'(
Does this qualify as a signature? 
The answer is "Sure."


Offline Ivoah

  • Super User
  • Join Date: Dec 2014
  • Location:
  • Posts: 523
  • Post Rating Ratio: +6/-0
    • @NoahRosamilia
    • Ivoah
    • @UCmgDyh_AeaHALohvR7PKXIw
    • /u/Ivoah
    • Ivoah
    • 114/11421
    • View Profile
    • Codinghobbit
  • Gender: Male
  • WalriiPoints: 100
Re: CHIP-8 emulator
« Reply #5 on: February 23, 2016, 04:34:38 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

Offline DJ Omnimaga

  • Omni founder & CW co-founder
  • CodeWalrus Staff
  • Super User
  • Forum Maintenance
  • Original 5
  • CodeWalrus Supporter
  • *
  • Topic Management
  • Join Date: Nov 2014
  • Location: Quebec, Canada
  • Posts: 17486
  • Post Rating Ratio: +83/-4
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • @djomnimaga
    • @DJOmnimaga
    • View Profile
    • DJ Omnimaga music store
  • Gender: Male
Re: CHIP-8 emulator
« Reply #6 on: 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=
  • Calculators owned: TI-73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX (semi-broken), HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)
??? ??? ??? ???

Offline Jim Bauwens

  • Full User
  • Join Date: Feb 2015
  • Location:
  • Posts: 25
  • Post Rating Ratio: +1/-0
    • View Profile
Re: CHIP-8 emulator
« Reply #7 on: 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 »

Offline Jkolade936

  • All Around Coolio
  • Super User
  • Join Date: Jan 2016
  • Location: Horseheads, NY
  • Posts: 1515
  • Post Rating Ratio: +9/-1
  • I'm an unknown loner. I try to change that.
    • Jkolade936
    • View Profile
    • My Sprites and Walrii Collection
  • Gender: Male
Re: CHIP-8 emulator
« Reply #8 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
  • Calculators owned: None of them. :'(
Does this qualify as a signature? 
The answer is "Sure."


Offline Ivoah

  • Super User
  • Join Date: Dec 2014
  • Location:
  • Posts: 523
  • Post Rating Ratio: +6/-0
    • @NoahRosamilia
    • Ivoah
    • @UCmgDyh_AeaHALohvR7PKXIw
    • /u/Ivoah
    • Ivoah
    • 114/11421
    • View Profile
    • Codinghobbit
  • Gender: Male
  • WalriiPoints: 100
Re: CHIP-8 emulator
« Reply #9 on: February 23, 2016, 02:39:04 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

Offline Jkolade936

  • All Around Coolio
  • Super User
  • Join Date: Jan 2016
  • Location: Horseheads, NY
  • Posts: 1515
  • Post Rating Ratio: +9/-1
  • I'm an unknown loner. I try to change that.
    • Jkolade936
    • View Profile
    • My Sprites and Walrii Collection
  • Gender: Male
Re: CHIP-8 emulator
« Reply #10 on: 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...
  • Calculators owned: None of them. :'(
Does this qualify as a signature? 
The answer is "Sure."


Offline aeTIos

  • Dabbler in C
  • CodeWalrus Staff
  • Super User
  • Server Maintenance
  • Moderator
  • Original 5
  • Join Date: Nov 2014
  • Location: Ede, NL
  • Posts: 992
  • Post Rating Ratio: +12/-0
  • hi
    • r_vdijk
    • /u/aetios
    • aetios
    • View Profile
  • Gender: Male
Re: CHIP-8 emulator
« Reply #11 on: 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.
ceci n'est pas une signature

Offline Jkolade936

  • All Around Coolio
  • Super User
  • Join Date: Jan 2016
  • Location: Horseheads, NY
  • Posts: 1515
  • Post Rating Ratio: +9/-1
  • I'm an unknown loner. I try to change that.
    • Jkolade936
    • View Profile
    • My Sprites and Walrii Collection
  • Gender: Male
Re: CHIP-8 emulator
« Reply #12 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:
  • Calculators owned: None of them. :'(
Does this qualify as a signature? 
The answer is "Sure."


Offline Ivoah

  • Super User
  • Join Date: Dec 2014
  • Location:
  • Posts: 523
  • Post Rating Ratio: +6/-0
    • @NoahRosamilia
    • Ivoah
    • @UCmgDyh_AeaHALohvR7PKXIw
    • /u/Ivoah
    • Ivoah
    • 114/11421
    • View Profile
    • Codinghobbit
  • Gender: Male
  • WalriiPoints: 100
Re: CHIP-8 emulator
« Reply #13 on: February 23, 2016, 11:22:20 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

Offline Jkolade936

  • All Around Coolio
  • Super User
  • Join Date: Jan 2016
  • Location: Horseheads, NY
  • Posts: 1515
  • Post Rating Ratio: +9/-1
  • I'm an unknown loner. I try to change that.
    • Jkolade936
    • View Profile
    • My Sprites and Walrii Collection
  • Gender: Male
Re: CHIP-8 emulator
« Reply #14 on: 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
  • Calculators owned: None of them. :'(
Does this qualify as a signature? 
The answer is "Sure."


 


You can also use the following HTML or bulletin board code to share it on your page or forum signature!


Also do not forget to check our affiliates below.
Planet Casio TI-Planet Calc.news BroniesQC BosaikNet Velocity Games