I am currently working on a CHIP-8 emulator/interpreter using C++ and SDL. I hope to be able to port it to the Nspire, because afaik the only CHIP-8 emu for the Nspire is made in lua and was never released. I am currently stuck on opcode FX0A, if anyone has any helpful hints about how to implement it, then post!
I have the emulator mostly working on the PC, but for some reason only half of the screen is displayed, any help would be greatly appreciated.
Ivoah wrote:
I have the emulator mostly working on the PC, but for some reason only half of the screen is displayed, any help would be greatly appreciated.
Can you offer us any hints to help us help you? Is it just half the screen, masked off, or half the screen stretched to cover the whole screen? What are you using to display the screen? Do you think the problem is in your CHIP-8 simulation or in your use of your display library?
KermMartian wrote:
Ivoah wrote:
I have the emulator mostly working on the PC, but for some reason only half of the screen is displayed, any help would be greatly appreciated.
Can you offer us any hints to help us help you? Is it just half the screen, masked off, or half the screen stretched to cover the whole screen? What are you using to display the screen? Do you think the problem is in your CHIP-8 simulation or in your use of your display library?


1 and a half years later I've discovered the issue. I had my pixel pushing code think the screen was only 32 pixels wide, while it's actually 64.
I had something like

Code:
pixels[(y*32) + x] = color

when I needed something like

Code:
pixels[(y*64) + x] = color


I've picked this project back up, and fixed more bugs. It still isn't working completely, but it's much better than it was a few days ago.

I also might change it from C++ to C, so I might be able to port it to the CE.

Feel free to browse what I have here: https://github.com/Ivoah/nCHIP-8
From looking at your code, you use very few C++ features, so I see no particular reason why it couldn't be converted to C and thence to a TI-84 Plus CE program. I'm glad you picked it up again and that that bug was so easy to solve.
KermMartian wrote:
From looking at your code, you use very few C++ features, so I see no particular reason why it couldn't be converted to C and thence to a TI-84 Plus CE program. I'm glad you picked it up again and that that bug was so easy to solve.


Yeah the C++ -> C conversion shouldn't be hard.
Update time!

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:
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
This looks awesome; nice job! I'm impressed that it only took about an hour to port it to the GBA. Do you have any idea which of those other ports you mentioned you'd like to attack first? Since you could (for example) get it to compile in SC3 or with Mateo's SDK offline, I'm sure people here would be more than happy to test it with you to work through bugs. On the other hand, perhaps this is the push you need to get a CE!
KermMartian wrote:
This looks awesome; nice job! I'm impressed that it only took about an hour to port it to the GBA. Do you have any idea which of those other ports you mentioned you'd like to attack first? Since you could (for example) get it to compile in SC3 or with Mateo's SDK offline, I'm sure people here would be more than happy to test it with you to work through bugs. On the other hand, perhaps this is the push you need to get a CE!

Well, I'm probably going to get the emulator working 100% first. Right now a few games are bugged. After that, it'll probably be the Nspire, as that was the original goal for this project anyways.
Right, makes sense, and that would probably be the most straightforward of the options listed if you both have a TI-Nspire and experience writing programs for it. But would you port it as a C++ program that requires the Ndless software, or port it to Lua?
KermMartian wrote:
Right, makes sense, and that would probably be the most straightforward of the options listed if you both have a TI-Nspire and experience writing programs for it. But would you port it as a C++ program that requires the Ndless software, or port it to Lua?


I'd port it as a C Ndless program, since a Lua CHIP-8 emulator already exists.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement