--- np2/vram/maketext.c 2003/10/21 11:22:05 1.2 +++ np2/vram/maketext.c 2005/02/07 14:46:13 1.12 @@ -1,5 +1,5 @@ #include "compiler.h" -#include "memory.h" +#include "cpucore.h" #include "pccore.h" #include "iocore.h" #include "vram.h" @@ -14,16 +14,11 @@ static UINT32 text_table[512]; static UINT32 text_tblx2[512][2]; -void maketext_reset(void) { - - ZeroMemory(&tramflag, sizeof(tramflag)); -} - -void maketext_init(void) { +void maketext_initialize(void) { int i; int j; - BYTE bit; + UINT8 bit; ZeroMemory(text_table, sizeof(text_table)); for (i=0; i<8; i++) { @@ -67,9 +62,14 @@ void maketext_init(void) { } } -static BYTE dirtyonblink(void) { +void maketext_reset(void) { + + ZeroMemory(&tramflag, sizeof(tramflag)); +} + +static UINT8 dirtyonblink(void) { - BYTE ret; + UINT8 ret; int i; ret = 0; @@ -82,9 +82,9 @@ static BYTE dirtyonblink(void) { return(ret); } -BYTE maketext_curblink(void) { +UINT8 maketext_curblink(void) { - BYTE ret; + UINT8 ret; UINT16 csrw; ret = 0; @@ -125,7 +125,8 @@ BYTE maketext_curblink(void) { void maketext(int text_renewal) { - BYTE TEXT_LR; + UINT8 multiple; + UINT8 TEXT_LR; int TEXT_PL; int TEXT_BL; int TEXT_CL; @@ -134,30 +135,31 @@ void maketext(int text_renewal) { int topline; int lines; int nowline; - BYTE wait2; + UINT8 wait2; UINT pitch; UINT csrw; UINT esi; UINT scroll; int scrp; - BYTE wait1; - BYTE LRcnt; + UINT8 wait1; + UINT8 LRcnt; BOOL reloadline; int new_flag; int cur_line; int linecnt; - BYTE *q; + UINT8 *q; UINT y; - BYTE line_effect = 0; // for gcc + UINT8 line_effect = 0; // for gcc int x; UINT32 bitmap[TEXTXMAX]; - BYTE curx[TEXTXMAX+1]; + UINT8 curx[TEXTXMAX+1]; UINT16 color[TEXTXMAX]; if (text_renewal) { tramflag.gaiji = 0; } + multiple = ((!(gdc.mode1 & 8)) && (!(gdc.crt15khz & 1)))?0x20:0x00; TEXT_LR = gdc.m.para[GDC_CSRFORM] & 0x1f; TEXT_PL = crtc.reg.pl; TEXT_BL = crtc.reg.bl + 1; @@ -191,10 +193,9 @@ void maketext(int text_renewal) { pitch = gdc.m.para[GDC_PITCH] & 0xfe; csrw = LOADINTELWORD(gdc.m.para + GDC_CSRW); - esi = LOADINTELWORD(gdc.m.para + GDC_SCROLL); - esi &= 0xfff; + esi = LOW12(LOADINTELWORD(gdc.m.para + GDC_SCROLL)); scroll = LOADINTELWORD(gdc.m.para + GDC_SCROLL + 2); - scroll = (scroll >> 4) & 0x3ff; + scroll = LOW14(scroll) >> 4; scrp = 0; wait1 = 0; @@ -227,7 +228,7 @@ void maketext(int text_renewal) { new_flag = 1; break; } - edi = (edi + 1) & 0xfff; + edi = LOW12(edi + 1); } } if (new_flag) { @@ -238,7 +239,7 @@ void maketext(int text_renewal) { edi = esi; gaiji1st = 0; kanji2nd = FALSE; - lastbitp = 0; // ver0.28 + lastbitp = 0; for (x=0; x= 0x0c)) { + if ((kc < 0x09) || (kc >= 0x0c)) { kanji2nd = TRUE; } } - // ver0.28 if ((curx[x] & TXTATR_BG) && (gdc.mode1 & 1)) { curx[x] |= 0x20; bitmap[x] += 8; } else if (!(gdc.mode1 & 8)) { - curx[x] |= 0x20; + curx[x] |= multiple; } } lastbitp = bitmap[x]; @@ -312,13 +312,13 @@ void maketext(int text_renewal) { bitmap[x] = 0; } } - edi = (edi+1) & 0x0fff; // width80 + edi = LOW12(edi + 1); } if (!tramflag.curdisp) { cur_line = -1; } } - esi = (esi + pitch) & 0x0fff; // ver0.26 + esi = LOW12(esi + pitch); } if ((!TEXT_SDR) && (nowline >= topline + crtc.reg.ssl)) { @@ -334,13 +334,13 @@ void maketext(int text_renewal) { if ((nowline >= (gdc.m.para[GDC_CSRFORM+1] & 0x1f)) && (nowline <= (gdc.m.para[GDC_CSRFORM+2] >> 3))) { color[cur_line] |= 256; - if (curx[cur_line] & 0x80) { // ver0.28 + if (curx[cur_line] & 0x80) { color[cur_line+1] |= 256; } } else { color[cur_line] &= ~(256); - if (curx[cur_line] & 0x80) { // ver0.28 + if (curx[cur_line] & 0x80) { color[cur_line+1] &= ~(256); } } @@ -349,12 +349,12 @@ void maketext(int text_renewal) { // width80 for (x=0; x>= 1; } - data = font[bitmap[x] + fntline]; + data = fontrom[bitmap[x] + (fntline & 0x0f)]; *(UINT32 *)(q+0) = text_table[color[x] + (data >> 4)]; *(UINT32 *)(q+4) = text_table[color[x] + (data & 15)]; q += 8; @@ -388,7 +388,6 @@ void maketext(int text_renewal) { } q += 4; } - // virtical line ver0.27 if ((line_effect & TXTATR_VL) && (!(gdc.mode1 & 1))) { // width80 q -= TEXTXMAX * 8; @@ -410,10 +409,9 @@ void maketext(int text_renewal) { y++; if (!(--scroll)) { scrp = (scrp + 4) & 0x0c; - esi = LOADINTELWORD(gdc.m.para + GDC_SCROLL + scrp); - esi &= 0xfff; + esi = LOW12(LOADINTELWORD(gdc.m.para + GDC_SCROLL + scrp)); scroll = LOADINTELWORD(gdc.m.para + GDC_SCROLL + scrp + 2); - scroll = (scroll >> 4) & 0x3ff; + scroll = LOW14(scroll) >> 4; reloadline = TRUE; } } @@ -436,7 +434,8 @@ void maketext(int text_renewal) { void maketext40(int text_renewal) { - BYTE TEXT_LR; + UINT8 multiple; + UINT8 TEXT_LR; int TEXT_PL; int TEXT_BL; int TEXT_CL; @@ -445,30 +444,31 @@ void maketext40(int text_renewal) { int topline; int lines; int nowline; - BYTE wait2; + UINT8 wait2; UINT pitch; UINT csrw; UINT esi; UINT scroll; int scrp; - BYTE wait1; - BYTE LRcnt; + UINT8 wait1; + UINT8 LRcnt; BOOL reloadline; int new_flag; int cur_line; int linecnt; - BYTE *q; + UINT8 *q; UINT y; - BYTE line_effect = 0; // for gcc + UINT8 line_effect = 0; // for gcc int x; UINT32 bitmap[TEXTXMAX]; - BYTE curx[TEXTXMAX+1]; + UINT8 curx[TEXTXMAX+1]; UINT16 color[TEXTXMAX]; if (text_renewal) { tramflag.gaiji = 0; } + multiple = ((!(gdc.mode1 & 8)) && (!(gdc.crt15khz & 1)))?0x20:0x00; TEXT_LR = gdc.m.para[GDC_CSRFORM] & 0x1f; TEXT_PL = crtc.reg.pl; TEXT_BL = crtc.reg.bl + 1; @@ -502,10 +502,9 @@ void maketext40(int text_renewal) { pitch = gdc.m.para[GDC_PITCH] & 0xfe; csrw = LOADINTELWORD(gdc.m.para + GDC_CSRW); - esi = LOADINTELWORD(gdc.m.para + GDC_SCROLL); - esi &= 0xfff; + esi = LOW12(LOADINTELWORD(gdc.m.para + GDC_SCROLL)); scroll = LOADINTELWORD(gdc.m.para + GDC_SCROLL + 2); - scroll = (scroll >> 4) & 0x3ff; + scroll = LOW14(scroll) >> 4; scrp = 0; wait1 = 0; @@ -538,7 +537,7 @@ void maketext40(int text_renewal) { new_flag = 1; break; } - edi = (edi + 1) & 0xfff; + edi = LOW12(edi + 1); } } if (new_flag) { @@ -549,7 +548,7 @@ void maketext40(int text_renewal) { edi = esi; gaiji1st = 0; kanji2nd = 0; - lastbitp = 0; // ver0.28 + lastbitp = 0; for (x=0; x<(TEXTXMAX/2); x++) { // width40 if (edi == csrw) { cur_line = x; @@ -562,9 +561,9 @@ void maketext40(int text_renewal) { } if (kanji2nd) { kanji2nd = FALSE; - bitmap[x] = lastbitp + 0x800; // ver0.28 + bitmap[x] = lastbitp + 0x800; curx[x-1] |= 0x80; - curx[x] |= curx[x-1] & 0x20; // ver0.28 + curx[x] |= curx[x-1] & 0x20; } else if (!(mem[0xa0001 + edi*2] & gdc.bitac)) { gaiji1st = 0; @@ -577,10 +576,10 @@ void maketext40(int text_renewal) { } else { bitmap[x] = 0x82000 + - (mem[0xa0000 + edi*2] << 3); - curx[x] |= 0x20; // ver0.28 + (mem[0xa0000 + edi*2] << 4); + curx[x] |= multiple; // ver0.74 if ((curx[x] & TXTATR_BG) && (gdc.mode1 & 1)) { - bitmap[x] += 0x800; + bitmap[x] += 8; } } } @@ -588,8 +587,8 @@ void maketext40(int text_renewal) { UINT kc; kc = LOADINTELWORD(mem + 0xa0000 + edi*2); bitmap[x] = (kc & 0x7f7f) << 4; - kc &= 0x7e; - if (kc == 0x56) { // ver0.28 + kc &= 0x7f; // ver0.78 + if ((kc == 0x56) || (kc == 0x57)) { tramflag.gaiji = 1; if ((gaiji1st) && (bitmap[x] == (lastbitp & (~15)))) { @@ -600,17 +599,16 @@ void maketext40(int text_renewal) { } else { gaiji1st = 0; - if ((kc < 0x08) || (kc >= 0x0c)) { + if ((kc < 0x09) || (kc >= 0x0c)) { kanji2nd = TRUE; } } - // ver0.28 if ((curx[x] & TXTATR_BG) && (gdc.mode1 & 1)) { curx[x] |= 0x20; bitmap[x] += 8; } else if (!(gdc.mode1 & 8)) { - curx[x] |= 0x20; + curx[x] |= multiple; } } lastbitp = bitmap[x]; @@ -623,13 +621,13 @@ void maketext40(int text_renewal) { bitmap[x] = 0; } } - edi = (edi+2) & 0x0fff; // width40 + edi = LOW12(edi + 2); // width40 } if (!tramflag.curdisp) { cur_line = -1; } } - esi = (esi + pitch) & 0x0fff; // ver0.26 + esi = LOW12(esi + pitch); } if ((!TEXT_SDR) && (nowline >= topline + crtc.reg.ssl)) { @@ -645,13 +643,13 @@ void maketext40(int text_renewal) { if ((nowline >= (gdc.m.para[GDC_CSRFORM+1] & 0x1f)) && (nowline <= (gdc.m.para[GDC_CSRFORM+2] >> 3))) { color[cur_line] |= 256; - if (curx[cur_line] & 0x80) { // ver0.28 + if (curx[cur_line] & 0x80) { color[cur_line+1] |= 256; } } else { color[cur_line] &= ~(256); - if (curx[cur_line] & 0x80) { // ver0.28 + if (curx[cur_line] & 0x80) { color[cur_line+1] &= ~(256); } } @@ -660,12 +658,12 @@ void maketext40(int text_renewal) { // width40 for (x=0; x<(TEXTXMAX/2); x++) { int fntline; - BYTE data; - fntline = nowline & 0x0f; + UINT8 data; + fntline = nowline; if (curx[x] & 0x20) { fntline >>= 1; } - data = font[bitmap[x] + fntline]; + data = fontrom[bitmap[x] + (fntline & 0x0f)]; *(UINT32 *)(q+ 0) = text_tblx2[color[x] + (data>>4)][0]; *(UINT32 *)(q+ 4) = text_tblx2[color[x] + @@ -715,7 +713,6 @@ void maketext40(int text_renewal) { } q += 12; } - // virtical line ver0.27 if ((line_effect & TXTATR_VL) && (!(gdc.mode1 & 1))) { // width40 q -= TEXTXMAX * 8; @@ -735,10 +732,9 @@ void maketext40(int text_renewal) { y++; if (!(--scroll)) { scrp = (scrp + 4) & 0x0c; - esi = LOADINTELWORD(gdc.m.para + GDC_SCROLL + scrp); - esi &= 0xfff; + esi = LOW12(LOADINTELWORD(gdc.m.para + GDC_SCROLL + scrp)); scroll = LOADINTELWORD(gdc.m.para + GDC_SCROLL + scrp + 2); - scroll = (scroll >> 4) & 0x3ff; + scroll = LOW14(scroll) >> 4; reloadline = TRUE; } }