|
|
| version 1.12, 2003/12/09 15:49:14 | version 1.15, 2003/12/22 01:44:59 |
|---|---|
| Line 1 | Line 1 |
| #include "compiler.h" | #include "compiler.h" |
| #include "cpucore.h" | #include "cpucore.h" |
| #include "memory.h" | |
| #include "egcmem.h" | #include "egcmem.h" |
| #include "pccore.h" | #include "pccore.h" |
| #include "iocore.h" | #include "iocore.h" |
| Line 8 | Line 7 |
| #include "font.h" | #include "font.h" |
| BYTE mem[0x200000]; | |
| #define USE_HIMEM 0x10fff0 | #define USE_HIMEM 0x10fff0 |
| #if defined(TRACE) | #if defined(TRACE) |
| Line 23 static void MEMCALL i286_wt(UINT32 addre | Line 25 static void MEMCALL i286_wt(UINT32 addre |
| 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 55 static void MEMCALL tram_wt(UINT32 addre | Line 57 static void MEMCALL tram_wt(UINT32 addre |
| 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 63 static void MEMCALL vram_w0(UINT32 addre | Line 65 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 74 static void MEMCALL grcg_rmw0(UINT32 add | Line 76 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 103 static void MEMCALL grcg_rmw1(UINT32 add | Line 105 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 131 static void MEMCALL grcg_tdw0(UINT32 add | Line 133 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 155 static void MEMCALL grcg_tdw1(UINT32 add | Line 157 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 177 static void MEMCALL grcg_tdw1(UINT32 add | Line 179 static void MEMCALL grcg_tdw1(UINT32 add |
| 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); |
| } | } |
| Line 201 static REG8 MEMCALL i286_rd(UINT32 addre | Line 204 static REG8 MEMCALL i286_rd(UINT32 addre |
| 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 218 static REG8 MEMCALL tram_rd(UINT32 addre | Line 221 static REG8 MEMCALL tram_rd(UINT32 addre |
| 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]); |
| } | } |
| Line 233 static REG8 MEMCALL grcg_tcr0(UINT32 add | Line 236 static REG8 MEMCALL grcg_tcr0(UINT32 add |
| 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 256 static REG8 MEMCALL grcg_tcr1(UINT32 add | Line 259 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 276 const BYTE *vram; | Line 279 const BYTE *vram; |
| 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)); |
| } | } |
| Line 305 static void MEMCALL i286w_wt(UINT32 addr | Line 309 static void MEMCALL i286w_wt(UINT32 addr |
| 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 350 static void MEMCALL tramw_wt(UINT32 addr | Line 355 static void MEMCALL tramw_wt(UINT32 addr |
| #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 359 static void MEMCALL tramw_wt(UINT32 addr | Line 364 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 405 static void MEMCALL tramw_wt(UINT32 addr | Line 410 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 439 static void MEMCALL grcgw_tdw1(UINT32 ad | Line 444 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 487 static REG16 MEMCALL i286w_rd(UINT32 add | Line 493 static REG16 MEMCALL i286w_rd(UINT32 add |
| 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 516 static REG16 MEMCALL tramw_rd(UINT32 add | Line 522 static REG16 MEMCALL tramw_rd(UINT32 add |
| 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)); |
| } | } |
| Line 531 static REG16 MEMCALL grcgw_tcr0(UINT32 a | Line 537 static REG16 MEMCALL grcgw_tcr0(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 554 static REG16 MEMCALL grcgw_tcr1(UINT32 a | Line 560 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 576 static REG16 MEMCALL egcw_rd(UINT32 addr | Line 582 static REG16 MEMCALL egcw_rd(UINT32 addr |
| 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 939 REG8 MEMCALL i286_membyte_read(UINT seg, | Line 946 REG8 MEMCALL i286_membyte_read(UINT seg, |
| UINT32 address; | UINT32 address; |
| address = (seg << 4) + off; | address = (seg << 4) + LOW16(off); |
| if (address < I286_MEMREADMAX) { | if (address < I286_MEMREADMAX) { |
| return(mem[address]); | return(mem[address]); |
| } | } |
| Line 952 REG16 MEMCALL i286_memword_read(UINT seg | Line 959 REG16 MEMCALL i286_memword_read(UINT seg |
| UINT32 address; | UINT32 address; |
| address = (seg << 4) + off; | address = (seg << 4) + LOW16(off); |
| if (address < (I286_MEMREADMAX - 1)) { | if (address < (I286_MEMREADMAX - 1)) { |
| return(LOADINTELWORD(mem + address)); | return(LOADINTELWORD(mem + address)); |
| } | } |
| Line 965 void MEMCALL i286_membyte_write(UINT seg | Line 972 void MEMCALL i286_membyte_write(UINT seg |
| UINT32 address; | UINT32 address; |
| address = (seg << 4) + off; | address = (seg << 4) + LOW16(off); |
| if (address < I286_MEMWRITEMAX) { | if (address < I286_MEMWRITEMAX) { |
| mem[address] = (BYTE)value; | mem[address] = (BYTE)value; |
| } | } |
| Line 978 void MEMCALL i286_memword_write(UINT seg | Line 985 void MEMCALL i286_memword_write(UINT seg |
| UINT32 address; | UINT32 address; |
| address = (seg << 4) + off; | address = (seg << 4) + LOW16(off); |
| if (address < (I286_MEMWRITEMAX - 1)) { | if (address < (I286_MEMWRITEMAX - 1)) { |
| STOREINTELWORD(mem + address, value); | STOREINTELWORD(mem + address, value); |
| } | } |
| Line 995 void MEMCALL i286_memstr_read(UINT seg, | Line 1002 void MEMCALL i286_memstr_read(UINT seg, |
| out = (BYTE *)dat; | out = (BYTE *)dat; |
| adrs = seg << 4; | adrs = seg << 4; |
| off = LOW16(off); | |
| if ((I286_MEMREADMAX >= 0x10000) && | if ((I286_MEMREADMAX >= 0x10000) && |
| (adrs < (I286_MEMREADMAX - 0x10000))) { | (adrs < (I286_MEMREADMAX - 0x10000))) { |
| if (leng) { | if (leng) { |
| Line 1033 void MEMCALL i286_memstr_write(UINT seg, | Line 1041 void MEMCALL i286_memstr_write(UINT seg, |
| out = (BYTE *)dat; | out = (BYTE *)dat; |
| adrs = seg << 4; | adrs = seg << 4; |
| off = LOW16(off); | |
| if ((I286_MEMWRITEMAX >= 0x10000) && | if ((I286_MEMWRITEMAX >= 0x10000) && |
| (adrs < (I286_MEMWRITEMAX - 0x10000))) { | (adrs < (I286_MEMWRITEMAX - 0x10000))) { |
| if (leng) { | if (leng) { |