--- np2/vram/scrndraw.c 2004/02/09 20:39:39 1.5 +++ np2/vram/scrndraw.c 2005/02/07 14:46:13 1.8 @@ -8,9 +8,9 @@ #include "palettes.h" - BYTE renewal_line[SURFACE_HEIGHT]; - BYTE np2_tram[SURFACE_SIZE]; - BYTE np2_vram[2][SURFACE_SIZE]; + UINT8 renewal_line[SURFACE_HEIGHT]; + UINT8 np2_tram[SURFACE_SIZE]; + UINT8 np2_vram[2][SURFACE_SIZE]; static void updateallline(UINT32 update) { @@ -44,7 +44,7 @@ void scrndraw_changepalette(void) { updateallline(0x80808080); } -static BYTE rasterdraw(SDRAWFN sdrawfn, SDRAW sdraw, int maxy) { +static UINT8 rasterdraw(SDRAWFN sdrawfn, SDRAW sdraw, int maxy) { RGB32 pal[16]; SINT32 clock; @@ -53,6 +53,7 @@ static BYTE rasterdraw(SDRAWFN sdrawfn, int nextupdate; int y; + TRACEOUT(("rasterdraw: maxy = %d", maxy)); CopyMemory(pal, palevent.pal, sizeof(pal)); clock = maxy; clock += 2; @@ -85,7 +86,7 @@ static BYTE rasterdraw(SDRAWFN sdrawfn, nextupdate = y; // お弁当を食べる while(clock < event->clock) { - ((BYTE *)pal)[event->color] = event->value; + ((UINT8 *)pal)[event->color] = event->value; event++; if (event >= eventterm) { break; @@ -94,7 +95,7 @@ static BYTE rasterdraw(SDRAWFN sdrawfn, } clock -= 2 * gdc.rasterclock; } - if (y < maxy) { + if (nextupdate < maxy) { if (!(np2cfg.LCD_MODE & 1)) { pal_makeanalog(pal, 0xffff); } @@ -123,13 +124,13 @@ static BYTE rasterdraw(SDRAWFN sdrawfn, } } -BYTE scrndraw_draw(BYTE redraw) { +UINT8 scrndraw_draw(UINT8 redraw) { - BYTE ret; + UINT8 ret; const SCRNSURF *surf; const SDRAWFN *sdrawfn; _SDRAW sdraw; - BYTE bit; + UINT8 bit; int i; int height; @@ -142,6 +143,12 @@ const SDRAWFN *sdrawfn; if (surf == NULL) { goto sddr_exit1; } +#if defined(SUPPORT_PC9821) + if (gdc.analog & 2) { + sdrawfn = sdraw_getproctblex(surf); + } + else +#endif sdrawfn = sdraw_getproctbl(surf); if (sdrawfn == NULL) { goto sddr_exit2; @@ -149,6 +156,12 @@ const SDRAWFN *sdrawfn; bit = 0; if (gdc.mode1 & 0x80) { // ver0.28 +#if defined(SUPPORT_PC9821) + if ((gdc.analog & 6) == 6) { + bit |= 0x01; + } + else +#endif if (gdcs.grphdisp & 0x80) { bit |= (1 << gdcs.disp); } @@ -167,12 +180,18 @@ const SDRAWFN *sdrawfn; } } height = surf->height; + do { +#if defined(SUPPORT_PC9821) + if (gdc.analog & 2) { + break; + } +#endif #if defined(SUPPORT_CRT15KHZ) - if (gdc.crt15khz & 2) { - sdrawfn += 12; - height >>= 1; - } - else { + if (gdc.crt15khz & 2) { + sdrawfn += 12; + height >>= 1; + break; + } #endif if (gdc.mode1 & 0x10) { sdrawfn += 4; @@ -180,9 +199,7 @@ const SDRAWFN *sdrawfn; sdrawfn += 4; } } -#if defined(SUPPORT_CRT15KHZ) - } -#endif + } while(0); switch(bit & 7) { case 1: // grph1 sdrawfn += 2; @@ -217,7 +234,7 @@ const SDRAWFN *sdrawfn; sdraw.y = 0; sdraw.xalign = surf->xalign; sdraw.yalign = surf->yalign; - if ((!gdc.analog) || (palevent.events >= PALEVENTMAX)) { + if (((gdc.analog & 3) != 1) || (palevent.events >= PALEVENTMAX)) { (*(*sdrawfn))(&sdraw, height); } else {