Diff for /np2/i386c/memory.c between versions 1.29 and 1.31

version 1.29, 2005/03/10 09:54:47 version 1.31, 2005/03/16 03:53:45
Line 76  static void MEMCALL memnc_wr16(UINT32 ad Line 76  static void MEMCALL memnc_wr16(UINT32 ad
 }  }
   
   
   
   
   
 // ---- write byte  
   
 static void MEMCALL egc_wt(UINT32 address, REG8 value) {                // VRAM  
   
         CPU_REMCLOCK -= MEMWAIT_GRCG;  
         memegc_wr8(address, value);  
 }  
   
   
 // ---- read byte  
   
 static REG8 MEMCALL egc_rd(UINT32 address) {                                    // VRAM  
   
         CPU_REMCLOCK -= MEMWAIT_GRCG;  
         return(memegc_rd8(address));  
 }  
   
   
 // ---- write word  
   
 static void MEMCALL egcw_wt(UINT32 address, REG16 value) {  
   
         CPU_REMCLOCK -= MEMWAIT_GRCG;  
         memegc_wr16(address, value);  
 }  
   
   
 // ---- read word  
   
 static REG16 MEMCALL egcw_rd(UINT32 address) {  
   
         CPU_REMCLOCK -= MEMWAIT_GRCG;  
         return(memegc_rd16(address));  
 }  
   
   
 // ---- table  // ---- table
   
 typedef void (MEMCALL * MEM8WRITE)(UINT32 address, REG8 value);  typedef void (MEMCALL * MEM8WRITE)(UINT32 address, REG8 value);
Line 127  typedef struct { Line 88  typedef struct {
         MEM8WRITE       wr8[0x20];          MEM8WRITE       wr8[0x20];
         MEM16READ       rd16[0x20];          MEM16READ       rd16[0x20];
         MEM16WRITE      wr16[0x20];          MEM16WRITE      wr16[0x20];
 } MEMFN;  } MEMFN0;
   
 typedef struct {  typedef struct {
         MEM8READ        brd8;           // E8000-F7FFF byte read          MEM8READ        brd8;           // E8000-F7FFF byte read
Line 145  typedef struct { Line 106  typedef struct {
         MEM16WRITE      wr16;          MEM16WRITE      wr16;
 } VACCTBL;  } VACCTBL;
   
 static MEMFN memfn = {  static MEMFN0 memfn0 = {
            {memmain_rd8,        memmain_rd8,    memmain_rd8,    memmain_rd8,    // 00             {memmain_rd8,        memmain_rd8,    memmain_rd8,    memmain_rd8,    // 00
                 memmain_rd8,    memmain_rd8,    memmain_rd8,    memmain_rd8,    // 20                  memmain_rd8,    memmain_rd8,    memmain_rd8,    memmain_rd8,    // 20
                 memmain_rd8,    memmain_rd8,    memmain_rd8,    memmain_rd8,    // 40                  memmain_rd8,    memmain_rd8,    memmain_rd8,    memmain_rd8,    // 40
Line 199  static const VACCTBL vacctbl[0x10] = { Line 160  static const VACCTBL vacctbl[0x10] = {
                 {memvram1_rd8,  memvram1_wr8,   memvram1_rd16,  memvram1_wr16},                  {memvram1_rd8,  memvram1_wr8,   memvram1_rd16,  memvram1_wr16},
                 {memtcr0_rd8,   memtdw0_wr8,    memtcr0_rd16,   memtdw0_wr16},  // 80                  {memtcr0_rd8,   memtdw0_wr8,    memtcr0_rd16,   memtdw0_wr16},  // 80
                 {memtcr1_rd8,   memtdw1_wr8,    memtcr1_rd16,   memtdw1_wr16},                  {memtcr1_rd8,   memtdw1_wr8,    memtcr1_rd16,   memtdw1_wr16},
                 {egc_rd,                egc_wt,                 egcw_rd,                egcw_wt},                  {memegc_rd8,    memegc_wr8,             memegc_rd16,    memegc_wr16},
                 {egc_rd,                egc_wt,                 egcw_rd,                egcw_wt},                  {memegc_rd8,    memegc_wr8,             memegc_rd16,    memegc_wr16},
                 {memvram0_rd8,  memrmw0_wr8,    memvram0_rd16,  memrmw0_wr16},  // c0                  {memvram0_rd8,  memrmw0_wr8,    memvram0_rd16,  memrmw0_wr16},  // c0
                 {memvram1_rd8,  memrmw1_wr8,    memvram1_rd16,  memrmw1_wr16},                  {memvram1_rd8,  memrmw1_wr8,    memvram1_rd16,  memrmw1_wr16},
                 {egc_rd,                egc_wt,                 egcw_rd,                egcw_wt},                  {memegc_rd8,    memegc_wr8,             memegc_rd16,    memegc_wr16},
                 {egc_rd,                egc_wt,                 egcw_rd,                egcw_wt}};                  {memegc_rd8,    memegc_wr8,             memegc_rd16,    memegc_wr16}};
   
   
 void MEMCALL i286_memorymap(UINT type) {  void MEMCALL i286_memorymap(UINT type) {
Line 213  const MMAPTBL *mm; Line 174  const MMAPTBL *mm;
   
         mm = mmaptbl + (type & 1);          mm = mmaptbl + (type & 1);
   
         memfn.rd8[0xe8000 >> 15] = mm->brd8;          memfn0.rd8[0xe8000 >> 15] = mm->brd8;
         memfn.rd8[0xf0000 >> 15] = mm->brd8;          memfn0.rd8[0xf0000 >> 15] = mm->brd8;
         memfn.rd8[0xf8000 >> 15] = mm->ird8;          memfn0.rd8[0xf8000 >> 15] = mm->ird8;
         memfn.wr8[0xe8000 >> 15] = mm->bwr8;          memfn0.wr8[0xe8000 >> 15] = mm->bwr8;
         memfn.wr8[0xf0000 >> 15] = mm->bwr8;          memfn0.wr8[0xf0000 >> 15] = mm->bwr8;
         memfn.wr8[0xf8000 >> 15] = mm->bwr8;          memfn0.wr8[0xf8000 >> 15] = mm->bwr8;
   
         memfn.rd16[0xe8000 >> 15] = mm->brd16;          memfn0.rd16[0xe8000 >> 15] = mm->brd16;
         memfn.rd16[0xf0000 >> 15] = mm->brd16;          memfn0.rd16[0xf0000 >> 15] = mm->brd16;
         memfn.rd16[0xf8000 >> 15] = mm->ird16;          memfn0.rd16[0xf8000 >> 15] = mm->ird16;
         memfn.wr16[0xe8000 >> 15] = mm->bwr16;          memfn0.wr16[0xe8000 >> 15] = mm->bwr16;
         memfn.wr16[0xf0000 >> 15] = mm->bwr16;          memfn0.wr16[0xf0000 >> 15] = mm->bwr16;
         memfn.wr16[0xf8000 >> 15] = mm->bwr16;          memfn0.wr16[0xf8000 >> 15] = mm->bwr16;
 }  }
   
 void MEMCALL i286_vram_dispatch(UINT func) {  void MEMCALL i286_vram_dispatch(UINT func) {
Line 236  const VACCTBL *vacc; Line 197  const VACCTBL *vacc;
         if (!(func & 0x20)) {          if (!(func & 0x20)) {
 #endif  #endif
                 vacc = vacctbl + (func & 0x0f);                  vacc = vacctbl + (func & 0x0f);
                 memfn.rd8[0xa8000 >> 15] = vacc->rd8;                  memfn0.rd8[0xa8000 >> 15] = vacc->rd8;
                 memfn.rd8[0xb0000 >> 15] = vacc->rd8;                  memfn0.rd8[0xb0000 >> 15] = vacc->rd8;
                 memfn.rd8[0xb8000 >> 15] = vacc->rd8;                  memfn0.rd8[0xb8000 >> 15] = vacc->rd8;
                 memfn.rd8[0xe0000 >> 15] = vacc->rd8;                  memfn0.rd8[0xe0000 >> 15] = vacc->rd8;
   
                 memfn.wr8[0xa8000 >> 15] = vacc->wr8;                  memfn0.wr8[0xa8000 >> 15] = vacc->wr8;
                 memfn.wr8[0xb0000 >> 15] = vacc->wr8;                  memfn0.wr8[0xb0000 >> 15] = vacc->wr8;
                 memfn.wr8[0xb8000 >> 15] = vacc->wr8;                  memfn0.wr8[0xb8000 >> 15] = vacc->wr8;
                 memfn.wr8[0xe0000 >> 15] = vacc->wr8;                  memfn0.wr8[0xe0000 >> 15] = vacc->wr8;
   
                 memfn.rd16[0xa8000 >> 15] = vacc->rd16;                  memfn0.rd16[0xa8000 >> 15] = vacc->rd16;
                 memfn.rd16[0xb0000 >> 15] = vacc->rd16;                  memfn0.rd16[0xb0000 >> 15] = vacc->rd16;
                 memfn.rd16[0xb8000 >> 15] = vacc->rd16;                  memfn0.rd16[0xb8000 >> 15] = vacc->rd16;
                 memfn.rd16[0xe0000 >> 15] = vacc->rd16;                  memfn0.rd16[0xe0000 >> 15] = vacc->rd16;
   
                 memfn.wr16[0xa8000 >> 15] = vacc->wr16;                  memfn0.wr16[0xa8000 >> 15] = vacc->wr16;
                 memfn.wr16[0xb0000 >> 15] = vacc->wr16;                  memfn0.wr16[0xb0000 >> 15] = vacc->wr16;
                 memfn.wr16[0xb8000 >> 15] = vacc->wr16;                  memfn0.wr16[0xb8000 >> 15] = vacc->wr16;
                 memfn.wr16[0xe0000 >> 15] = vacc->wr16;                  memfn0.wr16[0xe0000 >> 15] = vacc->wr16;
   
                 if (!(func & 0x10)) {                                                   // digital                  if (!(func & 0x10)) {                                                   // digital
                         memfn.rd8[0xe0000 >> 15] = memnc_rd8;                          memfn0.rd8[0xe0000 >> 15] = memnc_rd8;
                         memfn.wr8[0xe0000 >> 15] = memnc_wr8;                          memfn0.wr8[0xe0000 >> 15] = memnc_wr8;
                         memfn.rd16[0xe0000 >> 15] = memnc_rd16;                          memfn0.rd16[0xe0000 >> 15] = memnc_rd16;
                         memfn.wr16[0xe0000 >> 15] = memnc_wr16;                          memfn0.wr16[0xe0000 >> 15] = memnc_wr16;
                 }                  }
 #if defined(SUPPORT_PC9821)  #if defined(SUPPORT_PC9821)
         }          }
         else {          else {
                 memfn.rd8[0xa8000 >> 15] = memvga0_rd8;                  memfn0.rd8[0xa8000 >> 15] = memvga0_rd8;
                 memfn.rd8[0xb0000 >> 15] = memvga0_rd8;                  memfn0.rd8[0xb0000 >> 15] = memvga0_rd8;
                 memfn.rd8[0xb8000 >> 15] = memnc_rd8;                  memfn0.rd8[0xb8000 >> 15] = memnc_rd8;
                 memfn.rd8[0xe0000 >> 15] = memvgaio_rd8;                  memfn0.rd8[0xe0000 >> 15] = memvgaio_rd8;
   
                 memfn.wr8[0xa8000 >> 15] = memvga0_wr8;                  memfn0.wr8[0xa8000 >> 15] = memvga0_wr8;
                 memfn.wr8[0xb0000 >> 15] = memvga0_wr8;                  memfn0.wr8[0xb0000 >> 15] = memvga0_wr8;
                 memfn.wr8[0xb8000 >> 15] = memnc_wr8;                  memfn0.wr8[0xb8000 >> 15] = memnc_wr8;
                 memfn.wr8[0xe0000 >> 15] = memvgaio_wr8;                  memfn0.wr8[0xe0000 >> 15] = memvgaio_wr8;
   
                 memfn.rd16[0xa8000 >> 15] = memvga0_rd16;                  memfn0.rd16[0xa8000 >> 15] = memvga0_rd16;
                 memfn.rd16[0xb0000 >> 15] = memvga0_rd16;                  memfn0.rd16[0xb0000 >> 15] = memvga0_rd16;
                 memfn.rd16[0xb8000 >> 15] = memnc_rd16;                  memfn0.rd16[0xb8000 >> 15] = memnc_rd16;
                 memfn.rd16[0xe0000 >> 15] = memvgaio_rd16;                  memfn0.rd16[0xe0000 >> 15] = memvgaio_rd16;
   
                 memfn.wr16[0xa8000 >> 15] = memvga0_wr16;                  memfn0.wr16[0xa8000 >> 15] = memvga0_wr16;
                 memfn.wr16[0xb0000 >> 15] = memvga0_wr16;                  memfn0.wr16[0xb0000 >> 15] = memvga0_wr16;
                 memfn.wr16[0xb8000 >> 15] = memnc_wr16;                  memfn0.wr16[0xb8000 >> 15] = memnc_wr16;
                 memfn.wr16[0xe0000 >> 15] = memvgaio_wr16;                  memfn0.wr16[0xe0000 >> 15] = memvgaio_wr16;
         }          }
 #endif  #endif
 }  }
Line 302  REG8 MEMCALL i286_memoryread(UINT32 addr Line 263  REG8 MEMCALL i286_memoryread(UINT32 addr
                         return(CPU_EXTMEM[pos]);                          return(CPU_EXTMEM[pos]);
                 }                  }
                 else if ((addr >= 0x00fa0000) && (addr < 0x01000000)) {                  else if ((addr >= 0x00fa0000) && (addr < 0x01000000)) {
                         return(memfn.rd8[(addr >> 15) & 0x1f](addr - 0x00f00000));                          return(memfn0.rd8[(addr >> 15) & 0x1f](addr - 0x00f00000));
                 }                  }
 #if defined(SUPPORT_PC9821)  #if defined(SUPPORT_PC9821)
                 else if ((addr >= 0x00f00000) && (addr < 0x00f80000)) {                  else if ((addr >= 0x00f00000) && (addr < 0x00f80000)) {
Line 318  REG8 MEMCALL i286_memoryread(UINT32 addr Line 279  REG8 MEMCALL i286_memoryread(UINT32 addr
                 }                  }
         }          }
         else {          else {
                 return(memfn.rd8[(addr >> 15) & 0x1f](addr));                  return(memfn0.rd8[(addr >> 15) & 0x1f](addr));
         }          }
 }  }
   
Line 337  REG16 MEMCALL i286_memoryread_w(UINT32 a Line 298  REG16 MEMCALL i286_memoryread_w(UINT32 a
                                 return(LOADINTELWORD(CPU_EXTMEM + pos));                                  return(LOADINTELWORD(CPU_EXTMEM + pos));
                         }                          }
                         else if ((addr >= 0x00fa0000) && (addr < 0x01000000)) {                          else if ((addr >= 0x00fa0000) && (addr < 0x01000000)) {
                                 return(memfn.rd16[(addr >> 15) & 0x1f](addr - 0x00f00000));                                  return(memfn0.rd16[(addr >> 15) & 0x1f](addr - 0x00f00000));
                         }                          }
 #if defined(SUPPORT_PC9821)  #if defined(SUPPORT_PC9821)
                         else if ((addr >= 0x00f00000) && (addr < 0x00f80000)) {                          else if ((addr >= 0x00f00000) && (addr < 0x00f80000)) {
Line 352  REG16 MEMCALL i286_memoryread_w(UINT32 a Line 313  REG16 MEMCALL i286_memoryread_w(UINT32 a
                                 return(0xffff);                                  return(0xffff);
                         }                          }
                 }                  }
                 return(memfn.rd16[(addr >> 15) & 0x1f](addr));                  return(memfn0.rd16[(addr >> 15) & 0x1f](addr));
         }          }
         else {          else {
                 ret = i286_memoryread(addr);                  ret = i286_memoryread(addr);
Line 392  void MEMCALL i286_memorywrite(UINT32 add Line 353  void MEMCALL i286_memorywrite(UINT32 add
         UINT32  pos;          UINT32  pos;
   
         if (addr < I286_MEMWRITEMAX) {          if (addr < I286_MEMWRITEMAX) {
                 mem[addr] = (BYTE)value;                  mem[addr] = (UINT8)value;
         }          }
         else if (addr >= USE_HIMEM) {          else if (addr >= USE_HIMEM) {
                 pos = (addr & CPU_ADRSMASK) - 0x100000;                  pos = (addr & CPU_ADRSMASK) - 0x100000;
                 if (pos < CPU_EXTMEMSIZE) {                  if (pos < CPU_EXTMEMSIZE) {
                         CPU_EXTMEM[pos] = (BYTE)value;                          CPU_EXTMEM[pos] = (UINT8)value;
                 }                  }
                 else if ((addr >= 0x00fa0000) && (addr < 0x01000000)) {                  else if ((addr >= 0x00fa0000) && (addr < 0x01000000)) {
                         memfn.wr8[(addr >> 15) & 0x1f](addr - 0x00f00000, value);                          memfn0.wr8[(addr >> 15) & 0x1f](addr - 0x00f00000, value);
                 }                  }
 #if defined(SUPPORT_PC9821)  #if defined(SUPPORT_PC9821)
                 else if ((addr >= 0x00f00000) && (addr < 0x00f80000)) {                  else if ((addr >= 0x00f00000) && (addr < 0x00f80000)) {
Line 415  void MEMCALL i286_memorywrite(UINT32 add Line 376  void MEMCALL i286_memorywrite(UINT32 add
                 }                  }
         }          }
         else {          else {
                 memfn.wr8[(addr >> 15) & 0x1f](addr, value);                  memfn0.wr8[(addr >> 15) & 0x1f](addr, value);
         }          }
 }  }
   
Line 433  void MEMCALL i286_memorywrite_w(UINT32 a Line 394  void MEMCALL i286_memorywrite_w(UINT32 a
                                 STOREINTELWORD(CPU_EXTMEM + pos, value);                                  STOREINTELWORD(CPU_EXTMEM + pos, value);
                         }                          }
                         else if ((addr >= 0x00fa0000) && (addr < 0x01000000)) {                          else if ((addr >= 0x00fa0000) && (addr < 0x01000000)) {
                                 memfn.wr16[(addr >> 15) & 0x1f](addr - 0x00f00000, value);                                  memfn0.wr16[(addr >> 15) & 0x1f](addr - 0x00f00000, value);
                         }                          }
 #if defined(SUPPORT_PC9821)  #if defined(SUPPORT_PC9821)
                         else if ((addr >= 0x00f00000) && (addr < 0x00f80000)) {                          else if ((addr >= 0x00f00000) && (addr < 0x00f80000)) {
Line 448  void MEMCALL i286_memorywrite_w(UINT32 a Line 409  void MEMCALL i286_memorywrite_w(UINT32 a
                         }                          }
                 }                  }
                 else {                  else {
                         memfn.wr16[(addr >> 15) & 0x1f](addr, value);                          memfn0.wr16[(addr >> 15) & 0x1f](addr, value);
                 }                  }
         }          }
         else {          else {
Line 516  void MEMCALL i286_membyte_write(UINT seg Line 477  void MEMCALL i286_membyte_write(UINT seg
   
         address = (seg << 4) + LOW16(off);          address = (seg << 4) + LOW16(off);
         if (address < I286_MEMWRITEMAX) {          if (address < I286_MEMWRITEMAX) {
                 mem[address] = (BYTE)value;                  mem[address] = (UINT8)value;
         }          }
         else {          else {
                 i286_memorywrite(address, value);                  i286_memorywrite(address, value);
Line 539  void MEMCALL i286_memword_write(UINT seg Line 500  void MEMCALL i286_memword_write(UINT seg
   
 void MEMCALL memp_read(UINT32 address, void *dat, UINT leng) {  void MEMCALL memp_read(UINT32 address, void *dat, UINT leng) {
   
         BYTE *out = (BYTE *)dat;          UINT8 *out = (UINT8 *)dat;
         UINT pos;          UINT pos;
         UINT diff;          UINT diff;
   
Line 570  void MEMCALL memp_read(UINT32 address, v Line 531  void MEMCALL memp_read(UINT32 address, v
   
 void MEMCALL memp_write(UINT32 address, const void *dat, UINT leng) {  void MEMCALL memp_write(UINT32 address, const void *dat, UINT leng) {
   
         const BYTE *out = (BYTE *)dat;          const UINT8 *out = (UINT8 *)dat;
         UINT pos;          UINT pos;
         UINT diff;          UINT diff;
   
Line 706  void MEMCALL meml_readstr(UINT seg, UINT Line 667  void MEMCALL meml_readstr(UINT seg, UINT
                 }                  }
                 memp_read(addr, dat, size);                  memp_read(addr, dat, size);
                 off += size;                  off += size;
                 dat = ((BYTE *)dat) + size;                  dat = ((UINT8 *)dat) + size;
                 leng -= size;                  leng -= size;
         }          }
 }  }
Line 729  void MEMCALL meml_writestr(UINT seg, UIN Line 690  void MEMCALL meml_writestr(UINT seg, UIN
                 }                  }
                 memp_write(addr, dat, size);                  memp_write(addr, dat, size);
                 off += size;                  off += size;
                 dat = ((BYTE *)dat) + size;                  dat = ((UINT8 *)dat) + size;
                 leng -= size;                  leng -= size;
         }          }
 }  }
Line 747  void MEMCALL meml_read(UINT32 address, v Line 708  void MEMCALL meml_read(UINT32 address, v
                         size = min(size, leng);                          size = min(size, leng);
                         memp_read(physicaladdr(address, FALSE), dat, size);                          memp_read(physicaladdr(address, FALSE), dat, size);
                         address += size;                          address += size;
                         dat = ((BYTE *)dat) + size;                          dat = ((UINT8 *)dat) + size;
                         leng -= size;                          leng -= size;
                 }                  }
         }          }
Line 766  void MEMCALL meml_write(UINT32 address,  Line 727  void MEMCALL meml_write(UINT32 address, 
                         size = min(size, leng);                          size = min(size, leng);
                         memp_write(physicaladdr(address, TRUE), dat, size);                          memp_write(physicaladdr(address, TRUE), dat, size);
                         address += size;                          address += size;
                         dat = ((BYTE *)dat) + size;                          dat = ((UINT8 *)dat) + size;
                         leng -= size;                          leng -= size;
                 }                  }
         }          }

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


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