| version 1.9, 2004/08/12 17:57:36 | version 1.17, 2004/08/17 14:46:37 | 
| Line 1 | Line 1 | 
 | #include        "compiler.h" | #include        "compiler.h" | 
 | #include        "scrnmng.h" | #include        "scrnmng.h" | 
 |  | #include        "z80core.h" | 
 | #include        "pccore.h" | #include        "pccore.h" | 
 | #include        "iocore.h" | #include        "iocore.h" | 
 |  | #include        "nevent.h" | 
 | #include        "vram.h" | #include        "vram.h" | 
 | #include        "palettes.h" | #include        "palettes.h" | 
 | #include        "makescrn.h" | #include        "makescrn.h" | 
 |  |  | 
 |  |  | 
 |  | static const UINT8 defrgbp[4] = {0xaa, 0xcc, 0xf0, 0x00}; | 
 |  | static const UINT8 defreg[18] = { | 
 |  | 0x37, 0x28, 0x2d, 0x34, | 
 |  | 0x1f, 0x02, 0x19, 0x1c, | 
 |  | 0x00, 0x07, 0x00, 0x00, | 
 |  | 0x00, 0x00, 0x00, 0x00, | 
 |  | 0x00, 0x00}; | 
 |  |  | 
 |  | #if defined(SUPPORT_TURBOZ) | 
 | static const UINT8 defpaltext[8] = { | static const UINT8 defpaltext[8] = { | 
 | 0x00, 0x03, 0x0c, 0x0f, 0x30, 0x33, 0x3c, 0x3f}; | 0x00, 0x03, 0x0c, 0x0f, 0x30, 0x33, 0x3c, 0x3f}; | 
 |  |  | 
| Line 19  static const UINT16 defpalgrph[64] = { | Line 30  static const UINT16 defpalgrph[64] = { | 
 | 0x505, 0x50f, 0x5a5, 0x5af, 0xf05, 0xf0f, 0xfa5, 0xfaf, | 0x505, 0x50f, 0x5a5, 0x5af, 0xf05, 0xf0f, 0xfa5, 0xfaf, | 
 | 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}; | 
 |  | #endif | 
 |  |  | 
 |  |  | 
 |  | typedef struct { | 
 |  | UINT32  clock; | 
 |  | UINT    minx; | 
 |  | UINT    maxx; | 
 |  | UINT    miny; | 
 |  | UINT    maxy; | 
 |  | } GDCCLK; | 
 |  |  | 
| static const CRTCSTAT crtcdefault = { | static const GDCCLK gdcclk[] = { | 
| {0xaa, 0xcc, 0xf0, 0x00},       // rgbp | {14318180 / 8, 112 - 8, 112 + 8, 200, 300}, | 
| 0,                                                      // SCRN_BITS | {21052600 / 8, 108 - 6, 108 + 6, 400, 575}}; | 
| 0,                                                      // CRTC_NUM |  | 
 |  |  | 
| 7,                                                      // _FNT_YL | enum { | 
| 40,                                                     // TXT_XL | CRTCUPD_CLOCK           = 0x01, | 
| 25,                                                     // TXT_YL | CRTCUPD_TIMING          = 0x02, | 
| 28,                                                     // TXT_YS | CRTCUPD_POS                     = 0x04 | 
|  | }; | 
 |  |  | 
 | //                              200,                                            // CRT_YL |  | 
 | //                              232,                                            // CRT_VS |  | 
 | //                              266,                                            // CRT_VL |  | 
 |  |  | 
| 31,                                                     // TXT_VL | static void crtc_clkupdate(void) { | 
| 10,                                                     // TXT_VLA |  | 
 |  |  | 
| 0,                                                      // TXT_TOP | UINT            clksync; | 
| //                              8,                                                      // fnty | const GDCCLK    *clk; | 
|  | UINT            h; | 
|  | UINT            fonty; | 
|  | UINT            v; | 
|  |  | 
|  | clksync = (crtc.s.SCRN_BITS & SCRN_24KHZ); | 
|  | clk = gdcclk + clksync; | 
|  | h = crtc.s.reg[CRTCREG_HSIZE] + 1; | 
|  | if (crtc.s.width40) { | 
|  | h = h * 2; | 
|  | } | 
|  | if (h < clk->minx) { | 
|  | h = clk->minx; | 
|  | } | 
|  | else if (h > clk->maxx) { | 
|  | h = clk->maxx; | 
|  | } | 
|  | crtc.e.rasterclock8 = (4000000 * h) / (clk->clock >> 8); | 
 |  |  | 
| 0,                                                      // lastpal | fonty = crtc.s.reg[CRTCREG_CHRCY] & 0x1f; | 
|  | fonty >>= clksync; | 
|  | fonty += 1; | 
|  | crtc.e.fonty = fonty; | 
 |  |  | 
| 0,                                                      // BLACKPAL | v = (crtc.s.reg[CRTCREG_CHRCY] & 0x1f) + 1; | 
| 0,                                                      // EXTPALMODE | v = v * ((crtc.s.reg[CRTCREG_VSIZE] & 0x7f) + 1); | 
| 0,                                                      // EXTGRPHPAL | v = v + (crtc.s.reg[CRTCREG_VSIZEA] & 0x1f); | 
| 0,                                                      // ZPRY | if (v < clk->miny) { | 
| }; | v = clk->miny; | 
|  | } | 
|  | else if (v > clk->maxy) { | 
|  | v = clk->maxy; | 
|  | } | 
|  | crtc.e.frameclock = ((4000000 * h) / clk->clock) * v; | 
|  | } | 
 |  |  | 
 |  | static void crtc_timingupdate(void) { | 
 |  |  | 
| void crtc_bankupdate(void) { | UINT32  fontclock; | 
|  | UINT    yl; | 
 |  |  | 
 |  | // とりあえず…ね | 
 |  | crtc.e.rasterdisp8 = (crtc.e.rasterclock8 * 40) / 56; | 
 |  |  | 
 |  | fontclock = (crtc.s.reg[CRTCREG_CHRCY] & 0x1f) + 1; | 
 |  | fontclock = (fontclock * crtc.e.rasterclock8) >> 8; | 
 |  |  | 
 |  | // YsIIIが yl==0で disp信号見る…なんで? | 
 |  | yl = (crtc.s.reg[CRTCREG_VDISP] & 0x7f); | 
 |  | crtc.e.yl = yl; | 
 |  | crtc.e.dispclock = fontclock * max(yl, 1); | 
 |  | crtc.e.vsyncstart = fontclock * ((crtc.s.reg[CRTCREG_VSYNC] & 0x7f) + 1); | 
 |  | crtc.e.vpulseclock = ((crtc.s.reg[CRTCREG_PULSE] >> 4) | 
 |  | * crtc.e.rasterclock8) >> 8; | 
 |  |  | 
 |  | crtc.e.pos = crtc.s.reg[CRTCREG_POSL] | 
 |  | + ((crtc.s.reg[CRTCREG_POSH] & 7) << 8); | 
 |  | } | 
 |  |  | 
 |  | static void crtc_bankupdate(void) { | 
 |  |  | 
 |  | #if defined(SUPPORT_TURBOZ) | 
 | UINT    updatemask; | UINT    updatemask; | 
 | UINT8   dispmode; | UINT8   dispmode; | 
 | UINT8   pal_bank; | UINT8   pal_bank; | 
 | UINT8   pal_disp; | UINT8   pal_disp; | 
 |  | #endif | 
 |  |  | 
 | if (crtc.s.SCRN_BITS & 0x10) { | if (crtc.s.SCRN_BITS & 0x10) { | 
 | crtc.e.gram = gram + GRAM_BANK1; | crtc.e.gram = gram + GRAM_BANK1; | 
| Line 64  void crtc_bankupdate(void) { | Line 131  void crtc_bankupdate(void) { | 
 | crtc.e.gram = gram + GRAM_BANK0; | crtc.e.gram = gram + GRAM_BANK0; | 
 | crtc.e.updatebit = UPDATE_VRAM0; | crtc.e.updatebit = UPDATE_VRAM0; | 
 | } | } | 
 | dispmode = (crtc.s.SCRN_BITS & SCRN_DISPVRAM)?SCRN_BANK1:SCRN_BANK0; |  | 
 | pal_bank = pal_disp = PAL_NORMAL; |  | 
 |  |  | 
 |  | #if !defined(SUPPORT_TURBOZ) | 
 |  | crtc.e.updatemask = (crtc.s.SCRN_BITS & SCRN_TEXTYx2)?0x3ff:0x7ff; | 
 |  | crtc.e.dispmode = | 
 |  | (crtc.s.SCRN_BITS & SCRN_DISPVRAM)?SCRN_BANK1:SCRN_BANK0; | 
 |  | #else | 
 |  | dispmode = (crtc.s.SCRN_BITS & SCRN_DISPVRAM)?SCRN_BANK1:SCRN_BANK0; | 
 |  | pal_bank = PAL_NORMAL; | 
 |  | pal_disp = PAL_NORMAL; | 
 | if ((!(crtc.s.EXTPALMODE & 0x80)) || (crtc.s.SCRN_BITS & SCRN_UNDERLINE)) { | if ((!(crtc.s.EXTPALMODE & 0x80)) || (crtc.s.SCRN_BITS & SCRN_UNDERLINE)) { | 
 | updatemask = 0x7ff; | updatemask = 0x7ff; | 
| if ((crtc.s.SCRN_BITS & SCRN_24KHZ) && (crtc.s.TXT_XL == 80)) { | if ((crtc.s.SCRN_BITS & SCRN_24KHZ) && (!crtc.s.width40)) { | 
| pal_bank = pal_disp = PAL_HIGHRESO; | pal_bank = PAL_HIGHRESO; | 
|  | pal_disp = PAL_HIGHRESO; | 
 | } | } | 
 | if (crtc.s.SCRN_BITS & SCRN_TEXTYx2) { | if (crtc.s.SCRN_BITS & SCRN_TEXTYx2) { | 
 | updatemask = 0x3ff; | updatemask = 0x3ff; | 
| Line 80  void crtc_bankupdate(void) { | Line 154  void crtc_bankupdate(void) { | 
 | updatemask = 0x3ff; | updatemask = 0x3ff; | 
 | if (!(crtc.s.SCRN_BITS & SCRN_TEXTYx2)) { | if (!(crtc.s.SCRN_BITS & SCRN_TEXTYx2)) { | 
 | if (crtc.s.SCRN_BITS & SCRN_24KHZ) { | if (crtc.s.SCRN_BITS & SCRN_24KHZ) { | 
| if (crtc.s.TXT_XL == 40) { | if (crtc.s.width40) { | 
 | if (crtc.s.SCRN_BITS & SCRN_200LINE) {  // width 40,25,0,2 | if (crtc.s.SCRN_BITS & SCRN_200LINE) {  // width 40,25,0,2 | 
 | dispmode |= SCRN64_320x200; | dispmode |= SCRN64_320x200; | 
 | } | } | 
| Line 94  void crtc_bankupdate(void) { | Line 168  void crtc_bankupdate(void) { | 
 | } | } | 
 | } | } | 
 | else { | else { | 
| if (crtc.s.TXT_XL == 40) {                                      // width 40,25,0,1 | if (crtc.s.width40) {                                           // width 40,25,0,1 | 
 | if (crtc.s.EXTPALMODE & 0x10) { | if (crtc.s.EXTPALMODE & 0x10) { | 
 | if (crtc.s.ZPRY & 0x10) { | if (crtc.s.ZPRY & 0x10) { | 
 | dispmode = SCRN64_L320x200x2 | | dispmode = SCRN64_L320x200x2 | | 
| Line 125  void crtc_bankupdate(void) { | Line 199  void crtc_bankupdate(void) { | 
 | } | } | 
 | else { | else { | 
 | if (crtc.s.SCRN_BITS & SCRN_24KHZ) { | if (crtc.s.SCRN_BITS & SCRN_24KHZ) { | 
| if (crtc.s.TXT_XL == 40) { | if (crtc.s.width40) { | 
 | if (crtc.s.SCRN_BITS & SCRN_200LINE) {  // width 40,12,0,2 | if (crtc.s.SCRN_BITS & SCRN_200LINE) {  // width 40,12,0,2 | 
 | dispmode |= SCRN64_320x100; | dispmode |= SCRN64_320x100; | 
 | } | } | 
| Line 138  void crtc_bankupdate(void) { | Line 212  void crtc_bankupdate(void) { | 
 | } | } | 
 | } | } | 
 | else { | else { | 
| if (crtc.s.TXT_XL == 40) {                                      // width 40,12,0,1 | if (crtc.s.width40) {                                           // width 40,12,0,1 | 
 | if (crtc.s.EXTPALMODE & 0x10) { | if (crtc.s.EXTPALMODE & 0x10) { | 
 | if (crtc.s.ZPRY & 0x10) { | if (crtc.s.ZPRY & 0x10) { | 
 | dispmode = SCRN64_320x100x2 | | dispmode = SCRN64_320x100x2 | | 
| Line 171  void crtc_bankupdate(void) { | Line 245  void crtc_bankupdate(void) { | 
 | crtc.e.dispmode = dispmode; | crtc.e.dispmode = dispmode; | 
 | crtc.e.pal_bank = pal_bank; | crtc.e.pal_bank = pal_bank; | 
 | crtc.e.pal_disp = pal_disp; | crtc.e.pal_disp = pal_disp; | 
| } | #endif | 
|  |  | 
| void crtc_regupdate(void) { |  | 
|  |  | 
| UINT    fonty; |  | 
|  |  | 
| fonty = crtc.s._FNT_YL; |  | 
| if (crtc.s.SCRN_BITS & SCRN_24KHZ) { |  | 
| fonty >>= 1; |  | 
| } |  | 
| fonty += 1; |  | 
| crtc.e.fonty = fonty; |  | 
| crtc.e.yl = (crtc.s.TXT_YL & 0x7f); |  | 
|  |  | 
| crtc.e.dl = fonty * crtc.e.yl; |  | 
| crtc.e.vs = fonty * ((crtc.s.TXT_YS & 0x7f) + 1); |  | 
| crtc.e.vl = fonty * ((crtc.s.TXT_VL & 0x7f) + 1) + (crtc.s.TXT_VLA & 0x1f); |  | 
 | } | } | 
 |  |  | 
 |  |  | 
| Line 197  void IOOUTCALL crtc_o(UINT port, REG8 va | Line 255  void IOOUTCALL crtc_o(UINT port, REG8 va | 
 |  |  | 
 | port &= 0xff; | port &= 0xff; | 
 | if (port == 0) { | if (port == 0) { | 
| crtc.s.CRTC_NUM = value; | crtc.s.regnum = value; | 
 | } | } | 
 | else if (port == 1) { | else if (port == 1) { | 
| switch(crtc.s.CRTC_NUM) { | if (crtc.s.regnum < CRTCREG_MAX) { | 
| case 0x01: | if (crtc.s.reg[crtc.s.regnum] != value) { | 
| if (value <= 40) { | crtc.s.reg[crtc.s.regnum] = value; | 
| crtc.s.TXT_XL = 40; | crtc_clkupdate(); | 
| } | crtc_timingupdate(); | 
| else { |  | 
| crtc.s.TXT_XL = 80; |  | 
| } |  | 
 | crtc_bankupdate(); | crtc_bankupdate(); | 
 | break; |  | 
 |  |  | 
 | case 0x04: |  | 
 | crtc.s.TXT_VL = value; |  | 
 | break; |  | 
 |  |  | 
 | case 0x05: |  | 
 | crtc.s.TXT_VLA = value; |  | 
 | break; |  | 
 |  |  | 
 | case 0x06: |  | 
 | crtc.s.TXT_YL = value; |  | 
 | break; |  | 
 |  |  | 
 | case 0x07: |  | 
 | crtc.s.TXT_YS = value; |  | 
 | break; |  | 
 |  |  | 
 | case 0x09: |  | 
 | crtc.s._FNT_YL = value; |  | 
 | break; |  | 
 |  |  | 
 | case 0x0c: |  | 
 | crtc.s.TXT_TOP &= 0xff; |  | 
 | crtc.s.TXT_TOP |= (value & 7) << 8; |  | 
 | makescrn.remakeattr = 1; |  | 
 | break; |  | 
 |  |  | 
 | case 0x0d: |  | 
 | crtc.s.TXT_TOP &= 0x700; |  | 
 | crtc.s.TXT_TOP |= value; |  | 
 | makescrn.remakeattr = 1; | makescrn.remakeattr = 1; | 
| break; | scrnallflash = 1; | 
|  | } | 
| default: |  | 
| return; |  | 
 | } | } | 
 | //              crtc.s.GRP_XL = crtc.s.TXT_XL << 3; |  | 
 | //              crtc.s.GRP_YL = 200; |  | 
 | crtc_regupdate(); |  | 
 | scrnallflash = 1;                                                               /* 990220 puni */ |  | 
 | } | } | 
 | } | } | 
 |  |  | 
| Line 266  void IOOUTCALL scrn_o(UINT port, REG8 va | Line 284  void IOOUTCALL scrn_o(UINT port, REG8 va | 
 | //              pal_reset();                                    // なんで? | //              pal_reset();                                    // なんで? | 
 | scrnallflash = 1; | scrnallflash = 1; | 
 | makescrn.palandply = 1; | makescrn.palandply = 1; | 
| crtc_regupdate(); | crtc_clkupdate(); | 
|  | crtc_timingupdate(); | 
 | } | } | 
 | crtc_bankupdate(); | crtc_bankupdate(); | 
 | (void)port; | (void)port; | 
| Line 286  void IOOUTCALL ply_o(UINT port, REG8 val | Line 305  void IOOUTCALL ply_o(UINT port, REG8 val | 
 | if (crtc.s.rgbp[CRTC_PLY] != value) { | if (crtc.s.rgbp[CRTC_PLY] != value) { | 
 | crtc.s.rgbp[CRTC_PLY] = value; | crtc.s.rgbp[CRTC_PLY] = value; | 
 | makescrn.palandply = 1; | makescrn.palandply = 1; | 
 |  | #if defined(SUPPORT_PALEVENT) | 
 |  | if ((!corestat.vsync) && (palevent.events < SUPPORT_PALEVENT)) { | 
 |  | PAL1EVENT *e = palevent.event + palevent.events; | 
 |  | palevent.events++; | 
 |  | e->rgbp = CRTC_PLY; | 
 |  | e->value = value; | 
 |  | e->clock = nevent_getwork(NEVENT_FRAMES); | 
 |  | } | 
 |  | #endif | 
 | } | } | 
 | (void)port; | (void)port; | 
 | } | } | 
 |  |  | 
 | REG8 IOINPCALL ply_i(UINT port) { |  | 
 |  |  | 
 | (void)port; |  | 
 | return(crtc.s.rgbp[CRTC_PLY]); |  | 
 | } |  | 
 |  |  | 
 |  |  | 
 | // ---- パレット | // ---- パレット | 
 |  |  | 
 | void IOOUTCALL palette_o(UINT port, REG8 value) { | void IOOUTCALL palette_o(UINT port, REG8 value) { | 
 |  |  | 
 | REG8    sft; |  | 
 | UINT    num; | UINT    num; | 
 |  | #if defined(SUPPORT_TURBOZ) | 
 |  | REG8    sft; | 
 | UINT    pal; | UINT    pal; | 
 |  | #endif | 
 |  |  | 
 |  | #if defined(SUPPORT_TURBOZ) | 
 | crtc.s.lastpal = (value & 0xf0); | crtc.s.lastpal = (value & 0xf0); | 
| if (crtc.s.EXTPALMODE & 0x80) { | if (!(crtc.s.EXTPALMODE & 0x80)) { | 
|  | #endif | 
|  | num = (port >> 8) & 3; | 
|  | if (crtc.s.rgbp[num] != value) { | 
|  | crtc.s.rgbp[num] = value; | 
|  | makescrn.palandply = 1; | 
|  | #if defined(SUPPORT_PALEVENT) | 
|  | if ((!corestat.vsync) && (palevent.events < SUPPORT_PALEVENT)) { | 
|  | PAL1EVENT *e = palevent.event + palevent.events; | 
|  | palevent.events++; | 
|  | e->rgbp = (UINT8)num; | 
|  | e->value = value; | 
|  | e->clock = nevent_getwork(NEVENT_FRAMES); | 
|  | } | 
|  | #endif | 
|  | } | 
|  | #if defined(SUPPORT_TURBOZ) | 
|  | } | 
|  | else { | 
 | if ((crtc.s.EXTGRPHPAL & 0x88) != 0x80) { | if ((crtc.s.EXTGRPHPAL & 0x88) != 0x80) { | 
 | return; | return; | 
 | } | } | 
| Line 342  void IOOUTCALL palette_o(UINT port, REG8 | Line 385  void IOOUTCALL palette_o(UINT port, REG8 | 
 | pal_setgrph(crtc.e.pal_bank, (REG8)num); | pal_setgrph(crtc.e.pal_bank, (REG8)num); | 
 | } | } | 
 | } | } | 
| else { | #endif | 
| num = (port >> 8) & 3; | } | 
| if (crtc.s.rgbp[num] != value) { |  | 
| crtc.s.rgbp[num] = value; | void IOOUTCALL blackctrl_o(UINT port, REG8 value) { | 
| makescrn.palandply = 1; |  | 
|  | if (crtc.s.rgbp[CRTC_BLACK] != value) { | 
|  | crtc.s.rgbp[CRTC_BLACK] = value; | 
|  | makescrn.palandply = 1; | 
|  | #if defined(SUPPORT_PALEVENT) | 
|  | if ((!corestat.vsync) && (palevent.events < SUPPORT_PALEVENT)) { | 
|  | PAL1EVENT *e = palevent.event + palevent.events; | 
|  | palevent.events++; | 
|  | e->rgbp = CRTC_BLACK; | 
|  | e->value = value; | 
|  | e->clock = nevent_getwork(NEVENT_FRAMES); | 
 | } | } | 
 |  | #endif | 
 | } | } | 
 |  | (void)port; | 
 |  | } | 
 |  |  | 
 |  | REG8 IOINPCALL blackctrl_i(UINT port) { | 
 |  |  | 
 |  | (void)port; | 
 |  | return(crtc.s.rgbp[CRTC_BLACK]); | 
 |  | } | 
 |  |  | 
 |  |  | 
 |  | // ---- turboZ | 
 |  |  | 
 |  | #if defined(SUPPORT_TURBOZ) | 
 |  | REG8 IOINPCALL ply_i(UINT port) { | 
 |  |  | 
 |  | (void)port; | 
 |  | return(crtc.s.rgbp[CRTC_PLY]); | 
 | } | } | 
 |  |  | 
 | REG8 IOINPCALL palette_i(UINT port) { | REG8 IOINPCALL palette_i(UINT port) { | 
| Line 389  REG8 IOINPCALL palette_i(UINT port) { | Line 460  REG8 IOINPCALL palette_i(UINT port) { | 
 | } | } | 
 |  |  | 
 |  |  | 
 | // ---- turboZ |  | 
 |  |  | 
 | void IOOUTCALL extpal_o(UINT port, REG8 value) { | void IOOUTCALL extpal_o(UINT port, REG8 value) { | 
 |  |  | 
 | crtc.s.EXTPALMODE = value; | crtc.s.EXTPALMODE = value; | 
| Line 452  REG8 IOINPCALL exttextdisp_i(UINT port) | Line 521  REG8 IOINPCALL exttextdisp_i(UINT port) | 
 | (void)port; | (void)port; | 
 | return(0xff); | return(0xff); | 
 | } | } | 
 |  | #endif | 
 |  |  | 
 | void IOOUTCALL blackctrl_o(UINT port, REG8 value) { |  | 
 |  |  | 
| crtc.s.BLACKPAL = value; | // ---- | 
|  |  | 
|  | void crtc_update(void) { | 
|  |  | 
|  | crtc_clkupdate(); | 
|  | crtc_timingupdate(); | 
|  | crtc_bankupdate(); | 
 | makescrn.palandply = 1; | makescrn.palandply = 1; | 
| (void)port; | scrnallflash = 1; | 
 | } | } | 
 |  |  | 
| REG8 IOINPCALL blackctrl_i(UINT port) { | void crtc_setwidth(REG8 width40) { | 
 |  |  | 
| (void)port; | crtc.s.width40 = width40; | 
| return(crtc.s.BLACKPAL); | crtc_update(); | 
 | } | } | 
 |  |  | 
 |  |  | 
 | // ---- | // ---- | 
 |  |  | 
 |  | #if defined(SUPPORT_TURBOZ) | 
 | static void resetpal(void) { | static void resetpal(void) { | 
 |  |  | 
 | CopyMemory(crtc.p.text, defpaltext, sizeof(defpaltext)); | CopyMemory(crtc.p.text, defpaltext, sizeof(defpaltext)); | 
 | CopyMemory(crtc.p.grph[0], defpalgrph, sizeof(defpalgrph)); | CopyMemory(crtc.p.grph[0], defpalgrph, sizeof(defpalgrph)); | 
 | CopyMemory(crtc.p.grph[1], defpalgrph, sizeof(defpalgrph)); | CopyMemory(crtc.p.grph[1], defpalgrph, sizeof(defpalgrph)); | 
 | } | } | 
 |  | #endif | 
 |  |  | 
 |  | #if defined(SUPPORT_TURBOZ) | 
 | void crtc_initialize(void) { | void crtc_initialize(void) { | 
 |  |  | 
 | UINT    p; | UINT    p; | 
| Line 485  void crtc_initialize(void) { | Line 563  void crtc_initialize(void) { | 
 | crtc.p.grph4096[p] = p; | crtc.p.grph4096[p] = p; | 
 | } | } | 
 | } | } | 
 |  | #endif | 
 |  |  | 
 | void crtc_reset(void) { | void crtc_reset(void) { | 
 |  |  | 
| crtc.s = crtcdefault; | ZeroMemory(&crtc, sizeof(crtc)); | 
|  | CopyMemory(crtc.s.rgbp, defrgbp, 4); | 
|  | CopyMemory(crtc.s.reg, defreg, 18); | 
|  | crtc.s.width40 = 1; | 
|  | #if defined(SUPPORT_TURBOZ) | 
 | if (pccore.ROM_TYPE < 3) { | if (pccore.ROM_TYPE < 3) { | 
 | resetpal(); | resetpal(); | 
 | } | } | 
| if ((pccore.ROM_TYPE >= 2) && (!(pccore.DIP_SW & 1))) { | #endif | 
| crtc.s.SCRN_BITS = SCRN_200LINE; | //      IPLが勝手に切り替える筈である | 
| crtc.s._FNT_YL = 15; | //      if ((pccore.ROM_TYPE >= 2) && (!(pccore.DIP_SW & 1))) { | 
| } | //              crtc.s.SCRN_BITS = SCRN_200LINE; | 
|  | //              crtc.s.reg[CRTCREG_CHRCY] = 15; | 
|  | //      } | 
 |  |  | 
 | pal_reset(); | pal_reset(); | 
 | crtc_bankupdate(); |  | 
 | crtc_regupdate(); |  | 
 | makescrn.palandply = 1; | makescrn.palandply = 1; | 
| scrnallflash = 1; | crtc_update(); | 
 | } | } | 
 |  |  | 
 | void crtc_forcesetwidth(REG8 width) { | void crtc_forcesetwidth(REG8 width) { | 
 |  |  | 
| crtc.s.TXT_XL = (UINT8)width; | crtc.s.reg[CRTCREG_HDISP] = (UINT8)width; | 
 | crtc_bankupdate(); | crtc_bankupdate(); | 
 | scrnallflash = 1; | scrnallflash = 1; | 
 | } | } |