What's new

Chip 8

hap

New member
blueshogun96: I had a quick look, and I hope this is the main glitch, in CPU.c:

Code:
	case 0x0D:
		{
			switch(Op&0x00FF)
	...

change to:

	case 0x0D:
		{
			switch(Op&0x000F)
	...

Also, you've made a small mistake in the math addition opcode: wrong carry calculation like shangt did above.
 

blueshogun96

A lowdown dirty shame
gunder said:
Hello all, I've been gone for a while due to some real life problems. I'm back now and I want to start working on my Chip8 emu again. I searched through all 58 pages of this thread looking to see what rom most of you got working first but I wasn't able to find anything. Do any of you have any suggestions about which would be a good one to try and get working first?

-gunder
I meant to reply to your post last week :(

Anyway, welcome back gunder :) I personally reccomend not focusing on a certain rom when first building your emu. Try to make your core as complete and as compatible as possible. If you have trouble with a rom after building your emu, then try to inspect the problem you have with that particular rom. But if you must know, I'd say that hidden is the easiest rom to emulate IMO. Good luck on your road to emu author. We are here for you :bouncy:

Wow shogun your emu is having some troubles. You should keep working at it dont leave it in that state please for its sake. :canadian:
Thanks for the words of encouragement, I'm not giving up on my emu that easy. :p I let my ChipAint project sit around too long to give up on it now. :saint:

hap said:
blueshogun96: I had a quick look, and I hope this is the main glitch, in CPU.c:

Code:
	case 0x0D:
		{
			switch(Op&0x00FF)
	...

change to:

	case 0x0D:
		{
			switch(Op&0x000F)
	...

Also, you've made a small mistake in the math addition opcode: wrong carry calculation like shangt did above.
Hmmm, I didn't notice that, thank you sir, I'll apply the fixes asap and I'll see if this fixes the problem.

EDIT: I tried the fixes you reccomended and i get the same thing :( Maybe I just need to re write my core. I made a big mistake writing most of it then finishing it the following month. This time I'll try to do it all on one day. Thanks though.
 
Last edited:

hap

New member
Why rewrite ? The chance is big you'll make some same mistakes again, and new ones.

I had another quick look:
8xxx: no default in the switch
8xx6: carry is wrong
8xxe: opcode isn't there
cxxx: and, not modulo
dxxx: 00 and default should be switched around!! also, there's no break in the default case
exxx: no default in the switch
fxxx: no default in the switch
fx55 and fx65 will probably overflow and crash the emu, since you're using the contents of the register instead of the register number for the loop
 

Doomulation

?????????????????????????
gunder said:
Hello all, I've been gone for a while due to some real life problems. I'm back now and I want to start working on my Chip8 emu again. I searched through all 58 pages of this thread looking to see what rom most of you got working first but I wasn't able to find anything. Do any of you have any suggestions about which would be a good one to try and get working first?

-gunder
Well, I think I tried pong first. Doesn't matter really, though, I think... as long as it's chip8 and not super chip 8.

so do you know of good docs because all docs must be inaccurate including doomulations docs. even though at zophar's domain his emulator doesnt have those errors! SO, i downloaded the Chuit source code from zophar and his opcodes.cpp is empty!! what is this a monopoly
Then if something is wrong, VERIFY IT, and if it is wrong, then please TELL ME and I'll fix the error asap.
 

Doomulation

?????????????????????????
shangt said:
煩いスウェーデン人の宦官。。。静かにして。後で説明しますね。それをフィックスができるか。
Right, well, can't say I understood anything of that.
 

ShizZy

Emulator Developer
Hello all, I've been gone for a while due to some real life problems. I'm back now and I want to start working on my Chip8 emu again. I searched through all 58 pages of this thread looking to see what rom most of you got working first but I wasn't able to find anything. Do any of you have any suggestions about which would be a good one to try and get working first?
Glad to have you back:bouncy: First one that worked for me was the Blitz demo, it's fairly easy to emulate I think.
 

XTale

New member
I still have problem with colission detection:
- the ball doesn't colide with the paddles in pong
- the ball doesn't collide with the paddle in brix

on the other hand, it collides without problems with the stones and removes them in brix.

Anyone an idea what I'm doing wrong (I just attached the cpu-core if anyone wants to take a look).
 

hap

New member
Probably because the carry is generated wrong with subtraction (>=0 instead of <255).

A different approach would be.. This looks funky, but it should work:
Code:
unsigned char c1 = V[xpos].read();
unsigned char c2 = ~V[ypos].read();
c2++;
if ( (c1+c2)>255 )
     V[0xF].write(0x1);
else V[0xF].write(0x0);
V[xpos].write((c1+c2)&0xFF);
 

XTale

New member
Thanks - it was really the sub.
A not so funky looking approach:
Code:
unsigned char c1 = V[xpos].read();
unsigned char c2 = V[ypos].read();
if ( (c1-c2)<0 )
    V[0xF].write(0x0);
else V[0xF].write(0x1);
V[xpos].write((c1-c2)&0xFF);

I just had to replace the (c1-c2)<255 with (c1-c2)<0 (<255 was useless and a copy and paste error from the ADD op i think) ;)

Thanks for having a look :)
 

Doomulation

?????????????????????????
shangt said:
i apologize. i saw your signature and i think you may speak my native language called 日本語 ((nihongo)) ((japanese)) . it could make to communicate with you easier.
Ah, I know of some japanese, but I still can't read kanji (and yes, I know nihongo means japanese ;)).
 

Sdw

New member
gunder said:
Hello all, I've been gone for a while due to some real life problems. I'm back now and I want to start working on my Chip8 emu again. I searched through all 58 pages of this thread looking to see what rom most of you got working first but I wasn't able to find anything. Do any of you have any suggestions about which would be a good one to try and get working first?

-gunder

For me I started with "MAZE", probably the shortest/simplest CHIP8 program available...
 

XTale

New member
Well, the problem is that games like tetris, brix or pong work without any errors - so the painting code can't be totally wrong.
Others like maze or merlin just produce wired output.
Merlin also tries opcodes like f080 and f0f0 beside a bunch of 0000 and 05f2... strange

edit: now I see whats wrong with maze: I dont emulate schip stuff yet
 
Last edited:

Doomulation

?????????????????????????
Yes, some are super chip 8 opcodes, and besides that, you should check that the game isn't jumping to invalid addresses. There is an opcode that is jump to XXX + V0, which means that you might want to check your math opcodes that they put the right value into V0 and jump to the correct address later. That is, if it IS executing invalid opcodes.
 

XTale

New member
Boring lectures sometimes can be usefull ;)
Just found time to implement part of the SCHIP stuff.

Now even more games are working :)

Question about scrolling in Chip8 mode:
What if the number is odd? whats meant by "the scroll will be performed with a half-pixel shift" in the winter doc?
If I scan a "half line" the image will be totally fucked up it think...
 
Last edited:

refraction

PCSX2 Coder
the way i implemented SChip8 is i made Schip8 graphics the normal, so in Chip8 mode it actually made 4 pixels for each pixel (thats 2 across, 2 down) so the 64x32 res fit into 128x64, then you arent messing about with halfs, you can then work in singles and doubles which is much more manageable
 

Top