|
|
| version 1.13, 2004/08/17 16:52:46 | version 1.14, 2004/08/18 08:08:13 |
|---|---|
| Line 1 | Line 1 |
| #include "compiler.h" | #include "compiler.h" |
| #include "scrnmng.h" | #include "scrnmng.h" |
| #include "sysmng.h" | |
| #include "pccore.h" | #include "pccore.h" |
| #include "iocore.h" | #include "iocore.h" |
| #include "vram.h" | #include "vram.h" |
| Line 9 | Line 10 |
| #include "makesub.h" | #include "makesub.h" |
| MAKESCRN makescrn; | MAKESCRN makescrn; |
| UINT8 scrnallflash; | UINT8 scrnallflash; |
| static UINT8 lastdisp = 0; | UINT drawtime = 0; |
| static UINT8 blinktime = 1; | |
| UINT drawtime = 0; | |
| static void fillupdatetmp(void) { | static void fillupdatetmp(void) { |
| Line 101 static BRESULT updateblink(void) { | Line 100 static BRESULT updateblink(void) { |
| REG8 update; | REG8 update; |
| UINT r; | UINT r; |
| if (blinktime) { | if (makescrn.blinktime) { |
| blinktime--; | makescrn.blinktime--; |
| return(FALSE); | return(FALSE); |
| } | } |
| else { | else { |
| blinktime = 30 - 1; | makescrn.blinktime = 30 - 1; |
| pos = makescrn.vramtop; | pos = makescrn.vramtop; |
| makescrn.blinktest ^= 0x10; | makescrn.blinktest ^= 0x10; |
| update = 0; | update = 0; |
| Line 132 static BRESULT updateblink(void) { | Line 131 static BRESULT updateblink(void) { |
| // ---- | // ---- |
| typedef void (*MAKEFN)(void); | |
| static void width_dummy(void) { } | |
| static const UINT8 screendraw[] = { | |
| MAKESCRN_320x200S, MAKESCRN_320x400, | |
| MAKESCRN_320x200S, MAKESCRN_320x400, | |
| MAKESCRN_320x200S, MAKESCRN_320x400, | |
| MAKESCRN_320x200S, MAKESCRN_320x200H, | |
| MAKESCRN_320x200S, MAKESCRN_320x400, | |
| MAKESCRN_320x200S, MAKESCRN_320x400, | |
| MAKESCRN_320x200S, MAKESCRN_320x200H, | |
| MAKESCRN_320x200S, MAKESCRN_320x200H, | |
| #if defined(SUPPORT_TURBOZ) | |
| MAKESCRN_320x200H, MAKESCRN_320x200H, | |
| MAKESCRN_320x200H, MAKESCRN_320x200H, | |
| MAKESCRN_320x200H, MAKESCRN_320x200H, | |
| MAKESCRN_320x200H, MAKESCRN_320x200H, | |
| MAKESCRN_320x200H, MAKESCRN_320x200H, | |
| MAKESCRN_320x200H, MAKESCRN_320x200H, | |
| MAKESCRN_320x200H, MAKESCRN_320x200H, | |
| MAKESCRN_320x200H, MAKESCRN_320x200H, | |
| #endif | |
| }; | |
| static const MAKEFN screenmake[] = { | |
| width80x25_200l, width80x25_400h, | |
| width80x25_200l, width80x25_200h, | |
| width80x12_200l, width80x12_400h, | |
| width80x12_200l, width80x12_200h, | |
| width80x20l, width80x20h, | |
| width80x20l, width80x20h, | |
| width80x10l, width80x10h, | |
| width80x10l, width80x10h, | |
| #if defined(SUPPORT_TURBOZ) | |
| width_dummy, width_dummy, | |
| width_dummy, width_dummy, | |
| width_dummy, width_dummy, | |
| width_dummy, width_dummy, | |
| width_dummy, width_dummy, | |
| width_dummy, width_dummy, | |
| width_dummy, width_dummy, | |
| width_dummy, width_dummy, | |
| #endif | |
| }; | |
| static void changemodes(void) { | static void changemodes(void) { |
| lastdisp = crtc.e.dispmode; | REG8 dispmode; |
| if (!(lastdisp & SCRN_BANK1)) { | |
| dispmode = crtc.e.dispmode; | |
| makescrn.dispmode = dispmode; | |
| makescrn.drawmode = screendraw[dispmode & DISPMODE_MASKMODE]; | |
| if (dispmode & DISPMODE_WIDTH80) { | |
| makescrn.drawmode |= 1; | |
| } | |
| sysmng_scrnwidth((dispmode & DISPMODE_WIDTH80) == 0); | |
| if (!(dispmode & DISPMODE_BANK1)) { | |
| makescrn.disp1 = gram + GRAM_BANK0; | makescrn.disp1 = gram + GRAM_BANK0; |
| makescrn.disp2 = gram + GRAM_BANK1; | makescrn.disp2 = gram + GRAM_BANK1; |
| makescrn.dispflag = UPDATE_TRAM | UPDATE_VRAM0; | makescrn.dispflag = UPDATE_TRAM + UPDATE_VRAM0; |
| } | } |
| else { | else { |
| makescrn.disp1 = gram + GRAM_BANK1; | makescrn.disp1 = gram + GRAM_BANK1; |
| makescrn.disp2 = gram + GRAM_BANK0; | makescrn.disp2 = gram + GRAM_BANK0; |
| makescrn.dispflag = UPDATE_TRAM | UPDATE_VRAM1; | makescrn.dispflag = UPDATE_TRAM + UPDATE_VRAM1; |
| } | } |
| scrnallflash = 1; | scrnallflash = 1; |
| makescrn.palandply = 1; | makescrn.palandply = 1; |
| Line 155 static void changecrtc(void) { | Line 216 static void changecrtc(void) { |
| UINT scrnymax; | UINT scrnymax; |
| UINT textxl; | UINT textxl; |
| UINT surfcx; | UINT surfcx; |
| REG8 widthmode; | |
| UINT fontcy; | UINT fontcy; |
| UINT underlines; | UINT underlines; |
| REG8 y2; | REG8 y2; |
| Line 168 static void changecrtc(void) { | Line 228 static void changecrtc(void) { |
| makescrn.vramtop = crtc.e.pos; | makescrn.vramtop = crtc.e.pos; |
| scrnxmax = (crtc.s.width40)?40:80; | scrnxmax = (makescrn.dispmode & DISPMODE_WIDTH80)?80:40; |
| scrnymax = 200; | scrnymax = 200; |
| if (crtc.s.width40) { | |
| if (lastdisp & SCRN_DRAW4096) { | |
| widthmode = SCRNWIDTHMODE_4096; | |
| } | |
| else { | |
| widthmode = SCRNWIDTHMODE_WIDTH40; | |
| } | |
| } | |
| else { | |
| widthmode = SCRNWIDTHMODE_WIDTH80; | |
| } | |
| scrndraw_changewidth(widthmode); | |
| textxl = crtc.s.reg[CRTCREG_HDISP]; | textxl = crtc.s.reg[CRTCREG_HDISP]; |
| surfcx = min(scrnxmax, textxl); | surfcx = min(scrnxmax, textxl); |
| fontcy = crtc.e.fonty; | fontcy = crtc.e.fonty; |
| underlines = (crtc.s.SCRN_BITS & SCRN_UNDERLINE)?2:0; | underlines = (makescrn.dispmode & DISPMODE_UNDERLINE)?2:0; |
| if (fontcy > underlines) { | if (fontcy > underlines) { |
| fontcy -= underlines; | fontcy -= underlines; |
| } | } |
| else { | else { |
| fontcy = 0; | fontcy = 0; |
| } | } |
| y2 = (crtc.s.SCRN_BITS & SCRN_TEXTYx2)?1:0; | y2 = (makescrn.dispmode & DISPMODE_TEXTYx2)?1:0; |
| fontcy >>= y2; | fontcy >>= y2; |
| #if 0 | #if 0 |
| if (((dispmode & SCRN64_MASK) != SCRN64_INVALID) && (fontcy > 8)) { | if (((dispmode & SCRN64_MASK) != SCRN64_INVALID) && (fontcy > 8)) { |
| Line 241 static void changecrtc(void) { | Line 289 static void changecrtc(void) { |
| // scrnmng_setheight(0, charcy * surfcy * 2); | // scrnmng_setheight(0, charcy * surfcy * 2); |
| } | } |
| // ------------------------------------------------------------------------- | |
| typedef void (*DRAWFN)(void); | |
| static const DRAWFN screendraw[8] = { | |
| width80x25_200l, width80x25_400h, | |
| width80x25_200l, width80x25_200h, | |
| width80x12_200l, width80x12_400h, | |
| width80x12_200l, width80x12_200h}; | |
| static const DRAWFN screendraw2[8] = { | |
| width80x20l, width80x20h, | |
| width80x20l, width80x20h, | |
| width80x10l, width80x10h, | |
| width80x10l, width80x10h}; | |
| void scrnupdate(void) { | void scrnupdate(void) { |
| BRESULT ddrawflash; | BRESULT ddrawflash; |
| Line 271 void scrnupdate(void) { | Line 301 void scrnupdate(void) { |
| ddrawflash = makescrn.nextdraw; | ddrawflash = makescrn.nextdraw; |
| allflash = FALSE; | allflash = FALSE; |
| if (lastdisp != crtc.e.dispmode) { | if (makescrn.dispmode != crtc.e.dispmode) { |
| changemodes(); | changemodes(); |
| } | } |
| if (scrnallflash) { | if (scrnallflash) { |
| Line 299 void scrnupdate(void) { | Line 329 void scrnupdate(void) { |
| makescrn.scrnflash = 0; | makescrn.scrnflash = 0; |
| if (makescrn.vramsize) { | if (makescrn.vramsize) { |
| makescrn.fontycnt = 0; | makescrn.fontycnt = 0; |
| screenmake[makescrn.dispmode & DISPMODE_MASKMODE](); | |
| #if 0 | |
| switch(lastdisp & SCRN64_MASK) { | switch(lastdisp & SCRN64_MASK) { |
| case SCRN64_320x200: | case SCRN64_320x200: |
| // width40x25_64s(); | // width40x25_64s(); |
| Line 343 void scrnupdate(void) { | Line 375 void scrnupdate(void) { |
| // case SCRN64_INVALID: | // case SCRN64_INVALID: |
| default: | default: |
| if (!(crtc.s.SCRN_BITS & SCRN_UNDERLINE)) { | if (!(crtc.s.SCRN_BITS & SCRN_UNDERLINE)) { |
| screendraw[crtc.s.SCRN_BITS & 7](); | screenmake[(crtc.s.SCRN_BITS & 7) + 0](); |
| } | } |
| else { | else { |
| screendraw2[crtc.s.SCRN_BITS & 7](); | screenmake[(crtc.s.SCRN_BITS & 7) + 8](); |
| } | } |
| break; | break; |
| } | } |
| #endif | |
| ddrawflash = TRUE; | ddrawflash = TRUE; |
| } | } |
| } | } |
| if (ddrawflash) { | if (ddrawflash) { |
| ddrawflash = 0; | |
| makescrn.nextdraw = scrndraw_draw(allflash); | makescrn.nextdraw = scrndraw_draw(allflash); |
| drawtime++; | drawtime++; |
| } | } |