|
|
| version 1.7, 2004/01/05 15:47:18 | version 1.9, 2004/02/05 16:41:32 |
|---|---|
| Line 14 | Line 14 |
| BYTE mem[0x200000]; | BYTE mem[0x200000]; |
| #define USE_HIMEM 0x10fff0 | #define USE_HIMEM 0x110000 |
| // ---- write byte | // ---- write byte |
| Line 183 static void MEMCALL egc_wt(UINT32 addres | Line 183 static void MEMCALL egc_wt(UINT32 addres |
| egc_write(address, value); | egc_write(address, value); |
| } | } |
| static void MEMCALL emmc_wt(UINT32 address, REG8 value) { | |
| extmem.pageptr[(address >> 14) & 3][LOW14(address)] = (BYTE)value; | |
| } | |
| static void MEMCALL i286_wb(UINT32 address, REG8 value) { | static void MEMCALL i286_wb(UINT32 address, REG8 value) { |
| mem[address + 0x1c8000 - 0xe8000] = (BYTE)value; | mem[address + 0x1c8000 - 0xe8000] = (BYTE)value; |
| Line 288 static REG8 MEMCALL egc_rd(UINT32 addres | Line 283 static REG8 MEMCALL egc_rd(UINT32 addres |
| return(egc_read(address)); | return(egc_read(address)); |
| } | } |
| static REG8 MEMCALL emmc_rd(UINT32 address) { | |
| return(extmem.pageptr[(address >> 14) & 3][LOW14(address)]); | |
| } | |
| static REG8 MEMCALL i286_rb(UINT32 address) { | static REG8 MEMCALL i286_rb(UINT32 address) { |
| if (CPU_ITFBANK) { | if (CPU_ITFBANK) { |
| Line 465 static void MEMCALL egcw_wt(UINT32 addre | Line 455 static void MEMCALL egcw_wt(UINT32 addre |
| } | } |
| } | } |
| static void MEMCALL emmcw_wt(UINT32 address, REG16 value) { | |
| BYTE *ptr; | |
| if ((address & 0x3fff) != 0x3fff) { | |
| ptr = extmem.pageptr[(address >> 14) & 3] + LOW14(address); | |
| STOREINTELWORD(ptr, value); | |
| } | |
| else { | |
| extmem.pageptr[(address >> 14) & 3][0x3fff] = (BYTE)value; | |
| extmem.pageptr[((address + 1) >> 14) & 3][0] = (BYTE)(value >> 8); | |
| } | |
| } | |
| static void MEMCALL i286w_wb(UINT32 address, REG16 value) { | static void MEMCALL i286w_wb(UINT32 address, REG16 value) { |
| mem[address + 0x1c8000 - 0xe8000] = (BYTE)value; | mem[address + 0x1c8000 - 0xe8000] = (BYTE)value; |
| Line 611 static REG16 MEMCALL egcw_rd(UINT32 addr | Line 587 static REG16 MEMCALL egcw_rd(UINT32 addr |
| } | } |
| } | } |
| static REG16 MEMCALL emmcw_rd(UINT32 address) { | |
| const BYTE *ptr; | |
| REG16 ret; | |
| if ((address & 0x3fff) != 0x3fff) { | |
| ptr = extmem.pageptr[(address >> 14) & 3] + LOW14(address); | |
| return(LOADINTELWORD(ptr)); | |
| } | |
| else { | |
| ret = extmem.pageptr[(address >> 14) & 3][0x3fff]; | |
| ret += extmem.pageptr[((address + 1) >> 14) & 3][0] << 8; | |
| return(ret); | |
| } | |
| } | |
| static REG16 MEMCALL i286w_rb(UINT32 address) { | static REG16 MEMCALL i286w_rb(UINT32 address) { |
| if (CPU_ITFBANK) { | if (CPU_ITFBANK) { |
| Line 675 static MEMFN memfn = { | Line 635 static MEMFN memfn = { |
| i286_rd, i286_rd, i286_rd, i286_rd, // 60 | i286_rd, i286_rd, i286_rd, i286_rd, // 60 |
| i286_rd, i286_rd, i286_rd, i286_rd, // 80 | i286_rd, i286_rd, i286_rd, i286_rd, // 80 |
| tram_rd, vram_r0, vram_r0, vram_r0, // a0 | tram_rd, vram_r0, vram_r0, vram_r0, // a0 |
| emmc_rd, emmc_rd, i286_rd, i286_rd, // c0 | i286_rd, i286_rd, i286_rd, i286_rd, // c0 |
| vram_r0, i286_rd, i286_rd, i286_rb}, // f0 | vram_r0, i286_rd, i286_rd, i286_rb}, // e0 |
| {i286_wt, i286_wt, i286_wt, i286_wt, // 00 | {i286_wt, i286_wt, i286_wt, i286_wt, // 00 |
| i286_wt, i286_wt, i286_wt, i286_wt, // 20 | i286_wt, i286_wt, i286_wt, i286_wt, // 20 |
| Line 684 static MEMFN memfn = { | Line 644 static MEMFN memfn = { |
| i286_wt, i286_wt, i286_wt, i286_wt, // 60 | i286_wt, i286_wt, i286_wt, i286_wt, // 60 |
| i286_wt, i286_wt, i286_wt, i286_wt, // 80 | i286_wt, i286_wt, i286_wt, i286_wt, // 80 |
| tram_wt, vram_w0, vram_w0, vram_w0, // a0 | tram_wt, vram_w0, vram_w0, vram_w0, // a0 |
| emmc_wt, emmc_wt, i286_wn, i286_wn, // c0 | i286_wn, i286_wn, i286_wn, i286_wn, // c0 |
| vram_w0, i286_wn, i286_wn, i286_wn}, // e0 | vram_w0, i286_wn, i286_wn, i286_wn}, // e0 |
| {i286w_rd, i286w_rd, i286w_rd, i286w_rd, // 00 | {i286w_rd, i286w_rd, i286w_rd, i286w_rd, // 00 |
| Line 693 static MEMFN memfn = { | Line 653 static MEMFN memfn = { |
| i286w_rd, i286w_rd, i286w_rd, i286w_rd, // 60 | i286w_rd, i286w_rd, i286w_rd, i286w_rd, // 60 |
| i286w_rd, i286w_rd, i286w_rd, i286w_rd, // 80 | i286w_rd, i286w_rd, i286w_rd, i286w_rd, // 80 |
| tramw_rd, vramw_r0, vramw_r0, vramw_r0, // a0 | tramw_rd, vramw_r0, vramw_r0, vramw_r0, // a0 |
| emmcw_rd, emmcw_rd, i286w_rd, i286w_rd, // c0 | i286w_rd, i286w_rd, i286w_rd, i286w_rd, // c0 |
| vramw_r0, i286w_rd, i286w_rd, i286w_rb}, // e0 | vramw_r0, i286w_rd, i286w_rd, i286w_rb}, // e0 |
| {i286w_wt, i286w_wt, i286w_wt, i286w_wt, // 00 | {i286w_wt, i286w_wt, i286w_wt, i286w_wt, // 00 |
| Line 702 static MEMFN memfn = { | Line 662 static MEMFN memfn = { |
| i286w_wt, i286w_wt, i286w_wt, i286w_wt, // 60 | i286w_wt, i286w_wt, i286w_wt, i286w_wt, // 60 |
| i286w_wt, i286w_wt, i286w_wt, i286w_wt, // 80 | i286w_wt, i286w_wt, i286w_wt, i286w_wt, // 80 |
| tramw_wt, vramw_w0, vramw_w0, vramw_w0, // a0 | tramw_wt, vramw_w0, vramw_w0, vramw_w0, // a0 |
| emmcw_wt, emmcw_wt, i286w_wn, i286w_wn, // c0 | i286w_wn, i286w_wn, i286w_wn, i286w_wn, // c0 |
| vramw_w0, i286w_wn, i286w_wn, i286w_wn}}; // e0 | vramw_w0, i286w_wn, i286w_wn, i286w_wn}}; // e0 |
| static const MMAPTBL mmaptbl[2] = { | static const MMAPTBL mmaptbl[2] = { |
| Line 796 const VACCTBL *vacc; | Line 756 const VACCTBL *vacc; |
| memfn.wr16[0xb8000 >> 15] = vacc->wr16; | memfn.wr16[0xb8000 >> 15] = vacc->wr16; |
| memfn.wr16[0xe0000 >> 15] = vacc->wr16; | memfn.wr16[0xe0000 >> 15] = vacc->wr16; |
| if (!(func & 0x10)) { // degital | if (!(func & 0x10)) { // digital |
| memfn.wr8[0xe0000 >> 15] = i286_wn; | memfn.wr8[0xe0000 >> 15] = i286_wn; |
| memfn.wr16[0xe0000 >> 15] = i286w_wn; | memfn.wr16[0xe0000 >> 15] = i286w_wn; |
| memfn.rd8[0xe0000 >> 15] = i286_nonram_r; | memfn.rd8[0xe0000 >> 15] = i286_nonram_r; |
| Line 805 const VACCTBL *vacc; | Line 765 const VACCTBL *vacc; |
| } | } |
| REG8 MEMCALL __i286_memoryread(UINT32 address) { | REG8 MEMCALL i286_memoryread(UINT32 paddr) { |
| UINT32 address = paddr & CPU_ADRSMASK; | |
| if (address < I286_MEMREADMAX) { | if (address < I286_MEMREADMAX) { |
| return(mem[address]); | return(mem[address]); |
| } | } |
| #if defined(USE_HIMEM) | |
| else if (address >= USE_HIMEM) { | else if (address >= USE_HIMEM) { |
| address -= 0x100000; | address -= 0x100000; |
| if (address < CPU_EXTMEMSIZE) { | if (address < CPU_EXTMEMSIZE) { |
| Line 820 REG8 MEMCALL __i286_memoryread(UINT32 ad | Line 781 REG8 MEMCALL __i286_memoryread(UINT32 ad |
| return(0xff); | return(0xff); |
| } | } |
| } | } |
| #endif | |
| else { | else { |
| return(memfn.rd8[(address >> 15) & 0x1f](address)); | return(memfn.rd8[(address >> 15) & 0x1f](address)); |
| } | } |
| } | } |
| REG16 MEMCALL __i286_memoryread_w(UINT32 address) { | REG16 MEMCALL i286_memoryread_w(UINT32 paddr) { |
| UINT32 address = paddr & CPU_ADRSMASK; | |
| REG16 ret; | REG16 ret; |
| if (address < (I286_MEMREADMAX - 1)) { | if (address < (I286_MEMREADMAX - 1)) { |
| return(LOADINTELWORD(mem + address)); | return(LOADINTELWORD(mem + address)); |
| } | } |
| #if defined(USE_HIMEM) | |
| else if (address >= (USE_HIMEM - 1)) { | else if (address >= (USE_HIMEM - 1)) { |
| address -= 0x100000; | address -= 0x100000; |
| if (address == (USE_HIMEM - 0x100000 - 1)) { | if (address == (USE_HIMEM - 0x100000 - 1)) { |
| Line 854 REG16 MEMCALL __i286_memoryread_w(UINT32 | Line 814 REG16 MEMCALL __i286_memoryread_w(UINT32 |
| } | } |
| return(ret); | return(ret); |
| } | } |
| #endif | |
| else if ((address & 0x7fff) != 0x7fff) { | else if ((address & 0x7fff) != 0x7fff) { |
| return(memfn.rd16[(address >> 15) & 0x1f](address)); | return(memfn.rd16[(address >> 15) & 0x1f](address)); |
| } | } |
| else { | else { |
| ret = memfn.rd8[(address >> 15) & 0x1f](address); | ret = memfn.rd8[(address >> 15) & 0x1f](address); |
| address++; | address++; |
| ret += memfn.rd8[(address >> 15) & 0x1f](address) << 8; | ret += (REG16)(memfn.rd8[(address >> 15) & 0x1f](address)) << 8; |
| return(ret); | return(ret); |
| } | } |
| } | } |
| UINT32 MEMCALL __i286_memoryread_d(UINT32 address) { | UINT32 MEMCALL i286_memoryread_d(UINT32 paddr) { |
| UINT32 ret; | |
| ret = __i286_memoryread_w(address); | UINT32 address = paddr & CPU_ADRSMASK; |
| ret |= (UINT32)__i286_memoryread_w(address + 2) << 16; | UINT32 adrs; |
| UINT32 ret; | |
| if (address < (I286_MEMREADMAX - 3)) { | |
| return(LOADINTELDWORD(mem + address)); | |
| } | |
| else if (address >= USE_HIMEM) { | |
| adrs = address - 0x100000; | |
| if (adrs + 3 < CPU_EXTMEMSIZE) { | |
| return(LOADINTELDWORD(CPU_EXTMEM + adrs)); | |
| } | |
| } | |
| ret = i286_memoryread_w(address); | |
| ret += (UINT32)i286_memoryread_w(address + 2) << 16; | |
| return ret; | return ret; |
| } | } |
| void MEMCALL __i286_memorywrite(UINT32 address, REG8 value) { | void MEMCALL i286_memorywrite(UINT32 paddr, REG8 value) { |
| UINT32 address = paddr & CPU_ADRSMASK; | |
| if (address < I286_MEMWRITEMAX) { | if (address < I286_MEMWRITEMAX) { |
| mem[address] = (BYTE)value; | mem[address] = (BYTE)value; |
| } | } |
| #if defined(USE_HIMEM) | |
| else if (address >= USE_HIMEM) { | else if (address >= USE_HIMEM) { |
| address -= 0x100000; | address -= 0x100000; |
| if (address < CPU_EXTMEMSIZE) { | if (address < CPU_EXTMEMSIZE) { |
| CPU_EXTMEM[address] = (BYTE)value; | CPU_EXTMEM[address] = (BYTE)value; |
| } | } |
| } | } |
| #endif | |
| else { | else { |
| memfn.wr8[(address >> 15) & 0x1f](address, value); | memfn.wr8[(address >> 15) & 0x1f](address, value); |
| } | } |
| } | } |
| void MEMCALL __i286_memorywrite_w(UINT32 address, REG16 value) { | void MEMCALL i286_memorywrite_w(UINT32 paddr, REG16 value) { |
| UINT32 address = paddr & CPU_ADRSMASK; | |
| if (address < (I286_MEMWRITEMAX - 1)) { | if (address < (I286_MEMWRITEMAX - 1)) { |
| STOREINTELWORD(mem + address, value); | STOREINTELWORD(mem + address, value); |
| } | } |
| #if defined(USE_HIMEM) | |
| else if (address >= (USE_HIMEM - 1)) { | else if (address >= (USE_HIMEM - 1)) { |
| address -= 0x100000; | address -= 0x100000; |
| if (address == (USE_HIMEM - 0x100000 - 1)) { | if (address == (USE_HIMEM - 0x100000 - 1)) { |
| Line 913 void MEMCALL __i286_memorywrite_w(UINT32 | Line 883 void MEMCALL __i286_memorywrite_w(UINT32 |
| CPU_EXTMEM[address] = (BYTE)(value >> 8); | CPU_EXTMEM[address] = (BYTE)(value >> 8); |
| } | } |
| } | } |
| #endif | |
| else if ((address & 0x7fff) != 0x7fff) { | else if ((address & 0x7fff) != 0x7fff) { |
| memfn.wr16[(address >> 15) & 0x1f](address, value); | memfn.wr16[(address >> 15) & 0x1f](address, value); |
| } | } |
| Line 924 void MEMCALL __i286_memorywrite_w(UINT32 | Line 893 void MEMCALL __i286_memorywrite_w(UINT32 |
| } | } |
| } | } |
| void MEMCALL __i286_memorywrite_d(UINT32 address, UINT32 value) { | void MEMCALL i286_memorywrite_d(UINT32 paddr, UINT32 value) { |
| __i286_memorywrite_w(address, value & 0xffff); | UINT32 address = paddr & CPU_ADRSMASK; |
| __i286_memorywrite_w(address + 2, (WORD)(value >> 16)); | UINT32 adrs; |
| if (address < (I286_MEMWRITEMAX - 3)) { | |
| STOREINTELDWORD(mem + address, value); | |
| return; | |
| } | |
| else if (address >= USE_HIMEM) { | |
| adrs = address - 0x100000; | |
| if (adrs + 3 < CPU_EXTMEMSIZE) { | |
| STOREINTELDWORD(CPU_EXTMEM + adrs, value); | |
| return; | |
| } | |
| } | |
| i286_memorywrite_w(address, value & 0xffff); | |
| i286_memorywrite_w(address + 2, (WORD)(value >> 16)); | |
| } | } |
| #if 0 | #if 0 |
| Line 1100 const BYTE *out; | Line 1083 const BYTE *out; |
| } | } |
| } | } |
| } | } |
| #endif | #endif |