Diff for /xmil/io/crtc.c between versions 1.1 and 1.5

version 1.1, 2004/08/04 17:09:25 version 1.5, 2004/08/08 06:59:22
Line 3 Line 3
 #include        "pccore.h"  #include        "pccore.h"
 #include        "iocore.h"  #include        "iocore.h"
 #include        "vram.h"  #include        "vram.h"
 #include        "draw.h"  
 #include        "palettes.h"  #include        "palettes.h"
   #include        "makescrn.h"
   
   
                 BYTE    crtc_TEXTPAL[8];                  BYTE    crtc_TEXTPAL[8];
Line 13 Line 13
   
 static const UINT8 def_TEXTPAL[8] = {  static const UINT8 def_TEXTPAL[8] = {
                                 0x00, 0x03, 0x0c, 0x0f, 0x30, 0x33, 0x3c, 0x3f};                                  0x00, 0x03, 0x0c, 0x0f, 0x30, 0x33, 0x3c, 0x3f};
   
 static const UINT16 def_GRPHPAL[64] = {  static const UINT16 def_GRPHPAL[64] = {
                                 0x000, 0x00a, 0x0a0, 0x0aa, 0xa00, 0xa0a, 0xaa0, 0xaaa,                                  0x000, 0x00a, 0x0a0, 0x0aa, 0xa00, 0xa0a, 0xaa0, 0xaaa,
                                 0x005, 0x00f, 0x0a5, 0x0af, 0xa05, 0xa0f, 0xaa5, 0xaaf,                                  0x005, 0x00f, 0x0a5, 0x0af, 0xa05, 0xa0f, 0xaa5, 0xaaf,
Line 23  static const UINT16 def_GRPHPAL[64] = { Line 24  static const UINT16 def_GRPHPAL[64] = {
                                 0x550, 0x55a, 0x5f0, 0x5fa, 0xf50, 0xf5a, 0xff0, 0xffa,                                  0x550, 0x55a, 0x5f0, 0x5fa, 0xf50, 0xf5a, 0xff0, 0xffa,
                                 0x555, 0x55f, 0x5f5, 0x5ff, 0xf55, 0xf5f, 0xff5, 0xfff};                                  0x555, 0x55f, 0x5f5, 0x5ff, 0xf55, 0xf5f, 0xff5, 0xfff};
   
   
 static const CRTCSTAT crtcdefault = {  static const CRTCSTAT crtcdefault = {
                                 0xaa,                                           // PAL_B;                                  0xaa,                                           // PAL_B;
                                 0xcc,                                           // PAL_R;                                  0xcc,                                           // PAL_R;
Line 184  void vrambank_patch(void) { Line 184  void vrambank_patch(void) {
         crtc.e.updatemask = updatemask;          crtc.e.updatemask = updatemask;
 }  }
   
 void crtc_updt(void) {  static void crtc_updt(void) {
   
         if (crtc.s.SCRN_BITS & SCRN_24KHZ) {          if (crtc.s.SCRN_BITS & SCRN_24KHZ) {
                 crtc.s.fnty = (crtc.s.FNT_YL >> 1) & 0xfffe;                  crtc.s.fnty = (crtc.s.FNT_YL >> 1) & 0xfffe;
Line 246  void IOOUTCALL crtc_o(UINT port, REG8 va Line 246  void IOOUTCALL crtc_o(UINT port, REG8 va
                         case 0x0c:                          case 0x0c:
                                 crtc.s.TXT_TOP &= 0xff;                                  crtc.s.TXT_TOP &= 0xff;
                                 crtc.s.TXT_TOP |= (value & 7) << 8;                                  crtc.s.TXT_TOP |= (value & 7) << 8;
                                 doubleatrchange = 1;                                  makescrn.remakeattr = 1;
                                 break;                                  break;
   
                         case 0x0d:                          case 0x0d:
                                 crtc.s.TXT_TOP &= 0x7ff;                                  crtc.s.TXT_TOP &= 0x7ff;
                                 crtc.s.TXT_TOP |= value;                                  crtc.s.TXT_TOP |= value;
                                 doubleatrchange = 1;                                  makescrn.remakeattr = 1;
                                 break;                                  break;
   
                         default:                          default:
Line 275  void IOOUTCALL scrn_o(UINT port, REG8 va Line 275  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_DISPCHANGE) {          if (modify & SCRN_DISPCHANGE) {
                 textdrawproc_renewal();  //              pal_reset();                                    // ¤Ê¤ó¤Ç¡©
                 reflesh_palette();  
                 scrnallflash = 1;                  scrnallflash = 1;
                 palandply = 1;                  makescrn.palandply = 1;
                 crtc_updt();                  crtc_updt();
         }          }
         vrambank_patch();          vrambank_patch();
Line 300  void IOOUTCALL ply_o(UINT port, REG8 val Line 299  void IOOUTCALL ply_o(UINT port, REG8 val
   
         if (crtc.s.PLY != value) {          if (crtc.s.PLY != value) {
                 crtc.s.PLY = value;                  crtc.s.PLY = value;
                 palandply = 1;                  makescrn.palandply = 1;
         }          }
         (void)port;          (void)port;
 }  }
Line 392  void IOOUTCALL palette_o(UINT port, REG8 Line 391  void IOOUTCALL palette_o(UINT port, REG8
                         case 0x1000:                          case 0x1000:
                                 if (crtc.s.PAL_B != value) {                                  if (crtc.s.PAL_B != value) {
                                         crtc.s.PAL_B = value;                                          crtc.s.PAL_B = value;
                                         palandply = 1;                                          makescrn.palandply = 1;
                                 }                                  }
                                 break;                                  break;
   
                         case 0x1100:                          case 0x1100:
                                 if (crtc.s.PAL_R != value) {                                  if (crtc.s.PAL_R != value) {
                                         crtc.s.PAL_R = value;                                          crtc.s.PAL_R = value;
                                         palandply = 1;                                          makescrn.palandply = 1;
                                 }                                  }
                                 break;                                  break;
   
                         case 0x1200:                          case 0x1200:
                                 if (crtc.s.PAL_G != value) {                                  if (crtc.s.PAL_G != value) {
                                         crtc.s.PAL_G = value;                                          crtc.s.PAL_G = value;
                                         palandply = 1;                                          makescrn.palandply = 1;
                                 }                                  }
                                 break;                                  break;
                 }                  }
Line 476  void IOOUTCALL extpal_o(UINT port, REG8  Line 475  void IOOUTCALL extpal_o(UINT port, REG8 
   
         crtc.s.EXTPALMODE = value;          crtc.s.EXTPALMODE = value;
         vrambank_patch();          vrambank_patch();
           (void)port;
 }  }
   
 REG8 IOINPCALL extpal_i(UINT port) {  REG8 IOINPCALL extpal_i(UINT port) {
   
           (void)port;
         return(crtc.s.EXTPALMODE);          return(crtc.s.EXTPALMODE);
 }  }
   
Line 488  void IOOUTCALL extgrphpal_o(UINT port, R Line 489  void IOOUTCALL extgrphpal_o(UINT port, R
         if (crtc.s.EXTPALMODE & 0x80) {          if (crtc.s.EXTPALMODE & 0x80) {
                 crtc.s.EXTGRPHPAL = value;                  crtc.s.EXTGRPHPAL = value;
         }          }
           (void)port;
 }  }
   
 REG8 IOINPCALL extgrphpal_i(UINT port) {  REG8 IOINPCALL extgrphpal_i(UINT port) {
Line 495  REG8 IOINPCALL extgrphpal_i(UINT port) { Line 497  REG8 IOINPCALL extgrphpal_i(UINT port) {
         if (crtc.s.EXTPALMODE & 0x80) {          if (crtc.s.EXTPALMODE & 0x80) {
                 return(crtc.s.EXTGRPHPAL);                  return(crtc.s.EXTGRPHPAL);
         }          }
           (void)port;
         return(0xff);          return(0xff);
 }  }
   
Line 518  void IOOUTCALL exttextdisp_o(UINT port,  Line 521  void IOOUTCALL exttextdisp_o(UINT port, 
   
         crtc.s.ZPRY = value;          crtc.s.ZPRY = value;
         vrambank_patch();          vrambank_patch();
           (void)port;
 }  }
   
 REG8 IOINPCALL exttextdisp_i(UINT port) {  REG8 IOINPCALL exttextdisp_i(UINT port) {
Line 525  REG8 IOINPCALL exttextdisp_i(UINT port)  Line 529  REG8 IOINPCALL exttextdisp_i(UINT port) 
         if (crtc.s.EXTPALMODE & 0x80) {          if (crtc.s.EXTPALMODE & 0x80) {
                 return(crtc.s.ZPRY);                  return(crtc.s.ZPRY);
         }          }
           (void)port;
         return(0xff);          return(0xff);
 }  }
   
 void IOOUTCALL blackctrl_o(UINT port, REG8 value) {  void IOOUTCALL blackctrl_o(UINT port, REG8 value) {
   
         crtc.s.BLACKPAL = value;          crtc.s.BLACKPAL = value;
         palandply = 1;          makescrn.palandply = 1;
           (void)port;
 }  }
   
 REG8 IOINPCALL blackctrl_i(UINT port) {  REG8 IOINPCALL blackctrl_i(UINT port) {
   
           (void)port;
         return(crtc.s.BLACKPAL);          return(crtc.s.BLACKPAL);
 }  }
   
   
 // ----  // ----
   
   static void resetpal(void) {
   
           CopyMemory(crtc_TEXTPAL, def_TEXTPAL, 8);
           CopyMemory(crtc_GRPHPAL[0], def_GRPHPAL, 64*2);
           CopyMemory(crtc_GRPHPAL[1], def_GRPHPAL, 64*2);
   }
   
 void crtc_initialize(void) {  void crtc_initialize(void) {
   
           UINT    p;
   
           resetpal();
           for (p=0; p<4096; p++) {
                   crtc_PAL4096[p] = p;
           }
 }  }
   
 void crtc_reset(void) {  void crtc_reset(void) {
   
 static  BYTE    initcrtc = 0;  
         UINT    p;  
   
         crtc.s = crtcdefault;          crtc.s = crtcdefault;
   
         palandply = 1;  
         dispmode = SCRN64_INVALID;          dispmode = SCRN64_INVALID;
         pal_bank = pal_disp = PAL_NORMAL;          pal_bank = pal_disp = PAL_NORMAL;
         if (!initcrtc) {          if (pccore.ROM_TYPE < 3) {
                 initcrtc++;                  resetpal();
                 memcpy(crtc_TEXTPAL, def_TEXTPAL, 8);  
                 memcpy(crtc_GRPHPAL[0], def_GRPHPAL, 64*2);  
                 memcpy(crtc_GRPHPAL[1], def_GRPHPAL, 64*2);  
                 for (p=0; p<4096; p++) {  
                         crtc_PAL4096[p] = p;  
                 }  
         }  
         else if (pccore.ROM_TYPE < 3) {  
                 memcpy(crtc_TEXTPAL, def_TEXTPAL, 8);  
                 memcpy(crtc_GRPHPAL[0], def_GRPHPAL, 64*2);  
                 memcpy(crtc_GRPHPAL[1], def_GRPHPAL, 64*2);  
         }          }
         if ((pccore.ROM_TYPE >= 2) && (!(pccore.DIP_SW & 1))) {          if ((pccore.ROM_TYPE >= 2) && (!(pccore.DIP_SW & 1))) {
                 crtc.s.SCRN_BITS = SCRN_200LINE;                  crtc.s.SCRN_BITS = SCRN_200LINE;
                 crtc.s.FNT_YL = 16;                  crtc.s.FNT_YL = 16;
         }          }
   
         textdrawproc_renewal();          pal_reset();
         reflesh_palette();  
         crtc_updt();          crtc_updt();
   
         vrambank_patch();          vrambank_patch();
         palandply = 1;          makescrn.palandply = 1;
         scrnallflash = 1;          scrnallflash = 1;
 }  }
   

Removed from v.1.1  
changed lines
  Added in v.1.5


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