From fe3be00840ff69d67b9f930a00a2930c1fce32d8 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Tue, 30 Oct 2018 00:26:43 +1100 Subject: [PATCH] inconsistency, deprecation, duplication... (nw) --- src/devices/bus/hp_dio/hp98265a.cpp | 15 +-- src/devices/bus/hp_dio/hp98265a.h | 4 +- src/devices/bus/hp_dio/hp98620.cpp | 10 +- src/devices/bus/hp_dio/hp98620.h | 7 +- src/devices/bus/hp_dio/hp_dio.cpp | 8 +- src/devices/bus/hp_dio/hp_dio.h | 6 +- src/devices/bus/hp_dio/human_interface.h | 5 +- src/devices/bus/hp_hil/hil_devices.cpp | 1 + src/devices/bus/hp_hil/hlebase.cpp | 1 - src/devices/bus/hp_hil/hlekbd.cpp | 21 ++-- src/devices/bus/hp_hil/hlekbd.h | 41 +------- src/devices/bus/hp_hil/hlemouse.cpp | 3 +- src/devices/cpu/hphybrid/hphybrid.cpp | 126 +++++++++++------------ src/devices/cpu/hphybrid/hphybrid_dasm.h | 22 ++-- src/devices/cpu/hphybrid/hphybrid_defs.h | 8 +- src/mame/drivers/gal3.cpp | 4 +- src/mame/drivers/hp9825.cpp | 7 +- src/mame/drivers/namcofl.cpp | 2 +- src/mame/drivers/namconb1.cpp | 2 +- src/mame/drivers/namcos2.cpp | 6 +- src/mame/drivers/namcos21_c67.cpp | 2 +- src/mame/drivers/namcos21_de.cpp | 2 +- src/mame/drivers/namcos23.cpp | 2 +- src/mame/video/namco_c355spr.cpp | 39 ++++--- src/mame/video/namco_c355spr.h | 14 +-- 25 files changed, 157 insertions(+), 201 deletions(-) diff --git a/src/devices/bus/hp_dio/hp98265a.cpp b/src/devices/bus/hp_dio/hp98265a.cpp index b944661a851..15a50f84549 100644 --- a/src/devices/bus/hp_dio/hp98265a.cpp +++ b/src/devices/bus/hp_dio/hp98265a.cpp @@ -7,15 +7,17 @@ ***************************************************************************/ #include "emu.h" - -#define VERBOSE 0 -#include "logmacro.h" #include "hp98265a.h" + #include "machine/nscsi_bus.h" #include "machine/nscsi_cd.h" #include "machine/nscsi_hd.h" #include "machine/mb87030.h" +#define VERBOSE 0 +#include "logmacro.h" + + DEFINE_DEVICE_TYPE_NS(HPDIO_98265A, bus::hp_dio, dio16_98265a_device, "hp98265a", "HP98265A SCSI S16 Interface") namespace bus { namespace hp_dio { @@ -165,8 +167,7 @@ void dio16_98265a_device::device_reset() uint8_t code = m_sw1->read() >> REG_SW1_SELECT_CODE_SHIFT; code &= REG_SW1_SELECT_CODE_MASK; - if (!m_installed_io) - { + if (!m_installed_io) { program_space()->install_readwrite_handler( 0x600000 + (code * 0x10000), 0x6007ff + (code * 0x10000), @@ -192,7 +193,7 @@ READ16_MEMBER(dio16_98265a_device::io_r) uint16_t ret = 0xffff; - switch(offset) { + switch (offset) { case 0: /* ID */ ret = 0x07; break; @@ -214,7 +215,7 @@ WRITE16_MEMBER(dio16_98265a_device::io_w) { LOG("io_w: offset=%02X, data=%02X\n", offset, data); - switch(offset) { + switch (offset) { case 0: device_reset(); break; diff --git a/src/devices/bus/hp_dio/hp98265a.h b/src/devices/bus/hp_dio/hp98265a.h index 46941790f65..995430b1f1b 100644 --- a/src/devices/bus/hp_dio/hp98265a.h +++ b/src/devices/bus/hp_dio/hp98265a.h @@ -64,8 +64,8 @@ private: bool m_irq_state; bool m_dmar0; }; -} -} + +} } // namespace bus::hp_dio DECLARE_DEVICE_TYPE_NS(HPDIO_98265A, bus::hp_dio, dio16_98265a_device) diff --git a/src/devices/bus/hp_dio/hp98620.cpp b/src/devices/bus/hp_dio/hp98620.cpp index b27857a2fd3..2fdc8e0f932 100644 --- a/src/devices/bus/hp_dio/hp98620.cpp +++ b/src/devices/bus/hp_dio/hp98620.cpp @@ -7,10 +7,10 @@ ***************************************************************************/ #include "emu.h" +#include "hp98620.h" #define VERBOSE 0 #include "logmacro.h" -#include "hp98620.h" DEFINE_DEVICE_TYPE_NS(HPDIO_98620, bus::hp_dio, dio16_98620_device, "hp98620", "HP98620 DMA Controller") @@ -30,14 +30,6 @@ dio16_98620_device::dio16_98620_device(const machine_config &mconfig, device_typ { } -static INPUT_PORTS_START(hp98620_port) -INPUT_PORTS_END - -ioport_constructor dio16_98620_device::device_input_ports() const -{ - return INPUT_PORTS_NAME(hp98620_port); -} - void dio16_98620_device::device_start() { m_installed_io = false; diff --git a/src/devices/bus/hp_dio/hp98620.h b/src/devices/bus/hp_dio/hp98620.h index d4ae0192c27..e9fd2b8122b 100644 --- a/src/devices/bus/hp_dio/hp98620.h +++ b/src/devices/bus/hp_dio/hp98620.h @@ -23,13 +23,10 @@ public: protected: dio16_98620_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); - // device-level overrides virtual void device_start() override; virtual void device_reset() override; - virtual ioport_constructor device_input_ports() const override; - DECLARE_READ16_MEMBER(dma_r); DECLARE_WRITE16_MEMBER(dma_w); @@ -127,8 +124,8 @@ private: bool dmar[2]; }; -} -} + +} } // namespace bus::hp_dio DECLARE_DEVICE_TYPE_NS(HPDIO_98620, bus::hp_dio, dio16_98620_device) diff --git a/src/devices/bus/hp_dio/hp_dio.cpp b/src/devices/bus/hp_dio/hp_dio.cpp index 035f3ea2b5c..899b7be0c00 100644 --- a/src/devices/bus/hp_dio/hp_dio.cpp +++ b/src/devices/bus/hp_dio/hp_dio.cpp @@ -206,7 +206,7 @@ void dio16_device::set_dmar(unsigned int index, unsigned int num, int state) m_dmar[num] &= ~(1 << index); - for (auto & card:m_cards) { + for (auto &card : m_cards) { if (card->get_index() == index) continue; @@ -224,7 +224,7 @@ void dio16_device::set_dmar(unsigned int index, unsigned int num, int state) void dio16_device::dmack_w_out(int index, int channel, uint8_t val) { - for (auto & card:m_cards) { + for (auto &card : m_cards) { if (card->get_index() == index) continue; card->dmack_w_in(channel, val); @@ -235,7 +235,7 @@ uint8_t dio16_device::dmack_r_out(int index, int channel) { uint8_t ret = 0xff; - for (auto & card:m_cards) { + for (auto &card : m_cards) { if (card->get_index() == index) continue; ret &= card->dmack_r_in(channel); @@ -245,7 +245,7 @@ uint8_t dio16_device::dmack_r_out(int index, int channel) WRITE_LINE_MEMBER(dio16_device::reset_in) { - for (auto & card:m_cards) { + for (auto &card : m_cards) { if (card->get_index() != m_bus_index) card->reset_in(state); } diff --git a/src/devices/bus/hp_dio/hp_dio.h b/src/devices/bus/hp_dio/hp_dio.h index e7f09969ca8..ddf95e9570c 100644 --- a/src/devices/bus/hp_dio/hp_dio.h +++ b/src/devices/bus/hp_dio/hp_dio.h @@ -65,7 +65,7 @@ public: // construction/destruction dio16_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // inline configuration - template void set_cputag(T &&tag) { m_maincpu.set_tag(std::forward(tag)); } + template void set_cputag(T &&tag) { m_maincpu.set_tag(std::forward(tag)); } // callback configuration auto dmar0_out_cb() { return m_dmar0_out_cb.bind(); } @@ -82,7 +82,7 @@ public: // DANGER: these will currently produce different results for a DIO-I card on DIO-I and DIO-II systems // due to the varying bus widths. Using all install_memory() shields you from this problem. - // either know what you're doing (m_prgwidth is available to cards for this purpose) or + // Either know what you're doing (m_prgwidth is available to cards for this purpose) or // only use these for 32-bit DIO-II cards. void install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data); void install_rom(offs_t start, offs_t end, const char *tag, uint8_t *data); @@ -138,7 +138,7 @@ protected: // internal state required_device m_maincpu; - std::list m_cards; + std::list m_cards; // address spaces address_space *m_prgspace; diff --git a/src/devices/bus/hp_dio/human_interface.h b/src/devices/bus/hp_dio/human_interface.h index e50e3c01eff..985b47a763e 100644 --- a/src/devices/bus/hp_dio/human_interface.h +++ b/src/devices/bus/hp_dio/human_interface.h @@ -91,8 +91,9 @@ private: uint8_t m_ppoll_sc; uint8_t m_ppoll_mask; }; -} -} + +} } // namespace bus::hp_dio + // device type definition DECLARE_DEVICE_TYPE_NS(HPDIO_HUMAN_INTERFACE, bus::hp_dio, human_interface_device) diff --git a/src/devices/bus/hp_hil/hil_devices.cpp b/src/devices/bus/hp_hil/hil_devices.cpp index b7b6ae85513..b64f987a459 100644 --- a/src/devices/bus/hp_hil/hil_devices.cpp +++ b/src/devices/bus/hp_hil/hil_devices.cpp @@ -5,6 +5,7 @@ #include "hil_devices.h" #include "hlekbd.h" +#include "hlemouse.h" void hp_hil_devices(device_slot_interface &device) { diff --git a/src/devices/bus/hp_hil/hlebase.cpp b/src/devices/bus/hp_hil/hlebase.cpp index 836ef11cae8..c7b121dcb44 100644 --- a/src/devices/bus/hp_hil/hlebase.cpp +++ b/src/devices/bus/hp_hil/hlebase.cpp @@ -2,7 +2,6 @@ // copyright-holders:Sergey Svishchev #include "emu.h" #include "hlebase.h" -#include "hlekbd.h" //#define VERBOSE 1 #include "logmacro.h" diff --git a/src/devices/bus/hp_hil/hlekbd.cpp b/src/devices/bus/hp_hil/hlekbd.cpp index cb4a0dbb529..a12ea773f67 100644 --- a/src/devices/bus/hp_hil/hlekbd.cpp +++ b/src/devices/bus/hp_hil/hlekbd.cpp @@ -14,8 +14,7 @@ DEFINE_DEVICE_TYPE_NS(HP_IPC_HLE_KEYBOARD, bus::hp_hil, hle_hp_ipc_device, "hp_ipc_hle_kbd", "HP Integral Keyboard (HLE)") DEFINE_DEVICE_TYPE_NS(HP_ITF_HLE_KEYBOARD, bus::hp_hil, hle_hp_itf_device, "hp_itf_hle_kbd", "HP ITF Keyboard") -namespace bus { - namespace hp_hil { +namespace bus { namespace hp_hil { namespace { @@ -219,6 +218,7 @@ INPUT_PORTS_START( hle_hp_ipc_device ) PORT_INCLUDE( ipc_id ) INPUT_PORTS_END + INPUT_PORTS_START( itf_id ) PORT_START("COL0") PORT_DIPNAME( 0xff, 0xdf, "Layout" ) @@ -417,16 +417,14 @@ INPUT_PORTS_END void hle_hp_ipc_device::transmit_byte(uint8_t byte) { - if (!m_fifo.full()) { + if (!m_fifo.full()) m_fifo.enqueue(byte); - } } void hle_hp_itf_device::transmit_byte(uint8_t byte) { - if (!m_fifo.full()) { + if (!m_fifo.full()) m_fifo.enqueue(byte); - } } /*************************************************************************** @@ -454,7 +452,6 @@ void hle_hp_ipc_device::hil_idd() { m_hp_hil_mlc->hil_write(0x0100 | ioport("COL0")->read()); m_hp_hil_mlc->hil_write(m_device_id16 | 0); - return; } void hle_hp_ipc_device::key_make(uint8_t row, uint8_t column) @@ -475,7 +472,8 @@ int hle_hp_ipc_device::hil_poll() return frames; m_hp_hil_mlc->hil_write(m_device_id16 | 0x40); // Keycode Set 1, no coordinate data - while (!m_fifo.empty()) { + while (!m_fifo.empty()) + { m_hp_hil_mlc->hil_write(m_device_id16 | m_fifo.dequeue()); frames++; } @@ -490,7 +488,8 @@ int hle_hp_itf_device::hil_poll() LOG("KBD HAVE DATA\n"); frames++; m_hp_hil_mlc->hil_write(m_device_id16 | 0x40); // Keycode Set 1, no coordinate data - while (!m_fifo.empty()) { + while (!m_fifo.empty()) + { m_hp_hil_mlc->hil_write(m_device_id16 | m_fifo.dequeue()); frames++; } @@ -556,8 +555,6 @@ void hle_hp_itf_device::hil_idd() { m_hp_hil_mlc->hil_write(m_device_id16 | ioport("COL0")->read()); m_hp_hil_mlc->hil_write(m_device_id16 | 0x04); - return; } -} // namespace bus::hp_hil -} // namespace bus +} } // namespace bus::hp_hil diff --git a/src/devices/bus/hp_hil/hlekbd.h b/src/devices/bus/hp_hil/hlekbd.h index 714b0ba6d2b..25df57da3b3 100644 --- a/src/devices/bus/hp_hil/hlekbd.h +++ b/src/devices/bus/hp_hil/hlekbd.h @@ -10,8 +10,7 @@ #include "machine/keyboard.h" -namespace bus { - namespace hp_hil { +namespace bus { namespace hp_hil { class hle_hp_ipc_device : public hle_device_base @@ -52,46 +51,10 @@ private: void transmit_byte(uint8_t byte); }; - -class hle_hp_46060b_device - : public hle_device_base -{ -public: - hle_hp_46060b_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock); - virtual void device_reset() override; - virtual ioport_constructor device_input_ports() const override; - virtual int hil_poll() override; - virtual void hil_idd() override; - enum state_mask - { - MOUSE_YPOS = 0x000000ff, - MOUSE_XPOS = 0x0000ff00, - MOUSE_LBUTTON = 0x00010000, - MOUSE_MBUTTON = 0x00020000, - MOUSE_RBUTTON = 0x00040000, - - MOUSE_BUTTONS = 0x00070000 - }; - - DECLARE_INPUT_CHANGED_MEMBER(mouse_button); - DECLARE_INPUT_CHANGED_MEMBER(mouse_x); - DECLARE_INPUT_CHANGED_MEMBER(mouse_y); - - int8_t mouse_x_delta; - int8_t mouse_y_delta; - uint32_t mouse_buttons; - util::fifo m_fifo; - -}; - - - -} // namespace bus::hp_hil -} // namespace bus +} } // namespace bus::hp_hil DECLARE_DEVICE_TYPE_NS(HP_IPC_HLE_KEYBOARD, bus::hp_hil, hle_hp_ipc_device); DECLARE_DEVICE_TYPE_NS(HP_ITF_HLE_KEYBOARD, bus::hp_hil, hle_hp_itf_device); -DECLARE_DEVICE_TYPE_NS(HP_46060B_MOUSE, bus::hp_hil, hle_hp_46060b_device); #endif // MAME_DEVICES_HP_HIL_HLEKBD_H diff --git a/src/devices/bus/hp_hil/hlemouse.cpp b/src/devices/bus/hp_hil/hlemouse.cpp index d61f9143eff..881fce28d5c 100644 --- a/src/devices/bus/hp_hil/hlemouse.cpp +++ b/src/devices/bus/hp_hil/hlemouse.cpp @@ -1,9 +1,8 @@ // license:BSD-3-Clause // copyright-holders:Sven Schnelle #include "emu.h" -#include "hlekbd.h" +#include "hlemouse.h" -#include "machine/keyboard.ipp" //#define VERBOSE 1 #include "logmacro.h" diff --git a/src/devices/cpu/hphybrid/hphybrid.cpp b/src/devices/cpu/hphybrid/hphybrid.cpp index 75706bb1e7b..246804ec468 100644 --- a/src/devices/cpu/hphybrid/hphybrid.cpp +++ b/src/devices/cpu/hphybrid/hphybrid.cpp @@ -138,36 +138,36 @@ DEFINE_DEVICE_TYPE(HP_09825_67907, hp_09825_67907_cpu_device, "09825_67907", "He WRITE_LINE_MEMBER(hp_hybrid_cpu_device::dmar_w) { if (state) - BIT_SET(m_flags , HPHYBRID_DMAR_BIT); + BIT_SET(m_flags, HPHYBRID_DMAR_BIT); else - BIT_CLR(m_flags , HPHYBRID_DMAR_BIT); + BIT_CLR(m_flags, HPHYBRID_DMAR_BIT); } WRITE_LINE_MEMBER(hp_hybrid_cpu_device::halt_w) { if (state) - BIT_SET(m_flags , HPHYBRID_HALT_BIT); + BIT_SET(m_flags, HPHYBRID_HALT_BIT); else - BIT_CLR(m_flags , HPHYBRID_HALT_BIT); + BIT_CLR(m_flags, HPHYBRID_HALT_BIT); } WRITE_LINE_MEMBER(hp_hybrid_cpu_device::status_w) { if (state) - BIT_SET(m_flags , HPHYBRID_STS_BIT); + BIT_SET(m_flags, HPHYBRID_STS_BIT); else - BIT_CLR(m_flags , HPHYBRID_STS_BIT); + BIT_CLR(m_flags, HPHYBRID_STS_BIT); } WRITE_LINE_MEMBER(hp_hybrid_cpu_device::flag_w) { if (state) - BIT_SET(m_flags , HPHYBRID_FLG_BIT); + BIT_SET(m_flags, HPHYBRID_FLG_BIT); else - BIT_CLR(m_flags , HPHYBRID_FLG_BIT); + BIT_CLR(m_flags, HPHYBRID_FLG_BIT); } -uint8_t hp_hybrid_cpu_device::pa_r(void) const +uint8_t hp_hybrid_cpu_device::pa_r() const { return CURRENT_PA; } @@ -197,23 +197,23 @@ device_memory_interface::space_config_vector hp_hybrid_cpu_device::memory_space_ void hp_hybrid_cpu_device::device_start() { { - state_add(HPHYBRID_A, "A", m_reg_A); - state_add(HPHYBRID_B, "B", m_reg_B); - state_add(HPHYBRID_C, "C", m_reg_C); - state_add(HPHYBRID_D, "D", m_reg_D); - state_add(HPHYBRID_P, "P", m_reg_P); - state_add(STATE_GENPC, "GENPC", m_genpc).noshow(); - state_add(STATE_GENPCBASE, "CURPC", m_genpc).noshow(); - state_add(HPHYBRID_R, "R", m_reg_R); - state_add(STATE_GENSP, "GENSP", m_reg_R).noshow(); - state_add(HPHYBRID_IV, "IV", m_reg_IV); - state_add(HPHYBRID_PA, "PA", m_reg_PA[ 0 ]); - state_add(HPHYBRID_W, "W", m_reg_W).noshow(); - state_add(STATE_GENFLAGS, "GENFLAGS", m_flags).noshow().formatstr("%12s"); - state_add(HPHYBRID_DMAPA , "DMAPA" , m_dmapa).noshow(); - state_add(HPHYBRID_DMAMA , "DMAMA" , m_dmama).noshow(); - state_add(HPHYBRID_DMAC , "DMAC" , m_dmac).noshow(); - state_add(HPHYBRID_I , "I" , m_reg_I).noshow(); + state_add(HPHYBRID_A, "A", m_reg_A); + state_add(HPHYBRID_B, "B", m_reg_B); + state_add(HPHYBRID_C, "C", m_reg_C); + state_add(HPHYBRID_D, "D", m_reg_D); + state_add(HPHYBRID_P, "P", m_reg_P); + state_add(STATE_GENPC, "GENPC", m_genpc).noshow(); + state_add(STATE_GENPCBASE, "CURPC", m_genpc).noshow(); + state_add(HPHYBRID_R, "R", m_reg_R); + state_add(STATE_GENSP, "GENSP", m_reg_R).noshow(); + state_add(HPHYBRID_IV, "IV", m_reg_IV); + state_add(HPHYBRID_PA, "PA", m_reg_PA[ 0 ]); + state_add(HPHYBRID_W, "W", m_reg_W).noshow(); + state_add(STATE_GENFLAGS, "GENFLAGS", m_flags).noshow().formatstr("%12s"); + state_add(HPHYBRID_DMAPA, "DMAPA", m_dmapa).noshow(); + state_add(HPHYBRID_DMAMA, "DMAMA", m_dmama).noshow(); + state_add(HPHYBRID_DMAC, "DMAC", m_dmac).noshow(); + state_add(HPHYBRID_I, "I", m_reg_I).noshow(); } m_program = &space(AS_PROGRAM); @@ -935,7 +935,7 @@ uint32_t hp_hybrid_cpu_device::add_mae(aec_cases_t aec_case , uint16_t addr) uint16_t hp_hybrid_cpu_device::remove_mae(uint32_t addr) { - return (uint16_t)(addr & 0xffff); + return uint16_t(addr & 0xffff); } uint16_t hp_hybrid_cpu_device::RM(aec_cases_t aec_case , uint16_t addr) @@ -1165,7 +1165,7 @@ bool hp_hybrid_cpu_device::write_emc_reg(uint16_t addr , uint16_t v) } } -uint16_t hp_hybrid_cpu_device::fetch(void) +uint16_t hp_hybrid_cpu_device::fetch() { m_genpc = add_mae(AEC_CASE_A , m_reg_P); return RM(m_genpc); @@ -1229,7 +1229,7 @@ void hp_hybrid_cpu_device::do_add(uint16_t& addend1 , uint16_t addend2) BIT_SET(m_flags , HPHYBRID_O_BIT); } - addend1 = (uint16_t)tmp; + addend1 = uint16_t(tmp); } uint16_t hp_hybrid_cpu_device::get_skip_addr(uint16_t opcode , bool condition) const @@ -1271,7 +1271,7 @@ void hp_hybrid_cpu_device::update_pa() } } -void hp_hybrid_cpu_device::check_for_interrupts(void) +void hp_hybrid_cpu_device::check_for_interrupts() { if (!BIT(m_flags , HPHYBRID_INTEN_BIT) || BIT(m_flags , HPHYBRID_IRH_SVC_BIT) || BIT(m_flags , HPHYBRID_IM_BIT)) { return; @@ -1295,7 +1295,7 @@ void hp_hybrid_cpu_device::check_for_interrupts(void) } // Get interrupt vector in low byte - uint8_t vector = (uint8_t)standard_irq_callback(irqline); + uint8_t vector = uint8_t(standard_irq_callback(irqline)); uint8_t new_PA; // Get highest numbered 1 @@ -1335,7 +1335,7 @@ void hp_hybrid_cpu_device::check_for_interrupts(void) m_reg_I = fetch(); } -void hp_hybrid_cpu_device::enter_isr(void) +void hp_hybrid_cpu_device::enter_isr() { // Do nothing special } @@ -1354,34 +1354,34 @@ void hp_hybrid_cpu_device::WIO(uint8_t pa , uint8_t ic , uint16_t v) uint8_t hp_hybrid_cpu_device::do_dec_shift_r(uint8_t d1 , uint64_t& mantissa) { - uint8_t d12 = (uint8_t)(mantissa & 0xf); + uint8_t d12 = uint8_t(mantissa & 0xf); - mantissa = (mantissa >> 4) | ((uint64_t)d1 << 44); + mantissa = (mantissa >> 4) | (uint64_t(d1) << 44); return d12; } uint8_t hp_hybrid_cpu_device::do_dec_shift_l(uint8_t d12 , uint64_t& mantissa) { - uint8_t d1 = (uint8_t)((mantissa >> 44) & 0xf); + uint8_t d1 = uint8_t((mantissa >> 44) & 0xf); - mantissa = (mantissa << 4) | ((uint64_t)d12); + mantissa = (mantissa << 4) | uint64_t(d12); mantissa &= 0xffffffffffffULL; return d1; } -uint64_t hp_hybrid_cpu_device::get_ar1(void) +uint64_t hp_hybrid_cpu_device::get_ar1() { uint32_t addr; uint64_t tmp; addr = add_mae(AEC_CASE_B , HP_REG_AR1_ADDR + 1); - tmp = (uint64_t)RM(addr++); + tmp = uint64_t(RM(addr++)); tmp <<= 16; - tmp |= (uint64_t)RM(addr++); + tmp |= uint64_t(RM(addr++)); tmp <<= 16; - tmp |= (uint64_t)RM(addr); + tmp |= uint64_t(RM(addr)); return tmp; } @@ -1391,33 +1391,33 @@ void hp_hybrid_cpu_device::set_ar1(uint64_t v) uint32_t addr; addr = add_mae(AEC_CASE_B , HP_REG_AR1_ADDR + 3); - WM(addr-- , (uint16_t)(v & 0xffff)); + WM(addr-- , uint16_t(v & 0xffff)); v >>= 16; - WM(addr-- , (uint16_t)(v & 0xffff)); + WM(addr-- , uint16_t(v & 0xffff)); v >>= 16; - WM(addr , (uint16_t)(v & 0xffff)); + WM(addr , uint16_t(v & 0xffff)); } -uint64_t hp_hybrid_cpu_device::get_ar2(void) const +uint64_t hp_hybrid_cpu_device::get_ar2() const { uint64_t tmp; - tmp = (uint64_t)m_reg_ar2[ 1 ]; + tmp = uint64_t(m_reg_ar2[ 1 ]); tmp <<= 16; - tmp |= (uint64_t)m_reg_ar2[ 2 ]; + tmp |= uint64_t(m_reg_ar2[ 2 ]); tmp <<= 16; - tmp |= (uint64_t)m_reg_ar2[ 3 ]; + tmp |= uint64_t(m_reg_ar2[ 3 ]); return tmp; } void hp_hybrid_cpu_device::set_ar2(uint64_t v) { - m_reg_ar2[ 3 ] = (uint16_t)(v & 0xffff); + m_reg_ar2[ 3 ] = uint16_t(v & 0xffff); v >>= 16; - m_reg_ar2[ 2 ] = (uint16_t)(v & 0xffff); + m_reg_ar2[ 2 ] = uint16_t(v & 0xffff); v >>= 16; - m_reg_ar2[ 1 ] = (uint16_t)(v & 0xffff); + m_reg_ar2[ 1 ] = uint16_t(v & 0xffff); } uint64_t hp_hybrid_cpu_device::do_mrxy(uint64_t ar) @@ -1445,8 +1445,8 @@ bool hp_hybrid_cpu_device::do_dec_add(bool carry_in , uint64_t& a , uint64_t b) uint8_t digit_a , digit_b; for (i = 0; i < 12; i++) { - digit_a = (uint8_t)(a & 0xf); - digit_b = (uint8_t)(b & 0xf); + digit_a = uint8_t(a & 0xf); + digit_b = uint8_t(b & 0xf); if (carry_in) { digit_a++; @@ -1460,7 +1460,7 @@ bool hp_hybrid_cpu_device::do_dec_add(bool carry_in , uint64_t& a , uint64_t b) digit_a = (digit_a - 10) & 0xf; } - tmp |= (uint64_t)digit_a << (4 * i); + tmp |= uint64_t(digit_a) << (4 * i); a >>= 4; b >>= 4; @@ -1471,7 +1471,7 @@ bool hp_hybrid_cpu_device::do_dec_add(bool carry_in , uint64_t& a , uint64_t b) return carry_in; } -void hp_hybrid_cpu_device::do_mpy(void) +void hp_hybrid_cpu_device::do_mpy() { // Count 0->1 and 1->0 transitions in A register // Correct timing needs this count as real hw uses Booth's algorithm for multiplication @@ -1486,12 +1486,12 @@ void hp_hybrid_cpu_device::do_mpy(void) mask >>= 1; } - int32_t a = (int16_t)m_reg_A; - int32_t b = (int16_t)m_reg_B; + int32_t a = int16_t(m_reg_A); + int32_t b = int16_t(m_reg_B); int32_t p = a * b; - m_reg_A = (uint16_t)(p & 0xffff); - m_reg_B = (uint16_t)((p >> 16) & 0xffff); + m_reg_A = uint16_t(p & 0xffff); + m_reg_B = uint16_t((p >> 16) & 0xffff); m_icount -= 59; } @@ -1531,11 +1531,11 @@ bool hp_5061_3011_cpu_device::execute_no_bpc(uint16_t opcode , uint16_t& next_pc // Withdraw if (BIT(opcode , 11)) { // Byte - uint32_t tmp_addr = (uint32_t)(*ptr_reg); + uint32_t tmp_addr = uint32_t(*ptr_reg); if (m_flags & b_mask) { tmp_addr |= BIT_MASK(16); } - tmp = RM(AEC_CASE_C , (uint16_t)(tmp_addr >> 1)); + tmp = RM(AEC_CASE_C , uint16_t(tmp_addr >> 1)); if (BIT(tmp_addr , 0)) { tmp &= 0xff; } else { @@ -1574,7 +1574,7 @@ bool hp_5061_3011_cpu_device::execute_no_bpc(uint16_t opcode , uint16_t& next_pc tmp = RM(reg_addr); if (BIT(opcode , 11)) { // Byte - uint32_t tmp_addr = (uint32_t)(*ptr_reg); + uint32_t tmp_addr = uint32_t(*ptr_reg); if (m_flags & b_mask) { tmp_addr |= BIT_MASK(16); } @@ -1843,7 +1843,7 @@ uint32_t hp_5061_3001_cpu_device::add_mae(aec_cases_t aec_case , uint16_t addr) aec_reg = (aec_reg & 0xf) | 0x20; } - return (uint32_t)addr | ((uint32_t)aec_reg << 16); + return uint32_t(addr) | (uint32_t(aec_reg) << 16); } bool hp_5061_3001_cpu_device::read_non_common_reg(uint16_t addr , uint16_t& v) @@ -1887,7 +1887,7 @@ std::unique_ptr hp_5061_3001_cpu_device::create_disassem return std::make_unique(m_relative_mode); } -void hp_5061_3001_cpu_device::enter_isr(void) +void hp_5061_3001_cpu_device::enter_isr() { // Set interrupt mode when entering an ISR BIT_SET(m_flags, HPHYBRID_IM_BIT); diff --git a/src/devices/cpu/hphybrid/hphybrid_dasm.h b/src/devices/cpu/hphybrid/hphybrid_dasm.h index 4059a4aa90a..165af6181a8 100644 --- a/src/devices/cpu/hphybrid/hphybrid_dasm.h +++ b/src/devices/cpu/hphybrid/hphybrid_dasm.h @@ -26,7 +26,7 @@ public: virtual offs_t disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer ¶ms) override; protected: - typedef void (hp_hybrid_disassembler::*fn_dis_param)(std::ostream &stream , offs_t pc , uint16_t opcode); + typedef void (hp_hybrid_disassembler::*fn_dis_param)(std::ostream &stream, offs_t pc, uint16_t opcode); typedef struct { uint16_t m_op_mask; @@ -42,17 +42,17 @@ protected: static const dis_entry_t dis_table_emc[]; static const dis_entry_t dis_table_aec[]; - void addr_2_str(std::ostream &stream, uint16_t addr , bool indirect); - void param_none(std::ostream &stream, offs_t pc , uint16_t opcode); - void param_loc(std::ostream &stream, offs_t pc , uint16_t opcode); - void param_addr32(std::ostream &stream, offs_t pc , uint16_t opcode); - void param_skip(std::ostream &stream, offs_t pc , uint16_t opcode); - void param_skip_sc(std::ostream &stream, offs_t pc , uint16_t opcode); - void param_ret(std::ostream &stream, offs_t pc , uint16_t opcode); - void param_n16(std::ostream &stream, offs_t pc , uint16_t opcode); - void param_reg_id(std::ostream &stream, offs_t pc , uint16_t opcode); + void addr_2_str(std::ostream &stream, uint16_t addr, bool indirect); + void param_none(std::ostream &stream, offs_t pc, uint16_t opcode); + void param_loc(std::ostream &stream, offs_t pc, uint16_t opcode); + void param_addr32(std::ostream &stream, offs_t pc, uint16_t opcode); + void param_skip(std::ostream &stream, offs_t pc, uint16_t opcode); + void param_skip_sc(std::ostream &stream, offs_t pc, uint16_t opcode); + void param_ret(std::ostream &stream, offs_t pc, uint16_t opcode); + void param_n16(std::ostream &stream, offs_t pc, uint16_t opcode); + void param_reg_id(std::ostream &stream, offs_t pc, uint16_t opcode); - offs_t disassemble_table(uint16_t opcode , offs_t pc , const dis_entry_t *table , std::ostream &stream); + offs_t disassemble_table(uint16_t opcode, offs_t pc, const dis_entry_t *table, std::ostream &stream); }; class hp_5061_3001_disassembler : public hp_hybrid_disassembler diff --git a/src/devices/cpu/hphybrid/hphybrid_defs.h b/src/devices/cpu/hphybrid/hphybrid_defs.h index 7b2c22a8661..7704ed905e2 100644 --- a/src/devices/cpu/hphybrid/hphybrid_defs.h +++ b/src/devices/cpu/hphybrid/hphybrid_defs.h @@ -13,10 +13,10 @@ enum : uint16_t { HP_REG_R7_ADDR = 0x0007, HP_REG_IV_ADDR = 0x0008, HP_REG_PA_ADDR = 0x0009, - HP_REG_W_ADDR = 0x000A, - HP_REG_DMAPA_ADDR = 0x000B, - HP_REG_DMAMA_ADDR = 0x000C, - HP_REG_DMAC_ADDR = 0x000D, + HP_REG_W_ADDR = 0x000a, + HP_REG_DMAPA_ADDR = 0x000b, + HP_REG_DMAMA_ADDR = 0x000c, + HP_REG_DMAC_ADDR = 0x000d, HP_REG_C_ADDR = 0x000e, HP_REG_D_ADDR = 0x000f, HP_REG_AR2_ADDR = 0x0010, diff --git a/src/mame/drivers/gal3.cpp b/src/mame/drivers/gal3.cpp index d64fdccc9a4..9d628cefe5e 100644 --- a/src/mame/drivers/gal3.cpp +++ b/src/mame/drivers/gal3.cpp @@ -655,7 +655,7 @@ MACHINE_CONFIG_START(gal3_state::gal3) NAMCO_C355SPR(config, m_c355spr[0], 0); m_c355spr[0]->set_screen("lscreen"); m_c355spr[0]->set_gfxdecode_tag("gfxdecode_1"); - m_c355spr[0]->set_is_namcofl(false); + m_c355spr[0]->set_scroll_offsets(0x26, 0x19); m_c355spr[0]->set_tile_callback(namco_c355spr_device::c355_obj_code2tile_delegate()); m_c355spr[0]->set_palxor(0xf); // reverse mapping m_c355spr[0]->set_gfxregion(0); @@ -686,7 +686,7 @@ MACHINE_CONFIG_START(gal3_state::gal3) NAMCO_C355SPR(config, m_c355spr[1], 0); m_c355spr[1]->set_screen("rscreen"); m_c355spr[1]->set_gfxdecode_tag("gfxdecode_2"); - m_c355spr[1]->set_is_namcofl(false); + m_c355spr[1]->set_scroll_offsets(0x26, 0x19); m_c355spr[1]->set_tile_callback(namco_c355spr_device::c355_obj_code2tile_delegate()); m_c355spr[1]->set_palxor(0xf); // reverse mapping m_c355spr[1]->set_gfxregion(0); diff --git a/src/mame/drivers/hp9825.cpp b/src/mame/drivers/hp9825.cpp index c7e83cc1ffe..06431e85067 100644 --- a/src/mame/drivers/hp9825.cpp +++ b/src/mame/drivers/hp9825.cpp @@ -92,6 +92,10 @@ public: void hp9825b(machine_config &config); +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + private: required_device m_cpu; required_device m_cursor_timer; @@ -127,9 +131,6 @@ private: uint8_t m_printer_idx; unsigned m_printer_line; // 0: printer idle, 1..10: line being printed - virtual void machine_start() override; - virtual void machine_reset() override; - void cpu_io_map(address_map &map); void cpu_mem_map(address_map &map); diff --git a/src/mame/drivers/namcofl.cpp b/src/mame/drivers/namcofl.cpp index 15c255b2e09..7947692be99 100644 --- a/src/mame/drivers/namcofl.cpp +++ b/src/mame/drivers/namcofl.cpp @@ -588,7 +588,7 @@ MACHINE_CONFIG_START(namcofl_state::namcofl) NAMCO_C355SPR(config, m_c355spr, 0); m_c355spr->set_screen(m_screen); m_c355spr->set_gfxdecode_tag("gfxdecode"); - m_c355spr->set_is_namcofl(true); + m_c355spr->set_scroll_offsets(0, 0); m_c355spr->set_tile_callback(namco_c355spr_device::c355_obj_code2tile_delegate(&namcofl_state::FLobjcode2tile, this)); m_c355spr->set_palxor(0x0); m_c355spr->set_gfxregion(NAMCOFL_SPRITEGFX); diff --git a/src/mame/drivers/namconb1.cpp b/src/mame/drivers/namconb1.cpp index ad2d59dc0ba..eaaf3ecfb89 100644 --- a/src/mame/drivers/namconb1.cpp +++ b/src/mame/drivers/namconb1.cpp @@ -1064,7 +1064,7 @@ MACHINE_CONFIG_START(namconb1_state::namconb1) NAMCO_C355SPR(config, m_c355spr, 0); m_c355spr->set_screen(m_screen); m_c355spr->set_gfxdecode_tag("gfxdecode"); - m_c355spr->set_is_namcofl(false); + m_c355spr->set_scroll_offsets(0x26, 0x19); m_c355spr->set_tile_callback(namco_c355spr_device::c355_obj_code2tile_delegate(&namconb1_state::NB1objcode2tile, this)); m_c355spr->set_palxor(0x0); m_c355spr->set_buffer(2); // triple buffered diff --git a/src/mame/drivers/namcos2.cpp b/src/mame/drivers/namcos2.cpp index aacadc4a2c2..ad7cebf00bc 100644 --- a/src/mame/drivers/namcos2.cpp +++ b/src/mame/drivers/namcos2.cpp @@ -2033,7 +2033,7 @@ MACHINE_CONFIG_START(namcos2_state::sgunner) NAMCO_C355SPR(config, m_c355spr, 0); m_c355spr->set_screen(m_screen); m_c355spr->set_gfxdecode_tag("gfxdecode"); - m_c355spr->set_is_namcofl(false); + m_c355spr->set_scroll_offsets(0x26, 0x19); m_c355spr->set_tile_callback(namco_c355spr_device::c355_obj_code2tile_delegate()); m_c355spr->set_palxor(0x0); m_c355spr->set_gfxregion(0); @@ -2089,7 +2089,7 @@ MACHINE_CONFIG_START(namcos2_state::sgunner2) NAMCO_C355SPR(config, m_c355spr, 0); m_c355spr->set_screen(m_screen); m_c355spr->set_gfxdecode_tag("gfxdecode"); - m_c355spr->set_is_namcofl(false); + m_c355spr->set_scroll_offsets(0x26, 0x19); m_c355spr->set_tile_callback(namco_c355spr_device::c355_obj_code2tile_delegate()); m_c355spr->set_palxor(0x0); m_c355spr->set_gfxregion(0); @@ -2145,7 +2145,7 @@ MACHINE_CONFIG_START(namcos2_state::suzuka8h) NAMCO_C355SPR(config, m_c355spr, 0); m_c355spr->set_screen(m_screen); m_c355spr->set_gfxdecode_tag("gfxdecode"); - m_c355spr->set_is_namcofl(false); + m_c355spr->set_scroll_offsets(0x26, 0x19); m_c355spr->set_tile_callback(namco_c355spr_device::c355_obj_code2tile_delegate()); m_c355spr->set_palxor(0x0); m_c355spr->set_gfxregion(0); diff --git a/src/mame/drivers/namcos21_c67.cpp b/src/mame/drivers/namcos21_c67.cpp index 49eaf55274e..0d719353f49 100644 --- a/src/mame/drivers/namcos21_c67.cpp +++ b/src/mame/drivers/namcos21_c67.cpp @@ -852,7 +852,7 @@ MACHINE_CONFIG_START(namcos21_c67_state::namcos21) NAMCO_C355SPR(config, m_c355spr, 0); m_c355spr->set_screen(m_screen); m_c355spr->set_gfxdecode_tag("gfxdecode"); - m_c355spr->set_is_namcofl(false); + m_c355spr->set_scroll_offsets(0x26, 0x19); m_c355spr->set_tile_callback(namco_c355spr_device::c355_obj_code2tile_delegate()); m_c355spr->set_palxor(0xf); // reverse mapping m_c355spr->set_gfxregion(0); diff --git a/src/mame/drivers/namcos21_de.cpp b/src/mame/drivers/namcos21_de.cpp index a25b87a67c4..10bad673d0a 100644 --- a/src/mame/drivers/namcos21_de.cpp +++ b/src/mame/drivers/namcos21_de.cpp @@ -225,7 +225,7 @@ MACHINE_CONFIG_START(namco_de_pcbstack_device::device_add_mconfig) NAMCO_C355SPR(config, m_c355spr, 0); m_c355spr->set_screen(m_screen); m_c355spr->set_gfxdecode_tag("gfxdecode"); - m_c355spr->set_is_namcofl(false); + m_c355spr->set_scroll_offsets(0x26, 0x19); m_c355spr->set_tile_callback(namco_c355spr_device::c355_obj_code2tile_delegate()); m_c355spr->set_palxor(0xf); // reverse mapping m_c355spr->set_gfxregion(0); diff --git a/src/mame/drivers/namcos23.cpp b/src/mame/drivers/namcos23.cpp index 70e9d064521..fa890d00f09 100644 --- a/src/mame/drivers/namcos23.cpp +++ b/src/mame/drivers/namcos23.cpp @@ -2910,7 +2910,7 @@ READ16_MEMBER(namcos23_state::sub_comm_r) WRITE16_MEMBER(namcos23_state::sub_comm_w) { - if( offset == 1 ) + if (offset == 1) { // data tx m_mcu_unk = data & 0xff; diff --git a/src/mame/video/namco_c355spr.cpp b/src/mame/video/namco_c355spr.cpp index f93c5c4c1fc..c1e67d2dac1 100644 --- a/src/mame/video/namco_c355spr.cpp +++ b/src/mame/video/namco_c355spr.cpp @@ -22,7 +22,7 @@ namco_c355spr_device::namco_c355spr_device(const machine_config &mconfig, const device_video_interface(mconfig, *this), m_gfx_region(0), m_palxor(0), - m_is_namcofl(false), + m_scrolloffs{ 0, 0 }, m_buffer(0), m_gfxdecode(*this, finder_base::DUMMY_TAG) { @@ -189,15 +189,26 @@ void namco_c355spr_device::device_start() std::fill(std::begin(m_position), std::end(m_position), 0x0000); for (int i = 0; i < 2; i++) { - m_spritelist[i] = auto_alloc_array(machine(), struct c355_sprite, 0x100); - m_sprite_end[i] = m_spritelist[i]; - m_spriteram[i].resize(0x20000/2, 0); - save_item(NAME(m_spriteram[i]), i); + m_spritelist[i] = std::make_unique(0x100); + m_sprite_end[i] = m_spritelist[i].get(); + m_spriteram[i] = std::make_unique(0x20000/2); + std::fill_n(m_spriteram[i].get(), 0x20000/2, 0); + save_pointer(NAME(m_spriteram[i]), 0x20000/2, i); } save_item(NAME(m_position)); } +void namco_c355spr_device::device_stop() +{ + for (auto &spritelist : m_spritelist) + spritelist.reset(); + for (auto &spriteram : m_spriteram) + spriteram.reset(); + + device_t::device_stop(); +} + /**************************************************************************************/ @@ -222,7 +233,7 @@ READ16_MEMBER( namco_c355spr_device::position_r ) * 0x10000 sprite attr (page1) * 0x14000 sprite list (page1) */ -void namco_c355spr_device::get_single_sprite(const uint16_t *pSource, struct c355_sprite *sprite_ptr) +void namco_c355spr_device::get_single_sprite(const uint16_t *pSource, c355_sprite *sprite_ptr) { uint16_t *spriteram16 = &m_spriteram[std::max(0, m_buffer - 1)][0]; unsigned screen_height_remaining, screen_width_remaining; @@ -289,14 +300,8 @@ void namco_c355spr_device::get_single_sprite(const uint16_t *pSource, struct c35 } else { - if (m_is_namcofl) - { /* Namco FL: don't adjust and things line up fine */ - } - else - { /* Namco NB1, Namco System 2 */ - xscroll += 0x26; - yscroll += 0x19; - } + xscroll += m_scrolloffs[0]; + yscroll += m_scrolloffs[1]; } hpos -= xscroll; @@ -415,7 +420,7 @@ int namco_c355spr_device::default_code2tile(int code) void namco_c355spr_device::get_list(int no, const uint16_t *pSpriteList16, const uint16_t *pSpriteTable) { /* draw the sprites */ - struct c355_sprite *sprite_ptr = m_spritelist[no]; + c355_sprite *sprite_ptr = m_spritelist[no].get(); for (int i = 0; i < 256; i++) { sprite_ptr->disable = false; @@ -455,7 +460,7 @@ void namco_c355spr_device::draw_sprites(screen_device &screen, _BitmapClass &bit //if (offs == no) { int i = 0; - struct c355_sprite *sprite_ptr = m_spritelist[no]; + c355_sprite *sprite_ptr = m_spritelist[no].get(); while (sprite_ptr != m_sprite_end[no]) { @@ -515,7 +520,7 @@ WRITE_LINE_MEMBER( namco_c355spr_device::vblank ) get_sprites(); if (m_buffer > 1) - std::copy(m_spriteram[0].begin(), m_spriteram[0].end(), m_spriteram[1].begin()); + std::copy_n(m_spriteram[0].get(), 0x20000/2, m_spriteram[1].get()); } } diff --git a/src/mame/video/namco_c355spr.h b/src/mame/video/namco_c355spr.h index 5d53120488e..4856733c1af 100644 --- a/src/mame/video/namco_c355spr.h +++ b/src/mame/video/namco_c355spr.h @@ -15,7 +15,7 @@ public: namco_c355spr_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); template void set_gfxdecode_tag(T &&tag) { m_gfxdecode.set_tag(std::forward(tag)); } - void set_is_namcofl(bool state) { m_is_namcofl = state; } + void set_scroll_offsets(int x, int y) { m_scrolloffs[0] = x; m_scrolloffs[1] = y; } //void set_ram_words(uint32_t size) { m_ramsize = size; } void set_palxor(int palxor) { m_palxor = palxor; } void set_gfxregion(int region) { m_gfx_region = region; } @@ -43,6 +43,7 @@ public: protected: // device-level overrides virtual void device_start() override; + virtual void device_stop() override; private: @@ -69,21 +70,20 @@ private: int default_code2tile(int code); // C355 Motion Object internals - void get_single_sprite(const uint16_t *pSource, struct c355_sprite *sprite_ptr); + void get_single_sprite(const uint16_t *pSource, c355_sprite *sprite_ptr); void get_list(int no, const uint16_t *pSpriteList16, const uint16_t *pSpriteTable); void get_sprites(); template void draw_sprites(screen_device &screen, _BitmapClass &bitmap, const rectangle &cliprect, int pri); - struct c355_sprite *m_spritelist[2]; - const struct c355_sprite *m_sprite_end[2]; + std::unique_ptr m_spritelist[2]; + const c355_sprite *m_sprite_end[2]; c355_obj_code2tile_delegate m_code2tile; int m_gfx_region; int m_palxor; uint16_t m_position[4]; - std::vector m_spriteram[2]; - //std::vector m_spriteram; + std::unique_ptr m_spriteram[2]; - bool m_is_namcofl; + int m_scrolloffs[2]; //uint32_t m_ramsize; int m_buffer;