| version 1.1, 2004/08/05 04:53:15 | version 1.4, 2004/08/20 23:01:16 | 
| Line 4 | Line 4 | 
 | #include        "iocore.h" | #include        "iocore.h" | 
 |  |  | 
 |  |  | 
 |  | UINT8   biosmem[0x8000]; | 
 |  | #if defined(SUPPORT_BANKMEM) | 
 |  | UINT8   bankmem[16][0x8000]; | 
 |  | #endif | 
 |  |  | 
 |  |  | 
 | void memio_update(void) { | void memio_update(void) { | 
 |  |  | 
| if (memio.ems & 0x10) { | #if defined(SUPPORT_BANKMEM) | 
|  | if (memio.bank & 0x10) { | 
|  | #endif | 
 | if (!memio.ram) { | if (!memio.ram) { | 
| RAM0r = mBIOS; | z80core.e.memread = biosmem; | 
| RAM0w = mMAIN; |  | 
 | } | } | 
 | else { | else { | 
| RAM0r = RAM0w = mMAIN; | z80core.e.memread = mainmem; | 
 | } | } | 
 |  | z80core.e.memwrite = mainmem; | 
 |  | #if defined(SUPPORT_BANKMEM) | 
 | } | } | 
 | else { | else { | 
| RAM0r = RAM0w = mBANK[memio.ems & 15]; | z80core.e.memread = bankmem[memio.bank & 15]; | 
|  | z80core.e.memwrite = bankmem[memio.bank & 15]; | 
 | } | } | 
 |  | #endif | 
 | } | } | 
 |  |  | 
| void IOOUTCALL memio_ems_o(UINT port, REG8 dat) { | #if defined(SUPPORT_BANKMEM) | 
|  | void IOOUTCALL memio_bank_o(UINT port, REG8 dat) { | 
 |  |  | 
| memio.ems = dat; | memio.bank = dat; | 
 | memio_update(); | memio_update(); | 
 | (void)port; | (void)port; | 
 | } | } | 
 |  |  | 
| REG8 IOINPCALL memio_ems_i(UINT port) { | REG8 IOINPCALL memio_bank_i(UINT port) { | 
 |  |  | 
 | (void)port; | (void)port; | 
| return(memio.ems); | return(memio.bank); | 
 | } | } | 
 |  | #endif | 
 |  |  | 
 | void IOOUTCALL memio_rom(UINT port, REG8 dat) { | void IOOUTCALL memio_rom(UINT port, REG8 dat) { | 
 |  |  | 
 | memio.ram = 0x00; | memio.ram = 0x00; | 
| if (memio.ems & 0x10) { | #if defined(SUPPORT_BANKMEM) | 
| RAM0r = mBIOS; | if (memio.bank & 0x10) { | 
|  | #endif | 
|  | z80core.e.memread = biosmem; | 
|  | #if defined(SUPPORT_BANKMEM) | 
 | } | } | 
 |  | #endif | 
 | (void)port; | (void)port; | 
 | (void)dat; | (void)dat; | 
 | } | } | 
| Line 46  void IOOUTCALL memio_rom(UINT port, REG8 | Line 63  void IOOUTCALL memio_rom(UINT port, REG8 | 
 | void IOOUTCALL memio_ram(UINT port, REG8 dat) { | void IOOUTCALL memio_ram(UINT port, REG8 dat) { | 
 |  |  | 
 | memio.ram = 0x10; | memio.ram = 0x10; | 
| if (memio.ems & 0x10) { | #if defined(SUPPORT_BANKMEM) | 
| RAM0r = mMAIN; | if (memio.bank & 0x10) { | 
|  | #endif | 
|  | z80core.e.memread = mainmem; | 
|  | #if defined(SUPPORT_BANKMEM) | 
 | } | } | 
 |  | #endif | 
 | (void)port; | (void)port; | 
 | (void)dat; | (void)dat; | 
 | } | } | 
| Line 59  void IOOUTCALL memio_ram(UINT port, REG8 | Line 80  void IOOUTCALL memio_ram(UINT port, REG8 | 
 | void memio_reset(void) { | void memio_reset(void) { | 
 |  |  | 
 | memio.ram = 0x00; | memio.ram = 0x00; | 
| memio.ems = 0x78; | #if defined(SUPPORT_BANKMEM) | 
|  | memio.bank = 0x78; | 
|  | #endif | 
 | memio_update(); | memio_update(); | 
 | } | } | 
 |  |  |