diff --git a/src/devices/video/hd63484.cpp b/src/devices/video/hd63484.cpp index 1ae83881fbc..e0b08389492 100644 --- a/src/devices/video/hd63484.cpp +++ b/src/devices/video/hd63484.cpp @@ -1914,92 +1914,104 @@ void hd63484_device::video_registers_w(int offset) } } -READ16_MEMBER( hd63484_device::status16_r ) +uint16_t hd63484_device::read16(offs_t offset) { - // kothello is coded so that upper byte of this should be 0xff (tests with jc opcode). Maybe it's just unconnected? - return m_sr | 0xff00; -} - -READ16_MEMBER( hd63484_device::data16_r ) -{ - uint16_t res; - - if(m_ar == 0) // FIFO read + if (BIT(offset, 0)) { - uint8_t data; + // Read control register + uint16_t res; - dequeue_r(&data); - res = (data & 0xff) << 8; - dequeue_r(&data); - res |= data & 0xff; + if(m_ar == 0) // FIFO read + { + uint8_t data; + + dequeue_r(&data); + res = (data & 0xff) << 8; + dequeue_r(&data); + res |= data & 0xff; + } + else + res = video_registers_r(m_ar); + + inc_ar(2); + + return res; } else - res = video_registers_r(m_ar); - - inc_ar(2); - - return res; + { + // Read status register + // kothello is coded so that upper byte of this should be 0xff (tests with jc opcode). Maybe it's just open bus? + return m_sr | 0xff00; + } } -WRITE16_MEMBER( hd63484_device::address16_w ) +void hd63484_device::write16(offs_t offset, uint16_t data) { - if(ACCESSING_BITS_0_7) - m_ar = data & 0xfe; -} - -WRITE16_MEMBER( hd63484_device::data16_w ) -{ - if(ACCESSING_BITS_8_15) + if (BIT(offset, 0)) + { + // Write control register m_vreg[m_ar] = (data & 0xff00) >> 8; - - if(ACCESSING_BITS_0_7) m_vreg[m_ar+1] = (data & 0xff); - video_registers_w(m_ar); + video_registers_w(m_ar); - inc_ar(2); -} - -READ8_MEMBER( hd63484_device::status8_r ) -{ - return m_sr; -} - -WRITE8_MEMBER( hd63484_device::address8_w ) -{ - m_ar = data; -} - -READ8_MEMBER( hd63484_device::data8_r ) -{ - uint8_t res = 0xff; - - if(m_ar < 2) // FIFO read - dequeue_r(&res); - else - res = video_registers_r(m_ar & 0xfe) >> (m_ar & 1 ? 0 : 8); - - inc_ar(1); - - return res; -} - -WRITE8_MEMBER( hd63484_device::data8_w ) -{ - m_vreg[m_ar] = data; - - if(m_ar < 2) // FIFO write - { - queue_w(data); - if (m_ar & 1) - process_fifo(); - - m_ar ^= 1; + inc_ar(2); } else - video_registers_w(m_ar & 0xfe); + { + // Write address register + m_ar = data & 0xfe; + } +} - inc_ar(1); +uint8_t hd63484_device::read8(offs_t offset) +{ + if (BIT(offset, 0)) + { + // Read control register + uint8_t res = 0xff; + + if(m_ar < 2) // FIFO read + dequeue_r(&res); + else + res = video_registers_r(m_ar & 0xfe) >> (m_ar & 1 ? 0 : 8); + + inc_ar(1); + + return res; + } + else + { + // Read status register + return m_sr; + } +} + +void hd63484_device::write8(offs_t offset, uint8_t data) +{ + if (BIT(offset, 0)) + { + // Write control register + m_vreg[m_ar] = data; + + if(m_ar < 2) // FIFO write + { + queue_w(data); + if (m_ar & 1) + process_fifo(); + + m_ar ^= 1; + } + else + video_registers_w(m_ar & 0xfe); + + inc_ar(1); + } + else + { + // Write address register + m_ar = data; + } } void hd63484_device::device_start() diff --git a/src/devices/video/hd63484.h b/src/devices/video/hd63484.h index 508579aed73..7b3d8fb1225 100644 --- a/src/devices/video/hd63484.h +++ b/src/devices/video/hd63484.h @@ -31,15 +31,13 @@ public: void set_auto_configure_screen(bool auto_configure_screen) { m_auto_configure_screen = auto_configure_screen; } void set_external_skew(int skew) { m_external_skew = skew; } - DECLARE_WRITE16_MEMBER( address16_w ); - DECLARE_WRITE16_MEMBER( data16_w ); - DECLARE_READ16_MEMBER( status16_r ); - DECLARE_READ16_MEMBER( data16_r ); + // 16-bit bus interface + void write16(offs_t offset, uint16_t data); + uint16_t read16(offs_t offset); - DECLARE_WRITE8_MEMBER( address8_w ); - DECLARE_WRITE8_MEMBER( data8_w ); - DECLARE_READ8_MEMBER( status8_r ); - DECLARE_READ8_MEMBER( data8_r ); + // 8-bit bus interface + void write8(offs_t offset, uint8_t data); + uint8_t read8(offs_t offset); uint32_t update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); virtual const tiny_rom_entry *device_rom_region() const override; diff --git a/src/mame/drivers/adp.cpp b/src/mame/drivers/adp.cpp index 5654901b585..8583d191fd5 100644 --- a/src/mame/drivers/adp.cpp +++ b/src/mame/drivers/adp.cpp @@ -299,8 +299,7 @@ WRITE16_MEMBER(adp_state::input_w) void adp_state::skattv_mem(address_map &map) { map(0x000000, 0x0fffff).rom(); - map(0x800080, 0x800081).rw(m_acrtc, FUNC(hd63484_device::status16_r), FUNC(hd63484_device::address16_w)); - map(0x800082, 0x800083).rw(m_acrtc, FUNC(hd63484_device::data16_r), FUNC(hd63484_device::data16_w)); + map(0x800080, 0x800083).rw(m_acrtc, FUNC(hd63484_device::read16), FUNC(hd63484_device::write16)); map(0x800100, 0x800101).rw(FUNC(adp_state::input_r), FUNC(adp_state::input_w)); map(0x800140, 0x800143).rw("aysnd", FUNC(ay8910_device::data_r), FUNC(ay8910_device::address_data_w)).umask16(0x00ff); //18b too map(0x800180, 0x80019f).rw(m_duart, FUNC(mc68681_device::read), FUNC(mc68681_device::write)).umask16(0x00ff); @@ -311,8 +310,7 @@ void adp_state::skattva_mem(address_map &map) { map(0x000000, 0x03ffff).rom(); map(0x400000, 0x40001f).rw("rtc", FUNC(msm6242_device::read), FUNC(msm6242_device::write)).umask16(0x00ff); - map(0x800080, 0x800081).rw(m_acrtc, FUNC(hd63484_device::status16_r), FUNC(hd63484_device::address16_w)); - map(0x800082, 0x800083).rw(m_acrtc, FUNC(hd63484_device::data16_r), FUNC(hd63484_device::data16_w)); + map(0x800080, 0x800083).rw(m_acrtc, FUNC(hd63484_device::read16), FUNC(hd63484_device::write16)); map(0x800100, 0x800101).portr("IN0"); map(0x800140, 0x800143).rw("aysnd", FUNC(ay8910_device::data_r), FUNC(ay8910_device::address_data_w)).umask16(0x00ff); //18b too map(0x800180, 0x80019f).rw(m_duart, FUNC(mc68681_device::read), FUNC(mc68681_device::write)).umask16(0x00ff); @@ -323,8 +321,7 @@ void adp_state::quickjac_mem(address_map &map) { map(0x000000, 0x01ffff).rom(); map(0x400000, 0x40001f).rw("rtc", FUNC(msm6242_device::read), FUNC(msm6242_device::write)).umask16(0x00ff); - map(0x800080, 0x800081).rw(m_acrtc, FUNC(hd63484_device::status16_r), FUNC(hd63484_device::address16_w)); // bad - map(0x800082, 0x800083).rw(m_acrtc, FUNC(hd63484_device::data16_r), FUNC(hd63484_device::data16_w)); // bad + map(0x800080, 0x800083).rw(m_acrtc, FUNC(hd63484_device::read16), FUNC(hd63484_device::write16)); // bad map(0x800100, 0x800101).portr("IN0"); map(0x800140, 0x800143).rw("aysnd", FUNC(ay8910_device::data_r), FUNC(ay8910_device::address_data_w)).umask16(0x00ff); //18b too map(0x800180, 0x80019f).rw(m_duart, FUNC(mc68681_device::read), FUNC(mc68681_device::write)).umask16(0x00ff); @@ -335,8 +332,7 @@ void adp_state::funland_mem(address_map &map) { map(0x000000, 0x0fffff).rom(); map(0x400000, 0x40001f).rw("rtc", FUNC(msm6242_device::read), FUNC(msm6242_device::write)).umask16(0x00ff); - map(0x800080, 0x800081).rw(m_acrtc, FUNC(hd63484_device::status16_r), FUNC(hd63484_device::address16_w)); - map(0x800082, 0x800083).rw(m_acrtc, FUNC(hd63484_device::data16_r), FUNC(hd63484_device::data16_w)); + map(0x800080, 0x800083).rw(m_acrtc, FUNC(hd63484_device::read16), FUNC(hd63484_device::write16)); map(0x800089, 0x800089).w("ramdac", FUNC(ramdac_device::index_w)); map(0x80008b, 0x80008b).w("ramdac", FUNC(ramdac_device::pal_w)); map(0x80008d, 0x80008d).w("ramdac", FUNC(ramdac_device::mask_w)); @@ -349,8 +345,7 @@ void adp_state::funland_mem(address_map &map) void adp_state::fstation_mem(address_map &map) { map(0x000000, 0x0fffff).rom(); - map(0x800080, 0x800081).rw(m_acrtc, FUNC(hd63484_device::status16_r), FUNC(hd63484_device::address16_w)); - map(0x800082, 0x800083).rw(m_acrtc, FUNC(hd63484_device::data16_r), FUNC(hd63484_device::data16_w)); + map(0x800080, 0x800083).rw(m_acrtc, FUNC(hd63484_device::read16), FUNC(hd63484_device::write16)); map(0x800100, 0x800101).rw(FUNC(adp_state::input_r), FUNC(adp_state::input_w)); map(0x800140, 0x800143).rw("aysnd", FUNC(ay8910_device::data_r), FUNC(ay8910_device::address_data_w)).umask16(0x00ff); //18b too map(0x800180, 0x80019f).rw(m_duart, FUNC(mc68681_device::read), FUNC(mc68681_device::write)).umask16(0x00ff); diff --git a/src/mame/drivers/segajw.cpp b/src/mame/drivers/segajw.cpp index 6eba9fb6db0..50b81dbb3eb 100644 --- a/src/mame/drivers/segajw.cpp +++ b/src/mame/drivers/segajw.cpp @@ -177,8 +177,7 @@ void segajw_state::segajw_map(address_map &map) { map(0x000000, 0x03ffff).rom(); - map(0x080000, 0x080001).rw("hd63484", FUNC(hd63484_device::status16_r), FUNC(hd63484_device::address16_w)); - map(0x080002, 0x080003).rw("hd63484", FUNC(hd63484_device::data16_r), FUNC(hd63484_device::data16_w)); + map(0x080000, 0x080003).rw("hd63484", FUNC(hd63484_device::read16), FUNC(hd63484_device::write16)); map(0x180000, 0x180001).portr("DSW0"); map(0x180005, 0x180005).r("soundlatch2", FUNC(generic_latch_8_device::read)).w(m_soundlatch, FUNC(generic_latch_8_device::write)).umask16(0x00ff); diff --git a/src/mame/drivers/shanghai.cpp b/src/mame/drivers/shanghai.cpp index a1203ce93f4..856ccc04be8 100644 --- a/src/mame/drivers/shanghai.cpp +++ b/src/mame/drivers/shanghai.cpp @@ -120,8 +120,7 @@ void shanghai_state::shangha2_map(address_map &map) void shanghai_state::shanghai_portmap(address_map &map) { - map(0x00, 0x01).rw("hd63484", FUNC(hd63484_device::status16_r), FUNC(hd63484_device::address16_w)); - map(0x02, 0x03).rw("hd63484", FUNC(hd63484_device::data16_r), FUNC(hd63484_device::data16_w)); + map(0x00, 0x03).rw("hd63484", FUNC(hd63484_device::read16), FUNC(hd63484_device::write16)); map(0x20, 0x23).rw("ymsnd", FUNC(ym2203_device::read), FUNC(ym2203_device::write)).umask16(0x00ff); map(0x40, 0x41).portr("P1"); map(0x44, 0x45).portr("P2"); @@ -135,8 +134,7 @@ void shanghai_state::shangha2_portmap(address_map &map) map(0x00, 0x01).portr("P1"); map(0x10, 0x11).portr("P2"); map(0x20, 0x21).portr("SYSTEM"); - map(0x30, 0x31).rw("hd63484", FUNC(hd63484_device::status16_r), FUNC(hd63484_device::address16_w)); - map(0x32, 0x33).rw("hd63484", FUNC(hd63484_device::data16_r), FUNC(hd63484_device::data16_w)); + map(0x30, 0x33).rw("hd63484", FUNC(hd63484_device::read16), FUNC(hd63484_device::write16)); map(0x40, 0x43).rw("ymsnd", FUNC(ym2203_device::read), FUNC(ym2203_device::write)).umask16(0x00ff); map(0x50, 0x50).w(FUNC(shanghai_state::shanghai_coin_w)); } @@ -144,8 +142,7 @@ void shanghai_state::shangha2_portmap(address_map &map) void shanghai_state::kothello_map(address_map &map) { map(0x00000, 0x07fff).ram(); - map(0x08010, 0x08011).rw("hd63484", FUNC(hd63484_device::status16_r), FUNC(hd63484_device::address16_w)); - map(0x08012, 0x08013).rw("hd63484", FUNC(hd63484_device::data16_r), FUNC(hd63484_device::data16_w)); + map(0x08010, 0x08013).rw("hd63484", FUNC(hd63484_device::read16), FUNC(hd63484_device::write16)); map(0x09010, 0x09011).portr("P1"); map(0x09012, 0x09013).portr("P2"); map(0x09014, 0x09015).portr("SYSTEM"); diff --git a/src/mame/drivers/sigmab52.cpp b/src/mame/drivers/sigmab52.cpp index 659662240c5..14a8c07149a 100644 --- a/src/mame/drivers/sigmab52.cpp +++ b/src/mame/drivers/sigmab52.cpp @@ -318,8 +318,7 @@ void sigmab52_state::jwildb52_map(address_map &map) map(0xf720, 0xf727).rw("6840ptm_1", FUNC(ptm6840_device::read), FUNC(ptm6840_device::write)); - map(0xf730, 0xf730).rw("hd63484", FUNC(hd63484_device::status8_r), FUNC(hd63484_device::address8_w)); - map(0xf731, 0xf731).rw("hd63484", FUNC(hd63484_device::data8_r), FUNC(hd63484_device::data8_w)); + map(0xf730, 0xf731).rw("hd63484", FUNC(hd63484_device::read8), FUNC(hd63484_device::write8)); map(0xf740, 0xf740).r(FUNC(sigmab52_state::in0_r)); map(0xf741, 0xf741).portr("IN1"); diff --git a/src/mame/drivers/taito_b.cpp b/src/mame/drivers/taito_b.cpp index 36954a57171..d840b50a8b6 100644 --- a/src/mame/drivers/taito_b.cpp +++ b/src/mame/drivers/taito_b.cpp @@ -559,8 +559,7 @@ void taitob_c_state::realpunc_map(address_map &map) map(0x18c000, 0x18c001).w(FUNC(taitob_c_state::realpunc_output_w)); map(0x200000, 0x27ffff).m(m_tc0180vcu, FUNC(tc0180vcu_device::tc0180vcu_memrw)); map(0x280000, 0x281fff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); - map(0x300000, 0x300001).rw("hd63484", FUNC(hd63484_device::status16_r), FUNC(hd63484_device::address16_w)); - map(0x300002, 0x300003).rw("hd63484", FUNC(hd63484_device::data16_r), FUNC(hd63484_device::data16_w)); + map(0x300000, 0x300003).rw("hd63484", FUNC(hd63484_device::read16), FUNC(hd63484_device::write16)); // map(0x320000, 0x320001).nop(); // ? map(0x320002, 0x320003).nopr(); map(0x320002, 0x320002).w("tc0140syt", FUNC(tc0140syt_device::master_comm_w)); diff --git a/src/mame/drivers/wildpkr.cpp b/src/mame/drivers/wildpkr.cpp index 020face7887..a5f75a822f6 100644 --- a/src/mame/drivers/wildpkr.cpp +++ b/src/mame/drivers/wildpkr.cpp @@ -317,8 +317,7 @@ void wildpkr_state::wildpkr_map(address_map &map) { map(0x000000, 0x0fffff).rom(); map(0x100000, 0x113fff).ram(); - map(0x800000, 0x800001).rw("acrtc", FUNC(hd63484_device::status16_r), FUNC(hd63484_device::address16_w)); - map(0x800002, 0x800003).rw("acrtc", FUNC(hd63484_device::data16_r), FUNC(hd63484_device::data16_w)); + map(0x800000, 0x800003).rw("acrtc", FUNC(hd63484_device::read16), FUNC(hd63484_device::write16)); map(0x800080, 0x80009f).rw(m_duart, FUNC(mc68681_device::read), FUNC(mc68681_device::write)).umask16(0x00ff); map(0x800180, 0x800180).r(FUNC(wildpkr_state::unknown_read8)); map(0x800181, 0x800181).w(FUNC(wildpkr_state::unknown_write8)); @@ -336,8 +335,7 @@ void wildpkr_state::tabpkr_map(address_map &map) map(0x000000, 0x2fffff).rom(); map(0x300000, 0x303fff).ram(); map(0x400000, 0x400fff).ram().w(FUNC(wildpkr_state::nvram_w)).share("nvram"); - map(0x500000, 0x500001).rw("acrtc", FUNC(hd63484_device::status16_r), FUNC(hd63484_device::address16_w)); - map(0x500002, 0x500003).rw("acrtc", FUNC(hd63484_device::data16_r), FUNC(hd63484_device::data16_w)); + map(0x500000, 0x500003).rw("acrtc", FUNC(hd63484_device::read16), FUNC(hd63484_device::write16)); map(0x500021, 0x500021).rw("ramdac", FUNC(ramdac_device::index_r), FUNC(ramdac_device::index_w)); map(0x500023, 0x500023).rw("ramdac", FUNC(ramdac_device::pal_r), FUNC(ramdac_device::pal_w)); map(0x500025, 0x500025).rw("ramdac", FUNC(ramdac_device::mask_r), FUNC(ramdac_device::mask_w));