|
|
| version 1.1, 2004/02/29 03:10:03 | version 1.4, 2004/04/05 09:45:06 |
|---|---|
| Line 1 | Line 1 |
| #include "compiler.h" | #include "compiler.h" |
| #if defined(SUPPORT_PC9821) | |
| #include "cpucore.h" | #include "cpucore.h" |
| #include "mem9821.h" | #include "mem9821.h" |
| #include "pccore.h" | #include "pccore.h" |
| Line 15 void MEMCALL mem9821_w(UINT32 addr, REG8 | Line 18 void MEMCALL mem9821_w(UINT32 addr, REG8 |
| bit = (addr & 0x40000)?2:1; | bit = (addr & 0x40000)?2:1; |
| vramupdate[LOW15(addr >> 3)] |= bit; | vramupdate[LOW15(addr >> 3)] |= bit; |
| gdcs.grphdisp |= bit; | gdcs.grphdisp |= bit; |
| TRACEOUT(("mem9821_w %x %x", addr, value)); | // TRACEOUT(("mem9821_w %x %x", addr, value)); |
| } | } |
| REG8 MEMCALL mem9821_r(UINT32 addr) { | REG8 MEMCALL mem9821_r(UINT32 addr) { |
| Line 33 void MEMCALL mem9821_ww(UINT32 addr, REG | Line 36 void MEMCALL mem9821_ww(UINT32 addr, REG |
| vramupdate[LOW15(addr >> 3)] |= bit; | vramupdate[LOW15(addr >> 3)] |= bit; |
| vramupdate[LOW15((addr + 1) >> 3)] |= bit; | vramupdate[LOW15((addr + 1) >> 3)] |= bit; |
| gdcs.grphdisp |= bit; | gdcs.grphdisp |= bit; |
| TRACEOUT(("mem9821_ww %x %x", addr, value)); | // TRACEOUT(("mem9821_ww %x %x", addr, value)); |
| } | } |
| REG16 MEMCALL mem9821_rw(UINT32 addr) { | REG16 MEMCALL mem9821_rw(UINT32 addr) { |
| Line 50 void MEMCALL mem9821_b0w(UINT32 address, | Line 53 void MEMCALL mem9821_b0w(UINT32 address, |
| UINT32 addr; | UINT32 addr; |
| address -= 0xa8000; | address -= 0xa8000; |
| addr = (vramop.bank2[((address >> 14) & 2)] & 15) << 15; | addr = (vramop.mio1[((address >> 14) & 2)] & 15) << 15; |
| addr += LOW15(address); | addr += LOW15(address); |
| vramex[addr] = value; | vramex[addr] = value; |
| vramupdate[LOW15(addr >> 3)] |= (addr & 0x40000)?2:1; | vramupdate[LOW15(addr >> 3)] |= (addr & 0x40000)?2:1; |
| Line 62 REG8 MEMCALL mem9821_b0r(UINT32 address) | Line 65 REG8 MEMCALL mem9821_b0r(UINT32 address) |
| UINT32 addr; | UINT32 addr; |
| address -= 0xa8000; | address -= 0xa8000; |
| addr = (vramop.bank2[((address >> 14) & 2)] & 15) << 15; | addr = (vramop.mio1[((address >> 14) & 2)] & 15) << 15; |
| addr += LOW15(address); | addr += LOW15(address); |
| return(vramex[addr]); | return(vramex[addr]); |
| } | } |
| Line 83 REG16 MEMCALL mem9821_b0rw(UINT32 addres | Line 86 REG16 MEMCALL mem9821_b0rw(UINT32 addres |
| } | } |
| void MEMCALL mem9821_b2w(UINT32 address, REG8 value) { | void MEMCALL mem9821_b2w(UINT32 addr, REG8 value) { |
| UINT pos; | |
| address -= 0xe0004; | addr -= 0xe0000; |
| if (address < 4) { | pos = addr - 0x0004; |
| vramop.bank2[address] = value; | if (pos < 4) { |
| TRACEOUT(("bank2[%d] = %.2x", address, value)); | vramop.mio1[pos] = value; |
| return; | |
| } | |
| pos = addr - 0x0100; | |
| if (pos < 0x40) { | |
| vramop.mio2[pos] = value; | |
| TRACEOUT(("mem9821_b2w(%.5x, %.2x)", addr, value)); | |
| return; | |
| } | } |
| } | } |
| REG8 MEMCALL mem9821_b2r(UINT32 address) { | REG8 MEMCALL mem9821_b2r(UINT32 addr) { |
| UINT pos; | |
| address -= 0xe0004; | addr -= 0xe0000; |
| if (address < 4) { | pos = addr - 0x0004; |
| return(vramop.bank2[address]); | if (pos < 4) { |
| return(vramop.mio1[pos]); | |
| } | |
| pos = addr - 0x0100; | |
| if (pos < 0x40) { | |
| return(vramop.mio2[pos]); | |
| } | } |
| return(0xff); | return(0x00); |
| } | } |
| void MEMCALL mem9821_b2ww(UINT32 address, REG16 value) { | void MEMCALL mem9821_b2ww(UINT32 address, REG16 value) { |
| Line 115 REG16 MEMCALL mem9821_b2rw(UINT32 addres | Line 134 REG16 MEMCALL mem9821_b2rw(UINT32 addres |
| ret |= mem9821_b2r(address + 1) << 8; | ret |= mem9821_b2r(address + 1) << 8; |
| return(ret); | return(ret); |
| } | } |
| #endif | |