What's new

Chip 8

CyanPrime

New member
[MENTION=94827]CyanPrime[/MENTION] Do you happen to have my space invaders bug?

The flickering issue is standard behaviour of the Chip8, not a bug in your emu :)

The flow for the Invaders title screen goes like this (most of the title screen ops below) - (does your output match this?)

Code:
1NNN	Jump to NNN
6XKK 	VX = KK
6XKK	        VX = KK
6XKK	        VX = KK
ANNN	I = NNN
DXYN	Draws a sprite at (VX,VY) starting at M(I). VF = collision.
7XKK	        VX = VX + KK
FX1E 	I = I + VX
3XKK	        Skip next instruction if VX == KK
1NNN	Jump to NNN
DXYN	Draws a sprite at (VX,VY) starting at M(I). VF = collision.
7XKK	        VX = VX + KK
FX1E	        I = I + VX
3XKK	        Skip next instruction if VX == KK
1NNN	Jump to NNN
DXYN	Draws a sprite at (VX,VY) starting at M(I). VF = collision.
7XKK	        VX = VX + KK
FX1E	        I = I + VX
3XKK	        Skip next instruction if VX == KK
1NNN	Jump to NNN
DXYN	Draws a sprite at (VX,VY) starting at M(I). VF = collision.
7XKK	        VX = VX + KK
FX1E	I = I + VX

And so on...

I don't think I have any errors in INVADERS now, actually (if flickering isn't a bug, that is). What is your INVADERS bug again? I might have already solved it.
 

Danny

Programmer | Moderator
I don't think I have any errors in INVADERS now, actually (if flickering isn't a bug, that is). What is your INVADERS bug again? I might have already solved it.

NVM. Fixed it!
It was the way i was reading in the rom.
Cheers :D
 
Last edited:

Danny

Programmer | Moderator
More progress

I hope the following screens will inspire others to start or continue with their emulators!
Let's bring this thread back to life people :)

Getting good compatibility now overall. 80% of games work as expected, 20% have graphical issues in various places (some in title screens, but fine in game, and others with the inverse problem.

Has anyone else had the garbled Invaders text on the title screen? (see screenshot, just the "programmed by Dave Winter" text is garbled). you would think to point to the BCD opcode, but then again... it's working fine in other places. Odd.
 

Attachments

  • CAVE_and_ViewController_m.png
    CAVE_and_ViewController_m.png
    12.4 KB · Views: 125
  • HIDDEN_and_ViewController_m.png
    HIDDEN_and_ViewController_m.png
    19.4 KB · Views: 131
  • INVADERS_and_ViewController_m.png
    INVADERS_and_ViewController_m.png
    17.8 KB · Views: 115
  • LUNARLANDER_and_ViewController_m.png
    LUNARLANDER_and_ViewController_m.png
    15.1 KB · Views: 135
  • RUSSIANROULETTE_and_ViewController_m.png
    RUSSIANROULETTE_and_ViewController_m.png
    16.4 KB · Views: 118
  • SEQUENCESHOOT_and_ViewController_m.png
    SEQUENCESHOOT_and_ViewController_m.png
    18.7 KB · Views: 136
  • SPACEFLIGHT_and_ViewController_m.png
    SPACEFLIGHT_and_ViewController_m.png
    14.7 KB · Views: 123
  • SUBMARINE_and_ViewController_m.png
    SUBMARINE_and_ViewController_m.png
    16.8 KB · Views: 106
  • SYZYGY_and_ViewController_m.png
    SYZYGY_and_ViewController_m.png
    16.7 KB · Views: 132
  • TRON_and_ViewController_m.png
    TRON_and_ViewController_m.png
    15.4 KB · Views: 129
Last edited:

CyanPrime

New member
I'm going to make a public release post form my emulator. I hope no one minds.

--------------------------------------------

This Chip 8 emulator was coded in JavaScript by CyanPrime

My Chip 8 emulator will play most chip 8 games perfectly, and allows you to drag and drop your ROM files right into the Drop Area of the emulator page and begin playing right away. It also has a custom control system, since playing Chip 8 games on a keyboard using the default chip 8 Layout can highly vary in comfort.

Here are some screenshots of the Chip 8 emulator in action
chip-8-pic-1.png

chip-8-pic-2.png

chip-8-pic-3.png

chip-8-pic-4.png


Download - hosted on Github
The project page is here: https://github.com/CyanPrime/Chip-8-Emu-JS
Just click the "Download ZIP" button near the bottom right, and enjoy!
 

CyanPrime

New member
Are you going to add schip support?

I think I'm going to go right to making a GameBoy emulator, lol.

I have a quick question though. I'm making a save state system for my emulator, and I plan on having the user download a save file with the current stats of the emulator cpu. Is the whole game in the memory? and does it get changed as it runs? Cause I managed to get everything working except that it duplicates the moving/flickering objects, and then only the new ones are updated, so the old ones just stay there looking ugly. Even if you go over them with a new game object they don't go away.

Currently I only have it reading the memory of the old system up to 0x200,as that's when the game starts, and I don't want to distribute games with my save files.

So could anyone shed some more light as how the system's memory array works?


Edit: Nevermind, I fixed it by just saving everything that isn't the same value of the default game state to the savestate memory, lol.
 
Last edited:

Danny

Programmer | Moderator
I think I'm going to go right to making a GameBoy emulator, lol.

I have a quick question though. I'm making a save state system for my emulator, and I plan on having the user download a save file with the current stats of the emulator cpu. Is the whole game in the memory? and does it get changed as it runs? Cause I managed to get everything working except that it duplicates the moving/flickering objects, and then only the new ones are updated, so the old ones just stay there looking ugly. Even if you go over them with a new game object they don't go away.

Currently I only have it reading the memory of the old system up to 0x200,as that's when the game starts, and I don't want to distribute games with my save files.

So could anyone shed some more light as how the system's memory array works?


Edit: Nevermind, I fixed it by just saving everything that isn't the same value of the default game state to the savestate memory, lol.
[MENTION=94827]CyanPrime[/MENTION]
Interesting. I was also going to go straight to the GB, but it's quite the jump.
I'm personally taking a detour and am currently writing a Space Invaders emulator. I think it's a good intermediary step, as it has some similarities with the Gameboy, and gives you a bit more insight and knowledge before diving in the deep end.
I recommend that you check it out!

If not, keep us posted on your Gameboy emulator in the Gameboy sticky in this forum!
I'll be posting as usual as I progress with the Space Invaders emulator.

PS: Would be cool if there were more people than just me working on a Space Invaders emulator (hint hint ;))
 
Last edited:

shutterbug2000

New member
[MENTION=94827]CyanPrime[/MENTION]
Interesting. I was also going to go straight to the GB, but it's quite the jump.
I'm personally taking a detour and am currently writing a Space Invaders emulator. I think it's a good intermediary step, as it has some similarities with the Gameboy, and gives you a bit more insight and knowledge before diving in the deep end.
I recommend that you check it out!

If not, keep us posted on your Gameboy emulator in the Gameboy sticky in this forum!
I'll be posting as usual as I progress with the Space Invaders emulator.

PS: Would be cool if there were more people than just me working on a Space Invaders emulator (hint hint ;))

I was thinking of doing a Space Invaders as well. I'm stuck on graphics with my Gameboy emulator, so I may try space invaders, and see how that goes.
 

CyanPrime

New member
Dang, kinda wish I seen that Space Invaders thing before I started on my GB Emu.
What files does Space Invaders work with? Is it the MAME files?
 

Danny

Programmer | Moderator
Dang, kinda wish I seen that Space Invaders thing before I started on my GB Emu.
What files does Space Invaders work with? Is it the MAME files?

Just look for invaders.e, invaders.f, invaders.g, invaders.h via google :)
They might come with MAME also perhaps?
 

mendus

New member
[MENTION=104278]Feliwir[/MENTION] Try to locate your problem. Is it on the SFML end or in the drawing opcode end?
Try drawing something random to the window and printing to the console the screen array of 0-s and 1-s to see if you have the right data.

Also, it could be a good idea not to rely on proper cpu emulation to test the screen emulation. You could write a program in your main function that loads the necessary registers and part of the memory the registers will point to with your own data, and then call the drawing opcode. It is easier to test stuff by parts.
 

Feliwir

New member
Hello mendus.

the problem should theoretically be on the opcode side, because the collision detection also causes trouble (which doesn't relate to SFML). I watched the disassembly which seems to be correct, but the pong ball and the line in the middle aren't drawn the way they should. I can't really do your second advice, because i am not sure at what point the bug i have does occur the first time :-/
 

GamerCat

New member
Hello mendus.

the problem should theoretically be on the opcode side, because the collision detection also causes trouble (which doesn't relate to SFML). I watched the disassembly which seems to be correct, but the pong ball and the line in the middle aren't drawn the way they should. I can't really do your second advice, because i am not sure at what point the bug i have does occur the first time :-/

Don't really have time to look at your code right now, so here is my interpreter: https://github.com/Vik2015/chip8/blob/dev/chip8.c. It is written in C but hopefully that should not be the problem :). Good luck!
 

2ah

New member
I`ve begun writing Chipsk8, which for now only emulates Chip8. Its main feature is that it detects loops to eliminate flickering and speed issues. Compatibility is low for the moment, with only a few games and demos being executable, with many other games showing only their title screen.
 
Last edited:

2ah

New member
I`ve now updated the emulator to support Schip. The Schip compatibility is around 60%, while Chip8 compatibility has increased to 85%.
 
Last edited:

2ah

New member
The emulator now supports hi-res roms and comes along with a disassembler and some options for tuning the loop detection, as every game is differently structured.
 

Attachments

  • Chipsk8.7z
    525.6 KB · Views: 109

marco9999

New member
First of all, I have made a chip8 emulator with both interpreter and dynamic recompilation (just-in-time) cores... It was an exercise to learn about dynamic recompilation (and it was a lot of work!).

See here:
Interpreter: http://github.com/marco9999/Super8
Dynarec: http://github.com/marco9999/Super8_jitcore

And now a question:
Has anyone else encountered a bug with Space Invaders (INVADERS) rom? (using v0.9 by David Winter).. Seems like it corrupts the stack gradually and finally stops displaying any meaningful data after roughly 13 or 14 rounds of the game (due to running out of stack space on a 16 levels implementation).

I have investigated it a bit, and found that after the game over screen, each time it draws the title screen, it makes a call and puts 0x0245 onto the stack (opcode is 2387 - stack jump to 0x0387).. but the call is never removed from the stack - ie: no 00EE opcode. Im not sure where the 00EE call should happen either.

It happens on both my interpreter and dynarec emulators, and also on this emulator:
http://multigesture.net/articles/how-to-write-an-emulator-chip-8-interpreter/

Also if anyone is interested, I will probably write up an 'introduction to dynamic recompilation'... I know there are already some resources on the internet, but there is no concrete example of one being created, and what ideas are used in creating one (such as a jump table used in mine).

Had to modify urls because of limit... :)
 
Last edited by a moderator:

Top