Diff for /np2/i286a/memory.c between versions 1.3 and 1.4

version 1.3, 2003/12/19 09:38:25 version 1.4, 2003/12/20 10:27:55
Line 36  void MEMCALL tram_wt(UINT32 address, REG Line 36  void MEMCALL tram_wt(UINT32 address, REG
 #else  #else
 static void MEMCALL tram_wt(UINT32 address, REG8 value) {  static void MEMCALL tram_wt(UINT32 address, REG8 value) {
   
         CPU_REMCLOCK -= vramop.tramwait;          CPU_REMCLOCK -= MEMWAIT_TRAM;
         if (address < 0xa2000) {          if (address < 0xa2000) {
                 mem[address] = (BYTE)value;                  mem[address] = (BYTE)value;
                 tramupdate[LOW12(address >> 1)] = 1;                  tramupdate[LOW12(address >> 1)] = 1;
Line 73  void MEMCALL vram_w1(UINT32 address, REG Line 73  void MEMCALL vram_w1(UINT32 address, REG
 #else  #else
 static void MEMCALL vram_w0(UINT32 address, REG8 value) {  static void MEMCALL vram_w0(UINT32 address, REG8 value) {
   
         CPU_REMCLOCK -= vramop.vramwait;          CPU_REMCLOCK -= MEMWAIT_VRAM;
         mem[address] = (BYTE)value;          mem[address] = (BYTE)value;
         vramupdate[LOW15(address)] |= 1;          vramupdate[LOW15(address)] |= 1;
         gdcs.grphdisp |= 1;          gdcs.grphdisp |= 1;
Line 81  static void MEMCALL vram_w0(UINT32 addre Line 81  static void MEMCALL vram_w0(UINT32 addre
   
 static void MEMCALL vram_w1(UINT32 address, REG8 value) {  static void MEMCALL vram_w1(UINT32 address, REG8 value) {
   
         CPU_REMCLOCK -= vramop.vramwait;          CPU_REMCLOCK -= MEMWAIT_VRAM;
         mem[address + VRAM_STEP] = (BYTE)value;          mem[address + VRAM_STEP] = (BYTE)value;
         vramupdate[LOW15(address)] |= 2;          vramupdate[LOW15(address)] |= 2;
         gdcs.grphdisp |= 2;          gdcs.grphdisp |= 2;
Line 99  static void MEMCALL grcg_rmw0(UINT32 add Line 99  static void MEMCALL grcg_rmw0(UINT32 add
         REG8    mask;          REG8    mask;
         BYTE    *vram;          BYTE    *vram;
   
         CPU_REMCLOCK -= vramop.grcgwait;          CPU_REMCLOCK -= MEMWAIT_GRCG;
         mask = ~value;          mask = ~value;
         address = LOW15(address);          address = LOW15(address);
         vramupdate[address] |= 1;          vramupdate[address] |= 1;
Line 128  static void MEMCALL grcg_rmw1(UINT32 add Line 128  static void MEMCALL grcg_rmw1(UINT32 add
         REG8    mask;          REG8    mask;
         BYTE    *vram;          BYTE    *vram;
   
         CPU_REMCLOCK -= vramop.grcgwait;          CPU_REMCLOCK -= MEMWAIT_GRCG;
         mask = ~value;          mask = ~value;
         address = LOW15(address);          address = LOW15(address);
         vramupdate[address] |= 2;          vramupdate[address] |= 2;
Line 156  static void MEMCALL grcg_tdw0(UINT32 add Line 156  static void MEMCALL grcg_tdw0(UINT32 add
   
         BYTE    *vram;          BYTE    *vram;
   
         CPU_REMCLOCK -= vramop.grcgwait;          CPU_REMCLOCK -= MEMWAIT_GRCG;
         address = LOW15(address);          address = LOW15(address);
         vramupdate[address] |= 1;          vramupdate[address] |= 1;
         gdcs.grphdisp |= 1;          gdcs.grphdisp |= 1;
Line 180  static void MEMCALL grcg_tdw1(UINT32 add Line 180  static void MEMCALL grcg_tdw1(UINT32 add
   
         BYTE    *vram;          BYTE    *vram;
   
         CPU_REMCLOCK -= vramop.grcgwait;          CPU_REMCLOCK -= MEMWAIT_GRCG;
         address = LOW15(address);          address = LOW15(address);
         vramupdate[address] |= 2;          vramupdate[address] |= 2;
         gdcs.grphdisp |= 2;          gdcs.grphdisp |= 2;
Line 201  static void MEMCALL grcg_tdw1(UINT32 add Line 201  static void MEMCALL grcg_tdw1(UINT32 add
 }  }
 #endif  #endif
   
   #if 0 // defined(ARM)
   void MEMCALL egc_wt(UINT32 address, REG8 value);
   #else
 static void MEMCALL egc_wt(UINT32 address, REG8 value) {  static void MEMCALL egc_wt(UINT32 address, REG8 value) {
   
           CPU_REMCLOCK -= MEMWAIT_GRCG;
         egc_write(address, value);          egc_write(address, value);
 }  }
   #endif
   
   #if defined(ARM)
   void MEMCALL emmc_wt(UINT32 address, REG8 value);
   #else
 static void MEMCALL emmc_wt(UINT32 address, REG8 value) {  static void MEMCALL emmc_wt(UINT32 address, REG8 value) {
   
         extmem.pageptr[(address >> 14) & 3][LOW14(address)] = (BYTE)value;          extmem.pageptr[(address >> 14) & 3][LOW14(address)] = (BYTE)value;
 }  }
   #endif
   
   #if defined(ARM)
   void MEMCALL i286_wn(UINT32 address, REG8 value);
   #else
 static void MEMCALL i286_wn(UINT32 address, REG8 value) {  static void MEMCALL i286_wn(UINT32 address, REG8 value) {
   
         (void)address;          (void)address;
         (void)value;          (void)value;
 }  }
   #endif
   
   
 // ---- read byte  // ---- read byte
Line 235  static REG8 MEMCALL i286_rdex(UINT32 add Line 248  static REG8 MEMCALL i286_rdex(UINT32 add
 }  }
 #endif  #endif
   
 #if 0 // defined(ARM)  #if defined(ARM)
 REG8 MEMCALL tram_rd(UINT32 address);  REG8 MEMCALL tram_rd(UINT32 address);
 #else  #else
 static REG8 MEMCALL tram_rd(UINT32 address) {  static REG8 MEMCALL tram_rd(UINT32 address) {
   
         CPU_REMCLOCK -= vramop.tramwait;          CPU_REMCLOCK -= MEMWAIT_TRAM;
         if (address < 0xa4000) {          if (address < 0xa4000) {
                 return(mem[address]);                  return(mem[address]);
         }          }
Line 256  static REG8 MEMCALL tram_rd(UINT32 addre Line 269  static REG8 MEMCALL tram_rd(UINT32 addre
 }  }
 #endif  #endif
   
 #if 0 // defined(ARM)  #if defined(ARM)
 REG8 MEMCALL vram_r0(UINT32 address);  REG8 MEMCALL vram_r0(UINT32 address);
 REG8 MEMCALL vram_r1(UINT32 address);  REG8 MEMCALL vram_r1(UINT32 address);
 #else  #else
 static REG8 MEMCALL vram_r0(UINT32 address) {  static REG8 MEMCALL vram_r0(UINT32 address) {
   
         CPU_REMCLOCK -= vramop.vramwait;          CPU_REMCLOCK -= MEMWAIT_VRAM;
         return(mem[address]);          return(mem[address]);
 }  }
   
 static REG8 MEMCALL vram_r1(UINT32 address) {  static REG8 MEMCALL vram_r1(UINT32 address) {
   
         CPU_REMCLOCK -= vramop.vramwait;          CPU_REMCLOCK -= MEMWAIT_VRAM;
         return(mem[address + VRAM_STEP]);          return(mem[address + VRAM_STEP]);
 }  }
 #endif  #endif
   
   #if defined(ARM)
   REG8 MEMCALL grcg_tcr0(UINT32 address);
   REG8 MEMCALL grcg_tcr1(UINT32 address);
   #else
 static REG8 MEMCALL grcg_tcr0(UINT32 address) {  static REG8 MEMCALL grcg_tcr0(UINT32 address) {
   
 const BYTE      *vram;  const BYTE      *vram;
         REG8    ret;          REG8    ret;
   
         CPU_REMCLOCK -= vramop.grcgwait;          CPU_REMCLOCK -= MEMWAIT_GRCG;
         vram = mem + LOW15(address);          vram = mem + LOW15(address);
         ret = 0;          ret = 0;
         if (!(grcg.modereg & 1)) {          if (!(grcg.modereg & 1)) {
Line 301  static REG8 MEMCALL grcg_tcr1(UINT32 add Line 318  static REG8 MEMCALL grcg_tcr1(UINT32 add
 const BYTE      *vram;  const BYTE      *vram;
         REG8    ret;          REG8    ret;
   
         CPU_REMCLOCK -= vramop.grcgwait;          CPU_REMCLOCK -= MEMWAIT_GRCG;
         ret = 0;          ret = 0;
         vram = mem + LOW15(address);          vram = mem + LOW15(address);
         if (!(grcg.modereg & 1)) {          if (!(grcg.modereg & 1)) {
Line 318  const BYTE *vram; Line 335  const BYTE *vram;
         }          }
         return(ret ^ 0xff);          return(ret ^ 0xff);
 }  }
   #endif
   
 static REG8 MEMCALL egc_rd(UINT32 address) {  static REG8 MEMCALL egc_rd(UINT32 address) {
   
           CPU_REMCLOCK -= MEMWAIT_GRCG;
         return(egc_read(address));          return(egc_read(address));
 }  }
   
   #if defined(ARM)
   REG8 MEMCALL emmc_rd(UINT32 address);
   #else
 static REG8 MEMCALL emmc_rd(UINT32 address) {  static REG8 MEMCALL emmc_rd(UINT32 address) {
   
         return(extmem.pageptr[(address >> 14) & 3][LOW14(address)]);          return(extmem.pageptr[(address >> 14) & 3][LOW14(address)]);
 }  }
   #endif
   
   #if defined(ARM)
   REG8 MEMCALL i286_itf(UINT32 address);
   #else
 static REG8 MEMCALL i286_itf(UINT32 address) {  static REG8 MEMCALL i286_itf(UINT32 address) {
   
         if (CPU_ITFBANK) {          if (CPU_ITFBANK) {
Line 336  static REG8 MEMCALL i286_itf(UINT32 addr Line 362  static REG8 MEMCALL i286_itf(UINT32 addr
         }          }
         return(mem[address]);          return(mem[address]);
 }  }
   #endif
   
   
 // ---- write word  // ---- write word
Line 361  static void MEMCALL i286w_wtex(UINT32 ad Line 388  static void MEMCALL i286w_wtex(UINT32 ad
 }  }
 #endif  #endif
   
   #if defined(ARM)
   void MEMCALL tramw_wt(UINT32 address, REG16 value);
   #else
 static void MEMCALL tramw_wt(UINT32 address, REG16 value) {  static void MEMCALL tramw_wt(UINT32 address, REG16 value) {
   
           CPU_REMCLOCK -= MEMWAIT_TRAM;
         if (address < 0xa1fff) {          if (address < 0xa1fff) {
                 STOREINTELWORD(mem + address, value);                  STOREINTELWORD(mem + address, value);
                 tramupdate[LOW12(address >> 1)] = 1;                  tramupdate[LOW12(address >> 1)] = 1;
Line 405  static void MEMCALL tramw_wt(UINT32 addr Line 436  static void MEMCALL tramw_wt(UINT32 addr
                 }                  }
         }          }
 }  }
   #endif
   
 #define GRCGW_NON(page) {                                                                                       \  #define GRCGW_NON(page) {                                                                                       \
         CPU_REMCLOCK -= vramop.vramwait;                                                                \          CPU_REMCLOCK -= MEMWAIT_VRAM;                                                                   \
         STOREINTELWORD(mem + address + VRAM_STEP*(page), value);                \          STOREINTELWORD(mem + address + VRAM_STEP*(page), value);                \
         vramupdate[LOW15(address)] |= (1 << page);                                              \          vramupdate[LOW15(address)] |= (1 << page);                                              \
         vramupdate[LOW15(address + 1)] |= (1 << page);                                  \          vramupdate[LOW15(address + 1)] |= (1 << page);                                  \
Line 417  static void MEMCALL tramw_wt(UINT32 addr Line 448  static void MEMCALL tramw_wt(UINT32 addr
   
 #define GRCGW_RMW(page) {                                                                                       \  #define GRCGW_RMW(page) {                                                                                       \
         BYTE    *vram;                                                                                                  \          BYTE    *vram;                                                                                                  \
         CPU_REMCLOCK -= vramop.grcgwait;                                                                \          CPU_REMCLOCK -= MEMWAIT_GRCG;                                                                   \
         address = LOW15(address);                                                                               \          address = LOW15(address);                                                                               \
         vramupdate[address] |= (1 << page);                                                             \          vramupdate[address] |= (1 << page);                                                             \
         vramupdate[address + 1] |= (1 << page);                                                 \          vramupdate[address + 1] |= (1 << page);                                                 \
Line 463  static void MEMCALL tramw_wt(UINT32 addr Line 494  static void MEMCALL tramw_wt(UINT32 addr
   
 #define GRCGW_TDW(page) {                                                                                       \  #define GRCGW_TDW(page) {                                                                                       \
         BYTE    *vram;                                                                                                  \          BYTE    *vram;                                                                                                  \
         CPU_REMCLOCK -= vramop.grcgwait;                                                                \          CPU_REMCLOCK -= MEMWAIT_GRCG;                                                                   \
         address = LOW15(address);                                                                               \          address = LOW15(address);                                                                               \
         vramupdate[address] |= (1 << page);                                                             \          vramupdate[address] |= (1 << page);                                                             \
         vramupdate[address + 1] |= (1 << page);                                                 \          vramupdate[address + 1] |= (1 << page);                                                 \
Line 506  static void MEMCALL grcgw_tdw1(UINT32 ad Line 537  static void MEMCALL grcgw_tdw1(UINT32 ad
   
 static void MEMCALL egcw_wt(UINT32 address, REG16 value) {  static void MEMCALL egcw_wt(UINT32 address, REG16 value) {
   
           CPU_REMCLOCK -= MEMWAIT_GRCG;
         if (!(address & 1)) {          if (!(address & 1)) {
                 egc_write_w(address, value);                  egc_write_w(address, value);
         }          }
Line 521  static void MEMCALL egcw_wt(UINT32 addre Line 553  static void MEMCALL egcw_wt(UINT32 addre
         }          }
 }  }
   
   #if defined(ARM)
   void MEMCALL emmcw_wt(UINT32 address, REG16 value);
   #else
 static void MEMCALL emmcw_wt(UINT32 address, REG16 value) {  static void MEMCALL emmcw_wt(UINT32 address, REG16 value) {
   
         BYTE    *ptr;          BYTE    *ptr;
Line 534  static void MEMCALL emmcw_wt(UINT32 addr Line 569  static void MEMCALL emmcw_wt(UINT32 addr
                 extmem.pageptr[((address + 1) >> 14) & 3][0] = (BYTE)(value >> 8);                  extmem.pageptr[((address + 1) >> 14) & 3][0] = (BYTE)(value >> 8);
         }          }
 }  }
   #endif
   
   #if defined(ARM)
   void MEMCALL i286w_wn(UINT32 address, REG16 value);
   #else
 static void MEMCALL i286w_wn(UINT32 address, REG16 value) {  static void MEMCALL i286w_wn(UINT32 address, REG16 value) {
   
         (void)address;          (void)address;
         (void)value;          (void)value;
 }  }
   #endif
   
   
 // ---- read word  // ---- read word
Line 565  static REG16 MEMCALL i286w_rdex(UINT32 a Line 605  static REG16 MEMCALL i286w_rdex(UINT32 a
 }  }
 #endif  #endif
   
   #if defined(ARM)
   REG16 MEMCALL tramw_rd(UINT32 address);
   #else
 static REG16 MEMCALL tramw_rd(UINT32 address) {  static REG16 MEMCALL tramw_rd(UINT32 address) {
   
         CPU_REMCLOCK -= vramop.tramwait;          CPU_REMCLOCK -= MEMWAIT_TRAM;
         if (address < (0xa4000 - 1)) {          if (address < (0xa4000 - 1)) {
                 return(LOADINTELWORD(mem + address));                  return(LOADINTELWORD(mem + address));
         }          }
Line 593  static REG16 MEMCALL tramw_rd(UINT32 add Line 636  static REG16 MEMCALL tramw_rd(UINT32 add
         }          }
         return(LOADINTELWORD(mem + address));          return(LOADINTELWORD(mem + address));
 }  }
   #endif
   
 #if 0 // defined(ARM)  #if defined(ARM)
 REG16 MEMCALL vramw_r0(UINT32 address);  REG16 MEMCALL vramw_r0(UINT32 address);
 REG16 MEMCALL vramw_r1(UINT32 address);  REG16 MEMCALL vramw_r1(UINT32 address);
 #else  #else
 static REG16 MEMCALL vramw_r0(UINT32 address) {  static REG16 MEMCALL vramw_r0(UINT32 address) {
   
         CPU_REMCLOCK -= vramop.vramwait;          CPU_REMCLOCK -= MEMWAIT_VRAM;
         return(LOADINTELWORD(mem + address));          return(LOADINTELWORD(mem + address));
 }  }
   
 static REG16 MEMCALL vramw_r1(UINT32 address) {  static REG16 MEMCALL vramw_r1(UINT32 address) {
   
         CPU_REMCLOCK -= vramop.vramwait;          CPU_REMCLOCK -= MEMWAIT_VRAM;
         return(LOADINTELWORD(mem + address + VRAM_STEP));          return(LOADINTELWORD(mem + address + VRAM_STEP));
 }  }
 #endif  #endif
   
   #if defined(ARM)
   REG16 MEMCALL grcgw_tcr0(UINT32 address);
   REG16 MEMCALL grcgw_tcr1(UINT32 address);
   #else
 static REG16 MEMCALL grcgw_tcr0(UINT32 address) {  static REG16 MEMCALL grcgw_tcr0(UINT32 address) {
   
         BYTE    *vram;          BYTE    *vram;
         REG16   ret;          REG16   ret;
   
         CPU_REMCLOCK -= vramop.grcgwait;          CPU_REMCLOCK -= MEMWAIT_GRCG;
         ret = 0;          ret = 0;
         vram = mem + LOW15(address);          vram = mem + LOW15(address);
         if (!(grcg.modereg & 1)) {          if (!(grcg.modereg & 1)) {
Line 639  static REG16 MEMCALL grcgw_tcr1(UINT32 a Line 687  static REG16 MEMCALL grcgw_tcr1(UINT32 a
         BYTE    *vram;          BYTE    *vram;
         REG16   ret;          REG16   ret;
   
         CPU_REMCLOCK -= vramop.grcgwait;          CPU_REMCLOCK -= MEMWAIT_GRCG;
         ret = 0;          ret = 0;
         vram = mem + LOW15(address);          vram = mem + LOW15(address);
         if (!(grcg.modereg & 1)) {          if (!(grcg.modereg & 1)) {
Line 656  static REG16 MEMCALL grcgw_tcr1(UINT32 a Line 704  static REG16 MEMCALL grcgw_tcr1(UINT32 a
         }          }
         return((UINT16)(~ret));          return((UINT16)(~ret));
 }  }
   #endif
   
 static REG16 MEMCALL egcw_rd(UINT32 address) {  static REG16 MEMCALL egcw_rd(UINT32 address) {
   
         REG16   ret;          REG16   ret;
   
           CPU_REMCLOCK -= MEMWAIT_GRCG;
         if (!(address & 1)) {          if (!(address & 1)) {
                 return(egc_read_w(address));                  return(egc_read_w(address));
         }          }
Line 678  static REG16 MEMCALL egcw_rd(UINT32 addr Line 728  static REG16 MEMCALL egcw_rd(UINT32 addr
         }          }
 }  }
   
   #if defined(ARM)
   REG16 MEMCALL emmcw_rd(UINT32 address);
   #else
 static REG16 MEMCALL emmcw_rd(UINT32 address) {  static REG16 MEMCALL emmcw_rd(UINT32 address) {
   
 const BYTE      *ptr;  const BYTE      *ptr;
Line 693  const BYTE *ptr; Line 746  const BYTE *ptr;
                 return(ret);                  return(ret);
         }          }
 }  }
   #endif
   
   #if defined(ARM)
   REG16 MEMCALL i286w_itf(UINT32 address);
   #else
 static REG16 MEMCALL i286w_itf(UINT32 address) {  static REG16 MEMCALL i286w_itf(UINT32 address) {
   
         if (CPU_ITFBANK) {          if (CPU_ITFBANK) {
Line 701  static REG16 MEMCALL i286w_itf(UINT32 ad Line 758  static REG16 MEMCALL i286w_itf(UINT32 ad
         }          }
         return(LOADINTELWORD(mem + address));          return(LOADINTELWORD(mem + address));
 }  }
   #endif
   
   
 // ---- table  // ---- table
Line 856  REG8 MEMCALL i286_memoryread(UINT32 addr Line 914  REG8 MEMCALL i286_memoryread(UINT32 addr
                 return(memfn.rd8[(address >> 15) & 0x1f](address));                  return(memfn.rd8[(address >> 15) & 0x1f](address));
         }          }
 }  }
 #endif  
   
 #if !defined(ARM)  
 REG16 MEMCALL i286_memoryread_w(UINT32 address) {  REG16 MEMCALL i286_memoryread_w(UINT32 address) {
   
         REG16   ret;          REG16   ret;
Line 898  REG16 MEMCALL i286_memoryread_w(UINT32 a Line 954  REG16 MEMCALL i286_memoryread_w(UINT32 a
                 return(ret);                  return(ret);
         }          }
 }  }
 #endif  
   
 #if !defined(ARM)  
 void MEMCALL i286_memorywrite(UINT32 address, REG8 value) {  void MEMCALL i286_memorywrite(UINT32 address, REG8 value) {
   
         if (address < I286_MEMWRITEMAX) {          if (address < I286_MEMWRITEMAX) {
Line 918  void MEMCALL i286_memorywrite(UINT32 add Line 972  void MEMCALL i286_memorywrite(UINT32 add
                 memfn.wr8[(address >> 15) & 0x1f](address, value);                  memfn.wr8[(address >> 15) & 0x1f](address, value);
         }          }
 }  }
 #endif  
   
 #if !defined(ARM)  
 void MEMCALL i286_memorywrite_w(UINT32 address, REG16 value) {  void MEMCALL i286_memorywrite_w(UINT32 address, REG16 value) {
   
         if (address < (I286_MEMWRITEMAX - 1)) {          if (address < (I286_MEMWRITEMAX - 1)) {

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


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