diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/plugins/chip8.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/apps/plugins/chip8.c b/apps/plugins/chip8.c index 0be5e10436..585295c405 100644 --- a/apps/plugins/chip8.c +++ b/apps/plugins/chip8.c | |||
@@ -24,8 +24,7 @@ | |||
24 | #ifdef HAVE_LCD_BITMAP | 24 | #ifdef HAVE_LCD_BITMAP |
25 | 25 | ||
26 | static struct plugin_api* rb; /* here is a global api struct pointer */ | 26 | static struct plugin_api* rb; /* here is a global api struct pointer */ |
27 | /* plugins have no framebuffer access, we need a copy */ | 27 | unsigned char lcd_framebuf[8][64]; /* frame buffer in hardware fomat */ |
28 | unsigned char lcd_framebuf[8][64]; | ||
29 | 28 | ||
30 | typedef unsigned char byte; /* sizeof(byte)==1 */ | 29 | typedef unsigned char byte; /* sizeof(byte)==1 */ |
31 | typedef unsigned short word; /* sizeof(word)>=2 */ | 30 | typedef unsigned short word; /* sizeof(word)>=2 */ |
@@ -344,10 +343,11 @@ static void chip8_update_display(void) | |||
344 | { | 343 | { |
345 | int x,y,i; | 344 | int x,y,i; |
346 | byte w; | 345 | byte w; |
346 | byte* row; | ||
347 | 347 | ||
348 | // lcd_clear_display(); | ||
349 | for (y=0;y<=7;++y) /* 32 rows */ | 348 | for (y=0;y<=7;++y) /* 32 rows */ |
350 | { | 349 | { |
350 | row = lcd_framebuf[y]; | ||
351 | for (x=0;x<64;++x) /* 64 columns */ | 351 | for (x=0;x<64;++x) /* 64 columns */ |
352 | { | 352 | { |
353 | w = 0; | 353 | w = 0; |
@@ -358,19 +358,11 @@ static void chip8_update_display(void) | |||
358 | { | 358 | { |
359 | w += 128+64; | 359 | w += 128+64; |
360 | } | 360 | } |
361 | lcd_framebuf[y][x] = w; | ||
362 | } | 361 | } |
362 | *row++ = w; | ||
363 | } | 363 | } |
364 | } | 364 | } |
365 | rb->lcd_bitmap(lcd_framebuf[0], 24, 0*8, 64, 8, true); | 365 | rb->lcd_blit(lcd_framebuf[0], 24, 0, 64, 8, 64); |
366 | rb->lcd_bitmap(lcd_framebuf[1], 24, 1*8, 64, 8, true); | ||
367 | rb->lcd_bitmap(lcd_framebuf[2], 24, 2*8, 64, 8, true); | ||
368 | rb->lcd_bitmap(lcd_framebuf[3], 24, 3*8, 64, 8, true); | ||
369 | rb->lcd_bitmap(lcd_framebuf[4], 24, 4*8, 64, 8, true); | ||
370 | rb->lcd_bitmap(lcd_framebuf[5], 24, 5*8, 64, 8, true); | ||
371 | rb->lcd_bitmap(lcd_framebuf[6], 24, 6*8, 64, 8, true); | ||
372 | rb->lcd_bitmap(lcd_framebuf[7], 24, 7*8, 64, 8, true); | ||
373 | rb->lcd_update_rect(24,0,64,64); | ||
374 | } | 366 | } |
375 | 367 | ||
376 | 368 | ||
@@ -432,7 +424,7 @@ static void chip8_execute(void) | |||
432 | /* Update the machine status */ | 424 | /* Update the machine status */ |
433 | chip8_update_display(); | 425 | chip8_update_display(); |
434 | chip8_keyboard(); | 426 | chip8_keyboard(); |
435 | rb->sleep(HZ/70); /* ca. 70Hz */ | 427 | rb->yield(); /* we should regulate the speed by timer query, sleep/yield */ |
436 | 428 | ||
437 | for (i=key_pressed=0;i<16;++i) /* check if a key was first */ | 429 | for (i=key_pressed=0;i<16;++i) /* check if a key was first */ |
438 | if (chip8_keys[i]) key_pressed=i+1; /* pressed */ | 430 | if (chip8_keys[i]) key_pressed=i+1; /* pressed */ |