Pages

Monday, May 31, 2010

Saturday, February 6, 2010

Progress on Chip 8 to date.


So, where are we at? Well, I'm up to version 15 for the Processing version of the Chip 8 emulator/debugger. It's slow and tiny but has taught me a lot about the attributes of Chip 8, Java, Processing, version control and perseverance.
Still have to work out what chip 8 thinks it's getting when keys are pressed. Pretty sure it looks for a 0x01 when a "1" is pressed and not 0x31 that I programmed it with.Think it's time this phase is finished and put to bed so then I can start on the Arduino version.

Wednesday, January 6, 2010

Finished finally version 0.1 of Processing Chip8


By attacking one instruction, sometimes two each day, I've finally got all the Chip 8 instructions working ok in the slow test version of the Chip8 emulator written in the excellent but quirky language, Processing. This was done over the Xmas break where I ate and drank too much so I'm quite pleased I stuck at it. Now I've got to get the real programs running in the interpreter I've made. There's heaps on the 'net and I thought I'd start off with the old favourite, Pong. That's tomorrow. Maybe the day after as it's fully social tomorrow. Above is a screen shot of a project coming to a close. At least that phase.

Saturday, December 12, 2009



Well I finally got the sprites to work OK. At least the little play I've had today. Problem has been how to get the rules for black-white dots for the four different cases and just what is a collision. The key is to concentrate on the white dots in the sprite, that is the 1's. A 1 onto a 1 gives a zero, a black dot and a 1 onto a 0 gives a white dot. The others stay the same. I don't have an EXOR function in the Processing language so had to bit-twiddle.

Here's some code that took a while:

void drawSpriteByte2(int x, int y, byte sprite) { // put byte at scrn x,y
int v15 =0, pixIndex=0, change=0;
color colorOfPixel,newPix=black;
loadPixels();

for (int i = 0;i<8;i++) {
change=0; //don't flick pixels unless we have to
pixIndex = y*width+x+i; //Might have to change to long later
colorOfPixel=pixels[pixIndex]; //current pixel, might change
if((colorOfPixel == black) && (bit(7-i,sprite) == 1)) {
newPix = white; change = 1;
// println("Drawn a white dot on black x,y pixPos "+ x + " " +y +" " +y*width+x+i+ " "+ pixIndex);
}
if((colorOfPixel == white) && (bit(7-i,sprite) == 1)) {
newPix = black;
change = 1; v15 =1;
// println("Drawn a black dot on black x,y pixPos ");
// v15 = 1;
}
if(change==1){
pixels[pixIndex] = newPix;
// println("Putting in colour-->at "+hex(newPix)+" "+ pixIndex);
}
}
//pixels[pixIndex] = white;
//pixels[1930] = white;
updatePixels();
}

void test_drawSpriteByte2() {
drawSpriteByte2(28,25,byte(0x22));
}

Thursday, December 10, 2009


Had another go at some old-fashioned Chip8 programs today. Tried to get chip8.exe emulator going again. Never had much luck in the past. This time I managed to get screens like the one above. I never really saw that much of the screen as it was a buzzing, jerky mess with not much response to key presses. Still, considering the way computers have changed since 1998 it's amazing to get something almost working.

Wednesday, December 9, 2009

First posting


<

Where's all the news about Chip8? Someone's just got to address this.