--- xmil/vram/makescrn.c 2004/08/12 13:32:52 1.7 +++ xmil/vram/makescrn.c 2004/08/17 16:52:46 1.13 @@ -11,9 +11,9 @@ MAKESCRN makescrn; - BYTE scrnallflash; -static BYTE lastdisp = 0; -static BYTE blinktime = 1; + UINT8 scrnallflash; +static UINT8 lastdisp = 0; +static UINT8 blinktime = 1; UINT drawtime = 0; @@ -29,7 +29,6 @@ static void fillupdatetmp(void) { } } -#if 1 static void flashupdatetmp(void) { UINT posl; @@ -45,17 +44,17 @@ static void flashupdatetmp(void) { if (!makescrn.vramsize) { return; } - posl = crtc.s.TXT_TOP; - y = crtc.s.TXT_YL; + posl = crtc.e.pos; + y = crtc.e.yl; do { - for (x=0; x> 1; + y2 = (x < crtc.s.reg[CRTCREG_HDISP])?FALSE:TRUE; + udtbase = (x < crtc.s.reg[CRTCREG_HDISP])?0x0000:0x0404; + r = (crtc.s.reg[CRTCREG_HDISP] + 1) >> 1; do { posr = LOW11(posl + 1); atr = (tram[TRAM_ATR + posl] << 8) | tram[TRAM_ATR + posr]; @@ -90,111 +89,11 @@ static void flashupdatetmp(void) { } posl = LOW11(posl + 2); } while(--r); - if (crtc.s.TXT_XL & 1) { + if (crtc.s.reg[CRTCREG_HDISP] & 1) { posl = LOW11(posl - 1); } } while(--y); } -#else -static LABEL void flashupdatetmp(void) { - - __asm { - push ebx - push esi - push edi - - movzx esi, crtc.s.TXT_TOP - xor dl, dl - // まず行すべてが縦倍角か調べる -check_tateflag: mov edi, esi - movzx ecx, crtc.s.TXT_XL -tateflaglp_s: and edi, (TRAM_MAX - 1) - test tram[TRAM_ATR + edi], X1ATR_Yx2 - je tatex1 - inc edi - loop tateflaglp_s - // すべて縦倍角 だったら - - movzx ecx, crtc.s.TXT_XL - shr cl, 1 - -tatex2loop_s: and esi, (TRAM_MAX - 1) - mov ax, (UPDATE_TVRAM or 04h) * 0101h // 縦倍角 - mov bx, word ptr (tram[TRAM_ATR + esi]) - - test bl, X1ATR_Xx2 - je tatex2_norleft - // 倍角フラグが立ってる - or ax, 08h + 12h * 256 // 左4倍角 + 右縦倍角は確定 - test bh, X1ATR_Xx2 - je tatex2_pcg - or ah, 8 // 右側も倍角ビットが立ってた - jmp tatex2_pcg - -tatex2_norleft: test bh, X1ATR_Xx2 // 4倍角でない場合 - je tatex2_pcg - or ah, 8 // 右側のみ倍角だった -tatex2_pcg: mov bx, word ptr (updatetmp[esi]) - and bx, UPDATE_TVRAM * 0101h - or ax, bx // UPDATEフラグを加える - cmp word ptr (updatetmp[esi]), ax - je tatex2noupdate - or ax, UPDATE_TVRAM * 0101h - mov word ptr (updatetmp[esi]), ax -tatex2noupdate: add esi, 2 - loop tatex2loop_s - jmp nextlinecheck - -tatex1: movzx ecx, crtc.s.TXT_XL - shr cl, 1 - xor dh, dh -tatex1loop_s: and esi, (TRAM_MAX - 1) - xor ax, ax - mov bx, word ptr (tram[TRAM_ATR + esi]) - or dh, dh // 縦ノーマルは既にあったか? - jne tatex1_tate_e - test bl, X1ATR_Yx2 - je tatex1_tate0 - mov al, UPDATE_TVRAM or 1 // 左潰れ縦倍角 - test bh, X1ATR_Yx2 - je tatex1_tate0 - mov ah, UPDATE_TVRAM or 1 // 右潰れ縦倍角 - jmp tatex1_tate_e -tatex1_tate0: inc dh // 縦ノーマルの出現 -tatex1_tate_e: - test bl, X1ATR_Xx2 - je tatex1_norleft - // 倍角フラグが立ってる - or ax, 08h + (12h * 256) // 左横倍角 は確定 - test bh, X1ATR_Xx2 - je tatex1_pcg - or ah, 8 // 右側も倍角ビットが立ってた - jmp tatex1_pcg - -tatex1_norleft: test bh, X1ATR_Xx2 // 倍角でない場合 - je tatex1_pcg - or ah, 8 // 右側のみ倍角だった -tatex1_pcg: mov bx, word ptr (updatetmp[esi]) - and bx, UPDATE_TVRAM * 0101h - or ax, bx - cmp word ptr (updatetmp[esi]), ax - je tatex1noupdate - or ax, UPDATE_TVRAM * 0101h - mov word ptr (updatetmp[esi]), ax -tatex1noupdate: add esi, 2 - loop tatex1loop_s - -nextlinecheck: inc dl - cmp dl, crtc.s.TXT_YL - jb check_tateflag - - pop edi - pop esi - pop ebx - ret - } -} -#endif static BRESULT updateblink(void) { @@ -262,15 +161,16 @@ static void changecrtc(void) { REG8 y2; UINT charcy; UINT surfcy; + UINT surfsy; UINT x; UINT y; UINT8 *p; - makescrn.vramtop = LOW11(crtc.s.TXT_TOP); + makescrn.vramtop = crtc.e.pos; - scrnxmax = (crtc.s.TXT_XL <= 40)?40:80; + scrnxmax = (crtc.s.width40)?40:80; scrnymax = 200; - if (crtc.s.TXT_XL <= 40) { + if (crtc.s.width40) { if (lastdisp & SCRN_DRAW4096) { widthmode = SCRNWIDTHMODE_4096; } @@ -283,7 +183,7 @@ static void changecrtc(void) { } scrndraw_changewidth(widthmode); - textxl = crtc.s.TXT_XL; + textxl = crtc.s.reg[CRTCREG_HDISP]; surfcx = min(scrnxmax, textxl); fontcy = crtc.e.fonty; @@ -312,28 +212,30 @@ static void changecrtc(void) { makescrn.charcy = charcy; charcy <<= y2; surfcy = scrnymax / charcy; - if (surfcy > crtc.s.TXT_YL) { - surfcy = crtc.s.TXT_YL; + if (surfcy > crtc.e.yl) { + surfcy = crtc.e.yl; } + surfsy = charcy * surfcy * 2; x = min(scrnxmax, makescrn.surfcx); if (surfcx < x) { // 小さくなった x = (x - surfcx) * 8; p = screenmap + (surfcx * 8); - y = surfcy * 2; + y = surfsy; while(y) { y--; ZeroMemory(p, x); p += SURFACE_WIDTH; } } - if (surfcy < makescrn.surfcy) { - ZeroMemory(screenmap + (SURFACE_WIDTH * surfcy * 2), - SURFACE_WIDTH * (makescrn.surfcy - surfcy) * 2); + if (surfsy < makescrn.surfsy) { + ZeroMemory(screenmap + (SURFACE_WIDTH * surfsy), + SURFACE_WIDTH * (makescrn.surfsy - surfsy)); } makescrn.surfcx = surfcx; makescrn.surfrx = textxl - surfcx; makescrn.surfcy = surfcy; + makescrn.surfsy = surfsy; makescrn.surfstep = (SURFACE_WIDTH * charcy * 2) - (surfcx * 8); makescrn.vramsize = min(0x800, surfcy * textxl); // scrnmng_setheight(0, charcy * surfcy * 2); @@ -367,7 +269,7 @@ void scrnupdate(void) { } corestat.drawframe = 0; - ddrawflash = FALSE; + ddrawflash = makescrn.nextdraw; allflash = FALSE; if (lastdisp != crtc.e.dispmode) { changemodes(); @@ -376,6 +278,7 @@ void scrnupdate(void) { scrnallflash = 0; fillupdatetmp(); changecrtc(); + ddrawflash = TRUE; allflash = TRUE; makescrn.scrnflash = 1; } @@ -386,7 +289,7 @@ void scrnupdate(void) { if (makescrn.palandply) { makescrn.palandply = 0; pal_update(); - ddrawflash = 1; + ddrawflash = TRUE; } if (makescrn.existblink) { makescrn.scrnflash |= updateblink(); @@ -447,13 +350,13 @@ void scrnupdate(void) { } break; } - ddrawflash = 1; + ddrawflash = TRUE; } } if (ddrawflash) { ddrawflash = 0; - scrndraw_draw(allflash); + makescrn.nextdraw = scrndraw_draw(allflash); drawtime++; } } @@ -466,8 +369,8 @@ void makescrn_initialize(void) { void makescrn_reset(void) { - fillupdatetmp(); changemodes(); changecrtc(); + flashupdatetmp(); }