Diff for /np2/io/gdc_pset.c between versions 1.4 and 1.5

version 1.4, 2004/02/02 01:40:59 version 1.5, 2004/02/05 11:34:43
Line 8 Line 8
   
   
 static void MEMCALL _nop(GDCPSET pset, UINT addr, UINT bit) {  static void MEMCALL _nop(GDCPSET pset, UINT addr, UINT bit) {
   }
   
         pset->pattern = (pset->pattern << 1) + (pset->pattern >> 15);  static void MEMCALL _replace0(GDCPSET pset, UINT addr, UINT bit) {
         (void)addr;  
         (void)bit;          vramupdate[addr] |= pset->update.b[0];
           pset->base.ptr[addr] &= ~(0x80 >> bit);
 }  }
   
 static void MEMCALL _replace(GDCPSET pset, UINT addr, UINT bit) {  static void MEMCALL _replace1(GDCPSET pset, UINT addr, UINT bit) {
   
         vramupdate[addr] |= pset->update.b[0];          vramupdate[addr] |= pset->update.b[0];
         if (pset->pattern & 0x8000) {          pset->base.ptr[addr] |= (0x80 >> bit);
                 pset->pattern <<= 1;  
                 pset->pattern++;  
                 pset->base.ptr[addr] |= (0x80 >> bit);  
         }  
         else {  
                 pset->pattern <<= 1;  
                 pset->base.ptr[addr] &= ~(0x80 >> bit);  
         }  
 }  }
   
 static void MEMCALL _complemnt(GDCPSET pset, UINT addr, UINT bit) {  static void MEMCALL _complemnt(GDCPSET pset, UINT addr, UINT bit) {
   
         if (pset->pattern & 0x8000) {          vramupdate[addr] |= pset->update.b[0];
                 pset->pattern <<= 1;          pset->base.ptr[addr] ^= (0x80 >> bit);
                 pset->pattern++;  
                 vramupdate[addr] |= pset->update.b[0];  
                 pset->base.ptr[addr] ^= (0x80 >> bit);  
         }  
         else {  
                 pset->pattern <<= 1;  
         }  
 }  }
   
 static void MEMCALL _clear(GDCPSET pset, UINT addr, UINT bit) {  static void MEMCALL _clear(GDCPSET pset, UINT addr, UINT bit) {
   
         if (pset->pattern & 0x8000) {          vramupdate[addr] |= pset->update.b[0];
                 pset->pattern <<= 1;          pset->base.ptr[addr] &= ~(0x80 >> bit);
                 pset->pattern++;  
                 vramupdate[addr] |= pset->update.b[0];  
                 pset->base.ptr[addr] &= ~(0x80 >> bit);  
         }  
         else {  
                 pset->pattern <<= 1;  
         }  
 }  }
   
 static void MEMCALL _set(GDCPSET pset, UINT addr, UINT bit) {  static void MEMCALL _set(GDCPSET pset, UINT addr, UINT bit) {
   
         if (pset->pattern & 0x8000) {          vramupdate[addr] |= pset->update.b[0];
                 pset->pattern <<= 1;          pset->base.ptr[addr] |= (0x80 >> bit);
                 pset->pattern++;  
                 vramupdate[addr] |= pset->update.b[0];  
                 pset->base.ptr[addr] |= (0x80 >> bit);  
         }  
         else {  
                 pset->pattern <<= 1;  
         }  
 }  }
   
   
Line 74  static void MEMCALL withtdw(GDCPSET pset Line 47  static void MEMCALL withtdw(GDCPSET pset
   
         BYTE    *ptr;          BYTE    *ptr;
   
         if (pset->pattern & 0x8000) {          addr &= ~1;
                 pset->pattern <<= 1;          *(UINT16 *)(vramupdate + addr) |= pset->update.w;
                 pset->pattern++;          ptr = pset->base.ptr + addr;
                 addr &= ~1;          *(UINT16 *)(ptr + VRAM_B) = grcg.tile[0].w;
           *(UINT16 *)(ptr + VRAM_R) = grcg.tile[1].w;
                 *(UINT16 *)(vramupdate + addr) |= pset->update.w;          *(UINT16 *)(ptr + VRAM_G) = grcg.tile[2].w;
                 ptr = pset->base.ptr + addr;          *(UINT16 *)(ptr + VRAM_E) = grcg.tile[3].w;
                 *(UINT16 *)(ptr + VRAM_B) = grcg.tile[0].w;  
                 *(UINT16 *)(ptr + VRAM_R) = grcg.tile[1].w;  
                 *(UINT16 *)(ptr + VRAM_G) = grcg.tile[2].w;  
                 *(UINT16 *)(ptr + VRAM_E) = grcg.tile[3].w;  
         }  
         else {  
                 pset->pattern <<= 1;  
         }  
         (void)bit;          (void)bit;
 }  }
   
Line 98  static void MEMCALL withrmw(GDCPSET pset Line 63  static void MEMCALL withrmw(GDCPSET pset
         BYTE    data;          BYTE    data;
         BYTE    mask;          BYTE    mask;
   
         if (pset->pattern & 0x8000) {          vramupdate[addr] |= pset->update.b[0];
                 pset->pattern <<= 1;          ptr = pset->base.ptr + addr;
                 pset->pattern++;          data = (0x80 >> bit);
                 vramupdate[addr] |= pset->update.b[0];          mask = ~data;
                 ptr = pset->base.ptr + addr;          ptr[VRAM_B] &= mask;
                 data = (0x80 >> bit);          ptr[VRAM_B] |= data & grcg.tile[0].b[0];
                 mask = ~data;          ptr[VRAM_R] &= mask;
                 ptr[VRAM_B] &= mask;          ptr[VRAM_R] |= data & grcg.tile[1].b[0];
                 ptr[VRAM_B] |= data & grcg.tile[0].b[0];          ptr[VRAM_G] &= mask;
                 ptr[VRAM_R] &= mask;          ptr[VRAM_G] |= data & grcg.tile[2].b[0];
                 ptr[VRAM_R] |= data & grcg.tile[1].b[0];          ptr[VRAM_E] &= mask;
                 ptr[VRAM_G] &= mask;          ptr[VRAM_E] |= data & grcg.tile[3].b[0];
                 ptr[VRAM_G] |= data & grcg.tile[2].b[0];  
                 ptr[VRAM_E] &= mask;  
                 ptr[VRAM_E] |= data & grcg.tile[3].b[0];  
         }  
         else {  
                 pset->pattern <<= 1;  
         }  
 }  }
   
   
Line 126  static void MEMCALL withegc(GDCPSET pset Line 84  static void MEMCALL withegc(GDCPSET pset
   
         REG16   data;          REG16   data;
   
         if (pset->pattern & 0x8000) {          data = (0x80 >> bit);
                 pset->pattern <<= 1;          if (addr & 1) {
                 pset->pattern++;                  addr &= ~1;
                 data = (0x80 >> bit);                  data <<= 8;
                 if (addr & 1) {  
                         addr &= ~1;  
                         data <<= 8;  
                 }  
                 egc_write_w(pset->base.addr + addr, data);  
         }  
         else {  
                 pset->pattern <<= 1;  
         }          }
           egc_write_w(pset->base.addr + addr, data);
 }  }
   
   
 static const GDCPSFN psettbl[] = {_replace, _complemnt, _clear, _set};  static const GDCPSFN psettbl[4][2] = {
                                   {_replace0,     _replace1},
                                   {_nop,          _complemnt},
                                   {_nop,          _clear},
                                   {_nop,          _set}};
   
   
 // ----  // ----
Line 153  void MEMCALL gdcpset_prepare(GDCPSET pse Line 108  void MEMCALL gdcpset_prepare(GDCPSET pse
         BYTE    update;          BYTE    update;
   
         if (vramop.operate & VOP_EGCBIT) {          if (vramop.operate & VOP_EGCBIT) {
                 pset->func = withegc;                  pset->func[0] = _nop;
                   pset->func[1] = withegc;
                 pset->base.addr = vramplaneseg[(csrw >> 14) & 3];                  pset->base.addr = vramplaneseg[(csrw >> 14) & 3];
         }          }
         else {          else {
Line 167  void MEMCALL gdcpset_prepare(GDCPSET pse Line 123  void MEMCALL gdcpset_prepare(GDCPSET pse
                 }                  }
                 op &= 3;                  op &= 3;
                 if (!(grcg.gdcwithgrcg & 0x8)) {                  if (!(grcg.gdcwithgrcg & 0x8)) {
                         pset->func = psettbl[op];                          pset->func[0] = psettbl[op][0];
                           pset->func[1] = psettbl[op][1];
                         pset->base.ptr = base + vramplaneseg[(csrw >> 14) & 3];                          pset->base.ptr = base + vramplaneseg[(csrw >> 14) & 3];
                 }                  }
                 else {                  else {
                         pset->func = (grcg.gdcwithgrcg & 0x4)?withrmw:withtdw;                          pset->func[0] = _nop;
                           pset->func[1] = (grcg.gdcwithgrcg & 0x4)?withrmw:withtdw;
                         pset->base.ptr = base;                          pset->base.ptr = base;
                 }                  }
                 gdcs.grphdisp |= update;                  gdcs.grphdisp |= update;
Line 186  void MEMCALL gdcpset_prepare(GDCPSET pse Line 144  void MEMCALL gdcpset_prepare(GDCPSET pse
   
 void MEMCALL gdcpset(GDCPSET pset, UINT16 x, UINT16 y) {  void MEMCALL gdcpset(GDCPSET pset, UINT16 x, UINT16 y) {
   
           UINT    dot;
   
           dot = pset->pattern & 1;
           pset->pattern = (pset->pattern >> 1) + (dot << 15);
         pset->dots++;          pset->dots++;
         if (y > 409) {          if (y > 409) {
                 goto nopset;                  return;
         }          }
         else if (y == 409) {          else if (y == 409) {
                 if (x >= 384) {                  if (x >= 384) {
                         goto nopset;                          return;
                 }                  }
         }          }
         else {          else {
                 if (x >= 640) {                  if (x >= 640) {
                         goto nopset;                          return;
                 }                  }
         }          }
         (*pset->func)(pset, (y * 80) + (x >> 3), x & 7);          (*pset->func[dot])(pset, (y * 80) + (x >> 3), x & 7);
         return;  
   
 nopset:  
         pset->pattern = (pset->pattern << 1) + (pset->pattern >> 15);  
 }  }
   

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


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