mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-08 12:45:26 -05:00
Rockboy: adapted to colour LCD (but no colours for gameboy color games yet). Some cleanup; killed a ton of TABs.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7915 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
32877021a5
commit
59825952f3
4 changed files with 452 additions and 455 deletions
|
|
@ -16,10 +16,12 @@ struct scan
|
|||
{
|
||||
int bg[64];
|
||||
int wnd[64];
|
||||
#if LCD_DEPTH == 2
|
||||
byte buf[4][256];
|
||||
#else
|
||||
#if LCD_DEPTH == 1
|
||||
byte buf[8][256];
|
||||
#elif LCD_DEPTH == 2
|
||||
byte buf[4][256];
|
||||
#elif LCD_DEPTH > 4
|
||||
byte buf[1][256];
|
||||
#endif
|
||||
byte pal1[128];
|
||||
un16 pal2[64];
|
||||
|
|
|
|||
|
|
@ -853,6 +853,7 @@ void lcd_refreshline(void)
|
|||
if (!(R_LCDC & 0x80))
|
||||
return; /* should not happen... */
|
||||
|
||||
#if LCD_HEIGHT < 144
|
||||
if ( (fb.mode==0&&(R_LY >= 128)) ||
|
||||
(fb.mode==1&&(R_LY < 16)) ||
|
||||
(fb.mode==2&&(R_LY<8||R_LY>=136)) ||
|
||||
|
|
@ -863,6 +864,7 @@ void lcd_refreshline(void)
|
|||
#endif
|
||||
)
|
||||
return;
|
||||
#endif
|
||||
|
||||
updatepatpix();
|
||||
|
||||
|
|
@ -901,25 +903,25 @@ void lcd_refreshline(void)
|
|||
recolor(BUF+WX, 0x04, 160-WX);
|
||||
}
|
||||
spr_scan();
|
||||
#if LCD_DEPTH == 2
|
||||
if (scanline_ind == 3)
|
||||
#else
|
||||
#if LCD_DEPTH == 1
|
||||
if (scanline_ind == 7)
|
||||
#elif LCD_DEPTH == 2
|
||||
if (scanline_ind == 3)
|
||||
#endif
|
||||
{
|
||||
#if LCD_HEIGHT < 144
|
||||
if(fb.mode!=3)
|
||||
vid_update(L);
|
||||
else
|
||||
vid_update(L-((int)(L/9)));
|
||||
}
|
||||
#if LCD_HEIGHT == 64
|
||||
scanline_ind = (scanline_ind+1) % 8;
|
||||
#else
|
||||
#if LCD_DEPTH == 2
|
||||
scanline_ind = (scanline_ind+1) % 4;
|
||||
#else
|
||||
scanline_ind = (scanline_ind+1) % 8;
|
||||
vid_update(L);
|
||||
#endif
|
||||
}
|
||||
#if LCD_DEPTH == 1
|
||||
scanline_ind = (scanline_ind+1) % 8;
|
||||
#elif LCD_DEPTH == 2
|
||||
scanline_ind = (scanline_ind+1) % 4;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -84,6 +84,11 @@ int gnuboy_main(char *rom)
|
|||
PUTS("Emu reset");
|
||||
emu_reset();
|
||||
PUTS("Emu run");
|
||||
#if (LCD_HEIGHT > 144) || (LCD_WIDTH > 160)
|
||||
rb->lcd_clear_display();
|
||||
rb->lcd_drawrect((LCD_WIDTH-160)/2-1, (LCD_HEIGHT-144)/2-1, 162, 146);
|
||||
rb->lcd_update();
|
||||
#endif
|
||||
emu_run();
|
||||
|
||||
// never reached
|
||||
|
|
|
|||
|
|
@ -36,12 +36,9 @@ rcvar_t vid_exports[] =
|
|||
};
|
||||
|
||||
struct fb fb;
|
||||
byte *video_base_buf;
|
||||
|
||||
extern int debug_trace;
|
||||
|
||||
static byte frameb[145][160];
|
||||
|
||||
void vid_settitle(char *title)
|
||||
{
|
||||
rb->splash(HZ*2, true, title);
|
||||
|
|
@ -124,7 +121,7 @@ void ev_poll(void)
|
|||
ev_postevent(&ev);
|
||||
}
|
||||
if(pressed & ROCKBOY_MENU) {
|
||||
#if CONFIG_KEYPAD == IRIVER_H100_PAD
|
||||
#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)
|
||||
if (do_user_menu() == USER_MENU_QUIT)
|
||||
#endif
|
||||
{
|
||||
|
|
@ -156,15 +153,20 @@ void vid_init(void)
|
|||
fb.pitch=160;
|
||||
fb.enabled=1;
|
||||
fb.dirty=0;
|
||||
video_base_buf=fb.ptr=(byte *)frameb;
|
||||
fb.mode=3;
|
||||
}
|
||||
|
||||
#ifdef HAVE_LCD_COLOR
|
||||
static const fb_data my_pal[4] = {
|
||||
LCD_WHITE, LCD_LIGHTGRAY, LCD_DARKGRAY, LCD_BLACK
|
||||
};
|
||||
#endif
|
||||
|
||||
void vid_update(int scanline)
|
||||
{
|
||||
int cnt=0,scanline_remapped;
|
||||
byte *frameb;
|
||||
#if LCD_HEIGHT == 64 /* Archos */
|
||||
fb_data *frameb;
|
||||
#if (LCD_HEIGHT == 64) && (LCD_DEPTH == 1) /* Archos */
|
||||
int balance = 0;
|
||||
if (fb.mode==1)
|
||||
scanline-=16;
|
||||
|
|
@ -176,18 +178,7 @@ void vid_update(int scanline)
|
|||
balance += LCD_WIDTH;
|
||||
if (balance > 0)
|
||||
{
|
||||
#ifdef SIMULATOR /* simulator uses C */
|
||||
register unsigned scrbyte = 0;
|
||||
if (scan.buf[0][cnt] & 0x02) scrbyte |= 0x01;
|
||||
if (scan.buf[1][cnt] & 0x02) scrbyte |= 0x02;
|
||||
if (scan.buf[2][cnt] & 0x02) scrbyte |= 0x04;
|
||||
if (scan.buf[3][cnt] & 0x02) scrbyte |= 0x08;
|
||||
if (scan.buf[4][cnt] & 0x02) scrbyte |= 0x10;
|
||||
if (scan.buf[5][cnt] & 0x02) scrbyte |= 0x20;
|
||||
if (scan.buf[6][cnt] & 0x02) scrbyte |= 0x40;
|
||||
if (scan.buf[7][cnt] & 0x02) scrbyte |= 0x80;
|
||||
*(frameb++) = scrbyte;
|
||||
#else
|
||||
#if (CONFIG_CPU == SH7034) && !defined(SIMULATOR)
|
||||
asm volatile (
|
||||
"mov.b @%0,r0 \n"
|
||||
"add %1,%0 \n"
|
||||
|
|
@ -234,32 +225,6 @@ void vid_update(int scanline)
|
|||
: /* clobbers */
|
||||
"r0", "r1"
|
||||
);
|
||||
#endif
|
||||
balance -= 160;
|
||||
}
|
||||
cnt ++;
|
||||
}
|
||||
rb->lcd_update_rect(0, (scanline/2) & ~7, LCD_WIDTH, 8);
|
||||
#else /* LCD_HEIGHT != 64, iRiver */
|
||||
if (fb.mode==1)
|
||||
scanline-=16;
|
||||
else if (fb.mode==2)
|
||||
scanline-=8;
|
||||
#if LCD_DEPTH == 2
|
||||
scanline_remapped = scanline / 4;
|
||||
#else
|
||||
scanline_remapped = scanline / 8;
|
||||
#endif
|
||||
frameb = rb->lcd_framebuffer + scanline_remapped * LCD_WIDTH;
|
||||
while (cnt < 160) {
|
||||
#if LCD_DEPTH == 2
|
||||
*(frameb++) = (scan.buf[0][cnt]&0x3) |
|
||||
((scan.buf[1][cnt]&0x3)<<2) |
|
||||
((scan.buf[2][cnt]&0x3)<<4) |
|
||||
((scan.buf[3][cnt]&0x3)<<6);
|
||||
cnt++;
|
||||
}
|
||||
rb->lcd_update_rect(0, scanline & ~3, LCD_WIDTH, 4);
|
||||
#else
|
||||
register unsigned scrbyte = 0;
|
||||
if (scan.buf[0][cnt] & 0x02) scrbyte |= 0x01;
|
||||
|
|
@ -271,10 +236,33 @@ void vid_update(int scanline)
|
|||
if (scan.buf[6][cnt] & 0x02) scrbyte |= 0x40;
|
||||
if (scan.buf[7][cnt] & 0x02) scrbyte |= 0x80;
|
||||
*(frameb++) = scrbyte;
|
||||
#endif
|
||||
balance -= 160;
|
||||
}
|
||||
cnt ++;
|
||||
}
|
||||
rb->lcd_update_rect(0, scanline & ~7, LCD_WIDTH, 8);
|
||||
#endif /* LCD_DEPTH */
|
||||
rb->lcd_update_rect(0, (scanline/2) & ~7, LCD_WIDTH, 8);
|
||||
#elif (LCD_HEIGHT == 128) && (LCD_DEPTH == 2) /* iriver H1x0 */
|
||||
if (fb.mode==1)
|
||||
scanline-=16;
|
||||
else if (fb.mode==2)
|
||||
scanline-=8;
|
||||
scanline_remapped = scanline / 4;
|
||||
frameb = rb->lcd_framebuffer + scanline_remapped * LCD_WIDTH;
|
||||
while (cnt < 160) {
|
||||
*(frameb++) = (scan.buf[0][cnt]&0x3) |
|
||||
((scan.buf[1][cnt]&0x3)<<2) |
|
||||
((scan.buf[2][cnt]&0x3)<<4) |
|
||||
((scan.buf[3][cnt]&0x3)<<6);
|
||||
cnt++;
|
||||
}
|
||||
rb->lcd_update_rect(0, scanline & ~3, LCD_WIDTH, 4);
|
||||
#elif (LCD_HEIGHT >= 144) && defined(HAVE_LCD_COLOR) /* iriver H3x0, colour iPod */
|
||||
scanline_remapped = scanline + (LCD_HEIGHT-144)/2;
|
||||
frameb = rb->lcd_framebuffer + scanline_remapped * LCD_WIDTH + (LCD_WIDTH-160)/2;
|
||||
while (cnt < 160)
|
||||
*frameb++ = my_pal[scan.buf[0][cnt++]&0x3];
|
||||
rb->lcd_update_rect((LCD_WIDTH-160)/2, scanline_remapped, 160, 1);
|
||||
#endif /* LCD_HEIGHT */
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue