What's new

Chip 8

bjz

New member
this pic shows off the 3d alot more

invaders.jpg
 

refraction

PCSX2 Coder
nice job bjz :) thats kinda what im aiming for, but without the evil blue background.


see youve come across the same bug (in every way) i had with the scrolling writing on the space invaders title screen! i cant remember how i fixed it now either!
 

bjz

New member
refraction said:
nice job bjz :) thats kinda what im aiming for, but without the evil blue background.


see youve come across the same bug (in every way) i had with the scrolling writing on the space invaders title screen! i cant remember how i fixed it now either!

nope got that fixed up yesterday by aprentice i didnt implement till now, text works now.
 

refraction

PCSX2 Coder
ahh wicked mate! i see what you mean, n that camera could get confusing! hope that was just you showing off the moveable camera :p

one way of slowing it down would to be just stick in an empty loop for example

for (int i = 0, i < 1000, i++){
}

either that or put in some code to detect the processor speed and make it only do so many operations per cpu clock cycle. think the docs say the chip8 system does 60 cycles per second.

say on a 2ghz system that 2000/60 = 33.3
so 1 operation per 33 mhz
 

LXS

New member
Or just add a little counter allowing a new operation to be performed each CHip8 real clock tick.
 

Doomulation

?????????????????????????
We don't know how much each time each opcode takes. So emulating speed is a little tricky. I guess.
 

refraction

PCSX2 Coder
well with interpreters, on every op code call it cycles through the list of opcodes till it finds the one it wants. i suppose the only (and best) way to do it is put the code in where it tells it to interpret the next op code, i spose that would be classed as a chip8 cycle.
 

LXS

New member
I've read once opcodes timing for Chip8, and they were probably wrong cause I remember they said opcode timing was a constant...
 

refraction

PCSX2 Coder
op code timing hmm, there is no certain amount of cycles for a chip8 code, far as i know theyre all 1 cycle and the system does 60 cycles per second.
 

LXS

New member
Yes I've read that, the only thing to do in the interpreters is to execute each 1000/60 ms a instruction. Chip8 was my first experience in emulation programming :)
 

euphoria

Emutalk Member
refraction said:
well with interpreters, on every op code call it cycles through the list of opcodes till it finds the one it wants. i suppose the only (and best) way to do it is put the code in where it tells it to interpret the next op code, i spose that would be classed as a chip8 cycle.
That it cycles through the list of opcodes sounds bad. If you're doing it with if-else-statements, you should consider other options like function pointer tables. Because if you do it with if-else then the last instruction in your list takes the longest time to find and non-constant values in instruction calls are no good. Maybe a switch-case could work better, because function pointers are little obscure, if not familiar with them.
But i don't think that all this matters for performance in chip8.
 

euphoria

Emutalk Member
LXS said:
Moreover, switch case *ARE* if-else if-else statements...
I think that if the compiler is smart enough and it is possible it converts switch-cases to jump tables, but generally you're right.

sorry about the double post, little problems with my connection/browser, i thought that the message was never posted...
 

aprentice

Moderator
euphoria said:
I think that if the compiler is smart enough and it is possible it converts switch-cases to jump tables, but generally you're right.

sorry about the double post, little problems with my connection/browser, i thought that the message was never posted...

nope, i havent seen a compiler that does that yet :p
 

Top