Skip to content

Commit 49834a4

Browse files
committed
[Access Virus] Implement RAM banking
1 parent bf0f7da commit 49834a4

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/mame/access/acvirus.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,11 @@ class acvirus_state : public driver_device
8787
acvirus_state(const machine_config &mconfig, device_type type, const char *tag) :
8888
driver_device(mconfig, type, tag),
8989
m_maincpu(*this, "maincpu"),
90+
m_banked_ram(*this, "banked_ram", 4 * 0x8000, ENDIANNESS_LITTLE),
9091
m_lcdc(*this, "lcdc"),
9192
m_dsp(*this, "dsp"),
9293
m_rombank(*this, "rombank"),
94+
m_rambank(*this, "rambank"),
9395
m_row(*this, "ROW%u", 0U),
9496
m_knob(*this, "knob_%u", 0U),
9597
m_leds(*this, "leds"),
@@ -110,9 +112,11 @@ class acvirus_state : public driver_device
110112

111113
private:
112114
required_device<sab80c535_device> m_maincpu;
115+
memory_share_creator<u8> m_banked_ram;
113116
required_device<hd44780_device> m_lcdc;
114117
required_device<dsp563xx_device> m_dsp;
115118
required_memory_bank m_rombank;
119+
required_memory_bank m_rambank;
116120
required_ioport_array<4> m_row;
117121

118122
void prog_map(address_map &map) ATTR_COLD;
@@ -146,6 +150,9 @@ void acvirus_state::machine_start()
146150
m_rombank->configure_entries(0, 16, memregion("maincpu")->base(), 0x8000);
147151
m_rombank->set_entry(3);
148152

153+
m_rambank->configure_entries(0, 4, m_banked_ram, 0x8000);
154+
m_rambank->set_entry(0);
155+
149156
save_item(NAME(m_scan));
150157
save_item(NAME(m_an_select));
151158
save_item(NAME(m_led_pattern));
@@ -190,6 +197,9 @@ void acvirus_state::p5_w(u8 data)
190197
{
191198
m_rombank->set_entry((data >> 4) & 15);
192199

200+
if (BIT(data, 3))
201+
m_rambank->set_entry((data >> 4) & 3);
202+
193203
m_scan = data & 15;
194204
m_leds->matrix(1 << m_scan, m_led_pattern);
195205
}
@@ -204,7 +214,7 @@ void acvirus_state::data_map(address_map &map)
204214
{
205215
map(0x0000, 0x7fff).ram();
206216
map(0x0400, 0x0407).rw(m_dsp, FUNC(dsp563xx_device::hi08_r), FUNC(dsp563xx_device::hi08_w));
207-
map(0x8000, 0xffff).ram(); // TODO: RAM banks
217+
map(0x8000, 0xffff).bankrw(m_rambank);
208218
}
209219

210220
void acvirus_state::dsp_p_map(address_map &map)

0 commit comments

Comments
 (0)