|
|
| version 1.17, 2004/08/17 14:46:37 | version 1.20, 2008/06/02 20:07:31 |
|---|---|
| Line 1 | Line 1 |
| #include "compiler.h" | #include "compiler.h" |
| #include "scrnmng.h" | |
| #include "z80core.h" | #include "z80core.h" |
| #include "pccore.h" | #include "pccore.h" |
| #include "iocore.h" | #include "iocore.h" |
| Line 45 static const GDCCLK gdcclk[] = { | Line 44 static const GDCCLK gdcclk[] = { |
| {14318180 / 8, 112 - 8, 112 + 8, 200, 300}, | {14318180 / 8, 112 - 8, 112 + 8, 200, 300}, |
| {21052600 / 8, 108 - 6, 108 + 6, 400, 575}}; | {21052600 / 8, 108 - 6, 108 + 6, 400, 575}}; |
| enum { | |
| CRTCUPD_CLOCK = 0x01, | |
| CRTCUPD_TIMING = 0x02, | |
| CRTCUPD_POS = 0x04 | |
| }; | |
| static void crtc_bankupdate(void) { | |
| static void crtc_clkupdate(void) { | if (!(crtc.s.SCRN_BITS & SCRN_ACCESSVRAM)) { |
| crtc.e.gramacc = gram + GRAM_BANK0; | |
| UINT clksync; | crtc.e.updatebit = UPDATE_VRAM0; |
| 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); | |
| fonty = crtc.s.reg[CRTCREG_CHRCY] & 0x1f; | |
| fonty >>= clksync; | |
| fonty += 1; | |
| crtc.e.fonty = fonty; | |
| v = (crtc.s.reg[CRTCREG_CHRCY] & 0x1f) + 1; | |
| v = v * ((crtc.s.reg[CRTCREG_VSIZE] & 0x7f) + 1); | |
| v = v + (crtc.s.reg[CRTCREG_VSIZEA] & 0x1f); | |
| if (v < clk->miny) { | |
| v = clk->miny; | |
| } | } |
| else if (v > clk->maxy) { | else { |
| v = clk->maxy; | crtc.e.gramacc = gram + GRAM_BANK1; |
| crtc.e.updatebit = UPDATE_VRAM1; | |
| } | } |
| crtc.e.frameclock = ((4000000 * h) / clk->clock) * v; | |
| } | } |
| static void crtc_timingupdate(void) { | static void crtc_dispupdate(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) { | |
| REG8 scrnpage; | |
| REG8 dispmode; | |
| #if defined(SUPPORT_TURBOZ) | #if defined(SUPPORT_TURBOZ) |
| UINT updatemask; | UINT updatemask; |
| UINT8 dispmode; | REG8 pal_bank; |
| UINT8 pal_bank; | REG8 pal_disp; |
| UINT8 pal_disp; | |
| #endif | #endif |
| if (crtc.s.SCRN_BITS & 0x10) { | scrnpage = (crtc.s.SCRN_BITS & SCRN_DISPVRAM)?SCRN_BANK1:SCRN_BANK0; |
| crtc.e.gram = gram + GRAM_BANK1; | if (!crtc.s.width40) { |
| crtc.e.updatebit = UPDATE_VRAM1; | scrnpage += SCRN_WIDTH80; |
| } | |
| else { | |
| crtc.e.gram = gram + GRAM_BANK0; | |
| crtc.e.updatebit = UPDATE_VRAM0; | |
| } | } |
| dispmode = scrnpage; | |
| dispmode += (crtc.s.SCRN_BITS & SCRN_UNDERLINE) >> 4; | |
| dispmode += (crtc.s.SCRN_BITS & 7); | |
| #if !defined(SUPPORT_TURBOZ) | #if !defined(SUPPORT_TURBOZ) |
| crtc.e.updatemask = (crtc.s.SCRN_BITS & SCRN_TEXTYx2)?0x3ff:0x7ff; | crtc.e.updatemask = (crtc.s.SCRN_BITS & SCRN_TEXTYx2)?0x3ff:0x7ff; |
| crtc.e.dispmode = | crtc.e.dispmode = dispmode; |
| (crtc.s.SCRN_BITS & SCRN_DISPVRAM)?SCRN_BANK1:SCRN_BANK0; | |
| #else | #else |
| dispmode = (crtc.s.SCRN_BITS & SCRN_DISPVRAM)?SCRN_BANK1:SCRN_BANK0; | |
| pal_bank = PAL_NORMAL; | pal_bank = PAL_NORMAL; |
| pal_disp = 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)) { |
| Line 150 static void crtc_bankupdate(void) { | Line 91 static void crtc_bankupdate(void) { |
| updatemask = 0x3ff; | updatemask = 0x3ff; |
| } | } |
| } | } |
| else { // Analog mode | else { /* Analog mode */ |
| 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.width40) { | if (crtc.s.width40) { |
| if (crtc.s.SCRN_BITS & SCRN_200LINE) { // width 40,25,0,2 | if (crtc.s.SCRN_BITS & SCRN_200LINE) { |
| dispmode |= SCRN64_320x200; | /* width 40,25,0,2 */ |
| dispmode = scrnpage + SCRN64_320x200; | |
| } | } |
| else { // width 40,25,1,2 | else { /* width 40,25,1,2 */ |
| dispmode = SCRN64_H320x400; | dispmode = SCRN64_H320x400; |
| } | } |
| } | } |
| else { // width 80,25,?,2 | else { /* width 80,25,?,2 */ |
| updatemask = 0x7ff; | updatemask = 0x7ff; |
| pal_bank = pal_disp = PAL_HIGHRESO; | pal_bank = PAL_HIGHRESO; |
| pal_disp = PAL_HIGHRESO; | |
| } | } |
| } | } |
| else { | else { |
| if (crtc.s.width40) { // 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 + |
| ((crtc.s.ZPRY & 8) ? SCRN_BANK1 : SCRN_BANK0); | ((crtc.s.ZPRY & 8)?SCRN_BANK1:SCRN_BANK0); |
| pal_disp = PAL_4096 | PAL_64x2 | | pal_disp = PAL_4096 + PAL_64x2 + |
| ((crtc.s.ZPRY & 8) ? PAL_4096L : PAL_4096H); | ((crtc.s.ZPRY & 8)?PAL_4096L:PAL_4096H); |
| } | } |
| else { | else { |
| dispmode |= SCRN64_320x200; | dispmode = scrnpage + SCRN64_320x200; |
| pal_disp = PAL_4096 | | pal_disp = PAL_4096 + |
| ((crtc.s.SCRN_BITS & SCRN_DISPVRAM) | ((crtc.s.SCRN_BITS & SCRN_DISPVRAM) |
| ? PAL_4096L : PAL_4096H); | ?PAL_4096L:PAL_4096H); |
| } | } |
| pal_bank = PAL_4096 | | pal_bank = PAL_4096 + |
| ((crtc.s.SCRN_BITS & SCRN_ACCESSVRAM) | ((crtc.s.SCRN_BITS & SCRN_ACCESSVRAM) |
| ? PAL_4096L : PAL_4096H); | ?PAL_4096L:PAL_4096H); |
| } | } |
| else { | else { |
| dispmode = SCRN64_320x200x4096 | SCRN_DRAW4096; | dispmode = SCRN_DRAW4096 + SCRN64_320x200x4096; |
| pal_bank = pal_disp = PAL_4096 | PAL_4096FULL; | pal_bank = PAL_4096 + PAL_4096FULL; |
| pal_disp = PAL_4096 + PAL_4096FULL; | |
| } | } |
| } | } |
| else { // width 80,25,0,1 | else { /* width 80,25,0,1 */ |
| updatemask = 0x7ff; | updatemask = 0x7ff; |
| dispmode = SCRN64_L640x200; | dispmode = SCRN_WIDTH80 + SCRN64_L640x200; |
| } | } |
| } | } |
| } | } |
| else { | else { |
| if (crtc.s.SCRN_BITS & SCRN_24KHZ) { | if (crtc.s.SCRN_BITS & SCRN_24KHZ) { |
| if (crtc.s.width40) { | if (crtc.s.width40) { |
| if (crtc.s.SCRN_BITS & SCRN_200LINE) { // width 40,12,0,2 | if (crtc.s.SCRN_BITS & SCRN_200LINE) { |
| dispmode |= SCRN64_320x100; | /* width 40,12,0,2 */ |
| dispmode = scrnpage + SCRN64_320x100; | |
| } | } |
| else { // width 40,12,1,2 | else { /* width 40,12,1,2 */ |
| dispmode = SCRN64_H320x200; | dispmode = SCRN64_H320x200; |
| } | } |
| } | } |
| else { // width 80,12,?,2 | else { /* width 80,12,?,2 */ |
| pal_bank = pal_disp = PAL_HIGHRESO; | pal_bank = PAL_HIGHRESO; |
| pal_disp = PAL_HIGHRESO; | |
| } | } |
| } | } |
| else { | else { |
| if (crtc.s.width40) { // 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 + |
| ((crtc.s.ZPRY & 8) ? SCRN_BANK1 : SCRN_BANK0); | ((crtc.s.ZPRY & 8)?SCRN_BANK1:SCRN_BANK0); |
| pal_disp = PAL_4096 | PAL_64x2 | | pal_disp = PAL_4096 + PAL_64x2 + |
| ((crtc.s.ZPRY & 8) ? PAL_4096L : PAL_4096H); | ((crtc.s.ZPRY & 8)?PAL_4096L:PAL_4096H); |
| } | } |
| else { | else { |
| dispmode |= SCRN64_320x100; | dispmode = scrnpage + SCRN64_320x100; |
| pal_disp = PAL_4096 | | pal_disp = PAL_4096 + |
| ((crtc.s.SCRN_BITS & SCRN_DISPVRAM) | ((crtc.s.SCRN_BITS & SCRN_DISPVRAM) |
| ? PAL_4096L : PAL_4096H); | ?PAL_4096L:PAL_4096H); |
| } | } |
| pal_bank = PAL_4096 | | pal_bank = PAL_4096 + |
| ((crtc.s.SCRN_BITS & SCRN_ACCESSVRAM) | ((crtc.s.SCRN_BITS & SCRN_ACCESSVRAM) |
| ? PAL_4096L : PAL_4096H); | ?PAL_4096L:PAL_4096H); |
| } | } |
| else { | else { |
| dispmode = SCRN64_320x100x4096 | SCRN_DRAW4096; | dispmode = SCRN_DRAW4096 + SCRN64_320x100x4096; |
| pal_bank = pal_disp = PAL_4096 | PAL_4096FULL; | pal_bank = PAL_4096 + PAL_4096FULL; |
| pal_disp = PAL_4096 + PAL_4096FULL; | |
| } | } |
| } | } |
| else { // width 80,12,0,1 | else { /* width 80,12,0,1 */ |
| dispmode = SCRN64_L640x100; | dispmode = SCRN_WIDTH80 + SCRN64_L640x100; |
| } | } |
| } | } |
| } | } |
| Line 248 static void crtc_bankupdate(void) { | Line 195 static void crtc_bankupdate(void) { |
| #endif | #endif |
| } | } |
| static void crtc_clkupdate(void) { | |
| UINT clksync; | |
| 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); | |
| fonty = crtc.s.reg[CRTCREG_CHRCY] & 0x1f; | |
| fonty >>= clksync; | |
| fonty += 1; | |
| crtc.e.fonty = fonty; | |
| v = (crtc.s.reg[CRTCREG_CHRCY] & 0x1f) + 1; | |
| v = v * ((crtc.s.reg[CRTCREG_VSIZE] & 0x7f) + 1); | |
| v = v + (crtc.s.reg[CRTCREG_VSIZEA] & 0x1f); | |
| 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) { | |
| UINT32 fontclock; | |
| UINT yl; | |
| SINT32 vsyncstart; | |
| /* とりあえず…ね */ | |
| crtc.e.pos = crtc.s.reg[CRTCREG_POSL] | |
| + ((crtc.s.reg[CRTCREG_POSH] & 7) << 8); | |
| 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; | |
| iocore.e.dispclock = fontclock * max(yl, 1); | |
| vsyncstart = fontclock * ((crtc.s.reg[CRTCREG_VSYNC] & 0x7f) + 1); | |
| iocore.e.vsyncstart = vsyncstart; | |
| #if !defined(MAINFRAMES_OLD) | |
| iocore.e.vsyncend = vsyncstart + (((crtc.s.reg[CRTCREG_PULSE] >> 4) | |
| * crtc.e.rasterclock8) >> 8); | |
| neitem_mainframes(NEVENT_FRAMES); | |
| #else | |
| iocore.e.vpulseclock = ((crtc.s.reg[CRTCREG_PULSE] >> 4) | |
| * crtc.e.rasterclock8) >> 8; | |
| #endif | |
| } | |
| // ---- CRTC | /* CRTC */ |
| void IOOUTCALL crtc_o(UINT port, REG8 value) { | void IOOUTCALL crtc_o(UINT port, REG8 value) { |
| Line 263 void IOOUTCALL crtc_o(UINT port, REG8 va | Line 280 void IOOUTCALL crtc_o(UINT port, REG8 va |
| crtc.s.reg[crtc.s.regnum] = value; | crtc.s.reg[crtc.s.regnum] = value; |
| crtc_clkupdate(); | crtc_clkupdate(); |
| crtc_timingupdate(); | crtc_timingupdate(); |
| crtc_bankupdate(); | crtc.e.remakeattr = 1; |
| makescrn.remakeattr = 1; | crtc.e.scrnallflash = 1; |
| scrnallflash = 1; | |
| } | } |
| } | } |
| } | } |
| } | } |
| // ---- スクリーンモード | /* スクリーンモード */ |
| void IOOUTCALL scrn_o(UINT port, REG8 value) { | void IOOUTCALL scrn_o(UINT port, REG8 value) { |
| Line 280 void IOOUTCALL scrn_o(UINT port, REG8 va | Line 296 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_ACCESSVRAM) { | |
| crtc_bankupdate(); | |
| } | |
| if (modify & SCRN_DISPCHANGE) { | if (modify & SCRN_DISPCHANGE) { |
| // pal_reset(); // なんで? | crtc.e.scrnallflash = 1; |
| scrnallflash = 1; | crtc_dispupdate(); |
| makescrn.palandply = 1; | |
| crtc_clkupdate(); | crtc_clkupdate(); |
| crtc_timingupdate(); | crtc_timingupdate(); |
| crtc.e.palandply = 1; | |
| } | } |
| crtc_bankupdate(); | |
| (void)port; | (void)port; |
| } | } |
| Line 298 REG8 IOINPCALL scrn_i(UINT port) { | Line 316 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.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; | crtc.e.palandply = 1; |
| #if defined(SUPPORT_PALEVENT) | #if defined(SUPPORT_PALEVENT) |
| if ((!corestat.vsync) && (palevent.events < SUPPORT_PALEVENT)) { | if ((!corestat.vsync) && (palevent.events < SUPPORT_PALEVENT)) { |
| PAL1EVENT *e = palevent.event + palevent.events; | PAL1EVENT *e = palevent.event + palevent.events; |
| Line 319 void IOOUTCALL ply_o(UINT port, REG8 val | Line 337 void IOOUTCALL ply_o(UINT port, REG8 val |
| } | } |
| // ---- パレット | /* パレット */ |
| void IOOUTCALL palette_o(UINT port, REG8 value) { | void IOOUTCALL palette_o(UINT port, REG8 value) { |
| Line 336 void IOOUTCALL palette_o(UINT port, REG8 | Line 354 void IOOUTCALL palette_o(UINT port, REG8 |
| num = (port >> 8) & 3; | num = (port >> 8) & 3; |
| if (crtc.s.rgbp[num] != value) { | if (crtc.s.rgbp[num] != value) { |
| crtc.s.rgbp[num] = value; | crtc.s.rgbp[num] = value; |
| makescrn.palandply = 1; | crtc.e.palandply = 1; |
| #if defined(SUPPORT_PALEVENT) | #if defined(SUPPORT_PALEVENT) |
| if ((!corestat.vsync) && (palevent.events < SUPPORT_PALEVENT)) { | if ((!corestat.vsync) && (palevent.events < SUPPORT_PALEVENT)) { |
| PAL1EVENT *e = palevent.event + palevent.events; | PAL1EVENT *e = palevent.event + palevent.events; |
| Line 354 void IOOUTCALL palette_o(UINT port, REG8 | Line 372 void IOOUTCALL palette_o(UINT port, REG8 |
| return; | return; |
| } | } |
| sft = (port >> (8 - 2)) & (3 << 2); | sft = (port >> (8 - 2)) & (3 << 2); |
| if (crtc.e.pal_bank & PAL_4096) { // use 4096palettes | if (crtc.e.pal_bank & PAL_4096) { /* use 4096palettes */ |
| num = ((port & 0xff) << 4) + (crtc.s.lastpal >> 4); | num = ((port & 0xff) << 4) + (crtc.s.lastpal >> 4); |
| if (!(crtc.e.pal_bank & PAL_4096FULL)) { | if (!(crtc.e.pal_bank & PAL_4096FULL)) { |
| num &= 0xccc; | num &= 0xccc; |
| Line 371 void IOOUTCALL palette_o(UINT port, REG8 | Line 389 void IOOUTCALL palette_o(UINT port, REG8 |
| else { | else { |
| num = ((port & 0x80) >> 5) | ((port & 0x08) >> 2) | | num = ((port & 0x80) >> 5) | ((port & 0x08) >> 2) | |
| ((value & 0x80) >> 7); | ((value & 0x80) >> 7); |
| if ((crtc.e.dispmode & SCRN64_MASK) == SCRN64_INVALID) { | if (crtc.e.dispmode & SCRN64_ENABLE) { |
| num |= (num << 3); | |
| } | |
| else { | |
| num += ((port & 0x40) >> 1) | ((port & 0x04) << 2) | | num += ((port & 0x40) >> 1) | ((port & 0x04) << 2) | |
| ((value & 0x40) >> 3); | ((value & 0x40) >> 3); |
| } | } |
| else { | |
| num |= (num << 3); | |
| } | |
| pal = crtc.p.grph[crtc.e.pal_bank][num]; | pal = crtc.p.grph[crtc.e.pal_bank][num]; |
| pal &= ~((0x0f) << sft); | pal &= ~((0x0f) << sft); |
| pal |= (value & 0x0f) << sft; | pal |= (value & 0x0f) << sft; |
| Line 392 void IOOUTCALL blackctrl_o(UINT port, RE | Line 410 void IOOUTCALL blackctrl_o(UINT port, RE |
| if (crtc.s.rgbp[CRTC_BLACK] != value) { | if (crtc.s.rgbp[CRTC_BLACK] != value) { |
| crtc.s.rgbp[CRTC_BLACK] = value; | crtc.s.rgbp[CRTC_BLACK] = value; |
| makescrn.palandply = 1; | crtc.e.palandply = 1; |
| #if defined(SUPPORT_PALEVENT) | #if defined(SUPPORT_PALEVENT) |
| if ((!corestat.vsync) && (palevent.events < SUPPORT_PALEVENT)) { | if ((!corestat.vsync) && (palevent.events < SUPPORT_PALEVENT)) { |
| PAL1EVENT *e = palevent.event + palevent.events; | PAL1EVENT *e = palevent.event + palevent.events; |
| Line 413 REG8 IOINPCALL blackctrl_i(UINT port) { | Line 431 REG8 IOINPCALL blackctrl_i(UINT port) { |
| } | } |
| // ---- turboZ | /* turboZ */ |
| #if defined(SUPPORT_TURBOZ) | #if defined(SUPPORT_TURBOZ) |
| REG8 IOINPCALL ply_i(UINT port) { | REG8 IOINPCALL ply_i(UINT port) { |
| Line 429 REG8 IOINPCALL palette_i(UINT port) { | Line 447 REG8 IOINPCALL palette_i(UINT port) { |
| REG8 sft; | REG8 sft; |
| if ((crtc.s.EXTPALMODE & 0x80) && ((crtc.s.EXTGRPHPAL & 0x88) == 0x88)) { | if ((crtc.s.EXTPALMODE & 0x80) && ((crtc.s.EXTGRPHPAL & 0x88) == 0x88)) { |
| if (crtc.e.pal_bank & PAL_4096) { // use 4096palettes | if (crtc.e.pal_bank & PAL_4096) { /* use 4096palettes */ |
| num = ((port & 0xff) << 4) + (crtc.s.lastpal >> 4); | num = ((port & 0xff) << 4) + (crtc.s.lastpal >> 4); |
| if (!(crtc.e.pal_bank & PAL_4096FULL)) { | if (!(crtc.e.pal_bank & PAL_4096FULL)) { |
| num &= 0xccc; | num &= 0xccc; |
| Line 442 REG8 IOINPCALL palette_i(UINT port) { | Line 460 REG8 IOINPCALL palette_i(UINT port) { |
| else { | else { |
| num = ((port & 0x80) >> 5) | ((port & 0x08) >> 2) | | num = ((port & 0x80) >> 5) | ((port & 0x08) >> 2) | |
| ((crtc.s.lastpal & 0x80) >> 7); | ((crtc.s.lastpal & 0x80) >> 7); |
| if ((crtc.e.dispmode & SCRN64_MASK) == SCRN64_INVALID) { | if (crtc.e.dispmode & SCRN64_ENABLE) { |
| num |= (num << 3); | |
| } | |
| else { | |
| num += ((port & 0x40) >> 1) | ((port & 0x04) << 2) | | num += ((port & 0x40) >> 1) | ((port & 0x04) << 2) | |
| ((crtc.s.lastpal & 0x40) >> 3); | ((crtc.s.lastpal & 0x40) >> 3); |
| } | } |
| else { | |
| num |= (num << 3); | |
| } | |
| pal = crtc.p.grph[crtc.e.pal_bank][num]; | pal = crtc.p.grph[crtc.e.pal_bank][num]; |
| } | } |
| sft = (port >> (8 - 2)) & (3 << 2); | sft = (port >> (8 - 2)) & (3 << 2); |
| Line 463 REG8 IOINPCALL palette_i(UINT port) { | Line 481 REG8 IOINPCALL palette_i(UINT port) { |
| void IOOUTCALL extpal_o(UINT port, REG8 value) { | void IOOUTCALL extpal_o(UINT port, REG8 value) { |
| crtc.s.EXTPALMODE = value; | crtc.s.EXTPALMODE = value; |
| crtc_bankupdate(); | crtc_dispupdate(); |
| (void)port; | (void)port; |
| } | } |
| Line 509 REG8 IOINPCALL exttextpal_i(UINT port) { | Line 527 REG8 IOINPCALL exttextpal_i(UINT port) { |
| void IOOUTCALL exttextdisp_o(UINT port, REG8 value) { | void IOOUTCALL exttextdisp_o(UINT port, REG8 value) { |
| crtc.s.ZPRY = value; | crtc.s.ZPRY = value; |
| crtc_bankupdate(); | crtc_dispupdate(); |
| (void)port; | (void)port; |
| } | } |
| Line 524 REG8 IOINPCALL exttextdisp_i(UINT port) | Line 542 REG8 IOINPCALL exttextdisp_i(UINT port) |
| #endif | #endif |
| // ---- | /* extension */ |
| void crtc_update(void) { | void crtc_update(void) { |
| crtc_bankupdate(); | |
| crtc_dispupdate(); | |
| crtc_clkupdate(); | crtc_clkupdate(); |
| crtc_timingupdate(); | crtc_timingupdate(); |
| crtc_bankupdate(); | crtc.e.palandply = 1; |
| makescrn.palandply = 1; | crtc.e.scrnallflash = 1; |
| scrnallflash = 1; | |
| } | } |
| void crtc_setwidth(REG8 width40) { | void crtc_setwidth(REG8 width40) { |
| Line 542 void crtc_setwidth(REG8 width40) { | Line 561 void crtc_setwidth(REG8 width40) { |
| } | } |
| // ---- | /* init/reset */ |
| #if defined(SUPPORT_TURBOZ) | #if defined(SUPPORT_TURBOZ) |
| static void resetpal(void) { | static void resetpal(void) { |
| Line 576 void crtc_reset(void) { | Line 595 void crtc_reset(void) { |
| resetpal(); | resetpal(); |
| } | } |
| #endif | #endif |
| // IPLが勝手に切り替える筈である | #if 0 |
| // if ((pccore.ROM_TYPE >= 2) && (!(pccore.DIP_SW & 1))) { | /* IPLが勝手に切り替える筈である */ |
| // crtc.s.SCRN_BITS = SCRN_200LINE; | if ((pccore.ROM_TYPE >= 2) && (!(pccore.DIP_SW & 1))) { |
| // crtc.s.reg[CRTCREG_CHRCY] = 15; | crtc.s.SCRN_BITS = SCRN_200LINE; |
| // } | crtc.s.reg[CRTCREG_CHRCY] = 15; |
| } | |
| #endif /* 0 */ | |
| pal_reset(); | pal_reset(); |
| makescrn.palandply = 1; | crtc.e.palandply = 1; |
| crtc_update(); | crtc_update(); |
| } | } |
| void crtc_forcesetwidth(REG8 width) { | void crtc_forcesetwidth(REG8 width) { |
| crtc.s.reg[CRTCREG_HDISP] = (UINT8)width; | crtc.s.reg[CRTCREG_HDISP] = (UINT8)width; |
| crtc_bankupdate(); | crtc_dispupdate(); |
| scrnallflash = 1; | crtc.e.scrnallflash = 1; |
| } | } |