diff options
author | R. Belmont <rb6502@users.noreply.github.com> | 2019-08-18 11:18:39 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-18 11:18:39 -0400 |
commit | d9d938c88aeadca3c4d05193bd0126ce6004e810 (patch) | |
tree | 0b1e3da21eea4868ba5f51834350fc15ae8f88c6 | |
parent | 47447da16bc8b6ac0a69b2f51284d27aeb1ddc60 (diff) | |
parent | 333dd07332322f292b7937b1d1d3f387fa7a8c32 (diff) |
Merge pull request #5501 from DavidHaywood/170819_3
use ramdac device on policetr
-rw-r--r-- | src/mame/drivers/atronic.cpp | 14 | ||||
-rw-r--r-- | src/mame/drivers/policetr.cpp | 16 | ||||
-rw-r--r-- | src/mame/includes/policetr.h | 10 | ||||
-rw-r--r-- | src/mame/video/policetr.cpp | 31 |
4 files changed, 25 insertions, 46 deletions
diff --git a/src/mame/drivers/atronic.cpp b/src/mame/drivers/atronic.cpp index 95ebf7718fe..61ab1769991 100644 --- a/src/mame/drivers/atronic.cpp +++ b/src/mame/drivers/atronic.cpp @@ -333,6 +333,7 @@ public: m_palette(*this, "palette"), m_maincpu(*this, "maincpu"), m_videocpu(*this, "tms"), + m_ramdac(*this, "ramdac"), m_vidram(*this, "vidram") { } @@ -356,6 +357,7 @@ private: required_device<palette_device> m_palette; required_device<cpu_device> m_maincpu; required_device<tms34020_device> m_videocpu; + required_device<ramdac_device> m_ramdac; required_shared_ptr<uint16_t> m_vidram; @@ -438,9 +440,9 @@ void atronic_state::video_map(address_map &map) { map(0x00000000, 0x01ffffff).ram().share("vidram"); - map(0xa0000010, 0xa000001f).w("ramdac", FUNC(ramdac_device::index_w)).umask16(0x00ff); - map(0xa0000020, 0xa000002f).w("ramdac", FUNC(ramdac_device::pal_w)).umask16(0x00ff); - map(0xa0000030, 0xa000003f).w("ramdac", FUNC(ramdac_device::mask_w)).umask16(0x00ff); + map(0xa0000010, 0xa000001f).w(m_ramdac, FUNC(ramdac_device::index_w)).umask16(0x00ff); + map(0xa0000020, 0xa000002f).w(m_ramdac, FUNC(ramdac_device::pal_w)).umask16(0x00ff); + map(0xa0000030, 0xa000003f).w(m_ramdac, FUNC(ramdac_device::mask_w)).umask16(0x00ff); map(0xfc000000, 0xffffffff).rom().region("user1", 0); } @@ -458,7 +460,7 @@ void atronic_state::video_map(address_map &map) void atronic_state::ramdac_map(address_map &map) { - map(0x000, 0x3ff).rw("ramdac", FUNC(ramdac_device::ramdac_pal_r), FUNC(ramdac_device::ramdac_rgb888_w)); + map(0x000, 0x2ff).rw(m_ramdac, FUNC(ramdac_device::ramdac_pal_r), FUNC(ramdac_device::ramdac_rgb888_w)); } void atronic_state::atronic(machine_config &config) @@ -480,8 +482,8 @@ void atronic_state::atronic(machine_config &config) m_screen->set_screen_update("tms", FUNC(tms34020_device::tms340x0_rgb32)); PALETTE(config, "palette").set_entries(256); - ramdac_device &ramdac(RAMDAC(config, "ramdac", 0, m_palette)); - ramdac.set_addrmap(0, &atronic_state::ramdac_map); + RAMDAC(config, m_ramdac, 0, m_palette); + m_ramdac->set_addrmap(0, &atronic_state::ramdac_map); TMS34020(config, m_videocpu, VIDEO_CLOCK); m_videocpu->set_addrmap(AS_PROGRAM, &atronic_state::video_map); diff --git a/src/mame/drivers/policetr.cpp b/src/mame/drivers/policetr.cpp index c46eb3f2664..6a67624e38c 100644 --- a/src/mame/drivers/policetr.cpp +++ b/src/mame/drivers/policetr.cpp @@ -235,6 +235,11 @@ WRITE32_MEMBER(policetr_state::speedup_w) * *************************************/ +void policetr_state::ramdac_map(address_map &map) +{ + map(0x000, 0x2ff).rw(m_ramdac, FUNC(ramdac_device::ramdac_pal_r), FUNC(ramdac_device::ramdac_rgb888_w)); +} + void policetr_state::mem(address_map &map) { map.global_mask(0x3fffffff); @@ -246,8 +251,8 @@ void policetr_state::mem(address_map &map) map(0x00600002, 0x00600002).r(FUNC(policetr_state::bsmt2000_data_r)); map(0x00700000, 0x00700003).w(FUNC(policetr_state::bsmt2000_reg_w)); map(0x00800000, 0x00800003).w(FUNC(policetr_state::bsmt2000_data_w)); - map(0x00900001, 0x00900001).w(FUNC(policetr_state::palette_offset_w)); - map(0x00920001, 0x00920001).w(FUNC(policetr_state::palette_data_w)); + map(0x00900001, 0x00900001).w(m_ramdac, FUNC(ramdac_device::index_w)); + map(0x00920001, 0x00920001).w(m_ramdac, FUNC(ramdac_device::pal_w)); map(0x00a00000, 0x00a00003).w(FUNC(policetr_state::control_w)); map(0x00a00000, 0x00a00003).portr("IN0"); map(0x00a20000, 0x00a20003).portr("IN1"); @@ -263,8 +268,8 @@ void sshooter_state::mem(address_map &map) map(0x00000000, 0x0001ffff).ram().share(m_rambase); map(0x00200000, 0x00200003).w(FUNC(sshooter_state::bsmt2000_data_w)); - map(0x00300001, 0x00300001).w(FUNC(sshooter_state::palette_offset_w)); - map(0x00320001, 0x00320001).w(FUNC(sshooter_state::palette_data_w)); + map(0x00300001, 0x00300001).w(m_ramdac, FUNC(ramdac_device::index_w)); + map(0x00320001, 0x00320001).w(m_ramdac, FUNC(ramdac_device::pal_w)); map(0x00400000, 0x00400003).r(FUNC(sshooter_state::video_r)); map(0x00500000, 0x00500003).nopw(); // copies ROM here at startup, plus checksum map(0x00600002, 0x00600002).r(FUNC(sshooter_state::bsmt2000_data_r)); @@ -426,6 +431,9 @@ void policetr_state::policetr(machine_config &config) m_screen->screen_vblank().set(FUNC(policetr_state::vblank)); PALETTE(config, m_palette).set_entries(256); + + RAMDAC(config, m_ramdac, 0, m_palette); // BT481A Palette RAMDAC + m_ramdac->set_addrmap(0, &policetr_state::ramdac_map); /* sound hardware */ SPEAKER(config, m_lspeaker).front_left(); diff --git a/src/mame/includes/policetr.h b/src/mame/includes/policetr.h index f95b0af9f16..972761af697 100644 --- a/src/mame/includes/policetr.h +++ b/src/mame/includes/policetr.h @@ -9,6 +9,7 @@ #include "cpu/mips/mips1.h" #include "machine/eepromser.h" #include "sound/bsmt2000.h" +#include "video/ramdac.h" #include "emupal.h" #include "screen.h" #include "speaker.h" @@ -39,6 +40,7 @@ protected: m_eeprom(*this, "eeprom"), m_screen(*this, "screen"), m_palette(*this, "palette"), + m_ramdac(*this, "ramdac"), m_leds(*this, "leds%u", 0U), m_gun_x_io(*this, "GUNX%u", 1U), m_gun_y_io(*this, "GUNY%u", 1U), @@ -50,6 +52,8 @@ protected: void mem(address_map &map); + void ramdac_map(address_map& map); + DECLARE_WRITE32_MEMBER(control_w); DECLARE_WRITE32_MEMBER(speedup_w); @@ -59,8 +63,6 @@ protected: DECLARE_WRITE32_MEMBER(video_w); DECLARE_READ32_MEMBER(video_r); - DECLARE_WRITE8_MEMBER(palette_offset_w); - DECLARE_WRITE8_MEMBER(palette_data_w); DECLARE_WRITE_LINE_MEMBER(vblank); void render_display_list(offs_t offset); uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); @@ -75,6 +77,7 @@ protected: required_device<eeprom_serial_93cxx_device> m_eeprom; required_device<screen_device> m_screen; required_device<palette_device> m_palette; + required_device<ramdac_device> m_ramdac; enum { @@ -97,9 +100,6 @@ protected: uint32_t m_loop_count; offs_t m_speedup_pc; offs_t m_speedup_addr; - uint32_t m_palette_offset; - uint8_t m_palette_index; - uint8_t m_palette_data[3]; rectangle m_render_clip; std::unique_ptr<bitmap_ind8> m_dstbitmap; uint16_t m_src_xoffs; diff --git a/src/mame/video/policetr.cpp b/src/mame/video/policetr.cpp index bb59755ccd2..061308015e8 100644 --- a/src/mame/video/policetr.cpp +++ b/src/mame/video/policetr.cpp @@ -25,9 +25,6 @@ void policetr_state::video_start() /* the destination bitmap is not directly accessible to the CPU */ m_dstbitmap = std::make_unique<bitmap_ind8>(+DSTBITMAP_WIDTH, +DSTBITMAP_HEIGHT); - save_item(NAME(m_palette_offset)); - save_item(NAME(m_palette_index)); - save_item(NAME(m_palette_data)); save_item(NAME(m_src_xoffs)); save_item(NAME(m_src_yoffs)); save_item(NAME(m_dst_xoffs)); @@ -300,34 +297,6 @@ READ32_MEMBER(policetr_state::video_r) return 0; } - - - -/************************************* - * - * Palette access - * - *************************************/ - -WRITE8_MEMBER(policetr_state::palette_offset_w) -{ - m_palette_offset = data; - m_palette_index = 0; -} - - -WRITE8_MEMBER(policetr_state::palette_data_w) -{ - m_palette_data[m_palette_index] = data; - if (++m_palette_index == 3) - { - m_palette->set_pen_color(m_palette_offset, rgb_t(m_palette_data[0], m_palette_data[1], m_palette_data[2])); - m_palette_index = 0; - } -} - - - /************************************* * * Main refresh |