What's new

Chip 8

bgilb

New member
Okay i guess a few of the problems you listed are solved.. but... now it draws this:
(each dot is 1 pixel turned on)
Code:
.. .. .
 ... .
(kinda looks like `UV)

http://www.rafb.net/paste/results/CXlLxl35.html

oh and that +8 and +40 are because the Java GUI doesn't take account the title bar and the little sidebars so i have to move the whole screen over a little or else it would get covered up
 
Last edited:

bcrew1375

New member
Your x and y are reversed! :p Y goes to 31, X goes to 63. Instead of "y+(x*64)" you should have "(y*64)+x" Also, you should have "y<32", not "y<31", and "x<64", not "x<63" That's going to slice a pixel off the bottom and the right.
 

refraction

PCSX2 Coder
bcrew1375 said:
Your x and y are reversed! :p Y goes to 31, X goes to 63. Instead of "y+(x*64)" you should have "(y*64)+x" Also, you should have "y<32", not "y<31", and "x<64", not "x<63" That's going to slice a pixel off the bottom and the right.


you wont believe the errors hes had, ive sorted most of them out with him over irc, but he needs to sort his loading routine, its doing it as text or something, cos when it reaches a position of the file with 0x00 in, it skips it and just loads the next bit instead ;p

stupid java, explains his dodgy graphical bug anyway :p
 

mikeshoup

New member
Quick question,
I'm writing a Chip8 emu in Python (yes, fun, I know). Now, Python can't limit integers to just a single byte. So, with instructions like Add, you have the potential of exceeding 255. I'm assuming this will cause problems. So, I need to 'wrap around' 255. Would the following code work?
Code:
memory.V[X] &= 0x00FF
Also, will the same code work for the 0x8ry5 opcode if the result would be negative? Or how should I do that?
 
Last edited:

bcrew1375

New member
Yes, that should work just fine for both of them. And yes, it WILL cause problems if you do not wrap them.

Congratulations on fixing your bug, bgilb :D. (BTW, that server doesn't allow remote linking :p).
 
Last edited:

refraction

PCSX2 Coder
its asking for the location in memory of a font given in the register.

conveniently the chip8 fonts are only 0-F, so whatever is in the register is the font it wants.

i gave you the hex codes for the fonts yesterday, you just have to write them somewhere in the chip8 memory (i suggest starting at the address 0x0) before you start the emulation, so you can call them when you need them. The hex fonts will require 4 spaces in memory each, so you will have to do like

I = register[x] * 4;
 
Last edited:

bgilb

New member
Thanks, yea i found some. Although somethings iffy about them because on BLITZ the level says "29"

but on pong the scores say 0, but also on .. merlin the title is right.. wierd..

Also im not sure how the delay timers are supposed to act because, Pong has a delay right before it supposed to start and its supposed to count down then start or something, but it just counts down forever..
 

refraction

PCSX2 Coder
at the beginning of your emulation code just after you fetch the opcode from memory do

if(delaytimer > 0) delaytimer--;
if(soundtimer > 0) soundtimer--;

simple as that
 

refraction

PCSX2 Coder
a carry is when the result of an equasion is greater than 255, thats when a carry occurs, it can also be used on bit shifts to store the bit that will be pushed out of the register (depending on the side its comming out of)

the keyboard stuff, your best off having a BOOL array with each of the keys, so it can check the array, if it returns True the key is pressed, if its false, then obviously it isnt.

dont know how youd do controls in java, i used SDL for mine.
 

bgilb

New member
got it, the only thing now is to iron out bugs, im getting alot of exceptions when drawing stuff, the numbers that come in are too big for the screen array, so it crashes. Not sure what opcode is causing this ..

heres a picture of the redraw problem:
http://lockandload.8m.com/chip8-7.png

(Copy and paste to your browser or else you'll get remote linking error)
 
Last edited:

Top