|
|
| version 1.3, 2004/01/13 05:30:59 | version 1.10, 2011/01/15 18:04:43 |
|---|---|
| Line 8 | Line 8 |
| #include "palettes.h" | #include "palettes.h" |
| BYTE renewal_line[SURFACE_HEIGHT]; | UINT8 renewal_line[SURFACE_HEIGHT]; |
| BYTE np2_tram[SURFACE_SIZE]; | UINT8 np2_tram[SURFACE_SIZE]; |
| BYTE np2_vram[2][SURFACE_SIZE]; | UINT8 np2_vram[2][SURFACE_SIZE]; |
| static void updateallline(UINT32 update) { | static void updateallline(UINT32 update) { |
| Line 44 void scrndraw_changepalette(void) { | Line 44 void scrndraw_changepalette(void) { |
| updateallline(0x80808080); | updateallline(0x80808080); |
| } | } |
| static BYTE rasterdraw(SDRAWFN sdrawfn, SDRAW sdraw, int maxy) { | static UINT8 rasterdraw(SDRAWFN sdrawfn, SDRAW sdraw, int maxy) { |
| RGB32 pal[16]; | RGB32 pal[16]; |
| SINT32 clock; | SINT32 clk; |
| PAL1EVENT *event; | PAL1EVENT *event; |
| PAL1EVENT *eventterm; | PAL1EVENT *eventterm; |
| int nextupdate; | int nextupdate; |
| int y; | int y; |
| TRACEOUT(("rasterdraw: maxy = %d", maxy)); | |
| CopyMemory(pal, palevent.pal, sizeof(pal)); | CopyMemory(pal, palevent.pal, sizeof(pal)); |
| clock = maxy; | clk = maxy; |
| clock += 2; | clk += 2; |
| clock += np2cfg.realpal; | clk += np2cfg.realpal; |
| clock -= 32; | clk -= 32; |
| clock += (gdc.m.para[GDC_SYNC + 5] >> 2) & 0x3f; | clk += (gdc.m.para[GDC_SYNC + 5] >> 2) & 0x3f; |
| clock *= pccore.raster; | clk *= gdc.rasterclock; |
| event = palevent.event; | event = palevent.event; |
| eventterm = event + palevent.events; | eventterm = event + palevent.events; |
| nextupdate = 0; | nextupdate = 0; |
| Line 68 static BYTE rasterdraw(SDRAWFN sdrawfn, | Line 69 static BYTE rasterdraw(SDRAWFN sdrawfn, |
| break; | break; |
| } | } |
| // お弁当はあった? | // お弁当はあった? |
| if (clock < event->clock) { | if (clk < event->clock) { |
| if (!(np2cfg.LCD_MODE & 1)) { | if (!(np2cfg.LCD_MODE & 1)) { |
| pal_makeanalog(pal, 0xffff); | pal_makeanalog(pal, 0xffff); |
| } | } |
| Line 84 static BYTE rasterdraw(SDRAWFN sdrawfn, | Line 85 static BYTE rasterdraw(SDRAWFN sdrawfn, |
| (*sdrawfn)(sdraw, y); | (*sdrawfn)(sdraw, y); |
| nextupdate = y; | nextupdate = y; |
| // お弁当を食べる | // お弁当を食べる |
| while(clock < event->clock) { | while(clk < event->clock) { |
| ((BYTE *)pal)[event->color] = event->value; | ((UINT8 *)pal)[event->color] = event->value; |
| event++; | event++; |
| if (event >= eventterm) { | if (event >= eventterm) { |
| break; | break; |
| } | } |
| } | } |
| } | } |
| clock -= 2 * pccore.raster; | clk -= 2 * gdc.rasterclock; |
| } | } |
| if (y < maxy) { | if (nextupdate < maxy) { |
| if (!(np2cfg.LCD_MODE & 1)) { | if (!(np2cfg.LCD_MODE & 1)) { |
| pal_makeanalog(pal, 0xffff); | pal_makeanalog(pal, 0xffff); |
| } | } |
| Line 123 static BYTE rasterdraw(SDRAWFN sdrawfn, | Line 124 static BYTE rasterdraw(SDRAWFN sdrawfn, |
| } | } |
| } | } |
| BYTE scrndraw_draw(BYTE redraw) { | UINT8 scrndraw_draw(UINT8 redraw) { |
| BYTE ret; | UINT8 ret; |
| const SCRNSURF *surf; | const SCRNSURF *surf; |
| const SDRAWFN *sdrawfn; | const SDRAWFN *sdrawfn; |
| _SDRAW sdraw; | _SDRAW sdraw; |
| BYTE bit; | UINT8 bit; |
| int i; | int i; |
| int height; | |
| if (redraw) { | if (redraw) { |
| updateallline(0x80808080); | updateallline(0x80808080); |
| Line 141 const SDRAWFN *sdrawfn; | Line 143 const SDRAWFN *sdrawfn; |
| if (surf == NULL) { | if (surf == NULL) { |
| goto sddr_exit1; | goto sddr_exit1; |
| } | } |
| #if defined(SUPPORT_PC9821) | |
| if (gdc.analog & 2) { | |
| sdrawfn = sdraw_getproctblex(surf); | |
| } | |
| else | |
| #endif | |
| sdrawfn = sdraw_getproctbl(surf); | sdrawfn = sdraw_getproctbl(surf); |
| if (sdrawfn == NULL) { | if (sdrawfn == NULL) { |
| goto sddr_exit2; | goto sddr_exit2; |
| Line 149 const SDRAWFN *sdrawfn; | Line 157 const SDRAWFN *sdrawfn; |
| bit = 0; | bit = 0; |
| if (gdc.mode1 & 0x80) { // ver0.28 | if (gdc.mode1 & 0x80) { // ver0.28 |
| if (gdcs.grphdisp & 0x80) { | if (gdcs.grphdisp & 0x80) { |
| #if defined(SUPPORT_PC9821) | |
| if ((gdc.analog & 6) == 6) { | |
| bit |= 0x01; | |
| } | |
| else | |
| #endif | |
| bit |= (1 << gdcs.disp); | bit |= (1 << gdcs.disp); |
| } | } |
| if (gdcs.textdisp & 0x80) { | if (gdcs.textdisp & 0x80) { |
| Line 165 const SDRAWFN *sdrawfn; | Line 179 const SDRAWFN *sdrawfn; |
| renewal_line[i] &= ~bit; | renewal_line[i] &= ~bit; |
| } | } |
| } | } |
| if (gdc.mode1 & 0x10) { | height = surf->height; |
| sdrawfn += 4; | do { |
| if (np2cfg.skipline) { | #if defined(SUPPORT_PC9821) |
| if (gdc.analog & 2) { | |
| break; | |
| } | |
| #endif | |
| #if defined(SUPPORT_CRT15KHZ) | |
| if (gdc.crt15khz & 2) { | |
| sdrawfn += 12; | |
| height >>= 1; | |
| break; | |
| } | |
| #endif | |
| if (gdc.mode1 & 0x10) { | |
| sdrawfn += 4; | sdrawfn += 4; |
| if (np2cfg.skipline) { | |
| sdrawfn += 4; | |
| } | |
| } | } |
| } | } while(0); |
| switch(bit & 7) { | switch(bit & 7) { |
| case 1: // grph1 | case 1: // grph1 |
| sdrawfn += 2; | sdrawfn += 2; |
| Line 205 const SDRAWFN *sdrawfn; | Line 234 const SDRAWFN *sdrawfn; |
| sdraw.y = 0; | sdraw.y = 0; |
| sdraw.xalign = surf->xalign; | sdraw.xalign = surf->xalign; |
| sdraw.yalign = surf->yalign; | sdraw.yalign = surf->yalign; |
| if ((!gdc.analog) || (palevent.events >= PALEVENTMAX)) { | if (((gdc.analog & 3) != 1) || (palevent.events >= PALEVENTMAX)) { |
| (*(*sdrawfn))(&sdraw, surf->height); | (*(*sdrawfn))(&sdraw, height); |
| } | } |
| else { | else { |
| ret = rasterdraw(*sdrawfn, &sdraw, surf->height); | ret = rasterdraw(*sdrawfn, &sdraw, height); |
| } | } |
| sddr_exit2: | sddr_exit2: |