| version 1.2, 2004/08/05 04:53:15 | version 1.7, 2004/08/08 16:39:03 | 
| Line 3 | Line 3 | 
 | #include        "pccore.h" | #include        "pccore.h" | 
 | #include        "iocore.h" | #include        "iocore.h" | 
 | #include        "vram.h" | #include        "vram.h" | 
 | #include        "draw.h" |  | 
 | #include        "palettes.h" | #include        "palettes.h" | 
 |  | #include        "makescrn.h" | 
 |  |  | 
 |  |  | 
| BYTE    crtc_TEXTPAL[8]; | static const UINT8 defpaltext[8] = { | 
| WORD    crtc_GRPHPAL[2][64]; |  | 
| WORD    crtc_PAL4096[4096]; |  | 
|  |  | 
| static const UINT8 def_TEXTPAL[8] = { |  | 
 | 0x00, 0x03, 0x0c, 0x0f, 0x30, 0x33, 0x3c, 0x3f}; | 0x00, 0x03, 0x0c, 0x0f, 0x30, 0x33, 0x3c, 0x3f}; | 
| static const UINT16 def_GRPHPAL[64] = { |  | 
|  | static const UINT16 defpalgrph[64] = { | 
 | 0x000, 0x00a, 0x0a0, 0x0aa, 0xa00, 0xa0a, 0xaa0, 0xaaa, | 0x000, 0x00a, 0x0a0, 0x0aa, 0xa00, 0xa0a, 0xaa0, 0xaaa, | 
 | 0x005, 0x00f, 0x0a5, 0x0af, 0xa05, 0xa0f, 0xaa5, 0xaaf, | 0x005, 0x00f, 0x0a5, 0x0af, 0xa05, 0xa0f, 0xaa5, 0xaaf, | 
 | 0x050, 0x05a, 0x0f0, 0x0fa, 0xa50, 0xa5a, 0xaf0, 0xafa, | 0x050, 0x05a, 0x0f0, 0x0fa, 0xa50, 0xa5a, 0xaf0, 0xafa, | 
| Line 23  static const UINT16 def_GRPHPAL[64] = { | Line 20  static const UINT16 def_GRPHPAL[64] = { | 
 | 0x550, 0x55a, 0x5f0, 0x5fa, 0xf50, 0xf5a, 0xff0, 0xffa, | 0x550, 0x55a, 0x5f0, 0x5fa, 0xf50, 0xf5a, 0xff0, 0xffa, | 
 | 0x555, 0x55f, 0x5f5, 0x5ff, 0xf55, 0xf5f, 0xff5, 0xfff}; | 0x555, 0x55f, 0x5f5, 0x5ff, 0xf55, 0xf5f, 0xff5, 0xfff}; | 
 |  |  | 
 |  |  | 
 | static const CRTCSTAT crtcdefault = { | static const CRTCSTAT crtcdefault = { | 
| 0xaa,                                           // PAL_B; | {0xaa, 0xcc, 0xf0, 0x00},       // rgbp | 
| 0xcc,                                           // PAL_R; |  | 
| 0xf0,                                           // PAL_G; |  | 
| 0x00,                                           // PLY |  | 
| {0, 1, 2, 3, 4, 5, 6, 7},       // TEXT_PAL[8] |  | 
 | 0,                                                      // SCRN_BITS | 0,                                                      // SCRN_BITS | 
 | 0,                                                      // CRTC_NUM | 0,                                                      // CRTC_NUM | 
 |  |  | 
 | 0,                                                      // DISP_PAGE |  | 
 | 8,                                                      // FNT_XL |  | 
 | 8,                                                      // FNT_YL | 8,                                                      // FNT_YL | 
 | 40,                                                     // TXT_XL | 40,                                                     // TXT_XL | 
 | 25,                                                     // TXT_YL | 25,                                                     // TXT_YL | 
 | 28,                                                     // TXT_YS | 28,                                                     // TXT_YS | 
 | 320,                                            // GRP_XL |  | 
 | 200,                                            // GRP_YL |  | 
 | 0,                                                      // CPU_BANK |  | 
 | 0,                                                      // CRT_BANK |  | 
 |  |  | 
 | 200,                                            // CRT_YL | 200,                                            // CRT_YL | 
| 232,                                            // CRT_VS | //                              232,                                            // CRT_VS | 
| 266,                                            // CRT_VL | //                              266,                                            // CRT_VL | 
 |  |  | 
 | 31,                                                     // TXT_VL | 31,                                                     // TXT_VL | 
 | 10,                                                     // TXT_VLA | 10,                                                     // TXT_VLA | 
| Line 62  static const CRTCSTAT crtcdefault = { | Line 48  static const CRTCSTAT crtcdefault = { | 
 | 0,                                                      // ZPRY | 0,                                                      // ZPRY | 
 | }; | }; | 
 |  |  | 
 | BYTE    dispmode = SCRN64_INVALID; |  | 
 | BYTE    pal_bank = PAL_NORMAL; |  | 
 | BYTE    pal_disp = PAL_NORMAL; |  | 
 |  |  | 
 | void vrambank_patch(void) { | void vrambank_patch(void) { | 
 |  |  | 
 | UINT    updatemask; | UINT    updatemask; | 
 |  | UINT8   dispmode; | 
 |  | UINT8   pal_bank; | 
 |  | UINT8   pal_disp; | 
 |  |  | 
 | if (crtc.s.SCRN_BITS & 0x10) { | if (crtc.s.SCRN_BITS & 0x10) { | 
 | crtc.e.gram = GRP_RAM + GRAM_BANK1; | crtc.e.gram = GRP_RAM + GRAM_BANK1; | 
| Line 182  void vrambank_patch(void) { | Line 168  void vrambank_patch(void) { | 
 | } | } | 
 | } | } | 
 | crtc.e.updatemask = updatemask; | crtc.e.updatemask = updatemask; | 
 |  | crtc.e.dispmode = dispmode; | 
 |  | crtc.e.pal_bank = pal_bank; | 
 |  | crtc.e.pal_disp = pal_disp; | 
 | } | } | 
 |  |  | 
| void crtc_updt(void) { | static void crtc_updt(void) { | 
 |  |  | 
 | if (crtc.s.SCRN_BITS & SCRN_24KHZ) { | if (crtc.s.SCRN_BITS & SCRN_24KHZ) { | 
 | crtc.s.fnty = (crtc.s.FNT_YL >> 1) & 0xfffe; | crtc.s.fnty = (crtc.s.FNT_YL >> 1) & 0xfffe; | 
| Line 198  void crtc_updt(void) { | Line 187  void crtc_updt(void) { | 
 | else { | else { | 
 | crtc.s.CRT_YL = crtc.s.fnty * 1; | crtc.s.CRT_YL = crtc.s.fnty * 1; | 
 | } | } | 
| crtc.s.CRT_VS = crtc.s.fnty * (crtc.s.TXT_YS + 1); | crtc.e.vs = crtc.s.fnty * (crtc.s.TXT_YS + 1); | 
| crtc.s.CRT_VL = (crtc.s.TXT_VL + 1) * crtc.s.fnty + crtc.s.TXT_VLA; | crtc.e.vl = (crtc.s.TXT_VL + 1) * crtc.s.fnty + crtc.s.TXT_VLA; | 
 | //      TRACEOUT(("set> %d / %d / %d", crtc.s.CRT_YL, crtc.s.CRT_VS, crtc.s.CRT_VL)); | //      TRACEOUT(("set> %d / %d / %d", crtc.s.CRT_YL, crtc.s.CRT_VS, crtc.s.CRT_VL)); | 
 | } | } | 
 |  |  | 
| Line 208  void crtc_updt(void) { | Line 197  void crtc_updt(void) { | 
 |  |  | 
 | void IOOUTCALL crtc_o(UINT port, REG8 value) { | void IOOUTCALL crtc_o(UINT port, REG8 value) { | 
 |  |  | 
| if (port == 0x1800) { | port &= 0xff; | 
|  | if (port == 0) { | 
 | crtc.s.CRTC_NUM = value; | crtc.s.CRTC_NUM = value; | 
 | } | } | 
| else if (port == 0x1801) { | else if (port == 1) { | 
 | switch(crtc.s.CRTC_NUM) { | switch(crtc.s.CRTC_NUM) { | 
 | case 0x01: | case 0x01: | 
 | if (value <= 40) { | if (value <= 40) { | 
| Line 246  void IOOUTCALL crtc_o(UINT port, REG8 va | Line 236  void IOOUTCALL crtc_o(UINT port, REG8 va | 
 | case 0x0c: | case 0x0c: | 
 | crtc.s.TXT_TOP &= 0xff; | crtc.s.TXT_TOP &= 0xff; | 
 | crtc.s.TXT_TOP |= (value & 7) << 8; | crtc.s.TXT_TOP |= (value & 7) << 8; | 
| doubleatrchange = 1; | makescrn.remakeattr = 1; | 
 | break; | break; | 
 |  |  | 
 | case 0x0d: | case 0x0d: | 
| crtc.s.TXT_TOP &= 0x7ff; | crtc.s.TXT_TOP &= 0x700; | 
 | crtc.s.TXT_TOP |= value; | crtc.s.TXT_TOP |= value; | 
| doubleatrchange = 1; | makescrn.remakeattr = 1; | 
 | break; | break; | 
 |  |  | 
 | default: | default: | 
 | return; | return; | 
 | } | } | 
| crtc.s.GRP_XL = crtc.s.TXT_XL << 3; | //              crtc.s.GRP_XL = crtc.s.TXT_XL << 3; | 
| crtc.s.GRP_YL = 200; | //              crtc.s.GRP_YL = 200; | 
 | crtc_updt(); | crtc_updt(); | 
 | scrnallflash = 1;                                                               /* 990220 puni */ | scrnallflash = 1;                                                               /* 990220 puni */ | 
 | } | } | 
| Line 275  void IOOUTCALL scrn_o(UINT port, REG8 va | Line 265  void IOOUTCALL scrn_o(UINT port, REG8 va | 
 | modify = crtc.s.SCRN_BITS ^ value; | modify = crtc.s.SCRN_BITS ^ value; | 
 | crtc.s.SCRN_BITS = value; | crtc.s.SCRN_BITS = value; | 
 | if (modify & SCRN_DISPCHANGE) { | if (modify & SCRN_DISPCHANGE) { | 
| textdrawproc_renewal(); | //              pal_reset();                                    // ¤Ê¤ó¤Ç¡© | 
| reflesh_palette(); |  | 
 | scrnallflash = 1; | scrnallflash = 1; | 
| palandply = 1; | makescrn.palandply = 1; | 
 | crtc_updt(); | crtc_updt(); | 
 | } | } | 
 | vrambank_patch(); | vrambank_patch(); | 
 | crtc.s.CPU_BANK = (BYTE)((crtc.s.SCRN_BITS & SCRN_ACCESSVRAM)?1:0); |  | 
 | crtc.s.CRT_BANK = (BYTE)((crtc.s.SCRN_BITS & SCRN_DISPVRAM)?1:0); |  | 
 | (void)port; | (void)port; | 
 | } | } | 
 |  |  | 
| Line 298  REG8 IOINPCALL scrn_i(UINT port) { | Line 285  REG8 IOINPCALL scrn_i(UINT port) { | 
 |  |  | 
 | void IOOUTCALL ply_o(UINT port, REG8 value) { | void IOOUTCALL ply_o(UINT port, REG8 value) { | 
 |  |  | 
| if (crtc.s.PLY != value) { | if (crtc.s.rgbp[CRTC_PLY] != value) { | 
| crtc.s.PLY = value; | crtc.s.rgbp[CRTC_PLY] = value; | 
| palandply = 1; | makescrn.palandply = 1; | 
 | } | } | 
 | (void)port; | (void)port; | 
 | } | } | 
| Line 308  void IOOUTCALL ply_o(UINT port, REG8 val | Line 295  void IOOUTCALL ply_o(UINT port, REG8 val | 
 | REG8 IOINPCALL ply_i(UINT port) { | REG8 IOINPCALL ply_i(UINT port) { | 
 |  |  | 
 | (void)port; | (void)port; | 
| return(crtc.s.PLY); | return(crtc.s.rgbp[CRTC_PLY]); | 
 | } | } | 
 |  |  | 
 |  |  | 
| Line 316  REG8 IOINPCALL ply_i(UINT port) { | Line 303  REG8 IOINPCALL ply_i(UINT port) { | 
 |  |  | 
 | void IOOUTCALL palette_o(UINT port, REG8 value) { | void IOOUTCALL palette_o(UINT port, REG8 value) { | 
 |  |  | 
 |  | REG8    sft; | 
 |  | UINT    num; | 
 | UINT    pal; | UINT    pal; | 
 | BYTE    c; |  | 
 |  |  | 
 | crtc.s.lastpal = (value & 0xf0); | crtc.s.lastpal = (value & 0xf0); | 
 | if (crtc.s.EXTPALMODE & 0x80) { | if (crtc.s.EXTPALMODE & 0x80) { | 
 | if ((crtc.s.EXTGRPHPAL & 0x88) != 0x80) { | if ((crtc.s.EXTGRPHPAL & 0x88) != 0x80) { | 
 | return; | return; | 
 | } | } | 
| if (pal_bank & PAL_4096) {                                      // use 4096palettes | sft = (port >> (8 - 2)) & (3 << 2); | 
| switch(pal_bank & (PAL_4096FULL | PAL_4096BANK)) { | if (crtc.e.pal_bank & PAL_4096) {                               // use 4096palettes | 
| case 0: | num = ((port & 0xff) << 4) + (crtc.s.lastpal >> 4); | 
| pal = ((port & 0xcc) << 4) + ((value & 0xc0) >> 4); | if (!(crtc.e.pal_bank & PAL_4096FULL)) { | 
| break; | num &= 0xccc; | 
|  | if (crtc.e.pal_bank & PAL_4096BANK) { | 
| case 1: | num >>= 2; | 
| pal = ((port & 0xcc) << 2) + ((value & 0xc0) >> 6); | } | 
| break; |  | 
|  |  | 
| default: |  | 
| pal = ((port & 0xff) << 4) + (crtc.s.lastpal >> 4); |  | 
| break; |  | 
| } |  | 
| value &= 0xf; |  | 
| switch(port & 0xff00) { |  | 
| case 0x1000: |  | 
| crtc_PAL4096[pal] &= 0xff0; |  | 
| crtc_PAL4096[pal] |= value; |  | 
| break; |  | 
|  |  | 
| case 0x1100: |  | 
| crtc_PAL4096[pal] &= 0xf0f; |  | 
| crtc_PAL4096[pal] |= (value << 4); |  | 
| break; |  | 
|  |  | 
| case 0x1200: |  | 
| crtc_PAL4096[pal] &= 0x0ff; |  | 
| crtc_PAL4096[pal] |= ((WORD)value << 8); |  | 
| break; |  | 
 | } | } | 
| pal_setgrph4096(pal); | pal = crtc.p.grph4096[num]; | 
|  | pal &= ~((0x0f) << sft); | 
|  | pal |= (value & 0x0f) << sft; | 
|  | crtc.p.grph4096[num] = pal; | 
|  | pal_setgrph4096(num); | 
 | } | } | 
 | else { | else { | 
| c = ((port & 0x80) >> 5) | ((port & 0x08) >> 2) | | num = ((port & 0x80) >> 5) | ((port & 0x08) >> 2) | | 
 | ((value & 0x80) >> 7); | ((value & 0x80) >> 7); | 
| if ((dispmode & SCRN64_MASK) == SCRN64_INVALID) { | if ((crtc.e.dispmode & SCRN64_MASK) == SCRN64_INVALID) { | 
| c |= (c << 3); | num |= (num << 3); | 
 | } | } | 
 | else { | else { | 
| c += ((port & 0x40) >> 1) | ((port & 0x04) << 2) | | num += ((port & 0x40) >> 1) | ((port & 0x04) << 2) | | 
 | ((value & 0x40) >> 3); | ((value & 0x40) >> 3); | 
 | } | } | 
| value &= 0xf; | pal = crtc.p.grph[crtc.e.pal_bank][num]; | 
| switch(port & 0xff00) { | pal &= ~((0x0f) << sft); | 
| case 0x1000: | pal |= (value & 0x0f) << sft; | 
| crtc_GRPHPAL[pal_bank][c] &= 0xff0; | crtc.p.grph[crtc.e.pal_bank][num] = pal; | 
| crtc_GRPHPAL[pal_bank][c] |= value; | pal_setgrph(crtc.e.pal_bank, (REG8)num); | 
| break; |  | 
|  |  | 
| case 0x1100: |  | 
| crtc_GRPHPAL[pal_bank][c] &= 0xf0f; |  | 
| crtc_GRPHPAL[pal_bank][c] |= (value << 4); |  | 
| break; |  | 
|  |  | 
| case 0x1200: |  | 
| crtc_GRPHPAL[pal_bank][c] &= 0x0ff; |  | 
| crtc_GRPHPAL[pal_bank][c] |= ((WORD)value << 8); |  | 
| break; |  | 
| } |  | 
| pal_setgrph(pal_bank, c); |  | 
 | } | } | 
 | } | } | 
 | else { | else { | 
| switch(port & 0xff00) { | num = (port >> 8) & 3; | 
| case 0x1000: | if (crtc.s.rgbp[num] != value) { | 
| if (crtc.s.PAL_B != value) { | crtc.s.rgbp[num] = value; | 
| crtc.s.PAL_B = value; | makescrn.palandply = 1; | 
| palandply = 1; |  | 
| } |  | 
| break; |  | 
|  |  | 
| case 0x1100: |  | 
| if (crtc.s.PAL_R != value) { |  | 
| crtc.s.PAL_R = value; |  | 
| palandply = 1; |  | 
| } |  | 
| break; |  | 
|  |  | 
| case 0x1200: |  | 
| if (crtc.s.PAL_G != value) { |  | 
| crtc.s.PAL_G = value; |  | 
| palandply = 1; |  | 
| } |  | 
| break; |  | 
 | } | } | 
 | } | } | 
 | } | } | 
 |  |  | 
 | REG8 IOINPCALL palette_i(UINT port) { | REG8 IOINPCALL palette_i(UINT port) { | 
 |  |  | 
| UINT    c; | UINT    num; | 
|  | UINT    pal; | 
|  | REG8    sft; | 
 |  |  | 
 | if ((crtc.s.EXTPALMODE & 0x80) && ((crtc.s.EXTGRPHPAL & 0x88) == 0x88)) { | if ((crtc.s.EXTPALMODE & 0x80) && ((crtc.s.EXTGRPHPAL & 0x88) == 0x88)) { | 
| if (pal_bank & PAL_4096) {                                      // use 4096palettes | if (crtc.e.pal_bank & PAL_4096) {                               // use 4096palettes | 
| switch(pal_bank & (PAL_4096FULL | PAL_4096BANK)) { | num = ((port & 0xff) << 4) + (crtc.s.lastpal >> 4); | 
| case 0: | if (!(crtc.e.pal_bank & PAL_4096FULL)) { | 
| c = ((port & 0xcc) << 4) | ((crtc.s.lastpal & 0xc0) >> 4); | num &= 0xccc; | 
| break; | if (crtc.e.pal_bank & PAL_4096BANK) { | 
|  | num >>= 2; | 
| case 1: | } | 
| c = ((port & 0xcc) << 2) | ((crtc.s.lastpal & 0xc0) >> 6); |  | 
| break; |  | 
|  |  | 
| default: |  | 
| c = ((port & 0xff) << 4) | (crtc.s.lastpal >> 4); |  | 
| break; |  | 
| } |  | 
| switch(port & 0xff00) { |  | 
| case 0x1000: |  | 
| return(crtc.s.lastpal | (crtc_PAL4096[c] & 0xf)); |  | 
|  |  | 
| case 0x1100: |  | 
| return(crtc.s.lastpal | ((crtc_PAL4096[c] & 0xf0) >> 4)); |  | 
|  |  | 
| case 0x1200: |  | 
| return(crtc.s.lastpal | ((crtc_PAL4096[c] & 0xf00) >> 8)); |  | 
 | } | } | 
 |  | pal = crtc.p.grph4096[num]; | 
 | } | } | 
 | else { | else { | 
| c = ((port & 0x80) >> 5) | ((port & 0x08) >> 2) | | num = ((port & 0x80) >> 5) | ((port & 0x08) >> 2) | | 
 | ((crtc.s.lastpal & 0x80) >> 7); | ((crtc.s.lastpal & 0x80) >> 7); | 
| if ((dispmode & SCRN64_MASK) == SCRN64_INVALID) { | if ((crtc.e.dispmode & SCRN64_MASK) == SCRN64_INVALID) { | 
| c |= (c << 3); | num |= (num << 3); | 
 | } | } | 
 | else { | else { | 
| c += ((port & 0x40) >> 1) | ((port & 0x04) << 2) | | num += ((port & 0x40) >> 1) | ((port & 0x04) << 2) | | 
 | ((crtc.s.lastpal & 0x40) >> 3); | ((crtc.s.lastpal & 0x40) >> 3); | 
 | } | } | 
| switch(port & 0xff00) { | pal = crtc.p.grph[crtc.e.pal_bank][num]; | 
| case 0x1000: |  | 
| return(crtc.s.lastpal | |  | 
| (crtc_GRPHPAL[pal_bank][c] & 0xf)); |  | 
| case 0x1100: |  | 
| return(crtc.s.lastpal | |  | 
| ((crtc_GRPHPAL[pal_bank][c] & 0xf0) >> 4)); |  | 
| case 0x1200: |  | 
| return(crtc.s.lastpal | |  | 
| ((crtc_GRPHPAL[pal_bank][c] & 0xf00) >> 8)); |  | 
| } |  | 
 | } | } | 
 |  | sft = (port >> (8 - 2)) & (3 << 2); | 
 |  | return((REG8)(crtc.s.lastpal + ((pal >> sft) & 0xf))); | 
 |  | } | 
 |  | else { | 
 |  | return(0xff); | 
 | } | } | 
 | return(0xff); |  | 
 | } | } | 
 |  |  | 
 |  |  | 
| Line 476  void IOOUTCALL extpal_o(UINT port, REG8 | Line 397  void IOOUTCALL extpal_o(UINT port, REG8 | 
 |  |  | 
 | crtc.s.EXTPALMODE = value; | crtc.s.EXTPALMODE = value; | 
 | vrambank_patch(); | vrambank_patch(); | 
 |  | (void)port; | 
 | } | } | 
 |  |  | 
 | REG8 IOINPCALL extpal_i(UINT port) { | REG8 IOINPCALL extpal_i(UINT port) { | 
 |  |  | 
 |  | (void)port; | 
 | return(crtc.s.EXTPALMODE); | return(crtc.s.EXTPALMODE); | 
 | } | } | 
 |  |  | 
| Line 488  void IOOUTCALL extgrphpal_o(UINT port, R | Line 411  void IOOUTCALL extgrphpal_o(UINT port, R | 
 | if (crtc.s.EXTPALMODE & 0x80) { | if (crtc.s.EXTPALMODE & 0x80) { | 
 | crtc.s.EXTGRPHPAL = value; | crtc.s.EXTGRPHPAL = value; | 
 | } | } | 
 |  | (void)port; | 
 | } | } | 
 |  |  | 
 | REG8 IOINPCALL extgrphpal_i(UINT port) { | REG8 IOINPCALL extgrphpal_i(UINT port) { | 
| Line 495  REG8 IOINPCALL extgrphpal_i(UINT port) { | Line 419  REG8 IOINPCALL extgrphpal_i(UINT port) { | 
 | if (crtc.s.EXTPALMODE & 0x80) { | if (crtc.s.EXTPALMODE & 0x80) { | 
 | return(crtc.s.EXTGRPHPAL); | return(crtc.s.EXTGRPHPAL); | 
 | } | } | 
 |  | (void)port; | 
 | return(0xff); | return(0xff); | 
 | } | } | 
 |  |  | 
 | void IOOUTCALL exttextpal_o(UINT port, REG8 value) { | void IOOUTCALL exttextpal_o(UINT port, REG8 value) { | 
 |  |  | 
 | if (crtc.s.EXTPALMODE & 0x80) { | if (crtc.s.EXTPALMODE & 0x80) { | 
| crtc_TEXTPAL[port & 7] = value; | crtc.p.text[port & 7] = value; | 
 | pal_settext((REG8)(port & 7)); | pal_settext((REG8)(port & 7)); | 
 | } | } | 
 | } | } | 
| Line 509  void IOOUTCALL exttextpal_o(UINT port, R | Line 434  void IOOUTCALL exttextpal_o(UINT port, R | 
 | REG8 IOINPCALL exttextpal_i(UINT port) { | REG8 IOINPCALL exttextpal_i(UINT port) { | 
 |  |  | 
 | if (crtc.s.EXTPALMODE & 0x80) { | if (crtc.s.EXTPALMODE & 0x80) { | 
| return(crtc_TEXTPAL[port & 7]); | return(crtc.p.text[port & 7]); | 
 | } | } | 
 | return(0xff); | return(0xff); | 
 | } | } | 
| Line 518  void IOOUTCALL exttextdisp_o(UINT port, | Line 443  void IOOUTCALL exttextdisp_o(UINT port, | 
 |  |  | 
 | crtc.s.ZPRY = value; | crtc.s.ZPRY = value; | 
 | vrambank_patch(); | vrambank_patch(); | 
 |  | (void)port; | 
 | } | } | 
 |  |  | 
 | REG8 IOINPCALL exttextdisp_i(UINT port) { | REG8 IOINPCALL exttextdisp_i(UINT port) { | 
| Line 525  REG8 IOINPCALL exttextdisp_i(UINT port) | Line 451  REG8 IOINPCALL exttextdisp_i(UINT port) | 
 | if (crtc.s.EXTPALMODE & 0x80) { | if (crtc.s.EXTPALMODE & 0x80) { | 
 | return(crtc.s.ZPRY); | return(crtc.s.ZPRY); | 
 | } | } | 
 |  | (void)port; | 
 | return(0xff); | return(0xff); | 
 | } | } | 
 |  |  | 
 | void IOOUTCALL blackctrl_o(UINT port, REG8 value) { | void IOOUTCALL blackctrl_o(UINT port, REG8 value) { | 
 |  |  | 
 | crtc.s.BLACKPAL = value; | crtc.s.BLACKPAL = value; | 
| palandply = 1; | makescrn.palandply = 1; | 
|  | (void)port; | 
 | } | } | 
 |  |  | 
 | REG8 IOINPCALL blackctrl_i(UINT port) { | REG8 IOINPCALL blackctrl_i(UINT port) { | 
 |  |  | 
 |  | (void)port; | 
 | return(crtc.s.BLACKPAL); | return(crtc.s.BLACKPAL); | 
 | } | } | 
 |  |  | 
| Line 544  REG8 IOINPCALL blackctrl_i(UINT port) { | Line 473  REG8 IOINPCALL blackctrl_i(UINT port) { | 
 |  |  | 
 | static void resetpal(void) { | static void resetpal(void) { | 
 |  |  | 
| CopyMemory(crtc_TEXTPAL, def_TEXTPAL, 8); | CopyMemory(crtc.p.text, defpaltext, sizeof(defpaltext)); | 
| CopyMemory(crtc_GRPHPAL[0], def_GRPHPAL, 64*2); | CopyMemory(crtc.p.grph[0], defpalgrph, sizeof(defpalgrph)); | 
| CopyMemory(crtc_GRPHPAL[1], def_GRPHPAL, 64*2); | CopyMemory(crtc.p.grph[1], defpalgrph, sizeof(defpalgrph)); | 
 | } | } | 
 |  |  | 
 | void crtc_initialize(void) { | void crtc_initialize(void) { | 
| Line 555  void crtc_initialize(void) { | Line 484  void crtc_initialize(void) { | 
 |  |  | 
 | resetpal(); | resetpal(); | 
 | for (p=0; p<4096; p++) { | for (p=0; p<4096; p++) { | 
| crtc_PAL4096[p] = p; | crtc.p.grph4096[p] = p; | 
 | } | } | 
 | } | } | 
 |  |  | 
 | void crtc_reset(void) { | void crtc_reset(void) { | 
 |  |  | 
 | crtc.s = crtcdefault; | crtc.s = crtcdefault; | 
 |  |  | 
 | palandply = 1; |  | 
 | dispmode = SCRN64_INVALID; |  | 
 | pal_bank = pal_disp = PAL_NORMAL; |  | 
 | if (pccore.ROM_TYPE < 3) { | if (pccore.ROM_TYPE < 3) { | 
 | resetpal(); | resetpal(); | 
 | } | } | 
| Line 574  void crtc_reset(void) { | Line 499  void crtc_reset(void) { | 
 | crtc.s.FNT_YL = 16; | crtc.s.FNT_YL = 16; | 
 | } | } | 
 |  |  | 
| textdrawproc_renewal(); | pal_reset(); | 
| reflesh_palette(); |  | 
 | crtc_updt(); | crtc_updt(); | 
 |  |  | 
 | vrambank_patch(); | vrambank_patch(); | 
| palandply = 1; | makescrn.palandply = 1; | 
 | scrnallflash = 1; | scrnallflash = 1; | 
 | } | } | 
 |  |  |