Diff for /np2/vram/maketext.c between versions 1.3 and 1.10

version 1.3, 2003/11/15 07:10:03 version 1.10, 2004/06/03 16:20:52
Line 1 Line 1
 #include        "compiler.h"  #include        "compiler.h"
 #include        "memory.h"  #include        "cpucore.h"
 #include        "pccore.h"  #include        "pccore.h"
 #include        "iocore.h"  #include        "iocore.h"
 #include        "vram.h"  #include        "vram.h"
Line 14  static UINT32 text_table[512]; Line 14  static UINT32 text_table[512];
 static  UINT32  text_tblx2[512][2];  static  UINT32  text_tblx2[512][2];
   
   
 void maketext_reset(void) {  void maketext_initialize(void) {
   
         ZeroMemory(&tramflag, sizeof(tramflag));  
 }  
   
 void maketext_init(void) {  
   
         int             i;          int             i;
         int             j;          int             j;
Line 67  void maketext_init(void) { Line 62  void maketext_init(void) {
         }          }
 }  }
   
   void maketext_reset(void) {
   
           ZeroMemory(&tramflag, sizeof(tramflag));
   }
   
 static BYTE dirtyonblink(void) {  static BYTE dirtyonblink(void) {
   
         BYTE    ret;          BYTE    ret;
Line 125  BYTE maketext_curblink(void) { Line 125  BYTE maketext_curblink(void) {
   
 void maketext(int text_renewal) {  void maketext(int text_renewal) {
   
           UINT8   multiple;
         BYTE    TEXT_LR;          BYTE    TEXT_LR;
         int             TEXT_PL;          int             TEXT_PL;
         int             TEXT_BL;          int             TEXT_BL;
Line 158  void maketext(int text_renewal) { Line 159  void maketext(int text_renewal) {
                 tramflag.gaiji = 0;                  tramflag.gaiji = 0;
         }          }
   
           multiple = ((!(gdc.mode1 & 8)) && (!(gdc.crt15khz & 1)))?0x20:0x00;
         TEXT_LR = gdc.m.para[GDC_CSRFORM] & 0x1f;          TEXT_LR = gdc.m.para[GDC_CSRFORM] & 0x1f;
         TEXT_PL = crtc.reg.pl;          TEXT_PL = crtc.reg.pl;
         TEXT_BL = crtc.reg.bl + 1;          TEXT_BL = crtc.reg.bl + 1;
Line 191  void maketext(int text_renewal) { Line 193  void maketext(int text_renewal) {
   
         pitch = gdc.m.para[GDC_PITCH] & 0xfe;          pitch = gdc.m.para[GDC_PITCH] & 0xfe;
         csrw = LOADINTELWORD(gdc.m.para + GDC_CSRW);          csrw = LOADINTELWORD(gdc.m.para + GDC_CSRW);
         esi = LOADINTELWORD(gdc.m.para + GDC_SCROLL);          esi = LOW12(LOADINTELWORD(gdc.m.para + GDC_SCROLL));
         esi &= 0xfff;  
         scroll = LOADINTELWORD(gdc.m.para + GDC_SCROLL + 2);          scroll = LOADINTELWORD(gdc.m.para + GDC_SCROLL + 2);
         scroll = (scroll >> 4) & 0x3ff;          scroll = LOW14(scroll) >> 4;
         scrp = 0;          scrp = 0;
   
         wait1 = 0;          wait1 = 0;
Line 227  void maketext(int text_renewal) { Line 228  void maketext(int text_renewal) {
                                                 new_flag = 1;                                                  new_flag = 1;
                                                 break;                                                  break;
                                         }                                          }
                                         edi = (edi + 1) & 0xfff;                                          edi = LOW12(edi + 1);
                                 }                                  }
                         }                          }
                         if (new_flag) {                          if (new_flag) {
Line 238  void maketext(int text_renewal) { Line 239  void maketext(int text_renewal) {
                                 edi = esi;                                  edi = esi;
                                 gaiji1st = 0;                                  gaiji1st = 0;
                                 kanji2nd = FALSE;                                  kanji2nd = FALSE;
                                 lastbitp = 0;                                                                           // ver0.28                                  lastbitp = 0;
                                 for (x=0; x<TEXTXMAX; x++) {                                            // width80                                  for (x=0; x<TEXTXMAX; x++) {                                            // width80
                                         if (edi == csrw) {                                          if (edi == csrw) {
                                                 cur_line = x;                                                  cur_line = x;
Line 251  void maketext(int text_renewal) { Line 252  void maketext(int text_renewal) {
                                         }                                          }
                                         if (kanji2nd) {                                          if (kanji2nd) {
                                                 kanji2nd = FALSE;                                                  kanji2nd = FALSE;
                                                 bitmap[x] = lastbitp + 0x800;                           // ver0.28                                                  bitmap[x] = lastbitp + 0x800;
                                                 curx[x-1] |= 0x80;                                                  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)) {                                          else if (!(mem[0xa0001 + edi*2] & gdc.bitac)) {
                                                 gaiji1st = 0;                                                  gaiji1st = 0;
Line 266  void maketext(int text_renewal) { Line 267  void maketext(int text_renewal) {
                                                 }                                                  }
                                                 else {                                                  else {
                                                         bitmap[x] = 0x82000 +                                                           bitmap[x] = 0x82000 + 
                                                                                 (mem[0xa0000 + edi*2] << 3);                                                                                  (mem[0xa0000 + edi*2] << 4);
                                                         curx[x] |= 0x20;                                                // ver0.28                                                          curx[x] |= multiple;                                    // ver0.74
                                                         if ((curx[x] & TXTATR_BG) && (gdc.mode1 & 1)) {                                                          if ((curx[x] & TXTATR_BG) && (gdc.mode1 & 1)) {
                                                                 bitmap[x] += 0x800;                                                                  bitmap[x] += 8;
                                                         }                                                          }
                                                 }                                                  }
                                         }                                          }
Line 278  void maketext(int text_renewal) { Line 279  void maketext(int text_renewal) {
                                                 kc = LOADINTELWORD(mem + 0xa0000 + edi*2);                                                  kc = LOADINTELWORD(mem + 0xa0000 + edi*2);
                                                 bitmap[x] = (kc & 0x7f7f) << 4;                                                  bitmap[x] = (kc & 0x7f7f) << 4;
                                                 kc &= 0x7e;                                                  kc &= 0x7e;
                                                 if (kc == 0x56) {                                                       // ver0.28                                                  if (kc == 0x56) {
                                                         tramflag.gaiji = 1;                                                          tramflag.gaiji = 1;
                                                         if ((gaiji1st) &&                                                          if ((gaiji1st) &&
                                                                 (bitmap[x] == (lastbitp & (~15)))) {                                                                  (bitmap[x] == (lastbitp & (~15)))) {
Line 289  void maketext(int text_renewal) { Line 290  void maketext(int text_renewal) {
                                                 }                                                  }
                                                 else {                                                  else {
                                                         gaiji1st = 0;                                                          gaiji1st = 0;
                                                         if ((kc < 0x08) || (kc >= 0x0c)) {                                                          if ((kc < 0x09) || (kc >= 0x0c)) {              // ver0.78
                                                                 kanji2nd = TRUE;                                                                  kanji2nd = TRUE;
                                                         }                                                          }
                                                 }                                                  }
                                                                                                                                         // ver0.28  
                                                 if ((curx[x] & TXTATR_BG) && (gdc.mode1 & 1)) {                                                  if ((curx[x] & TXTATR_BG) && (gdc.mode1 & 1)) {
                                                         curx[x] |= 0x20;                                                          curx[x] |= 0x20;
                                                         bitmap[x] += 8;                                                          bitmap[x] += 8;
                                                 }                                                  }
                                                 else if (!(gdc.mode1 & 8)) {                                                  else if (!(gdc.mode1 & 8)) {
                                                         curx[x] |= 0x20;                                                          curx[x] |= multiple;
                                                 }                                                  }
                                         }                                          }
                                         lastbitp = bitmap[x];                                          lastbitp = bitmap[x];
Line 312  void maketext(int text_renewal) { Line 312  void maketext(int text_renewal) {
                                                         bitmap[x] = 0;                                                          bitmap[x] = 0;
                                                 }                                                  }
                                         }                                          }
                                         edi = (edi+1) & 0x0fff;                                                 // width80                                          edi = LOW12(edi + 1);
                                 }                                  }
                                 if (!tramflag.curdisp) {                                  if (!tramflag.curdisp) {
                                         cur_line = -1;                                          cur_line = -1;
                                 }                                  }
                         }                          }
                         esi = (esi + pitch) & 0x0fff;                                                   // ver0.26                          esi = LOW12(esi + pitch);
                 }                  }
   
                 if ((!TEXT_SDR) && (nowline >= topline + crtc.reg.ssl)) {                  if ((!TEXT_SDR) && (nowline >= topline + crtc.reg.ssl)) {
Line 334  void maketext(int text_renewal) { Line 334  void maketext(int text_renewal) {
                                         if ((nowline >= (gdc.m.para[GDC_CSRFORM+1] & 0x1f)) &&                                          if ((nowline >= (gdc.m.para[GDC_CSRFORM+1] & 0x1f)) &&
                                                 (nowline <= (gdc.m.para[GDC_CSRFORM+2] >> 3))) {                                                  (nowline <= (gdc.m.para[GDC_CSRFORM+2] >> 3))) {
                                                 color[cur_line] |= 256;                                                  color[cur_line] |= 256;
                                                 if (curx[cur_line] & 0x80) {                            // ver0.28                                                  if (curx[cur_line] & 0x80) {
                                                         color[cur_line+1] |= 256;                                                          color[cur_line+1] |= 256;
                                                 }                                                  }
                                         }                                          }
                                         else {                                          else {
                                                 color[cur_line] &= ~(256);                                                  color[cur_line] &= ~(256);
                                                 if (curx[cur_line] & 0x80) {                            // ver0.28                                                  if (curx[cur_line] & 0x80) {
                                                         color[cur_line+1] &= ~(256);                                                          color[cur_line+1] &= ~(256);
                                                 }                                                  }
                                         }                                          }
Line 349  void maketext(int text_renewal) { Line 349  void maketext(int text_renewal) {
                                         // width80                                          // width80
                                         for (x=0; x<TEXTXMAX; x++) {                                          for (x=0; x<TEXTXMAX; x++) {
                                                 int fntline;                                                  int fntline;
                                                 BYTE data;                                                  UINT8 data;
                                                 fntline = nowline & 0x0f;                                                  fntline = nowline;
                                                 if (curx[x] & 0x20) {                                                  if (curx[x] & 0x20) {
                                                         fntline >>= 1;                                                          fntline >>= 1;
                                                 }                                                  }
                                                 data = fontrom[bitmap[x] + fntline];                                                  data = fontrom[bitmap[x] + (fntline & 0x0f)];
                                                 *(UINT32 *)(q+0) = text_table[color[x] + (data >> 4)];                                                  *(UINT32 *)(q+0) = text_table[color[x] + (data >> 4)];
                                                 *(UINT32 *)(q+4) = text_table[color[x] + (data & 15)];                                                  *(UINT32 *)(q+4) = text_table[color[x] + (data & 15)];
                                                 q += 8;                                                  q += 8;
Line 388  void maketext(int text_renewal) { Line 388  void maketext(int text_renewal) {
                                         }                                          }
                                         q += 4;                                          q += 4;
                                 }                                  }
                                                                                                         // virtical line ver0.27  
                                 if ((line_effect & TXTATR_VL) && (!(gdc.mode1 & 1))) {                                  if ((line_effect & TXTATR_VL) && (!(gdc.mode1 & 1))) {
                                         // width80                                          // width80
                                         q -= TEXTXMAX * 8;                                          q -= TEXTXMAX * 8;
Line 410  void maketext(int text_renewal) { Line 409  void maketext(int text_renewal) {
                         y++;                          y++;
                         if (!(--scroll)) {                          if (!(--scroll)) {
                                 scrp = (scrp + 4) & 0x0c;                                  scrp = (scrp + 4) & 0x0c;
                                 esi = LOADINTELWORD(gdc.m.para + GDC_SCROLL + scrp);                                  esi = LOW12(LOADINTELWORD(gdc.m.para + GDC_SCROLL + scrp));
                                 esi &= 0xfff;  
                                 scroll = LOADINTELWORD(gdc.m.para + GDC_SCROLL + scrp + 2);                                  scroll = LOADINTELWORD(gdc.m.para + GDC_SCROLL + scrp + 2);
                                 scroll = (scroll >> 4) & 0x3ff;                                  scroll = LOW14(scroll) >> 4;
                                 reloadline = TRUE;                                  reloadline = TRUE;
                         }                          }
                 }                  }
Line 436  void maketext(int text_renewal) { Line 434  void maketext(int text_renewal) {
   
 void maketext40(int text_renewal) {  void maketext40(int text_renewal) {
   
           UINT8   multiple;
         BYTE    TEXT_LR;          BYTE    TEXT_LR;
         int             TEXT_PL;          int             TEXT_PL;
         int             TEXT_BL;          int             TEXT_BL;
Line 469  void maketext40(int text_renewal) { Line 468  void maketext40(int text_renewal) {
                 tramflag.gaiji = 0;                  tramflag.gaiji = 0;
         }          }
   
           multiple = ((!(gdc.mode1 & 8)) && (!(gdc.crt15khz & 1)))?0x20:0x00;
         TEXT_LR = gdc.m.para[GDC_CSRFORM] & 0x1f;          TEXT_LR = gdc.m.para[GDC_CSRFORM] & 0x1f;
         TEXT_PL = crtc.reg.pl;          TEXT_PL = crtc.reg.pl;
         TEXT_BL = crtc.reg.bl + 1;          TEXT_BL = crtc.reg.bl + 1;
Line 502  void maketext40(int text_renewal) { Line 502  void maketext40(int text_renewal) {
   
         pitch = gdc.m.para[GDC_PITCH] & 0xfe;          pitch = gdc.m.para[GDC_PITCH] & 0xfe;
         csrw = LOADINTELWORD(gdc.m.para + GDC_CSRW);          csrw = LOADINTELWORD(gdc.m.para + GDC_CSRW);
         esi = LOADINTELWORD(gdc.m.para + GDC_SCROLL);          esi = LOW12(LOADINTELWORD(gdc.m.para + GDC_SCROLL));
         esi &= 0xfff;  
         scroll = LOADINTELWORD(gdc.m.para + GDC_SCROLL + 2);          scroll = LOADINTELWORD(gdc.m.para + GDC_SCROLL + 2);
         scroll = (scroll >> 4) & 0x3ff;          scroll = LOW14(scroll) >> 4;
         scrp = 0;          scrp = 0;
   
         wait1 = 0;          wait1 = 0;
Line 538  void maketext40(int text_renewal) { Line 537  void maketext40(int text_renewal) {
                                                 new_flag = 1;                                                  new_flag = 1;
                                                 break;                                                  break;
                                         }                                          }
                                         edi = (edi + 1) & 0xfff;                                          edi = LOW12(edi + 1);
                                 }                                  }
                         }                          }
                         if (new_flag) {                          if (new_flag) {
Line 549  void maketext40(int text_renewal) { Line 548  void maketext40(int text_renewal) {
                                 edi = esi;                                  edi = esi;
                                 gaiji1st = 0;                                  gaiji1st = 0;
                                 kanji2nd = 0;                                  kanji2nd = 0;
                                 lastbitp = 0;                                                                           // ver0.28                                  lastbitp = 0;
                                 for (x=0; x<(TEXTXMAX/2); x++) {                                        // width40                                  for (x=0; x<(TEXTXMAX/2); x++) {                                        // width40
                                         if (edi == csrw) {                                          if (edi == csrw) {
                                                 cur_line = x;                                                  cur_line = x;
Line 562  void maketext40(int text_renewal) { Line 561  void maketext40(int text_renewal) {
                                         }                                          }
                                         if (kanji2nd) {                                          if (kanji2nd) {
                                                 kanji2nd = FALSE;                                                  kanji2nd = FALSE;
                                                 bitmap[x] = lastbitp + 0x800;                           // ver0.28                                                  bitmap[x] = lastbitp + 0x800;
                                                 curx[x-1] |= 0x80;                                                  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)) {                                          else if (!(mem[0xa0001 + edi*2] & gdc.bitac)) {
                                                 gaiji1st = 0;                                                  gaiji1st = 0;
Line 577  void maketext40(int text_renewal) { Line 576  void maketext40(int text_renewal) {
                                                 }                                                  }
                                                 else {                                                  else {
                                                         bitmap[x] = 0x82000 +                                                           bitmap[x] = 0x82000 + 
                                                                                 (mem[0xa0000 + edi*2] << 3);                                                                                  (mem[0xa0000 + edi*2] << 4);
                                                         curx[x] |= 0x20;                                                // ver0.28                                                          curx[x] |= multiple;                                    // ver0.74
                                                         if ((curx[x] & TXTATR_BG) && (gdc.mode1 & 1)) {                                                          if ((curx[x] & TXTATR_BG) && (gdc.mode1 & 1)) {
                                                                 bitmap[x] += 0x800;                                                                  bitmap[x] += 8;
                                                         }                                                          }
                                                 }                                                  }
                                         }                                          }
Line 589  void maketext40(int text_renewal) { Line 588  void maketext40(int text_renewal) {
                                                 kc = LOADINTELWORD(mem + 0xa0000 + edi*2);                                                  kc = LOADINTELWORD(mem + 0xa0000 + edi*2);
                                                 bitmap[x] = (kc & 0x7f7f) << 4;                                                  bitmap[x] = (kc & 0x7f7f) << 4;
                                                 kc &= 0x7e;                                                  kc &= 0x7e;
                                                 if (kc == 0x56) {                                                       // ver0.28                                                  if (kc == 0x56) {
                                                         tramflag.gaiji = 1;                                                          tramflag.gaiji = 1;
                                                         if ((gaiji1st) &&                                                          if ((gaiji1st) &&
                                                                 (bitmap[x] == (lastbitp & (~15)))) {                                                                  (bitmap[x] == (lastbitp & (~15)))) {
Line 600  void maketext40(int text_renewal) { Line 599  void maketext40(int text_renewal) {
                                                 }                                                  }
                                                 else {                                                  else {
                                                         gaiji1st = 0;                                                          gaiji1st = 0;
                                                         if ((kc < 0x08) || (kc >= 0x0c)) {                                                          if ((kc < 0x09) || (kc >= 0x0c)) {              // ver0.78
                                                                 kanji2nd = TRUE;                                                                  kanji2nd = TRUE;
                                                         }                                                          }
                                                 }                                                  }
                                                                                                                                         // ver0.28  
                                                 if ((curx[x] & TXTATR_BG) && (gdc.mode1 & 1)) {                                                  if ((curx[x] & TXTATR_BG) && (gdc.mode1 & 1)) {
                                                         curx[x] |= 0x20;                                                          curx[x] |= 0x20;
                                                         bitmap[x] += 8;                                                          bitmap[x] += 8;
                                                 }                                                  }
                                                 else if (!(gdc.mode1 & 8)) {                                                  else if (!(gdc.mode1 & 8)) {
                                                         curx[x] |= 0x20;                                                          curx[x] |= multiple;
                                                 }                                                  }
                                         }                                          }
                                         lastbitp = bitmap[x];                                          lastbitp = bitmap[x];
Line 623  void maketext40(int text_renewal) { Line 621  void maketext40(int text_renewal) {
                                                         bitmap[x] = 0;                                                          bitmap[x] = 0;
                                                 }                                                  }
                                         }                                          }
                                         edi = (edi+2) & 0x0fff;                                                 // width40                                          edi = LOW12(edi + 2);                                                   // width40
                                 }                                  }
                                 if (!tramflag.curdisp) {                                  if (!tramflag.curdisp) {
                                         cur_line = -1;                                          cur_line = -1;
                                 }                                  }
                         }                          }
                         esi = (esi + pitch) & 0x0fff;                                                   // ver0.26                          esi = LOW12(esi + pitch);
                 }                  }
   
                 if ((!TEXT_SDR) && (nowline >= topline + crtc.reg.ssl)) {                  if ((!TEXT_SDR) && (nowline >= topline + crtc.reg.ssl)) {
Line 645  void maketext40(int text_renewal) { Line 643  void maketext40(int text_renewal) {
                                         if ((nowline >= (gdc.m.para[GDC_CSRFORM+1] & 0x1f)) &&                                          if ((nowline >= (gdc.m.para[GDC_CSRFORM+1] & 0x1f)) &&
                                                 (nowline <= (gdc.m.para[GDC_CSRFORM+2] >> 3))) {                                                  (nowline <= (gdc.m.para[GDC_CSRFORM+2] >> 3))) {
                                                 color[cur_line] |= 256;                                                  color[cur_line] |= 256;
                                                 if (curx[cur_line] & 0x80) {                            // ver0.28                                                  if (curx[cur_line] & 0x80) {
                                                         color[cur_line+1] |= 256;                                                          color[cur_line+1] |= 256;
                                                 }                                                  }
                                         }                                          }
                                         else {                                          else {
                                                 color[cur_line] &= ~(256);                                                  color[cur_line] &= ~(256);
                                                 if (curx[cur_line] & 0x80) {                            // ver0.28                                                  if (curx[cur_line] & 0x80) {
                                                         color[cur_line+1] &= ~(256);                                                          color[cur_line+1] &= ~(256);
                                                 }                                                  }
                                         }                                          }
Line 661  void maketext40(int text_renewal) { Line 659  void maketext40(int text_renewal) {
                                         for (x=0; x<(TEXTXMAX/2); x++) {                                          for (x=0; x<(TEXTXMAX/2); x++) {
                                                 int fntline;                                                  int fntline;
                                                 BYTE data;                                                  BYTE data;
                                                 fntline = nowline & 0x0f;                                                  fntline = nowline;
                                                 if (curx[x] & 0x20) {                                                  if (curx[x] & 0x20) {
                                                         fntline >>= 1;                                                          fntline >>= 1;
                                                 }                                                  }
                                                 data = fontrom[bitmap[x] + fntline];                                                  data = fontrom[bitmap[x] + (fntline & 0x0f)];
                                                 *(UINT32 *)(q+ 0) = text_tblx2[color[x] +                                                  *(UINT32 *)(q+ 0) = text_tblx2[color[x] +
                                                                                                                         (data>>4)][0];                                                                                                                          (data>>4)][0];
                                                 *(UINT32 *)(q+ 4) = text_tblx2[color[x] +                                                  *(UINT32 *)(q+ 4) = text_tblx2[color[x] +
Line 715  void maketext40(int text_renewal) { Line 713  void maketext40(int text_renewal) {
                                         }                                          }
                                         q += 12;                                          q += 12;
                                 }                                  }
                                                                                                         // virtical line ver0.27  
                                 if ((line_effect & TXTATR_VL) && (!(gdc.mode1 & 1))) {                                  if ((line_effect & TXTATR_VL) && (!(gdc.mode1 & 1))) {
                                         // width40                                          // width40
                                         q -= TEXTXMAX * 8;                                          q -= TEXTXMAX * 8;
Line 735  void maketext40(int text_renewal) { Line 732  void maketext40(int text_renewal) {
                         y++;                          y++;
                         if (!(--scroll)) {                          if (!(--scroll)) {
                                 scrp = (scrp + 4) & 0x0c;                                  scrp = (scrp + 4) & 0x0c;
                                 esi = LOADINTELWORD(gdc.m.para + GDC_SCROLL + scrp);                                  esi = LOW12(LOADINTELWORD(gdc.m.para + GDC_SCROLL + scrp));
                                 esi &= 0xfff;  
                                 scroll = LOADINTELWORD(gdc.m.para + GDC_SCROLL + scrp + 2);                                  scroll = LOADINTELWORD(gdc.m.para + GDC_SCROLL + scrp + 2);
                                 scroll = (scroll >> 4) & 0x3ff;                                  scroll = LOW14(scroll) >> 4;
                                 reloadline = TRUE;                                  reloadline = TRUE;
                         }                          }
                 }                  }

Removed from v.1.3  
changed lines
  Added in v.1.10


RetroPC.NET-CVS <cvs@retropc.net>