Diff for /np2/i286a/Attic/egcmem.c between versions 1.1 and 1.2

version 1.1, 2003/12/21 23:27:08 version 1.2, 2004/02/18 02:03:36
Line 6 Line 6
 #include        "vram.h"  #include        "vram.h"
   
   
 // C版EGCのみ ROPの回数を記録する  
 // #define              LOG_EGCROP  
   
   
 enum {  enum {
         EGCADDR_L               = 0,          EGCADDR_L               = 0,
         EGCADDR_H               = 1          EGCADDR_H               = 1
Line 19  enum { Line 15  enum {
   
   
 static  EGCQUAD         egc_src;  static  EGCQUAD         egc_src;
 static  EGCQUAD         data;  static  EGCQUAD         egc_data;
   
 static const UINT planead[4] = {VRAM_B, VRAM_R, VRAM_G, VRAM_E};  static const UINT planead[4] = {VRAM_B, VRAM_R, VRAM_G, VRAM_E};
   
   
 static const BYTE bytemask_u0[64] =             // dir:right by startbit + (len-1)*8  static const UINT8 bytemask_u0[64] =    // dir:right by startbit + (len-1)*8
                                         {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01,                                          {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01,
                                          0xc0, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x03, 0x01,                                           0xc0, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x03, 0x01,
                                          0xe0, 0x70, 0x38, 0x1c, 0x0e, 0x07, 0x03, 0x01,                                           0xe0, 0x70, 0x38, 0x1c, 0x0e, 0x07, 0x03, 0x01,
Line 34  static const BYTE bytemask_u0[64] =  //  Line 30  static const BYTE bytemask_u0[64] =  // 
                                          0xfe, 0x7f, 0x3f, 0x1f, 0x0f, 0x07, 0x03, 0x01,                                           0xfe, 0x7f, 0x3f, 0x1f, 0x0f, 0x07, 0x03, 0x01,
                                          0xff, 0x7f, 0x3f, 0x1f, 0x0f, 0x07, 0x03, 0x01};                                           0xff, 0x7f, 0x3f, 0x1f, 0x0f, 0x07, 0x03, 0x01};
   
 static const BYTE bytemask_u1[8] =              // dir:right by length  static const UINT8 bytemask_u1[8] =             // dir:right by length
                                         {0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff};                                          {0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff};
   
 static const BYTE bytemask_d0[64] =             // dir:left by startbit + (len-1)*8  static const UINT8 bytemask_d0[64] =    // dir:left by startbit + (len-1)*8
                                         {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80,                                          {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80,
                                          0x03, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x80,                                           0x03, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x80,
                                          0x07, 0x0e, 0x1c, 0x38, 0x70, 0xe0, 0xc0, 0x80,                                           0x07, 0x0e, 0x1c, 0x38, 0x70, 0xe0, 0xc0, 0x80,
Line 47  static const BYTE bytemask_d0[64] =  //  Line 43  static const BYTE bytemask_d0[64] =  // 
                                          0x7f, 0xfe, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0x80,                                           0x7f, 0xfe, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0x80,
                                          0xff, 0xfe, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0x80};                                           0xff, 0xfe, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0x80};
   
 static const BYTE bytemask_d1[8] =              // dir:left by length  static const UINT8 bytemask_d1[8] =             // dir:left by length
                                         {0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff};                                          {0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff};
   
 #ifdef LOG_EGCROP  
 static  int             egcropcnt[256];  
 #endif  
   
   
 void egcshift(void) {  void egcshift(void) {
   
Line 114  void egcshift(void) { Line 106  void egcshift(void) {
 }  }
   
   
 static void egcsftb_upn_sub(UINT ext) {  static void MEMCALL egcsftb_upn_sub(UINT ext) {
   
         if (egc.dstbit >= 8) {          if (egc.dstbit >= 8) {
                 egc.dstbit -= 8;                  egc.dstbit -= 8;
Line 150  static void egcsftb_upn_sub(UINT ext) { Line 142  static void egcsftb_upn_sub(UINT ext) {
         egc.outptr++;          egc.outptr++;
 }  }
   
 static void egcsftb_dnn_sub(UINT ext) {  static void MEMCALL egcsftb_dnn_sub(UINT ext) {
   
         if (egc.dstbit >= 8) {          if (egc.dstbit >= 8) {
                 egc.dstbit -= 8;                  egc.dstbit -= 8;
Line 192  static void egcsftb_dnn_sub(UINT ext) { Line 184  static void egcsftb_dnn_sub(UINT ext) {
 // 1st -> data[0] >> (dst - src)  // 1st -> data[0] >> (dst - src)
 // 2nd -> (data[0] << (8 - (dst - src))) | (data[1] >> (dst - src))  // 2nd -> (data[0] << (8 - (dst - src))) | (data[1] >> (dst - src))
   
 static void egcsftb_upr_sub(UINT ext) {  static void MEMCALL egcsftb_upr_sub(UINT ext) {
   
         if (egc.dstbit >= 8) {          if (egc.dstbit >= 8) {
                 egc.dstbit -= 8;                  egc.dstbit -= 8;
Line 241  static void egcsftb_upr_sub(UINT ext) { Line 233  static void egcsftb_upr_sub(UINT ext) {
 // 1st -> data[0] << (dst - src)  // 1st -> data[0] << (dst - src)
 // 2nd -> (data[0] >> (8 - (dst - src))) | (data[-1] << (dst - src))  // 2nd -> (data[0] >> (8 - (dst - src))) | (data[-1] << (dst - src))
   
 static void egcsftb_dnr_sub(UINT ext) {  static void MEMCALL egcsftb_dnr_sub(UINT ext) {
   
         if (egc.dstbit >= 8) {          if (egc.dstbit >= 8) {
                 egc.dstbit -= 8;                  egc.dstbit -= 8;
Line 290  static void egcsftb_dnr_sub(UINT ext) { Line 282  static void egcsftb_dnr_sub(UINT ext) {
 // 1st -> (data[0] << (src - dst)) | (data[1] >> (8 - (src - dst))  // 1st -> (data[0] << (src - dst)) | (data[1] >> (8 - (src - dst))
 // 2nd -> (data[0] << (src - dst)) | (data[1] >> (8 - (src - dst))  // 2nd -> (data[0] << (src - dst)) | (data[1] >> (8 - (src - dst))
   
 static void egcsftb_upl_sub(UINT ext) {  static void MEMCALL egcsftb_upl_sub(UINT ext) {
   
         if (egc.dstbit >= 8) {          if (egc.dstbit >= 8) {
                 egc.dstbit -= 8;                  egc.dstbit -= 8;
Line 336  static void egcsftb_upl_sub(UINT ext) { Line 328  static void egcsftb_upl_sub(UINT ext) {
 // 1st -> (data[0] >> (dst - src)) | (data[-1] << (8 - (src - dst))  // 1st -> (data[0] >> (dst - src)) | (data[-1] << (8 - (src - dst))
 // 2nd -> (data[0] >> (dst - src)) | (data[-1] << (8 - (src - dst))  // 2nd -> (data[0] >> (dst - src)) | (data[-1] << (8 - (src - dst))
   
 static void egcsftb_dnl_sub(UINT ext) {  static void MEMCALL egcsftb_dnl_sub(UINT ext) {
   
         if (egc.dstbit >= 8) {          if (egc.dstbit >= 8) {
                 egc.dstbit -= 8;                  egc.dstbit -= 8;
Line 377  static void egcsftb_dnl_sub(UINT ext) { Line 369  static void egcsftb_dnl_sub(UINT ext) {
 }  }
   
   
 static void egcsftb_upn0(UINT32 adrs) {  static void MEMCALL egcsftb_upn0(UINT ext) {
   
         UINT    ext;  
   
         ext = EGCADDR(adrs & 1);  
         if (egc.stack < (UINT)(8 - egc.dstbit)) {          if (egc.stack < (UINT)(8 - egc.dstbit)) {
                 egc.srcmask._b[ext] = 0;                  egc.srcmask._b[ext] = 0;
                 return;                  return;
Line 393  static void egcsftb_upn0(UINT32 adrs) { Line 382  static void egcsftb_upn0(UINT32 adrs) {
         }          }
 }  }
   
 static void egcsftw_upn0(UINT32 adrs) {  static void MEMCALL egcsftw_upn0(void) {
   
         if (egc.stack < (UINT)(16 - egc.dstbit)) {          if (egc.stack < (UINT)(16 - egc.dstbit)) {
                 egc.srcmask.w = 0;                  egc.srcmask.w = 0;
Line 411  static void egcsftw_upn0(UINT32 adrs) { Line 400  static void egcsftw_upn0(UINT32 adrs) {
                 egc.srcmask._b[EGCADDR_H] = 0;                  egc.srcmask._b[EGCADDR_H] = 0;
         }          }
         egcshift();          egcshift();
         (void)adrs;  
 }  }
   
 static void egcsftb_dnn0(UINT32 adrs) {  static void MEMCALL egcsftb_dnn0(UINT ext) {
   
         UINT    ext;  
   
         ext = EGCADDR(adrs & 1);  
         if (egc.stack < (UINT)(8 - egc.dstbit)) {          if (egc.stack < (UINT)(8 - egc.dstbit)) {
                 egc.srcmask._b[ext] = 0;                  egc.srcmask._b[ext] = 0;
                 return;                  return;
Line 430  static void egcsftb_dnn0(UINT32 adrs) { Line 415  static void egcsftb_dnn0(UINT32 adrs) {
         }          }
 }  }
   
 static void egcsftw_dnn0(UINT32 adrs) {  static void MEMCALL egcsftw_dnn0(void) {
   
         if (egc.stack < (UINT)(16 - egc.dstbit)) {          if (egc.stack < (UINT)(16 - egc.dstbit)) {
                 egc.srcmask.w = 0;                  egc.srcmask.w = 0;
Line 448  static void egcsftw_dnn0(UINT32 adrs) { Line 433  static void egcsftw_dnn0(UINT32 adrs) {
                 egc.srcmask._b[EGCADDR_L] = 0;                  egc.srcmask._b[EGCADDR_L] = 0;
         }          }
         egcshift();          egcshift();
         (void)adrs;  
 }  }
   
   
 static void egcsftb_upr0(UINT32 adrs) {                 // dir:up srcbit < dstbit  static void MEMCALL egcsftb_upr0(UINT ext) {            // dir:up srcbit < dstbit
   
         int             ext;  
   
         ext = EGCADDR(adrs & 1);  
         if (egc.stack < (UINT)(8 - egc.dstbit)) {          if (egc.stack < (UINT)(8 - egc.dstbit)) {
                 egc.srcmask._b[ext] = 0;                  egc.srcmask._b[ext] = 0;
                 return;                  return;
Line 468  static void egcsftb_upr0(UINT32 adrs) {  Line 449  static void egcsftb_upr0(UINT32 adrs) { 
         }          }
 }  }
   
 static void egcsftw_upr0(UINT32 adrs) {                 // dir:up srcbit < dstbit  static void MEMCALL egcsftw_upr0(void) {                        // dir:up srcbit < dstbit
   
         if (egc.stack < (UINT)(16 - egc.dstbit)) {          if (egc.stack < (UINT)(16 - egc.dstbit)) {
                 egc.srcmask.w = 0;                  egc.srcmask.w = 0;
Line 486  static void egcsftw_upr0(UINT32 adrs) {  Line 467  static void egcsftw_upr0(UINT32 adrs) { 
                 egc.srcmask._b[EGCADDR_H] = 0;                  egc.srcmask._b[EGCADDR_H] = 0;
         }          }
         egcshift();          egcshift();
         (void)adrs;  
 }  }
   
 static void egcsftb_dnr0(UINT32 adrs) {                 // dir:up srcbit < dstbit  static void MEMCALL egcsftb_dnr0(UINT ext) {            // dir:up srcbit < dstbit
   
         UINT    ext;  
   
         ext = EGCADDR(adrs & 1);  
         if (egc.stack < (UINT)(8 - egc.dstbit)) {          if (egc.stack < (UINT)(8 - egc.dstbit)) {
                 egc.srcmask._b[ext] = 0;                  egc.srcmask._b[ext] = 0;
                 return;                  return;
Line 505  static void egcsftb_dnr0(UINT32 adrs) {  Line 482  static void egcsftb_dnr0(UINT32 adrs) { 
         }          }
 }  }
   
 static void egcsftw_dnr0(UINT32 adrs) {                 // dir:up srcbit < dstbit  static void MEMCALL egcsftw_dnr0(void) {                        // dir:up srcbit < dstbit
   
         if (egc.stack < (UINT)(16 - egc.dstbit)) {          if (egc.stack < (UINT)(16 - egc.dstbit)) {
                 egc.srcmask.w = 0;                  egc.srcmask.w = 0;
Line 523  static void egcsftw_dnr0(UINT32 adrs) {  Line 500  static void egcsftw_dnr0(UINT32 adrs) { 
                 egc.srcmask._b[EGCADDR_L] = 0;                  egc.srcmask._b[EGCADDR_L] = 0;
         }          }
         egcshift();          egcshift();
         (void)adrs;  
 }  }
   
   
 static void egcsftb_upl0(UINT32 adrs) {                 // dir:up srcbit > dstbit  static void MEMCALL egcsftb_upl0(UINT ext) {            // dir:up srcbit > dstbit
   
         UINT    ext;  
   
         ext = EGCADDR(adrs & 1);  
         if (egc.stack < (UINT)(8 - egc.dstbit)) {          if (egc.stack < (UINT)(8 - egc.dstbit)) {
                 egc.srcmask._b[ext] = 0;                  egc.srcmask._b[ext] = 0;
                 return;                  return;
Line 543  static void egcsftb_upl0(UINT32 adrs) {  Line 516  static void egcsftb_upl0(UINT32 adrs) { 
         }          }
 }  }
   
 static void egcsftw_upl0(UINT32 adrs) {                 // dir:up srcbit > dstbit  static void MEMCALL egcsftw_upl0(void) {                        // dir:up srcbit > dstbit
   
         if (egc.stack < (UINT)(16 - egc.dstbit)) {          if (egc.stack < (UINT)(16 - egc.dstbit)) {
                 egc.srcmask.w = 0;                  egc.srcmask.w = 0;
Line 561  static void egcsftw_upl0(UINT32 adrs) {  Line 534  static void egcsftw_upl0(UINT32 adrs) { 
                 egc.srcmask._b[EGCADDR_H] = 0;                  egc.srcmask._b[EGCADDR_H] = 0;
         }          }
         egcshift();          egcshift();
         (void)adrs;  
 }  }
   
 static void egcsftb_dnl0(UINT32 adrs) {                 // dir:up srcbit > dstbit  static void MEMCALL egcsftb_dnl0(UINT ext) {            // dir:up srcbit > dstbit
   
         UINT    ext;  
   
         ext = EGCADDR(adrs & 1);  
         if (egc.stack < (UINT)(8 - egc.dstbit)) {          if (egc.stack < (UINT)(8 - egc.dstbit)) {
                 egc.srcmask._b[ext] = 0;                  egc.srcmask._b[ext] = 0;
                 return;                  return;
Line 580  static void egcsftb_dnl0(UINT32 adrs) {  Line 549  static void egcsftb_dnl0(UINT32 adrs) { 
         }          }
 }  }
   
 static void egcsftw_dnl0(UINT32 adrs) {                 // dir:up srcbit > dstbit  static void MEMCALL egcsftw_dnl0(void) {                        // dir:up srcbit > dstbit
   
         if (egc.stack < (UINT)(16 - egc.dstbit)) {          if (egc.stack < (UINT)(16 - egc.dstbit)) {
                 egc.srcmask.w = 0;                  egc.srcmask.w = 0;
Line 598  static void egcsftw_dnl0(UINT32 adrs) {  Line 567  static void egcsftw_dnl0(UINT32 adrs) { 
                 egc.srcmask._b[EGCADDR_L] = 0;                  egc.srcmask._b[EGCADDR_L] = 0;
         }          }
         egcshift();          egcshift();
         (void)adrs;  
 }  }
   
   
 static void (*egcsft_proc[])(UINT32 adrs) = {  typedef void (MEMCALL * EGCSFTB)(UINT ext);
                 egcsftw_upn0,   egcsftw_dnn0,  typedef void (MEMCALL * EGCSFTW)(void);
                 egcsftw_upr0,   egcsftw_dnr0,  
                 egcsftw_upl0,   egcsftw_dnl0,  
   
   static const EGCSFTB egcsftb[6] = {
                 egcsftb_upn0,   egcsftb_dnn0,                  egcsftb_upn0,   egcsftb_dnn0,
                 egcsftb_upr0,   egcsftb_dnr0,                  egcsftb_upr0,   egcsftb_dnr0,
                 egcsftb_upl0,   egcsftb_dnl0};                  egcsftb_upl0,   egcsftb_dnl0};
   
   static const EGCSFTW egcsftw[6] = {
                   egcsftw_upn0,   egcsftw_dnn0,
                   egcsftw_upr0,   egcsftw_dnr0,
                   egcsftw_upl0,   egcsftw_dnl0};
   
   
   
 // ---------------------------------------------------------------------------  // ---------------------------------------------------------------------------
   
 static void shiftinput_byte(UINT ext) {  static void MEMCALL shiftinput_byte(UINT ext) {
   
         if (egc.stack <= 16) {          if (egc.stack <= 16) {
                 if (egc.srcbit >= 8) {                  if (egc.srcbit >= 8) {
Line 632  static void shiftinput_byte(UINT ext) { Line 605  static void shiftinput_byte(UINT ext) {
                 }                  }
         }          }
         egc.srcmask._b[ext] = 0xff;          egc.srcmask._b[ext] = 0xff;
         egcsft_proc[egc.func + 6](ext);          (*egcsftb[egc.func])(ext);
 }  }
   
 static void shiftinput_incw(void) {  static void MEMCALL shiftinput_incw(void) {
   
         if (egc.stack <= 16) {          if (egc.stack <= 16) {
                 egc.inptr += 2;                  egc.inptr += 2;
Line 646  static void shiftinput_incw(void) { Line 619  static void shiftinput_incw(void) {
                 egc.srcbit = 0;                  egc.srcbit = 0;
         }          }
         egc.srcmask.w = 0xffff;          egc.srcmask.w = 0xffff;
         egcsft_proc[egc.func](0);          (*egcsftw[egc.func])();
 }  }
   
 static void shiftinput_decw(void) {  static void MEMCALL shiftinput_decw(void) {
   
         if (egc.stack <= 16) {          if (egc.stack <= 16) {
                 egc.inptr -= 2;                  egc.inptr -= 2;
Line 660  static void shiftinput_decw(void) { Line 633  static void shiftinput_decw(void) {
                 egc.srcbit = 0;                  egc.srcbit = 0;
         }          }
         egc.srcmask.w = 0xffff;          egc.srcmask.w = 0xffff;
         egcsft_proc[egc.func](0);          (*egcsftw[egc.func])();
   }
   
   #define EGCOPE_SHIFTB                                                                                   \
           if (egc.ope & 0x400) {                                                                          \
                   egc.inptr[ 0] = (BYTE)value;                                                    \
                   egc.inptr[ 4] = (BYTE)value;                                                    \
                   egc.inptr[ 8] = (BYTE)value;                                                    \
                   egc.inptr[12] = (BYTE)value;                                                    \
                   shiftinput_byte(EGCADDR(ad & 1));                                               \
           }                                                                                                                       \
   
   #define EGCOPE_SHIFTW                                                                                   \
           if (egc.ope & 0x400) {                                                                          \
                   if (!(egc.sft & 0x1000)) {                                                              \
                           egc.inptr[ 0] = (BYTE)value;                                            \
                           egc.inptr[ 1] = (BYTE)(value >> 8);                                     \
                           egc.inptr[ 4] = (BYTE)value;                                            \
                           egc.inptr[ 5] = (BYTE)(value >> 8);                                     \
                           egc.inptr[ 8] = (BYTE)value;                                            \
                           egc.inptr[ 9] = (BYTE)(value >> 8);                                     \
                           egc.inptr[12] = (BYTE)value;                                            \
                           egc.inptr[13] = (BYTE)(value >> 8);                                     \
                           shiftinput_incw();                                                                      \
                   }                                                                                                               \
                   else {                                                                                                  \
                           egc.inptr[-1] = (BYTE)value;                                            \
                           egc.inptr[ 0] = (BYTE)(value >> 8);                                     \
                           egc.inptr[ 3] = (BYTE)value;                                            \
                           egc.inptr[ 4] = (BYTE)(value >> 8);                                     \
                           egc.inptr[ 7] = (BYTE)value;                                            \
                           egc.inptr[ 8] = (BYTE)(value >> 8);                                     \
                           egc.inptr[11] = (BYTE)value;                                            \
                           egc.inptr[12] = (BYTE)(value >> 8);                                     \
                           shiftinput_decw();                                                                      \
                   }                                                                                                               \
           }
   
   
   // ----
   
   static const UINT8 data_00[8] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
   static const UINT8 data_ff[8] = {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff};
   
   static const EGCQUAD * MEMCALL ope_00(REG8 ope, UINT32 ad) {
   
           (void)ope;
           (void)ad;
           return((EGCQUAD *)data_00);
   }
   
   static const EGCQUAD * MEMCALL ope_0f(REG8 ope, UINT32 ad) {
   
           egc_data.d[0] = ~egc_src.d[0];
           egc_data.d[1] = ~egc_src.d[1];
   
           (void)ope;
           (void)ad;
           return(&egc_data);
 }  }
   
   static const EGCQUAD * MEMCALL ope_c0(REG8 ope, UINT32 ad) {
   
           EGCQUAD dst;
   
           dst.w[0] = *(UINT16 *)(&mem[ad + VRAM_B]);
           dst.w[1] = *(UINT16 *)(&mem[ad + VRAM_R]);
           dst.w[2] = *(UINT16 *)(&mem[ad + VRAM_G]);
           dst.w[3] = *(UINT16 *)(&mem[ad + VRAM_E]);
           egc_data.d[0] = (egc_src.d[0] & dst.d[0]);
           egc_data.d[1] = (egc_src.d[1] & dst.d[1]);
   
 #define EGCOPE_SHIFT {                                                                                          \          (void)ope;
         if (egc.ope & 0x400) {                                                                                  \          (void)ad;
                 if (func < 6) {                                                                                         \          return(&egc_data);
                         if (!(egc.sft & 0x1000)) {                                                              \  
                                 egc.inptr[ 0] = (BYTE)value;                                            \  
                                 egc.inptr[ 1] = (BYTE)(value >> 8);                                     \  
                                 egc.inptr[ 4] = (BYTE)value;                                            \  
                                 egc.inptr[ 5] = (BYTE)(value >> 8);                                     \  
                                 egc.inptr[ 8] = (BYTE)value;                                            \  
                                 egc.inptr[ 9] = (BYTE)(value >> 8);                                     \  
                                 egc.inptr[12] = (BYTE)value;                                            \  
                                 egc.inptr[13] = (BYTE)(value >> 8);                                     \  
                                 shiftinput_incw();                                                                      \  
                         }                                                                                                               \  
                         else {                                                                                                  \  
                                 egc.inptr[-1] = (BYTE)value;                                            \  
                                 egc.inptr[ 0] = (BYTE)(value >> 8);                                     \  
                                 egc.inptr[ 3] = (BYTE)value;                                            \  
                                 egc.inptr[ 4] = (BYTE)(value >> 8);                                     \  
                                 egc.inptr[ 7] = (BYTE)value;                                            \  
                                 egc.inptr[ 8] = (BYTE)(value >> 8);                                     \  
                                 egc.inptr[11] = (BYTE)value;                                            \  
                                 egc.inptr[12] = (BYTE)(value >> 8);                                     \  
                                 shiftinput_decw();                                                                      \  
                         }                                                                                                               \  
                 }                                                                                                                       \  
                 else {                                                                                                          \  
                         egc.inptr[ 0] = (BYTE)value;                                                    \  
                         egc.inptr[ 4] = (BYTE)value;                                                    \  
                         egc.inptr[ 8] = (BYTE)value;                                                    \  
                         egc.inptr[12] = (BYTE)value;                                                    \  
                         shiftinput_byte(EGCADDR(ad & 1));                                               \  
                 }                                                                                                                       \  
         }                                                                                                                               \  
 }  }
   
   static const EGCQUAD * MEMCALL ope_f0(REG8 ope, UINT32 ad) {
   
           (void)ope;
           (void)ad;
           return(&egc_src);
   }
   
 static void gdc_ope(UINT32 ad, REG16 value, int func) {  static const EGCQUAD * MEMCALL ope_fc(REG8 ope, UINT32 ad) {
   
           EGCQUAD dst;
   
           dst.w[0] = *(UINT16 *)(&mem[ad + VRAM_B]);
           dst.w[1] = *(UINT16 *)(&mem[ad + VRAM_R]);
           dst.w[2] = *(UINT16 *)(&mem[ad + VRAM_G]);
           dst.w[3] = *(UINT16 *)(&mem[ad + VRAM_E]);
           egc_data.d[0] = egc_src.d[0];
           egc_data.d[0] |= ((~egc_src.d[0]) & dst.d[0]);
           egc_data.d[1] = egc_src.d[1];
           egc_data.d[1] |= ((~egc_src.d[1]) & dst.d[1]);
   
           (void)ope;
           (void)ad;
           return(&egc_data);
   }
   
   static const EGCQUAD * MEMCALL ope_ff(REG8 ope, UINT32 ad) {
   
           (void)ope;
           (void)ad;
           return((EGCQUAD *)data_ff);
   }
   
   static const EGCQUAD * MEMCALL ope_nd(REG8 ope, UINT32 ad) {
   
         EGCQUAD pat;          EGCQUAD pat;
   
           switch(egc.fgbg & 0x6000) {
                   case 0x2000:
                           pat.d[0] = egc.bgc.d[0];
                           pat.d[1] = egc.bgc.d[1];
                           break;
   
                   case 0x4000:
                           pat.d[0] = egc.fgc.d[0];
                           pat.d[1] = egc.fgc.d[1];
                           break;
   
                   default:
                           if ((egc.ope & 0x0300) == 0x0100) {
                                   pat.d[0] = egc_src.d[0];
                                   pat.d[1] = egc_src.d[1];
                           }
                           else {
                                   pat.d[0] = egc.patreg.d[0];
                                   pat.d[1] = egc.patreg.d[1];
                           }
                           break;
           }
   
           egc_data.d[0] = 0;
           egc_data.d[1] = 0;
           if (ope & 0x80) {
                   egc_data.d[0] |= (pat.d[0] & egc_src.d[0]);
                   egc_data.d[1] |= (pat.d[1] & egc_src.d[1]);
           }
           if (ope & 0x40) {
                   egc_data.d[0] |= ((~pat.d[0]) & egc_src.d[0]);
                   egc_data.d[1] |= ((~pat.d[1]) & egc_src.d[1]);
           }
           if (ope & 0x08) {
                   egc_data.d[0] |= (pat.d[0] & (~egc_src.d[0]));
                   egc_data.d[1] |= (pat.d[1] & (~egc_src.d[1]));
           }
           if (ope & 0x04) {
                   egc_data.d[0] |= ((~pat.d[0]) & (~egc_src.d[0]));
                   egc_data.d[1] |= ((~pat.d[1]) & (~egc_src.d[1]));
           }
           (void)ad;
           return(&egc_data);
   }
   
   static const EGCQUAD * MEMCALL ope_np(REG8 ope, UINT32 ad) {
   
         EGCQUAD dst;          EGCQUAD dst;
   
         egc.mask2.w = egc.mask.w;          dst.w[0] = *(UINT16 *)(&mem[ad + VRAM_B]);
           dst.w[1] = *(UINT16 *)(&mem[ad + VRAM_R]);
           dst.w[2] = *(UINT16 *)(&mem[ad + VRAM_G]);
           dst.w[3] = *(UINT16 *)(&mem[ad + VRAM_E]);
   
           egc_data.d[0] = 0;
           egc_data.d[1] = 0;
           if (ope & 0x80) {
                   egc_data.d[0] |= (egc_src.d[0] & dst.d[0]);
                   egc_data.d[1] |= (egc_src.d[1] & dst.d[1]);
           }
           if (ope & 0x20) {
                   egc_data.d[0] |= (egc_src.d[0] & (~dst.d[0]));
                   egc_data.d[1] |= (egc_src.d[1] & (~dst.d[1]));
           }
           if (ope & 0x08) {
                   egc_data.d[0] |= ((~egc_src.d[0]) & dst.d[0]);
                   egc_data.d[1] |= ((~egc_src.d[1]) & dst.d[1]);
           }
           if (ope & 0x02) {
                   egc_data.d[0] |= ((~egc_src.d[0]) & (~dst.d[0]));
                   egc_data.d[1] |= ((~egc_src.d[1]) & (~dst.d[1]));
           }
           return(&egc_data);
   }
   
   static const EGCQUAD * MEMCALL ope_xx(REG8 ope, UINT32 ad) {
   
           EGCQUAD pat;
           EGCQUAD dst;
   
           switch(egc.fgbg & 0x6000) {
                   case 0x2000:
                           pat.d[0] = egc.bgc.d[0];
                           pat.d[1] = egc.bgc.d[1];
                           break;
   
                   case 0x4000:
                           pat.d[0] = egc.fgc.d[0];
                           pat.d[1] = egc.fgc.d[1];
                           break;
   
                   default:
                           if ((egc.ope & 0x0300) == 0x0100) {
                                   pat.d[0] = egc_src.d[0];
                                   pat.d[1] = egc_src.d[1];
                           }
                           else {
                                   pat.d[0] = egc.patreg.d[0];
                                   pat.d[1] = egc.patreg.d[1];
                           }
                           break;
           }
           dst.w[0] = *(UINT16 *)(&mem[ad + VRAM_B]);
           dst.w[1] = *(UINT16 *)(&mem[ad + VRAM_R]);
           dst.w[2] = *(UINT16 *)(&mem[ad + VRAM_G]);
           dst.w[3] = *(UINT16 *)(&mem[ad + VRAM_E]);
   
           egc_data.d[0] = 0;
           egc_data.d[1] = 0;
           if (ope & 0x80) {
                   egc_data.d[0] |= (pat.d[0] & egc_src.d[0] & dst.d[0]);
                   egc_data.d[1] |= (pat.d[1] & egc_src.d[1] & dst.d[1]);
           }
           if (ope & 0x40) {
                   egc_data.d[0] |= ((~pat.d[0]) & egc_src.d[0] & dst.d[0]);
                   egc_data.d[1] |= ((~pat.d[1]) & egc_src.d[1] & dst.d[1]);
           }
           if (ope & 0x20) {
                   egc_data.d[0] |= (pat.d[0] & egc_src.d[0] & (~dst.d[0]));
                   egc_data.d[1] |= (pat.d[1] & egc_src.d[1] & (~dst.d[1]));
           }
           if (ope & 0x10) {
                   egc_data.d[0] |= ((~pat.d[0]) & egc_src.d[0] & (~dst.d[0]));
                   egc_data.d[1] |= ((~pat.d[1]) & egc_src.d[1] & (~dst.d[1]));
           }
           if (ope & 0x08) {
                   egc_data.d[0] |= (pat.d[0] & (~egc_src.d[0]) & dst.d[0]);
                   egc_data.d[1] |= (pat.d[1] & (~egc_src.d[1]) & dst.d[1]);
           }
           if (ope & 0x04) {
                   egc_data.d[0] |= ((~pat.d[0]) & (~egc_src.d[0]) & dst.d[0]);
                   egc_data.d[1] |= ((~pat.d[1]) & (~egc_src.d[1]) & dst.d[1]);
           }
           if (ope & 0x02) {
                   egc_data.d[0] |= (pat.d[0] & (~egc_src.d[0]) & (~dst.d[0]));
                   egc_data.d[1] |= (pat.d[1] & (~egc_src.d[1]) & (~dst.d[1]));
           }
           if (ope & 0x01) {
                   egc_data.d[0] |= ((~pat.d[0]) & (~egc_src.d[0]) & (~dst.d[0]));
                   egc_data.d[1] |= ((~pat.d[1]) & (~egc_src.d[1]) & (~dst.d[1]));
           }
           return(&egc_data);
   }
   
   typedef const EGCQUAD * (MEMCALL * OPEFN)(REG8 ope, UINT32 ad);
   
   static const OPEFN opefn[256] = {
                           ope_00, ope_xx, ope_xx, ope_np, ope_xx, ope_nd, ope_xx, ope_xx,
                           ope_xx, ope_xx, ope_nd, ope_xx, ope_np, ope_xx, ope_xx, ope_0f,
                           ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx,
                           ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx,
                           ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx,
                           ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx,
                           ope_np, ope_xx, ope_xx, ope_np, ope_xx, ope_xx, ope_xx, ope_xx,
                           ope_xx, ope_xx, ope_xx, ope_xx, ope_np, ope_xx, ope_xx, ope_np,
                           ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx,
                           ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx,
                           ope_nd, ope_xx, ope_xx, ope_xx, ope_xx, ope_nd, ope_xx, ope_xx,
                           ope_xx, ope_xx, ope_nd, ope_xx, ope_xx, ope_xx, ope_xx, ope_nd,
                           ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx,
                           ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx,
                           ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx,
                           ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx,
                           ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx,
                           ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx,
                           ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx,
                           ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx,
                           ope_nd, ope_xx, ope_xx, ope_xx, ope_xx, ope_nd, ope_xx, ope_xx,
                           ope_xx, ope_xx, ope_nd, ope_xx, ope_xx, ope_xx, ope_xx, ope_nd,
                           ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx,
                           ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx,
                           ope_c0, ope_xx, ope_xx, ope_np, ope_xx, ope_xx, ope_xx, ope_xx,
                           ope_xx, ope_xx, ope_xx, ope_xx, ope_np, ope_xx, ope_xx, ope_np,
                           ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx,
                           ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx,
                           ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx,
                           ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx, ope_xx,
                           ope_f0, ope_xx, ope_xx, ope_np, ope_xx, ope_nd, ope_xx, ope_xx,
                           ope_xx, ope_xx, ope_nd, ope_xx, ope_fc, ope_xx, ope_xx, ope_ff};
   
   
   // ----
   
   static const EGCQUAD * MEMCALL egc_opeb(UINT32 ad, REG8 value) {
   
           UINT    tmp;
   
           egc.mask2.w = egc.mask.w;
         switch(egc.ope & 0x1800) {          switch(egc.ope & 0x1800) {
                 case 0x0800:                  case 0x0800:
                         EGCOPE_SHIFT;                          EGCOPE_SHIFTB;
                           egc.mask2.w &= egc.srcmask.w;
                           tmp = egc.ope & 0xff;
                           return((*opefn[tmp])(tmp, ad & (~1)));
   
                   case 0x1000:
                         switch(egc.fgbg & 0x6000) {                          switch(egc.fgbg & 0x6000) {
                                 case 0x2000:                                  case 0x2000:
                                         pat.d[0] = egc.bgc.d[0];                                          return(&egc.bgc);
                                         pat.d[1] = egc.bgc.d[1];  
                                         break;  
                                 case 0x4000:                                  case 0x4000:
                                         pat.d[0] = egc.fgc.d[0];                                          return(&egc.fgc);
                                         pat.d[1] = egc.fgc.d[1];  
                                         break;  
                                 default:                                  default:
                                         if ((egc.ope & 0x0300) == 0x0100) {     // ver0.29                                          EGCOPE_SHIFTB;
                                                 pat.d[0] = egc_src.d[0];                                          egc.mask2.w &= egc.srcmask.w;
                                                 pat.d[1] = egc_src.d[1];                                          return(&egc_src);
                                         }  
                                         else {  
                                                 pat.d[0] = egc.patreg.d[0];  
                                                 pat.d[1] = egc.patreg.d[1];  
                                         }  
                                         break;  
                         }                          }
                         ad &= ~1;                          break;
                         dst.w[0] = *(UINT16 *)(&mem[ad + VRAM_B]);  
                         dst.w[1] = *(UINT16 *)(&mem[ad + VRAM_R]);  
                         dst.w[2] = *(UINT16 *)(&mem[ad + VRAM_G]);  
                         dst.w[3] = *(UINT16 *)(&mem[ad + VRAM_E]);  
   
 #ifdef LOG_EGCROP                  default:
                         egcropcnt[egc.ope & 0xff]++;                          tmp = value & 0xff;
 #endif                          tmp = tmp | (tmp << 8);
                         data.d[0] = 0;                          egc_data.w[0] = (UINT16)tmp;
                         data.d[1] = 0;                          egc_data.w[1] = (UINT16)tmp;
                         if (egc.ope & 0x80) {                          egc_data.w[2] = (UINT16)tmp;
                                 data.d[0] |= (pat.d[0] & egc_src.d[0] & dst.d[0]);                          egc_data.w[3] = (UINT16)tmp;
                                 data.d[1] |= (pat.d[1] & egc_src.d[1] & dst.d[1]);                          return(&egc_data);
                         }          }
                         if (egc.ope & 0x40) {  }
                                 data.d[0] |= ((~pat.d[0]) & egc_src.d[0] & dst.d[0]);  
                                 data.d[1] |= ((~pat.d[1]) & egc_src.d[1] & dst.d[1]);  static const EGCQUAD * MEMCALL egc_opew(UINT32 ad, REG16 value) {
                         }  
                         if (egc.ope & 0x20) {          UINT    tmp;
                                 data.d[0] |= (pat.d[0] & egc_src.d[0] & (~dst.d[0]));  
                                 data.d[1] |= (pat.d[1] & egc_src.d[1] & (~dst.d[1]));          egc.mask2.w = egc.mask.w;
                         }          switch(egc.ope & 0x1800) {
                         if (egc.ope & 0x10) {                  case 0x0800:
                                 data.d[0] |= ((~pat.d[0]) & egc_src.d[0] & (~dst.d[0]));                          EGCOPE_SHIFTW;
                                 data.d[1] |= ((~pat.d[1]) & egc_src.d[1] & (~dst.d[1]));  
                         }  
                         if (egc.ope & 0x08) {  
                                 data.d[0] |= (pat.d[0] & (~egc_src.d[0]) & dst.d[0]);  
                                 data.d[1] |= (pat.d[1] & (~egc_src.d[1]) & dst.d[1]);  
                         }  
                         if (egc.ope & 0x04) {  
                                 data.d[0] |= ((~pat.d[0]) & (~egc_src.d[0]) & dst.d[0]);  
                                 data.d[1] |= ((~pat.d[1]) & (~egc_src.d[1]) & dst.d[1]);  
                         }  
                         if (egc.ope & 0x02) {  
                                 data.d[0] |= (pat.d[0] & (~egc_src.d[0]) & (~dst.d[0]));  
                                 data.d[1] |= (pat.d[1] & (~egc_src.d[1]) & (~dst.d[1]));  
                         }  
                         if (egc.ope & 0x01) {  
                                 data.d[0] |= ((~pat.d[0]) & (~egc_src.d[0]) & (~dst.d[0]));  
                                 data.d[1] |= ((~pat.d[1]) & (~egc_src.d[1]) & (~dst.d[1]));  
                         }  
                         egc.mask2.w &= egc.srcmask.w;                          egc.mask2.w &= egc.srcmask.w;
                         break;                          tmp = egc.ope & 0xff;
                           return((*opefn[tmp])(tmp, ad));
   
                 case 0x1000:                  case 0x1000:
                         switch(egc.fgbg & 0x6000) {                          switch(egc.fgbg & 0x6000) {
                                 case 0x2000:                                                    // ver0.29                                  case 0x2000:
                                         data.d[0] = egc.bgc.d[0];                                          return(&egc.bgc);
                                         data.d[1] = egc.bgc.d[1];  
                                         break;                                  case 0x4000:
                                 case 0x4000:                                                    // ver0.29                                          return(&egc.fgc);
                                         data.d[0] = egc.fgc.d[0];  
                                         data.d[1] = egc.fgc.d[1];  
                                         break;  
                                 default:                                  default:
 #if 0                                          EGCOPE_SHIFTW;
                                         data.d[0] = egc.patreg.d[0];  
                                         data.d[1] = egc.patreg.d[1];  
 #else  
                                         EGCOPE_SHIFT;  
                                         data.d[0] = egc_src.d[0];  
                                         data.d[1] = egc_src.d[1];  
                                         egc.mask2.w &= egc.srcmask.w;                                          egc.mask2.w &= egc.srcmask.w;
 #endif                                          return(&egc_src);
                                         break;  
                         }                          }
                         break;                          break;
   
                 default:                  default:
 #if defined(BYTESEX_LITTLE)  #if defined(BYTESEX_BIG)
                         data.w[0] = (UINT16)value;                          value = ((value >> 8) & 0xff) | ((value & 0xff) << 8);
                         data.w[1] = (UINT16)value;  
                         data.w[2] = (UINT16)value;  
                         data.w[3] = (UINT16)value;  
 #else  
                         data._b[0][0] = (BYTE)value;  
                         data._b[0][1] = (BYTE)(value >> 8);  
                         data.w[1] = data.w[0];  
                         data.w[2] = data.w[0];  
                         data.w[3] = data.w[0];  
 #endif  #endif
                         break;                          egc_data.w[0] = (UINT16)value;
                           egc_data.w[1] = (UINT16)value;
                           egc_data.w[2] = (UINT16)value;
                           egc_data.w[3] = (UINT16)value;
                           return(&egc_data);
         }          }
 }  }
   
Line 861  REG8 MEMCALL egc_read(UINT32 addr) { Line 1051  REG8 MEMCALL egc_read(UINT32 addr) {
   
 void MEMCALL egc_write(UINT32 addr, REG8 value) {  void MEMCALL egc_write(UINT32 addr, REG8 value) {
   
         UINT    ext;          UINT            ext;
         REG16   wvalue;  const EGCQUAD   *data;
   
         addr = LOW15(addr);          addr = LOW15(addr);
         ext = EGCADDR(addr & 1);          ext = EGCADDR(addr & 1);
Line 882  void MEMCALL egc_write(UINT32 addr, REG8 Line 1072  void MEMCALL egc_write(UINT32 addr, REG8
                 egc.patreg._b[3][ext] = mem[addr + VRAM_E];                  egc.patreg._b[3][ext] = mem[addr + VRAM_E];
         }          }
   
         value = (BYTE)value;          data = egc_opeb(addr, value);
         wvalue = (value << 8) + value;  
         if (!ext) {  
                 gdc_ope(addr, wvalue, egc.func + 6);  
         }  
         else {  
                 gdc_ope(addr, wvalue, egc.func + 6);  
         }  
         if (egc.mask2._b[ext]) {          if (egc.mask2._b[ext]) {
                 if (!(egc.access & 1)) {                  if (!(egc.access & 1)) {
                         mem[addr + VRAM_B] &= ~egc.mask2._b[ext];                          mem[addr + VRAM_B] &= ~egc.mask2._b[ext];
                         mem[addr + VRAM_B] |= data._b[0][ext] & egc.mask2._b[ext];                          mem[addr + VRAM_B] |= data->_b[0][ext] & egc.mask2._b[ext];
                 }                  }
                 if (!(egc.access & 2)) {                  if (!(egc.access & 2)) {
                         mem[addr + VRAM_R] &= ~egc.mask2._b[ext];                          mem[addr + VRAM_R] &= ~egc.mask2._b[ext];
                         mem[addr + VRAM_R] |= data._b[1][ext] & egc.mask2._b[ext];                          mem[addr + VRAM_R] |= data->_b[1][ext] & egc.mask2._b[ext];
                 }                  }
                 if (!(egc.access & 4)) {                  if (!(egc.access & 4)) {
                         mem[addr + VRAM_G] &= ~egc.mask2._b[ext];                          mem[addr + VRAM_G] &= ~egc.mask2._b[ext];
                         mem[addr + VRAM_G] |= data._b[2][ext] & egc.mask2._b[ext];                          mem[addr + VRAM_G] |= data->_b[2][ext] & egc.mask2._b[ext];
                 }                  }
                 if (!(egc.access & 8)) {                  if (!(egc.access & 8)) {
                         mem[addr + VRAM_E] &= ~egc.mask2._b[ext];                          mem[addr + VRAM_E] &= ~egc.mask2._b[ext];
                         mem[addr + VRAM_E] |= data._b[3][ext] & egc.mask2._b[ext];                          mem[addr + VRAM_E] |= data->_b[3][ext] & egc.mask2._b[ext];
                 }                  }
         }          }
 }  }
Line 981  REG16 MEMCALL egc_read_w(UINT32 addr) { Line 1164  REG16 MEMCALL egc_read_w(UINT32 addr) {
   
 void MEMCALL egc_write_w(UINT32 addr, REG16 value) {  void MEMCALL egc_write_w(UINT32 addr, REG16 value) {
   
   const EGCQUAD   *data;
   
         if (!(addr & 1)) {                                                                                      // word access          if (!(addr & 1)) {                                                                                      // word access
                 addr = LOW15(addr);                  addr = LOW15(addr);
                 if (!gdcs.access) {                  if (!gdcs.access) {
Line 998  void MEMCALL egc_write_w(UINT32 addr, RE Line 1183  void MEMCALL egc_write_w(UINT32 addr, RE
                         egc.patreg.w[2] = *(UINT16 *)(&mem[addr + VRAM_G]);                          egc.patreg.w[2] = *(UINT16 *)(&mem[addr + VRAM_G]);
                         egc.patreg.w[3] = *(UINT16 *)(&mem[addr + VRAM_E]);                          egc.patreg.w[3] = *(UINT16 *)(&mem[addr + VRAM_E]);
                 }                  }
                 gdc_ope(addr, value, egc.func);                  data = egc_opew(addr, value);
                 if (egc.mask2.w) {                  if (egc.mask2.w) {
                         if (!(egc.access & 1)) {                          if (!(egc.access & 1)) {
                                 *(UINT16 *)(&mem[addr + VRAM_B]) &= ~egc.mask2.w;                                  *(UINT16 *)(&mem[addr + VRAM_B]) &= ~egc.mask2.w;
                                 *(UINT16 *)(&mem[addr + VRAM_B]) |= data.w[0] & egc.mask2.w;                                  *(UINT16 *)(&mem[addr + VRAM_B]) |= data->w[0] & egc.mask2.w;
                         }                          }
                         if (!(egc.access & 2)) {                          if (!(egc.access & 2)) {
                                 *(UINT16 *)(&mem[addr + VRAM_R]) &= ~egc.mask2.w;                                  *(UINT16 *)(&mem[addr + VRAM_R]) &= ~egc.mask2.w;
                                 *(UINT16 *)(&mem[addr + VRAM_R]) |= data.w[1] & egc.mask2.w;                                  *(UINT16 *)(&mem[addr + VRAM_R]) |= data->w[1] & egc.mask2.w;
                         }                          }
                         if (!(egc.access & 4)) {                          if (!(egc.access & 4)) {
                                 *(UINT16 *)(&mem[addr + VRAM_G]) &= ~egc.mask2.w;                                  *(UINT16 *)(&mem[addr + VRAM_G]) &= ~egc.mask2.w;
                                 *(UINT16 *)(&mem[addr + VRAM_G]) |= data.w[2] & egc.mask2.w;                                  *(UINT16 *)(&mem[addr + VRAM_G]) |= data->w[2] & egc.mask2.w;
                         }                          }
                         if (!(egc.access & 8)) {                          if (!(egc.access & 8)) {
                                 *(UINT16 *)(&mem[addr + VRAM_E]) &= ~egc.mask2.w;                                  *(UINT16 *)(&mem[addr + VRAM_E]) &= ~egc.mask2.w;
                                 *(UINT16 *)(&mem[addr + VRAM_E]) |= data.w[3] & egc.mask2.w;                                  *(UINT16 *)(&mem[addr + VRAM_E]) |= data->w[3] & egc.mask2.w;
                         }                          }
                 }                  }
         }          }

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


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