summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame
diff options
context:
space:
mode:
authorGravatarGravatar Olivier Galibert <galibert@pobox.com>2020-11-12 15:52:20 +0100
committerGravatarGravatar Olivier Galibert <galibert@pobox.com>2020-11-22 19:43:52 +0100
commit574daf4e49e7e9ef4641f363bd2b007c5a414d47 (patch)
treeb43ca91fa36fbc26e54316de5a33069c85e1df9d /src/mame
parent8d4559070f10367dac4fb7f7721b1f3e91098c75 (diff)
Implement views, which are essentially bankdevs integrated into the
memory map system. [O. Galibert]
Diffstat (limited to 'src/mame')
-rw-r--r--src/mame/drivers/simpsons.cpp24
-rw-r--r--src/mame/includes/simpsons.h10
-rw-r--r--src/mame/video/simpsons.cpp7
3 files changed, 17 insertions, 24 deletions
diff --git a/src/mame/drivers/simpsons.cpp b/src/mame/drivers/simpsons.cpp
index 86fb6c95c78..356baeda1f9 100644
--- a/src/mame/drivers/simpsons.cpp
+++ b/src/mame/drivers/simpsons.cpp
@@ -118,8 +118,8 @@ Notes:
void simpsons_state::main_map(address_map &map)
{
map(0x0000, 0x1fff).rw(m_k052109, FUNC(k052109_device::read), FUNC(k052109_device::write));
- map(0x0000, 0x0fff).m(m_bank0000, FUNC(address_map_bank_device::amap8));
- map(0x2000, 0x3fff).m(m_bank2000, FUNC(address_map_bank_device::amap8));
+ map(0x0000, 0x0fff).view(m_palette_view);
+ m_palette_view[0](0x0000, 0x0fff).ram().w("palette", FUNC(palette_device::write8)).share("palette");
map(0x1f80, 0x1f80).portr("COIN");
map(0x1f81, 0x1f81).portr("TEST");
map(0x1f90, 0x1f90).portr("P1");
@@ -134,24 +134,15 @@ void simpsons_state::main_map(address_map &map)
map(0x1fc6, 0x1fc7).rw("k053260", FUNC(k053260_device::main_read), FUNC(k053260_device::main_write));
map(0x1fc8, 0x1fc9).r(m_k053246, FUNC(k053247_device::k053246_r));
map(0x1fca, 0x1fca).r("watchdog", FUNC(watchdog_timer_device::reset_r));
+ map(0x2000, 0x3fff).view(m_video_view);
+ m_video_view[0](0x2000, 0x3fff).rw(FUNC(simpsons_state::simpsons_k052109_r), FUNC(simpsons_state::simpsons_k052109_w));
+ m_video_view[1](0x2000, 0x2fff).rw(FUNC(simpsons_state::simpsons_k053247_r), FUNC(simpsons_state::simpsons_k053247_w));
+ m_video_view[1](0x3000, 0x3fff).ram();
map(0x4000, 0x5fff).ram();
map(0x6000, 0x7fff).bankr("bank1");
map(0x8000, 0xffff).rom().region("maincpu", 0x78000);
}
-void simpsons_state::bank0000_map(address_map &map)
-{
- map(0x0000, 0x0fff).rw(m_k052109, FUNC(k052109_device::read), FUNC(k052109_device::write));
- map(0x1000, 0x1fff).ram().w("palette", FUNC(palette_device::write8)).share("palette");
-}
-
-void simpsons_state::bank2000_map(address_map &map)
-{
- map(0x0000, 0x1fff).rw(FUNC(simpsons_state::simpsons_k052109_r), FUNC(simpsons_state::simpsons_k052109_w));
- map(0x2000, 0x2fff).rw(FUNC(simpsons_state::simpsons_k053247_r), FUNC(simpsons_state::simpsons_k053247_w));
- map(0x3000, 0x3fff).ram();
-}
-
void simpsons_state::z80_bankswitch_w(uint8_t data)
{
membank("bank2")->set_entry(data & 7);
@@ -331,9 +322,6 @@ void simpsons_state::simpsons(machine_config &config)
Z80(config, m_audiocpu, XTAL(3'579'545)); /* verified on pcb */
m_audiocpu->set_addrmap(AS_PROGRAM, &simpsons_state::z80_map); /* NMIs are generated by the 053260 */
- ADDRESS_MAP_BANK(config, "bank0000").set_map(&simpsons_state::bank0000_map).set_options(ENDIANNESS_BIG, 8, 13, 0x1000);
- ADDRESS_MAP_BANK(config, "bank2000").set_map(&simpsons_state::bank2000_map).set_options(ENDIANNESS_BIG, 8, 14, 0x2000);
-
EEPROM_ER5911_8BIT(config, "eeprom");
WATCHDOG_TIMER(config, "watchdog");
diff --git a/src/mame/includes/simpsons.h b/src/mame/includes/simpsons.h
index 69a9dbfa98c..7a766965378 100644
--- a/src/mame/includes/simpsons.h
+++ b/src/mame/includes/simpsons.h
@@ -17,10 +17,10 @@ class simpsons_state : public driver_device
public:
simpsons_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
+ m_palette_view(*this, "palette_view"),
+ m_video_view(*this, "video_view"),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
- m_bank0000(*this, "bank0000"),
- m_bank2000(*this, "bank2000"),
m_k052109(*this, "k052109"),
m_k053246(*this, "k053246"),
m_k053251(*this, "k053251")
@@ -47,11 +47,13 @@ private:
int m_firq_enabled;
u64 m_nmi_enabled;
+ /* views */
+ memory_view m_palette_view;
+ memory_view m_video_view;
+
/* devices */
required_device<konami_cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
- required_device<address_map_bank_device> m_bank0000;
- required_device<address_map_bank_device> m_bank2000;
required_device<k052109_device> m_k052109;
required_device<k053247_device> m_k053246;
required_device<k053251_device> m_k053251;
diff --git a/src/mame/video/simpsons.cpp b/src/mame/video/simpsons.cpp
index 2caafb9bac0..1c43114823d 100644
--- a/src/mame/video/simpsons.cpp
+++ b/src/mame/video/simpsons.cpp
@@ -77,8 +77,11 @@ void simpsons_state::simpsons_k053247_w(offs_t offset, uint8_t data)
void simpsons_state::simpsons_video_banking( int bank )
{
- m_bank0000->set_bank(bank & 1);
- m_bank2000->set_bank((bank >> 1) & 1);
+ if(bank & 1)
+ m_palette_view.select(0);
+ else
+ m_palette_view.disable();
+ m_video_view.select((bank >> 1) & 1);
}