trunk/src/mess/machine/nes_namcot.c
r23154 | r23155 | |
178 | 178 | |
179 | 179 | save_item(NAME(m_irq_enable)); |
180 | 180 | save_item(NAME(m_irq_count)); |
181 | | save_item(NAME(m_wram_enable)); |
| 181 | save_item(NAME(m_wram_protect)); |
182 | 182 | |
183 | 183 | m_n163_ram = auto_alloc_array_clear(machine(), UINT8, 0x2000); |
184 | 184 | save_pointer(NAME(m_n163_ram), 0x2000); |
r23154 | r23155 | |
197 | 197 | |
198 | 198 | m_irq_enable = 0; |
199 | 199 | m_irq_count = 0; |
200 | | m_wram_enable = 0; |
| 200 | m_wram_protect = 0; |
201 | 201 | } |
202 | 202 | |
203 | 203 | void nes_namcot163_device::device_start() |
r23154 | r23155 | |
517 | 517 | READ8_MEMBER(nes_namcot175_device::read_m) |
518 | 518 | { |
519 | 519 | // the only game supporting this is Family Circuit '91, and it has 2KB of battery |
520 | | if (m_battery && offset < m_battery_size && m_wram_enable) |
| 520 | // but it's mirrored up to 8KB (see Sprint Race -> Back Up menu breakage if not) |
| 521 | if (m_battery && !m_wram_protect) |
521 | 522 | return m_battery[offset & (m_battery_size - 1)]; |
522 | 523 | |
523 | 524 | return m_open_bus; // open bus |
r23154 | r23155 | |
526 | 527 | WRITE8_MEMBER(nes_namcot175_device::write_m) |
527 | 528 | { |
528 | 529 | // the only game supporting this is Family Circuit '91, and it has 2KB of battery |
529 | | if (m_battery && offset < m_battery_size && m_wram_enable) |
| 530 | // but it's mirrored up to 8KB (see Sprint Race -> Back Up menu breakage if not) |
| 531 | if (m_battery && !m_wram_protect) |
530 | 532 | m_battery[offset & (m_battery_size - 1)] = data; |
531 | 533 | } |
532 | 534 | |
r23154 | r23155 | |
537 | 539 | switch (offset & 0x7800) |
538 | 540 | { |
539 | 541 | case 0x4000: |
540 | | m_wram_enable = data & 1; |
| 542 | m_wram_protect = data & 1; |
541 | 543 | break; |
542 | 544 | case 0x6000: |
543 | 545 | prg8_89(data & 0x3f); |