Diff for /np2/i286c/memory.c between versions 1.30 and 1.31

version 1.30, 2005/03/18 06:49:16 version 1.31, 2005/05/20 13:59:47
Line 173  static const VACCTBL vacctbl[0x10] = { Line 173  static const VACCTBL vacctbl[0x10] = {
                 {memegc_rd8,    memegc_wr8,             memegc_rd16,    memegc_wr16}};                  {memegc_rd8,    memegc_wr8,             memegc_rd16,    memegc_wr16}};
   
   
 void MEMCALL i286_memorymap(UINT type) {  void MEMCALL memm_arch(UINT type) {
   
 const MMAPTBL   *mm;  const MMAPTBL   *mm;
   
Line 194  const MMAPTBL *mm; Line 194  const MMAPTBL *mm;
         memfn0.wr16[0xf8000 >> 15] = mm->bwr16;          memfn0.wr16[0xf8000 >> 15] = mm->bwr16;
 }  }
   
 void MEMCALL i286_vram_dispatch(UINT func) {  void MEMCALL memm_vram(UINT func) {
   
 const VACCTBL   *vacc;  const VACCTBL   *vacc;
   
Line 317  static const MEMFNF memfnf = { Line 317  static const MEMFNF memfnf = {
   
 // ----  // ----
   
 REG8 MEMCALL i286_memoryread(UINT32 address) {  REG8 MEMCALL memp_read8(UINT32 address) {
   
         if (address < I286_MEMREADMAX) {          if (address < I286_MEMREADMAX) {
                 return(mem[address]);                  return(mem[address]);
Line 353  REG8 MEMCALL i286_memoryread(UINT32 addr Line 353  REG8 MEMCALL i286_memoryread(UINT32 addr
         }          }
 }  }
   
 REG16 MEMCALL i286_memoryread_w(UINT32 address) {  REG16 MEMCALL memp_read16(UINT32 address) {
   
         REG16   ret;          REG16   ret;
   
Line 390  REG16 MEMCALL i286_memoryread_w(UINT32 a Line 390  REG16 MEMCALL i286_memoryread_w(UINT32 a
                 }                  }
         }          }
         else {          else {
                 ret = i286_memoryread(address + 0);                  ret = memp_read8(address + 0);
                 ret += (REG16)(i286_memoryread(address + 1) << 8);                  ret += (REG16)(memp_read8(address + 1) << 8);
                 return(ret);                  return(ret);
         }          }
 }  }
   
 UINT32 MEMCALL i286_memoryread_d(UINT32 address) {  UINT32 MEMCALL memp_read32(UINT32 address) {
   
         UINT32  pos;          UINT32  pos;
         UINT32  ret;          UINT32  ret;
Line 411  UINT32 MEMCALL i286_memoryread_d(UINT32  Line 411  UINT32 MEMCALL i286_memoryread_d(UINT32 
                 }                  }
         }          }
         if (!(address & 1)) {          if (!(address & 1)) {
                 ret = i286_memoryread_w(address + 0);                  ret = memp_read16(address + 0);
                 ret += (UINT32)i286_memoryread_w(address + 2) << 16;                  ret += (UINT32)memp_read16(address + 2) << 16;
         }          }
         else {          else {
                 ret = i286_memoryread(address + 0);                  ret = memp_read8(address + 0);
                 ret += (UINT32)i286_memoryread_w(address + 1) << 8;                  ret += (UINT32)memp_read16(address + 1) << 8;
                 ret += (UINT32)i286_memoryread(address + 3) << 24;                  ret += (UINT32)memp_read8(address + 3) << 24;
         }          }
         return(ret);          return(ret);
 }  }
   
 void MEMCALL i286_memorywrite(UINT32 address, REG8 value) {  void MEMCALL memp_write8(UINT32 address, REG8 value) {
   
         if (address < I286_MEMWRITEMAX) {          if (address < I286_MEMWRITEMAX) {
                 mem[address] = (UINT8)value;                  mem[address] = (UINT8)value;
Line 456  void MEMCALL i286_memorywrite(UINT32 add Line 456  void MEMCALL i286_memorywrite(UINT32 add
         }          }
 }  }
   
 void MEMCALL i286_memorywrite_w(UINT32 address, REG16 value) {  void MEMCALL memp_write16(UINT32 address, REG16 value) {
   
         if (address < (I286_MEMWRITEMAX - 1)) {          if (address < (I286_MEMWRITEMAX - 1)) {
                 STOREINTELWORD(mem + address, value);                  STOREINTELWORD(mem + address, value);
Line 489  void MEMCALL i286_memorywrite_w(UINT32 a Line 489  void MEMCALL i286_memorywrite_w(UINT32 a
                 }                  }
         }          }
         else {          else {
                 i286_memorywrite(address + 0, (UINT8)value);                  memp_write8(address + 0, (UINT8)value);
                 i286_memorywrite(address + 1, (UINT8)(value >> 8));                  memp_write8(address + 1, (UINT8)(value >> 8));
         }          }
 }  }
   
 void MEMCALL i286_memorywrite_d(UINT32 address, UINT32 value) {  void MEMCALL memp_write32(UINT32 address, UINT32 value) {
   
         UINT32  pos;          UINT32  pos;
   
Line 510  void MEMCALL i286_memorywrite_d(UINT32 a Line 510  void MEMCALL i286_memorywrite_d(UINT32 a
                 }                  }
         }          }
         if (!(address & 1)) {          if (!(address & 1)) {
                 i286_memorywrite_w(address + 0, (UINT16)value);                  memp_write16(address + 0, (UINT16)value);
                 i286_memorywrite_w(address + 2, (UINT16)(value >> 16));                  memp_write16(address + 2, (UINT16)(value >> 16));
         }          }
         else {          else {
                 i286_memorywrite(address + 0, (UINT8)value);                  memp_write8(address + 0, (UINT8)value);
                 i286_memorywrite_w(address + 1, (UINT16)(value >> 8));                  memp_write16(address + 1, (UINT16)(value >> 8));
                 i286_memorywrite(address + 3, (UINT8)(value >> 24));                  memp_write8(address + 3, (UINT8)(value >> 24));
           }
   }
   
   
   void MEMCALL memp_reads(UINT32 address, void *dat, UINT leng) {
   
           if ((address + leng) < I286_MEMREADMAX) {
                   CopyMemory(dat, mem + address, leng);
           }
           else {
                   UINT8 *out = (UINT8 *)dat;
                   if (address < I286_MEMREADMAX) {
                           CopyMemory(out, mem + address, I286_MEMREADMAX - address);
                           out += I286_MEMREADMAX - address;
                           leng -= I286_MEMREADMAX - address;
                           address = I286_MEMREADMAX;
                   }
                   while(leng--) {
                           *out++ = memp_read8(address++);
                   }
           }
   }
   
   void MEMCALL memp_writes(UINT32 address, const void *dat, UINT leng) {
   
   const UINT8     *out;
   
           if ((address + leng) < I286_MEMWRITEMAX) {
                   CopyMemory(mem + address, dat, leng);
           }
           else {
                   out = (UINT8 *)dat;
                   if (address < I286_MEMWRITEMAX) {
                           CopyMemory(mem + address, out, I286_MEMWRITEMAX - address);
                           out += I286_MEMWRITEMAX - address;
                           leng -= I286_MEMWRITEMAX - address;
                           address = I286_MEMWRITEMAX;
                   }
                   while(leng--) {
                           memp_write8(address++, *out++);
                   }
         }          }
 }  }
   
   
 // ---- Logical Space (BIOS)  // ---- Logical Space (BIOS)
   
 REG8 MEMCALL meml_read8(UINT seg, UINT off) {  REG8 MEMCALL memr_read8(UINT seg, UINT off) {
   
         UINT32  address;          UINT32  address;
   
Line 532  REG8 MEMCALL meml_read8(UINT seg, UINT o Line 573  REG8 MEMCALL meml_read8(UINT seg, UINT o
                 return(mem[address]);                  return(mem[address]);
         }          }
         else {          else {
                 return(i286_memoryread(address));                  return(memp_read8(address));
         }          }
 }  }
   
 REG16 MEMCALL meml_read16(UINT seg, UINT off) {  REG16 MEMCALL memr_read16(UINT seg, UINT off) {
   
         UINT32  address;          UINT32  address;
   
Line 545  REG16 MEMCALL meml_read16(UINT seg, UINT Line 586  REG16 MEMCALL meml_read16(UINT seg, UINT
                 return(LOADINTELWORD(mem + address));                  return(LOADINTELWORD(mem + address));
         }          }
         else {          else {
                 return(i286_memoryread_w(address));                  return(memp_read16(address));
         }          }
 }  }
   
 void MEMCALL meml_write8(UINT seg, UINT off, REG8 value) {  void MEMCALL memr_write8(UINT seg, UINT off, REG8 value) {
   
         UINT32  address;          UINT32  address;
   
Line 558  void MEMCALL meml_write8(UINT seg, UINT  Line 599  void MEMCALL meml_write8(UINT seg, UINT 
                 mem[address] = (UINT8)value;                  mem[address] = (UINT8)value;
         }          }
         else {          else {
                 i286_memorywrite(address, value);                  memp_write8(address, value);
         }          }
 }  }
   
 void MEMCALL meml_write16(UINT seg, UINT off, REG16 value) {  void MEMCALL memr_write16(UINT seg, UINT off, REG16 value) {
   
         UINT32  address;          UINT32  address;
   
Line 571  void MEMCALL meml_write16(UINT seg, UINT Line 612  void MEMCALL meml_write16(UINT seg, UINT
                 STOREINTELWORD(mem + address, value);                  STOREINTELWORD(mem + address, value);
         }          }
         else {          else {
                 i286_memorywrite_w(address, value);                  memp_write16(address, value);
         }          }
 }  }
   
 void MEMCALL meml_readstr(UINT seg, UINT off, void *dat, UINT leng) {  void MEMCALL memr_reads(UINT seg, UINT off, void *dat, UINT leng) {
   
         UINT8   *out;          UINT8   *out;
         UINT32  adrs;          UINT32  adrs;
Line 607  void MEMCALL meml_readstr(UINT seg, UINT Line 648  void MEMCALL meml_readstr(UINT seg, UINT
         }          }
         else {          else {
                 while(leng--) {                  while(leng--) {
                         *out++ = i286_memoryread(adrs + off);                          *out++ = memp_read8(adrs + off);
                         off = LOW16(off + 1);                          off = LOW16(off + 1);
                 }                  }
         }          }
 }  }
   
 void MEMCALL meml_writestr(UINT seg, UINT off, const void *dat, UINT leng) {  void MEMCALL memr_writes(UINT seg, UINT off, const void *dat, UINT leng) {
   
         UINT8   *out;          UINT8   *out;
         UINT32  adrs;          UINT32  adrs;
Line 645  void MEMCALL meml_writestr(UINT seg, UIN Line 686  void MEMCALL meml_writestr(UINT seg, UIN
         }          }
         else {          else {
                 while(leng--) {                  while(leng--) {
                         i286_memorywrite(adrs + off, *out++);                          memp_write8(adrs + off, *out++);
                         off = LOW16(off + 1);                          off = LOW16(off + 1);
                 }                  }
         }          }
 }  }
   
 void MEMCALL meml_read(UINT32 address, void *dat, UINT leng) {  
   
         if ((address + leng) < I286_MEMREADMAX) {  
                 CopyMemory(dat, mem + address, leng);  
         }  
         else {  
                 UINT8 *out = (UINT8 *)dat;  
                 if (address < I286_MEMREADMAX) {  
                         CopyMemory(out, mem + address, I286_MEMREADMAX - address);  
                         out += I286_MEMREADMAX - address;  
                         leng -= I286_MEMREADMAX - address;  
                         address = I286_MEMREADMAX;  
                 }  
                 while(leng--) {  
                         *out++ = i286_memoryread(address++);  
                 }  
         }  
 }  
   
 void MEMCALL meml_write(UINT32 address, const void *dat, UINT leng) {  
   
 const UINT8     *out;  
   
         if ((address + leng) < I286_MEMWRITEMAX) {  
                 CopyMemory(mem + address, dat, leng);  
         }  
         else {  
                 out = (UINT8 *)dat;  
                 if (address < I286_MEMWRITEMAX) {  
                         CopyMemory(mem + address, out, I286_MEMWRITEMAX - address);  
                         out += I286_MEMWRITEMAX - address;  
                         leng -= I286_MEMWRITEMAX - address;  
                         address = I286_MEMWRITEMAX;  
                 }  
                 while(leng--) {  
                         i286_memorywrite(address++, *out++);  
                 }  
         }  
 }  
   
 #endif  #endif
   

Removed from v.1.30  
changed lines
  Added in v.1.31


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