diff options
author | 2020-10-03 14:31:39 +1000 | |
---|---|---|
committer | 2020-10-03 14:31:39 +1000 | |
commit | d1681a8ecef978ee34bafe24e95d34f25581e9c3 (patch) | |
tree | 958f96e617f2b5cb3c7c74536a14ad19d9a45be7 | |
parent | b7de847b6e5f259fa5c67b43951586204a6ae387 (diff) | |
parent | 9ac531e2b9aa690910cbeb35a14bd93fb001592b (diff) |
Merge remote-tracking branch 'upstream/master' into master
159 files changed, 2542 insertions, 2297 deletions
diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index dc3013584ff..6d6e9a42dff 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -4032,6 +4032,7 @@ files { MAME_DIR .. "src/mame/machine/generalplus_gpl16250.cpp", MAME_DIR .. "src/mame/machine/generalplus_gpl16250.h", MAME_DIR .. "src/mame/drivers/generalplus_gpl32612.cpp", + MAME_DIR .. "src/mame/drivers/generalplus_gpl162xx_lcdtype.cpp", MAME_DIR .. "src/mame/drivers/generalplus_gpl_unknown.cpp", MAME_DIR .. "src/mame/drivers/xavix.cpp", MAME_DIR .. "src/mame/includes/xavix.h", diff --git a/src/devices/bus/adamnet/adamnet.cpp b/src/devices/bus/adamnet/adamnet.cpp index 69b25ce30e7..18b91c4fb8c 100644 --- a/src/devices/bus/adamnet/adamnet.cpp +++ b/src/devices/bus/adamnet/adamnet.cpp @@ -113,7 +113,7 @@ void adamnet_device::device_stop() void adamnet_device::add_device(device_t *target) { - auto entry = global_alloc(daisy_entry(target)); + auto entry = new daisy_entry(target); entry->m_interface->m_bus = this; diff --git a/src/devices/bus/cbmiec/cbmiec.cpp b/src/devices/bus/cbmiec/cbmiec.cpp index 98535963034..4ee8f287200 100644 --- a/src/devices/bus/cbmiec/cbmiec.cpp +++ b/src/devices/bus/cbmiec/cbmiec.cpp @@ -338,7 +338,7 @@ void cbm_iec_device::device_stop() void cbm_iec_device::add_device(cbm_iec_slot_device *slot, device_t *target) { - auto entry = global_alloc(daisy_entry(target)); + auto entry = new daisy_entry(target); entry->m_interface->m_slot = slot; entry->m_interface->m_bus = this; diff --git a/src/devices/bus/econet/econet.cpp b/src/devices/bus/econet/econet.cpp index f87850fe133..e9afc9c0d49 100644 --- a/src/devices/bus/econet/econet.cpp +++ b/src/devices/bus/econet/econet.cpp @@ -223,7 +223,7 @@ void econet_device::device_stop() void econet_device::add_device(device_t *target, int address) { - auto entry = global_alloc(daisy_entry(target)); + auto entry = new daisy_entry(target); entry->m_interface->m_econet = this; entry->m_interface->m_address = address; diff --git a/src/devices/bus/hexbus/hexbus.cpp b/src/devices/bus/hexbus/hexbus.cpp index 0b8d7821cb6..53e8a40e7c0 100644 --- a/src/devices/bus/hexbus/hexbus.cpp +++ b/src/devices/bus/hexbus/hexbus.cpp @@ -224,18 +224,20 @@ uint8_t hexbus_device::read(int dir) hexbus_chained_device::hexbus_chained_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock): device_t(mconfig, type, tag, owner, clock), device_hexbus_interface(mconfig, *this), + m_hexbus_outbound(nullptr), m_enabled(false), m_myvalue(0xff) { m_hexbus_inbound = dynamic_cast<hexbus_device *>(owner); } -void hexbus_chained_device::device_start() +void hexbus_chained_device::device_resolve_objects() { - m_hexbus_outbound = static_cast<hexbus_device*>(subdevice("hexbus")); + m_hexbus_outbound = dynamic_cast<hexbus_device *>(subdevice("hexbus")); // Establish callback for inbound propagations - m_hexbus_outbound->set_chain_element(this); + if (m_hexbus_outbound != nullptr) + m_hexbus_outbound->set_chain_element(this); } /* diff --git a/src/devices/bus/hexbus/hexbus.h b/src/devices/bus/hexbus/hexbus.h index 76092c0f16f..7f39400974b 100644 --- a/src/devices/bus/hexbus/hexbus.h +++ b/src/devices/bus/hexbus/hexbus.h @@ -60,7 +60,7 @@ protected: void set_outbound_hexbus(hexbus_device *outbound) { m_hexbus_outbound = outbound; } - virtual void device_start() override; + virtual void device_resolve_objects() override; // Link to the inbound Hexbus (if not null, see Oso chip) hexbus_device *m_hexbus_inbound; diff --git a/src/devices/bus/hexbus/hx5102.cpp b/src/devices/bus/hexbus/hx5102.cpp index f9d2341456e..65f59e0a18a 100644 --- a/src/devices/bus/hexbus/hx5102.cpp +++ b/src/devices/bus/hexbus/hx5102.cpp @@ -121,7 +121,9 @@ void hx5102_device::memmap(address_map &map) */ void hx5102_device::crumap(address_map &map) { - map(0x17e0, 0x17ff).rw(FUNC(hx5102_device::cruread), FUNC(hx5102_device::cruwrite)); + map(0x17e0, 0x17ff).r(FUNC(hx5102_device::cruread)); + map(0x17e0, 0x17ef).w(m_crulatch[0], FUNC(ls259_device::write_d0)); + map(0x17f0, 0x17ff).w(m_crulatch[1], FUNC(ls259_device::write_d0)); } hx5102_device::hx5102_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock): @@ -140,6 +142,7 @@ hx5102_device::hx5102_device(const machine_config &mconfig, const char *tag, dev m_floppy_select_last(UNDEF), m_hexbus_ctrl(*this, IBC_TAG), m_floppy_ctrl(*this, FDC_TAG), + m_crulatch(*this, "crulatch%u", 0U), m_motormf(*this, MTRD_TAG), m_speedmf(*this, MTSPD_TAG), m_readyff(*this, READYFF_TAG), @@ -480,92 +483,81 @@ uint8_t hx5102_device::cruread(offs_t offset) /* CRU write access. */ -void hx5102_device::cruwrite(offs_t offset, uint8_t data) +WRITE_LINE_MEMBER(hx5102_device::nocomp_w) { - // LOG("Writing CRU address %04x: %x\n", 0x17e0 + (offset<<1), data); - switch (offset) - { - case 0: - // unused right now - LOGMASKED(LOG_CRU, "Set precompensation = %d\n", data); - break; - case 1: - if (data==1) - { - LOGMASKED(LOG_CRU, "Trigger motor monoflop\n"); - } - m_motormf->b_w(data); - break; - case 2: - LOGMASKED(LOG_CRU, "Set undefined CRU bit 2 to %d\n", data); - break; - case 3: - LOGMASKED(LOG_CRU, "Set step direction = %d\n", data); - if (m_current_floppy != nullptr) m_current_floppy->dir_w((data==0)? 1 : 0); - break; - case 4: - if (data==1) - { - LOGMASKED(LOG_CRU, "Assert DACK*\n"); - m_dacken = (data != 0); - } - break; - case 5: - if (data==1) - { - LOGMASKED(LOG_CRU, "Step pulse\n"); - } - if (m_current_floppy != nullptr) m_current_floppy->stp_w((data==0)? 1 : 0); - break; - case 6: - if (data==1) - { - LOGMASKED(LOG_CRU, "Start watchdog\n"); - } - m_speedmf->b_w(data); - break; - case 7: - if (data==0) - { - LOGMASKED(LOG_CRU, "Reset i8272A controller\n"); - m_floppy_ctrl->soft_reset(); - } - break; - case 8: - LOGMASKED(LOG_CRU, "Set drive select 0 to %d\n", data); - if (data == 1) m_floppy_select |= 1; - else m_floppy_select &= ~1; - break; - case 9: - LOGMASKED(LOG_CRU, "Set drive select 1 to %d\n", data); - if (data == 1) m_floppy_select |= 2; - else m_floppy_select &= ~2; - break; - case 10: - // External drive; not implemented - LOGMASKED(LOG_CRU, "Set drive select 2 to %d\n", data); - break; - case 11: - // External drive; not implemented - LOGMASKED(LOG_CRU, "Set drive select 3 to %d\n", data); - break; - case 12: - // External drive; not implemented - LOGMASKED(LOG_CRU, "Set auxiliary motor line to %d\n", data); - break; - case 13: - LOGMASKED(LOG_CRU, "Set CRU bit 13 to %d (unused)\n", data); - break; - case 14: - m_wait = (data!=0); - LOGMASKED(LOG_CRU, "READY circuit %s\n", m_wait? "active" : "inactive" ); - update_readyff_input(); - break; - case 15: - LOGMASKED(LOG_CRU, "Set CRU bit 15 to %d (unused)\n", data); - break; - } + // unused right now + LOGMASKED(LOG_CRU, "Set precompensation = %d\n", state); +} +WRITE_LINE_MEMBER(hx5102_device::diren_w) +{ + LOGMASKED(LOG_CRU, "Set step direction = %d\n", state); + if (m_current_floppy != nullptr) + m_current_floppy->dir_w((state==0)? 1 : 0); +} + +WRITE_LINE_MEMBER(hx5102_device::dacken_w) +{ + if (state==1) + LOGMASKED(LOG_CRU, "Assert DACK*\n"); + m_dacken = (state != 0); +} + +WRITE_LINE_MEMBER(hx5102_device::stepen_w) +{ + if (state==1) + LOGMASKED(LOG_CRU, "Step pulse\n"); + if (m_current_floppy != nullptr) + m_current_floppy->stp_w((state==0)? 1 : 0); +} + +WRITE_LINE_MEMBER(hx5102_device::ds1_w) +{ + LOGMASKED(LOG_CRU, "Set drive select 0 to %d\n", state); + if (state == 1) + m_floppy_select |= 1; + else + m_floppy_select &= ~1; + update_drive_select(); +} + +WRITE_LINE_MEMBER(hx5102_device::ds2_w) +{ + LOGMASKED(LOG_CRU, "Set drive select 1 to %d\n", state); + if (state == 1) + m_floppy_select |= 2; + else + m_floppy_select &= ~2; + update_drive_select(); +} + +WRITE_LINE_MEMBER(hx5102_device::ds3_w) +{ + // External drive; not implemented + LOGMASKED(LOG_CRU, "Set drive select 2 to %d\n", state); +} + +WRITE_LINE_MEMBER(hx5102_device::ds4_w) +{ + // External drive; not implemented + LOGMASKED(LOG_CRU, "Set drive select 3 to %d\n", state); +} + +WRITE_LINE_MEMBER(hx5102_device::aux_motor_w) +{ + // External drive; not implemented + LOGMASKED(LOG_CRU, "Set auxiliary motor line to %d\n", state); +} + +WRITE_LINE_MEMBER(hx5102_device::wait_w) +{ + m_wait = (state!=0); + LOGMASKED(LOG_CRU, "READY circuit %s\n", m_wait? "active" : "inactive" ); + update_readyff_input(); +} + +void hx5102_device::update_drive_select() +{ if (m_floppy_select != m_floppy_select_last) { if (m_floppy_select == 1) @@ -677,7 +669,7 @@ void hx5102_device::device_add_mconfig(machine_config& config) HEXBUS(config, "hexbus", 0, hexbus_options, nullptr); // TMS9995 CPU @ 12.0 MHz - TMS9995(config, m_flopcpu, XTAL(12'000'000)); + TMS9995(config, m_flopcpu, 12_MHz_XTAL); m_flopcpu->set_addrmap(AS_PROGRAM, &hx5102_device::memmap); m_flopcpu->set_addrmap(AS_IO, &hx5102_device::crumap); m_flopcpu->extop_cb().set(FUNC(hx5102_device::external_operation)); @@ -687,27 +679,41 @@ void hx5102_device::device_add_mconfig(machine_config& config) // Not connected: Select lines (DS0, DS1), Head load (HDL), VCO // Tied to 1: READY // Tied to 0: TC - I8272A(config, m_floppy_ctrl, 8'000'000, false); + I8272A(config, m_floppy_ctrl, 8_MHz_XTAL / 2, false); m_floppy_ctrl->intrq_wr_callback().set(FUNC(hx5102_device::fdc_irq_w)); m_floppy_ctrl->drq_wr_callback().set(FUNC(hx5102_device::fdc_drq_w)); FLOPPY_CONNECTOR(config, "d0", hx5102_drive, "525dd", hx5102_device::floppy_formats).enable_sound(true); FLOPPY_CONNECTOR(config, "d1", hx5102_drive, nullptr, hx5102_device::floppy_formats).enable_sound(true); + // Addressable latches + LS259(config, m_crulatch[0]); // U18 + m_crulatch[0]->q_out_cb<0>().set(FUNC(hx5102_device::nocomp_w)); + m_crulatch[0]->q_out_cb<1>().set(m_motormf, FUNC(ttl74123_device::b_w)); + m_crulatch[0]->q_out_cb<3>().set(FUNC(hx5102_device::diren_w)); + m_crulatch[0]->q_out_cb<4>().set(FUNC(hx5102_device::dacken_w)); + m_crulatch[0]->q_out_cb<5>().set(FUNC(hx5102_device::stepen_w)); + m_crulatch[0]->q_out_cb<6>().set(m_speedmf, FUNC(ttl74123_device::b_w)); + m_crulatch[0]->q_out_cb<7>().set(m_floppy_ctrl, FUNC(i8272a_device::reset_w)).invert(); + + LS259(config, m_crulatch[1]); // U10 + m_crulatch[1]->q_out_cb<0>().set(FUNC(hx5102_device::ds1_w)); + m_crulatch[1]->q_out_cb<1>().set(FUNC(hx5102_device::ds2_w)); + m_crulatch[1]->q_out_cb<2>().set(FUNC(hx5102_device::ds3_w)); + m_crulatch[1]->q_out_cb<3>().set(FUNC(hx5102_device::ds4_w)); + m_crulatch[1]->q_out_cb<4>().set(FUNC(hx5102_device::aux_motor_w)); + m_crulatch[1]->q_out_cb<6>().set(FUNC(hx5102_device::wait_w)); + // Monoflops - TTL74123(config, m_motormf, 0); + TTL74123(config, m_motormf, RES_K(200), CAP_U(47)); m_motormf->set_connection_type(TTL74123_GROUNDED); - m_motormf->set_resistor_value(RES_K(200)); - m_motormf->set_capacitor_value(CAP_U(47)); m_motormf->set_a_pin_value(0); m_motormf->set_b_pin_value(1); m_motormf->set_clear_pin_value(1); m_motormf->out_cb().set(FUNC(hx5102_device::motor_w)); - TTL74123(config, m_speedmf, 0); + TTL74123(config, m_speedmf, RES_K(200), CAP_U(10)); m_speedmf->set_connection_type(TTL74123_GROUNDED); - m_speedmf->set_resistor_value(RES_K(200)); - m_speedmf->set_capacitor_value(CAP_U(10)); m_speedmf->set_a_pin_value(0); m_speedmf->set_b_pin_value(1); m_speedmf->set_clear_pin_value(1); diff --git a/src/devices/bus/hexbus/hx5102.h b/src/devices/bus/hexbus/hx5102.h index 12f48dbe555..573c999ce3b 100644 --- a/src/devices/bus/hexbus/hx5102.h +++ b/src/devices/bus/hexbus/hx5102.h @@ -22,6 +22,7 @@ #include "machine/upd765.h" #include "machine/7474.h" #include "machine/74123.h" +#include "machine/74259.h" #include "machine/rescap.h" #include "machine/ram.h" #include "imagedev/floppy.h" @@ -71,7 +72,17 @@ private: DECLARE_WRITE_LINE_MEMBER(hsklatch_out); uint8_t cruread(offs_t offset); - void cruwrite(offs_t offset, uint8_t data); + DECLARE_WRITE_LINE_MEMBER(nocomp_w); + DECLARE_WRITE_LINE_MEMBER(diren_w); + DECLARE_WRITE_LINE_MEMBER(dacken_w); + DECLARE_WRITE_LINE_MEMBER(stepen_w); + DECLARE_WRITE_LINE_MEMBER(ds1_w); + DECLARE_WRITE_LINE_MEMBER(ds2_w); + DECLARE_WRITE_LINE_MEMBER(ds3_w); + DECLARE_WRITE_LINE_MEMBER(ds4_w); + DECLARE_WRITE_LINE_MEMBER(aux_motor_w); + DECLARE_WRITE_LINE_MEMBER(wait_w); + void update_drive_select(); // Operate the floppy motors bool m_motor_on; @@ -96,6 +107,7 @@ private: required_device<ibc_device> m_hexbus_ctrl; required_device<i8272a_device> m_floppy_ctrl; + required_device_array<ls259_device, 2> m_crulatch; required_device<ttl74123_device> m_motormf; required_device<ttl74123_device> m_speedmf; required_device<ttl7474_device> m_readyff; diff --git a/src/devices/bus/ieee488/ieee488.cpp b/src/devices/bus/ieee488/ieee488.cpp index bcbe20e0573..947aad2d1f7 100644 --- a/src/devices/bus/ieee488/ieee488.cpp +++ b/src/devices/bus/ieee488/ieee488.cpp @@ -164,7 +164,7 @@ void ieee488_device::device_stop() void ieee488_device::add_device(ieee488_slot_device *slot, device_t *target) { - auto entry = global_alloc(daisy_entry(target)); + auto entry = new daisy_entry(target); entry->m_interface->m_bus = this; entry->m_interface->m_slot = slot; diff --git a/src/devices/bus/isa/fdc.cpp b/src/devices/bus/isa/fdc.cpp index 0648a16a6e3..aab99b12ed5 100644 --- a/src/devices/bus/isa/fdc.cpp +++ b/src/devices/bus/isa/fdc.cpp @@ -45,10 +45,6 @@ isa8_fdc_device::isa8_fdc_device(const machine_config &mconfig, device_type type { } -void isa8_fdc_device::device_reset() -{ -} - WRITE_LINE_MEMBER( isa8_fdc_device::irq_w ) { m_isa->irq6_w(state ? ASSERT_LINE : CLEAR_LINE); @@ -80,7 +76,9 @@ void isa8_fdc_device::eop_w(int state) } -isa8_upd765_fdc_device::isa8_upd765_fdc_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : isa8_fdc_device(mconfig, type, tag, owner, clock) +isa8_upd765_fdc_device::isa8_upd765_fdc_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) + : isa8_fdc_device(mconfig, type, tag, owner, clock) + , dor(0x00) { } @@ -94,7 +92,11 @@ void isa8_upd765_fdc_device::device_start() irq = drq = false; fdc_irq = fdc_drq = false; - dor = 0x00; +} + +void isa8_upd765_fdc_device::device_reset() +{ + dor_w(0x00); } // Bits 0-1 select one of the 4 drives, but only if the associated @@ -109,7 +111,6 @@ void isa8_upd765_fdc_device::device_start() void isa8_upd765_fdc_device::dor_w(uint8_t data) { LOG("dor = %02x\n", data); - uint8_t pdor = dor; dor = data; for(int i=0; i<4; i++) @@ -124,8 +125,7 @@ void isa8_upd765_fdc_device::dor_w(uint8_t data) check_irq(); check_drq(); - if((pdor^dor) & 4) - m_fdc->soft_reset(); + m_fdc->reset_w(!BIT(dor, 2)); } uint8_t isa8_upd765_fdc_device::dor_r() diff --git a/src/devices/bus/isa/fdc.h b/src/devices/bus/isa/fdc.h index a0c872a28f0..d4321ca4210 100644 --- a/src/devices/bus/isa/fdc.h +++ b/src/devices/bus/isa/fdc.h @@ -34,9 +34,6 @@ protected: // construction/destruction isa8_fdc_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); - // device-level overrides - virtual void device_reset() override; - virtual uint8_t dack_r(int line) override; virtual void dack_w(int line, uint8_t data) override; virtual void dack_line_w(int line, int state) override; @@ -53,6 +50,7 @@ protected: // device-level overrides virtual void device_start() override; + virtual void device_reset() override; uint8_t dor_r(); void dor_w(uint8_t data); diff --git a/src/devices/bus/isa/omti8621.cpp b/src/devices/bus/isa/omti8621.cpp index b75b09046ed..e9c80e126d3 100644 --- a/src/devices/bus/isa/omti8621.cpp +++ b/src/devices/bus/isa/omti8621.cpp @@ -1333,8 +1333,7 @@ void omti8621_device::fd_moten_w(uint8_t data) m_moten = data; - if (!BIT(data, 2)) - m_fdc->soft_reset(); + m_fdc->reset_w(!BIT(data, 2)); for (int i = 0; i < 2; i++) { diff --git a/src/devices/bus/ti99/gromport/cartridges.cpp b/src/devices/bus/ti99/gromport/cartridges.cpp index 6b2da977a2a..c703d331bf9 100644 --- a/src/devices/bus/ti99/gromport/cartridges.cpp +++ b/src/devices/bus/ti99/gromport/cartridges.cpp @@ -1558,13 +1558,13 @@ void ti99_cartridge_device::rpk::close() not a network socket) ***************************************************************/ -ti99_cartridge_device::rpk_socket::rpk_socket(const char* id, int length, uint8_t* contents, std::string &&pathname) - : m_id(id), m_length(length), m_contents(contents), m_pathname(std::move(pathname)) +ti99_cartridge_device::rpk_socket::rpk_socket(const char* id, int length, std::unique_ptr<uint8_t []> &&contents, std::string &&pathname) + : m_id(id), m_length(length), m_contents(std::move(contents)), m_pathname(std::move(pathname)) { } -ti99_cartridge_device::rpk_socket::rpk_socket(const char* id, int length, uint8_t* contents) - : rpk_socket(id, length, contents, "") +ti99_cartridge_device::rpk_socket::rpk_socket(const char* id, int length, std::unique_ptr<uint8_t []> &&contents) + : rpk_socket(id, length, std::move(contents), "") { } @@ -1609,7 +1609,7 @@ std::unique_ptr<ti99_cartridge_device::rpk_socket> ti99_cartridge_device::rpk_re util::archive_file::error ziperr; uint32_t crc; int length; - uint8_t* contents; + std::unique_ptr<uint8_t []> contents; int header; // find the file attribute (required) @@ -1635,11 +1635,11 @@ std::unique_ptr<ti99_cartridge_device::rpk_socket> ti99_cartridge_device::rpk_re length = zip.current_uncompressed_length(); // Allocate storage - contents = global_alloc_array_clear<uint8_t>(length); - if (contents==nullptr) throw rpk_exception(RPK_OUT_OF_MEMORY); + try { contents = make_unique_clear<uint8_t []>(length); } + catch (std::bad_alloc const &) { throw rpk_exception(RPK_OUT_OF_MEMORY); } // and unzip file from the zip file - ziperr = zip.decompress(contents, length); + ziperr = zip.decompress(contents.get(), length); if (ziperr != util::archive_file::error::NONE) { if (ziperr == util::archive_file::error::UNSUPPORTED) throw rpk_exception(RPK_ZIP_UNSUPPORTED); @@ -1651,7 +1651,7 @@ std::unique_ptr<ti99_cartridge_device::rpk_socket> ti99_cartridge_device::rpk_re if (sha1 != nullptr) { util::hash_collection actual_hashes; - actual_hashes.compute((const uint8_t *)contents, length, util::hash_collection::HASH_TYPES_CRC_SHA1); + actual_hashes.compute(contents.get(), length, util::hash_collection::HASH_TYPES_CRC_SHA1); util::hash_collection expected_hashes; expected_hashes.add_from_string(util::hash_collection::HASH_SHA1, sha1, strlen(sha1)); @@ -1660,7 +1660,7 @@ std::unique_ptr<ti99_cartridge_device::rpk_socket> ti99_cartridge_device::rpk_re } // Create a socket instance - return std::make_unique<rpk_socket>(socketname, length, contents); + return std::make_unique<rpk_socket>(socketname, length, std::move(contents)); } /* @@ -1673,7 +1673,7 @@ std::unique_ptr<ti99_cartridge_device::rpk_socket> ti99_cartridge_device::rpk_re const char* ram_filename; std::string ram_pname; unsigned int length; - uint8_t* contents; + std::unique_ptr<uint8_t []> contents; // find the length attribute length_string = ram_resource_node->get_attribute_string("length", nullptr); @@ -1701,8 +1701,8 @@ std::unique_ptr<ti99_cartridge_device::rpk_socket> ti99_cartridge_device::rpk_re } // Allocate memory for this resource - contents = global_alloc_array_clear<uint8_t>(length); - if (contents==nullptr) throw rpk_exception(RPK_OUT_OF_MEMORY); + try { contents = make_unique_clear<uint8_t []>(length); } + catch (std::bad_alloc const &) { throw rpk_exception(RPK_OUT_OF_MEMORY); } LOGMASKED(LOG_RPK, "[RPK handler] Allocating RAM buffer (%d bytes) for socket '%s'\n", length, socketname); @@ -1717,10 +1717,8 @@ std::unique_ptr<ti99_cartridge_device::rpk_socket> ti99_cartridge_device::rpk_re // Get the file name (required if persistent) ram_filename = ram_resource_node->get_attribute_string("file", nullptr); if (ram_filename==nullptr) - { - global_free_array(contents); throw rpk_exception(RPK_INVALID_RAM_SPEC, "<ram type='persistent'> must have a 'file' attribute"); - } + ram_pname = std::string(system_name).append(PATH_SEPARATOR).append(ram_filename); // load, and fill rest with 00 LOGMASKED(LOG_RPK, "[RPK handler] Loading NVRAM contents from '%s'\n", ram_pname.c_str()); @@ -1734,15 +1732,15 @@ std::unique_ptr<ti99_cartridge_device::rpk_socket> ti99_cartridge_device::rpk_re osd_file::error filerr = file.open(ram_pname); int bytes_read = 0; if (filerr == osd_file::error::NONE) - bytes_read = file.read(contents, length); + bytes_read = file.read(contents.get(), length); // fill remaining bytes (if necessary) - memset(((char *) contents) + bytes_read, 0x00, length - bytes_read); + std::fill_n(&contents[bytes_read], length - bytes_read, 0x00); } } // Create a socket instance - return std::make_unique<rpk_socket>(socketname, length, contents, std::move(ram_pname)); + return std::make_unique<rpk_socket>(socketname, length, std::move(contents), std::move(ram_pname)); } /*------------------------------------------------- diff --git a/src/devices/bus/ti99/gromport/cartridges.h b/src/devices/bus/ti99/gromport/cartridges.h index b494ad7e28d..f6e2e991d56 100644 --- a/src/devices/bus/ti99/gromport/cartridges.h +++ b/src/devices/bus/ti99/gromport/cartridges.h @@ -170,21 +170,21 @@ private: class rpk_socket { public: - rpk_socket(const char *id, int length, uint8_t *contents); - rpk_socket(const char *id, int length, uint8_t *contents, std::string &&pathname); + rpk_socket(const char *id, int length, std::unique_ptr<uint8_t []> &&contents); + rpk_socket(const char *id, int length, std::unique_ptr<uint8_t []> &&contents, std::string &&pathname); ~rpk_socket() {} const char* id() { return m_id; } int get_content_length() { return m_length; } - uint8_t* get_contents() { return m_contents; } + uint8_t* get_contents() { return m_contents.get(); } bool persistent_ram() { return !m_pathname.empty(); } const char* get_pathname() { return m_pathname.c_str(); } - void cleanup() { if (m_contents != nullptr) global_free_array(m_contents); } + void cleanup() { m_contents.reset(); } private: const char* m_id; uint32_t m_length; - uint8_t* m_contents; + std::unique_ptr<uint8_t []> m_contents; const std::string m_pathname; }; diff --git a/src/devices/bus/ti99/peb/horizon.cpp b/src/devices/bus/ti99/peb/horizon.cpp index 6da8483a046..8d9aa8dd20a 100644 --- a/src/devices/bus/ti99/peb/horizon.cpp +++ b/src/devices/bus/ti99/peb/horizon.cpp @@ -121,24 +121,22 @@ void horizon_ramdisk_device::nvram_read(emu_file &file) int size = 2097152*(1 << ioport("HORIZONSIZE")->read()); // NVRAM plus ROS - uint8_t* buffer = global_alloc_array_clear<uint8_t>(MAXSIZE + ROSSIZE); + auto buffer = make_unique_clear<uint8_t []>(MAXSIZE + ROSSIZE); memset(m_nvram->pointer(), 0, size); memset(m_ros->pointer(), 0, ROSSIZE); // We assume the last 8K is ROS - int filesize = file.read(buffer, MAXSIZE+ROSSIZE); + int filesize = file.read(&buffer[0], MAXSIZE+ROSSIZE); int nvramsize = filesize - ROSSIZE; // If there is a reasonable size if (nvramsize >= 0) { // Copy from buffer to NVRAM and ROS - memcpy(m_nvram->pointer(), buffer, nvramsize); - memcpy(m_ros->pointer(), buffer + nvramsize, ROSSIZE); + memcpy(m_nvram->pointer(), &buffer[0], nvramsize); + memcpy(m_ros->pointer(), &buffer[nvramsize], ROSSIZE); } - - global_free_array(buffer); } //------------------------------------------------- @@ -150,11 +148,11 @@ void horizon_ramdisk_device::nvram_write(emu_file &file) { int nvramsize = 2097152*(1 << ioport("HORIZONSIZE")->read()); - uint8_t* buffer = global_alloc_array_clear<uint8_t>(nvramsize + ROSSIZE); - memcpy(buffer, m_nvram->pointer(), nvramsize); - memcpy(buffer + nvramsize, m_ros->pointer(), ROSSIZE); + auto buffer = make_unique_clear<uint8_t []>(nvramsize + ROSSIZE); + memcpy(&buffer[0], m_nvram->pointer(), nvramsize); + memcpy(&buffer[nvramsize], m_ros->pointer(), ROSSIZE); - file.write(buffer, nvramsize + ROSSIZE); + file.write(buffer.get(), nvramsize + ROSSIZE); } void horizon_ramdisk_device::readz(offs_t offset, uint8_t *value) diff --git a/src/devices/cpu/x86log.cpp b/src/devices/cpu/x86log.cpp index b97f2553f11..7c7b13d1966 100644 --- a/src/devices/cpu/x86log.cpp +++ b/src/devices/cpu/x86log.cpp @@ -37,7 +37,7 @@ x86log_context *x86log_create_context(const char *filename) x86log_context *log; /* allocate the log */ - log = global_alloc_clear<x86log_context>(); + log = new x86log_context; /* allocate the filename */ log->filename.assign(filename); @@ -59,7 +59,7 @@ void x86log_free_context(x86log_context *log) noexcept fclose(log->file); /* free the structure */ - global_free(log); + delete log; } diff --git a/src/devices/cpu/x86log.h b/src/devices/cpu/x86log.h index ba2a349a55f..1383295e720 100644 --- a/src/devices/cpu/x86log.h +++ b/src/devices/cpu/x86log.h @@ -8,10 +8,10 @@ ***************************************************************************/ -#pragma once +#ifndef MAME_CPU_X86LOG_H +#define MAME_CPU_X86LOG_H -#ifndef __X86LOG_H__ -#define __X86LOG_H__ +#pragma once #include <cstdint> #include <cassert> @@ -38,34 +38,34 @@ typedef uint8_t x86code; /* code logging info */ struct log_comment { - x86code* base; - const char* string; + x86code* base = nullptr; + const char* string = nullptr; }; /* data ranges */ struct data_range_t { - x86code* base; - x86code* end; - int size; + x86code* base = nullptr; + x86code* end = nullptr; + int size = 0; }; /* the code logging context */ struct x86log_context { - std::string filename; /* name of the file */ - FILE* file; /* file we are logging to */ + std::string filename; // name of the file + FILE* file = nullptr; // file we are logging to - data_range_t data_range[MAX_DATA_RANGES]; /* list of data ranges */ - int data_range_count; /* number of data ranges */ + data_range_t data_range[MAX_DATA_RANGES]; // list of data ranges + int data_range_count = 0; // number of data ranges - log_comment comment_list[MAX_COMMENTS]; /* list of comments */ - int comment_count; /* number of live comments */ + log_comment comment_list[MAX_COMMENTS]; // list of comments + int comment_count = 0; // number of live comments - char comment_pool[COMMENT_POOL_SIZE]; /* string pool to hold comments */ - char* comment_pool_next; /* pointer to next string pool location */ + char comment_pool[COMMENT_POOL_SIZE]; // string pool to hold comments + char* comment_pool_next = nullptr; // pointer to next string pool location }; @@ -160,4 +160,4 @@ inline void x86log_printf(x86log_context* log, const char* format, Ts&&... xs) fflush(log->file); } -#endif /* __X86LOG_H__ */ +#endif // MAME_CPU_X86LOG_H diff --git a/src/devices/imagedev/floppy.cpp b/src/devices/imagedev/floppy.cpp index f39be79c761..fc4631199d8 100644 --- a/src/devices/imagedev/floppy.cpp +++ b/src/devices/imagedev/floppy.cpp @@ -178,7 +178,7 @@ floppy_image_device::floppy_image_device(const machine_config &mconfig, device_t device_image_interface(mconfig, *this), input_format(nullptr), output_format(nullptr), - image(nullptr), + image(), fif_list(nullptr), index_timer(nullptr), tracks(0), @@ -307,7 +307,7 @@ void floppy_image_device::commit_image() if (err != osd_file::error::NONE) popmessage("Error, unable to truncate image: %d", int(err)); - output_format->save(&io, image); + output_format->save(&io, image.get()); } //------------------------------------------------- @@ -473,12 +473,11 @@ image_init_result floppy_image_device::call_load() return image_init_result::FAIL; } - image = global_alloc(floppy_image(tracks, sides, form_factor)); - if (!best_format->load(&io, form_factor, image)) + image = std::make_unique<floppy_image>(tracks, sides, form_factor); + if (!best_format->load(&io, form_factor, image.get())) { seterror(IMAGE_ERROR_UNSUPPORTED, "Incompatible image format or corrupted data"); - global_free(image); - image = nullptr; + image.reset(); return image_init_result::FAIL; } output_format = is_readonly() ? nullptr : best_format; @@ -501,8 +500,7 @@ void floppy_image_device::call_unload() if (image) { if(image_dirty) commit_image(); - global_free(image); - image = nullptr; + image.reset(); } wpt = 1; // disk sleeve is covering the sensor @@ -526,7 +524,7 @@ void floppy_image_device::call_unload() image_init_result floppy_image_device::call_create(int format_type, util::option_resolution *format_options) { - image = global_alloc(floppy_image(tracks, sides, form_factor)); + image = std::make_unique<floppy_image>(tracks, sides, form_factor); output_format = nullptr; // search for a suitable format based on the extension diff --git a/src/devices/imagedev/floppy.h b/src/devices/imagedev/floppy.h index 515cf28f610..b163b0b6a42 100644 --- a/src/devices/imagedev/floppy.h +++ b/src/devices/imagedev/floppy.h @@ -154,7 +154,7 @@ protected: floppy_image_format_t *input_format; floppy_image_format_t *output_format; - floppy_image *image; + std::unique_ptr<floppy_image> image; char extension_list[256]; floppy_image_format_t *fif_list; emu_timer *index_timer; diff --git a/src/devices/imagedev/mfmhd.cpp b/src/devices/imagedev/mfmhd.cpp index a90cf75ea54..61eabb12217 100644 --- a/src/devices/imagedev/mfmhd.cpp +++ b/src/devices/imagedev/mfmhd.cpp @@ -366,7 +366,7 @@ void mfm_harddisk_device::device_start() m_current_cylinder = m_landing_zone; // Park position m_spinup_timer->adjust(attotime::from_msec(m_spinupms)); - m_cache = global_alloc(mfmhd_trackimage_cache(machine())); + m_cache = std::make_unique<mfmhd_trackimage_cache>(machine()); // In 5 second periods, check whether the cache has dirty lines m_cache_timer->adjust(attotime::from_msec(5000), 0, attotime::from_msec(5000)); @@ -411,7 +411,7 @@ void mfm_harddisk_device::device_reset() void mfm_harddisk_device::device_stop() { - if (m_cache!=nullptr) global_free(m_cache); + m_cache.reset(); } /* @@ -1010,9 +1010,8 @@ mfmhd_trackimage_cache::~mfmhd_trackimage_cache() while (current != nullptr) { - global_free_array(current->encdata); mfmhd_trackimage* currenttmp = current->next; - global_free(current); + delete current; current = currenttmp; } } @@ -1025,7 +1024,7 @@ void mfmhd_trackimage_cache::write_back_one() { if (current->dirty) { - m_mfmhd->write_track(current->encdata, current->cylinder, current->head); + m_mfmhd->write_track(current->encdata.get(), current->cylinder, current->head); current->dirty = false; break; } @@ -1045,7 +1044,7 @@ void mfmhd_trackimage_cache::cleanup() if (TRACE_CACHE) m_machine.logerror("[%s:cache] MFM HD cache: evict line cylinder=%d head=%d\n", m_mfmhd->tag(), current->cylinder, current->head); if (current->dirty) { - m_mfmhd->write_track(current->encdata, current->cylinder, current->head); + m_mfmhd->write_track(current->encdata.get(), current->cylinder, current->head); current->dirty = false; } mfmhd_trackimage* currenttmp = current->next; @@ -1087,11 +1086,11 @@ void mfmhd_trackimage_cache::init(mfm_harddisk_device* mfmhd, int tracksize, int { if (TRACE_DETAIL) m_machine.logerror("[%s:cache] MFM HD allocate cache slot\n", mfmhd->tag()); previous = current; - current = global_alloc(mfmhd_trackimage); - current->encdata = global_alloc_array(uint16_t, tracksize); + current = new mfmhd_trackimage; + current->encdata = std::make_unique<uint16_t []>(tracksize); // Load the first tracks into the slots - state = m_mfmhd->load_track(current->encdata, cylinder, head); + state = m_mfmhd->load_track(current->encdata.get(), cylinder, head); if (state != CHDERR_NONE) throw emu_fatalerror("Cannot load (c=%d,h=%d) from hard disk", cylinder, head); current->dirty = false; @@ -1148,7 +1147,7 @@ uint16_t* mfmhd_trackimage_cache::get_trackimage(int cylinder, int head) current->next = m_tracks; // put the previous head into the next field m_tracks = current; // set this line as new head } - return current->encdata; + return current->encdata.get(); } else { @@ -1168,11 +1167,11 @@ uint16_t* mfmhd_trackimage_cache::get_trackimage(int cylinder, int head) if (current->dirty) { - m_mfmhd->write_track(current->encdata, current->cylinder, current->head); + m_mfmhd->write_track(current->encdata.get(), current->cylinder, current->head); current->dirty = false; } - state = m_mfmhd->load_track(current->encdata, cylinder, head); + state = m_mfmhd->load_track(current->encdata.get(), cylinder, head); current->dirty = false; current->cylinder = cylinder; diff --git a/src/devices/imagedev/mfmhd.h b/src/devices/imagedev/mfmhd.h index 2d689a168cb..007be4be420 100644 --- a/src/devices/imagedev/mfmhd.h +++ b/src/devices/imagedev/mfmhd.h @@ -27,7 +27,7 @@ public: bool dirty; int cylinder; int head; - uint16_t* encdata; // MFM encoding per byte + std::unique_ptr<uint16_t []> encdata; // MFM encoding per byte mfmhd_trackimage* next; }; @@ -152,7 +152,7 @@ private: attotime m_settle_time; attotime m_step_time; - mfmhd_trackimage_cache* m_cache; + std::unique_ptr<mfmhd_trackimage_cache> m_cache; mfmhd_image_format_t* m_format; void head_move(); diff --git a/src/devices/imagedev/midiin.cpp b/src/devices/imagedev/midiin.cpp index 6086cb48a3e..62c7cba52a1 100644 --- a/src/devices/imagedev/midiin.cpp +++ b/src/devices/imagedev/midiin.cpp @@ -26,7 +26,7 @@ midiin_device::midiin_device(const machine_config &mconfig, const char *tag, dev : device_t(mconfig, MIDIIN, tag, owner, clock), device_image_interface(mconfig, *this), device_serial_interface(mconfig, *this), - m_midi(nullptr), + m_midi(), m_timer(nullptr), m_input_cb(*this), m_xmit_read(0), @@ -43,7 +43,7 @@ void midiin_device::device_start() { m_input_cb.resolve_safe(); m_timer = timer_alloc(0); - m_midi = nullptr; + m_midi.reset(); m_timer->enable(false); } @@ -68,7 +68,7 @@ void midiin_device::device_timer(emu_timer &timer, device_timer_id id, int param uint8_t buf[8192*4]; int bytesRead; - if (m_midi == nullptr) { + if (!m_midi) { return; } @@ -91,14 +91,13 @@ void midiin_device::device_timer(emu_timer &timer, device_timer_id id, int param call_load -------------------------------------------------*/ -image_init_result midiin_device::call_load(void) +image_init_result midiin_device::call_load() { m_midi = machine().osd().create_midi_device(); if (!m_midi->open_input(filename())) { - global_free(m_midi); - m_midi = nullptr; + m_midi.reset(); return image_init_result::FAIL; } @@ -111,15 +110,14 @@ image_init_result midiin_device::call_load(void) call_unload -------------------------------------------------*/ -void midiin_device::call_unload(void) +void midiin_device::call_unload() { if (m_midi) { m_midi->close(); - global_free(m_midi); } - m_timer->enable(false); - m_midi = nullptr; + m_midi.reset(); + m_timer->enable(false); } void midiin_device::tra_complete() diff --git a/src/devices/imagedev/midiin.h b/src/devices/imagedev/midiin.h index ad9eeabf236..dbebdfd71fc 100644 --- a/src/devices/imagedev/midiin.h +++ b/src/devices/imagedev/midiin.h @@ -60,7 +60,7 @@ private: void xmit_char(uint8_t data); - osd_midi_device *m_midi; + std::unique_ptr<osd_midi_device> m_midi; emu_timer *m_timer; devcb_write_line m_input_cb; uint8_t m_xmitring[XMIT_RING_SIZE]; diff --git a/src/devices/imagedev/midiout.cpp b/src/devices/imagedev/midiout.cpp index 3c0613e2015..e9551a50d17 100644 --- a/src/devices/imagedev/midiout.cpp +++ b/src/devices/imagedev/midiout.cpp @@ -26,7 +26,7 @@ midiout_device::midiout_device(const machine_config &mconfig, const char *tag, d : device_t(mconfig, MIDIOUT, tag, owner, clock), device_image_interface(mconfig, *this), device_serial_interface(mconfig, *this), - m_midi(nullptr) + m_midi() { } @@ -36,7 +36,7 @@ midiout_device::midiout_device(const machine_config &mconfig, const char *tag, d void midiout_device::device_start() { - m_midi = nullptr; + m_midi.reset(); } void midiout_device::device_reset() @@ -51,14 +51,13 @@ void midiout_device::device_reset() call_load -------------------------------------------------*/ -image_init_result midiout_device::call_load(void) +image_init_result midiout_device::call_load() { m_midi = machine().osd().create_midi_device(); if (!m_midi->open_output(filename())) { - global_free(m_midi); - m_midi = nullptr; + m_midi.reset(); return image_init_result::FAIL; } @@ -69,13 +68,12 @@ image_init_result midiout_device::call_load(void) call_unload -------------------------------------------------*/ -void midiout_device::call_unload(void) +void midiout_device::call_unload() { if (m_midi) { m_midi->close(); - global_free(m_midi); - m_midi = nullptr; + m_midi.reset(); } } diff --git a/src/devices/imagedev/midiout.h b/src/devices/imagedev/midiout.h index 2b182e0273d..20bc87131c5 100644 --- a/src/devices/imagedev/midiout.h +++ b/src/devices/imagedev/midiout.h @@ -53,7 +53,7 @@ protected: virtual void rcv_complete() override; // Rx completed receiving byte private: - osd_midi_device *m_midi; + std::unique_ptr<osd_midi_device> m_midi; }; // device type definition diff --git a/src/devices/machine/upd765.cpp b/src/devices/machine/upd765.cpp index 6328ec74dab..85aabb49335 100644 --- a/src/devices/machine/upd765.cpp +++ b/src/devices/machine/upd765.cpp @@ -174,6 +174,7 @@ upd765_family_device::upd765_family_device(const machine_config &mconfig, device ready_polled(true), select_connected(true), select_multiplexed(true), + has_dor(true), external_ready(false), recalibrate_steps(77), mode(mode_t::AT), @@ -181,8 +182,7 @@ upd765_family_device::upd765_family_device(const machine_config &mconfig, device drq_cb(*this), hdl_cb(*this), idx_cb(*this), - us_cb(*this), - dor_reset(0x00) + us_cb(*this) { } @@ -245,6 +245,7 @@ void upd765_family_device::device_start() cur_rate = 250000; tc = false; selected_drive = -1; + dor = 0x0c; // reset at upper levels may cause a write to tc ending up with // live_sync, which will crash if the live structure isn't @@ -267,7 +268,8 @@ void upd765_family_device::device_start() void upd765_family_device::device_reset() { - dor = dor_reset; + if(has_dor) + dor = 0x00; locked = false; soft_reset(); } @@ -304,6 +306,14 @@ void upd765_family_device::soft_reset() set_ds(select_multiplexed ? 0 : -1); check_irq(); + if(BIT(dor, 2)) + end_reset(); + else if(ready_polled) + poll_timer->adjust(attotime::never); +} + +void upd765_family_device::end_reset() +{ if(ready_polled) poll_timer->adjust(attotime::from_usec(100), 0, attotime::from_usec(1024)); } @@ -333,6 +343,25 @@ bool upd765_family_device::get_ready(int fid) return !external_ready; } +WRITE_LINE_MEMBER(upd765_family_device::reset_w) +{ + // This implementation is not valid for devices with DOR and possibly other extra registers. + // The working assumption is that no need to manipulate the RESET line directly when software can use DOR instead. + assert(!has_dor); + if(bool(state) == !BIT(dor, 2)) + return; + + LOGREGS("reset = %d\n", state); + if(state) { + dor &= 0xfb; + soft_reset(); + } + else { + dor |= 0x04; + end_reset(); + } +} + void upd765_family_device::set_ds(int fid) { if(selected_drive == fid) @@ -399,11 +428,16 @@ uint8_t upd765_family_device::dor_r() void upd765_family_device::dor_w(uint8_t data) { + assert(has_dor); LOGREGS("dor = %02x\n", data); uint8_t diff = dor ^ data; dor = data; - if(diff & 4) - soft_reset(); + if(BIT(diff, 2)) { + if(BIT(data, 2)) + end_reset(); + else + soft_reset(); + } for(int i=0; i<4; i++) { floppy_info &fi = flopi[i]; @@ -513,6 +547,9 @@ uint8_t upd765_family_device::fifo_r() void upd765_family_device::fifo_w(uint8_t data) { + if(!BIT(dor, 2)) + LOGWARN("%s: fifo_w(%02x) in reset\n", machine().describe_context(), data); + switch(main_phase) { case PHASE_CMD: { command[command_pos++] = data; @@ -780,7 +817,7 @@ void upd765_family_device::live_run(attotime limit) if(read_one_bit(limit)) return; - LOGSHIFT("%s: shift = %04x data=%02x c=%d\n", tts(cur_live.tm), cur_live.shift_reg, + LOGSHIFT("%s: shift = %04x data=%02x c=%d\n", cur_live.tm.to_string(), cur_live.shift_reg, (cur_live.shift_reg & 0x4000 ? 0x80 : 0x00) | (cur_live.shift_reg & 0x1000 ? 0x40 : 0x00) | (cur_live.shift_reg & 0x0400 ? 0x20 : 0x00) | @@ -796,7 +833,7 @@ void upd765_family_device::live_run(attotime limit) cur_live.data_separator_phase = false; cur_live.bit_counter = 0; cur_live.state = READ_HEADER_BLOCK_HEADER; - LOGLIVE("%s: Found A1\n", tts(cur_live.tm)); + LOGLIVE("%s: Found A1\n", cur_live.tm.to_string()); } if(!mfm && cur_live.shift_reg == 0xf57e) { @@ -804,7 +841,7 @@ void upd765_family_device::live_run(attotime limit) cur_live.data_separator_phase = false; cur_live.bit_counter = 0; cur_live.state = READ_ID_BLOCK; - LOGLIVE("%s: Found IDAM\n", tts(cur_live.tm)); + LOGLIVE("%s: Found IDAM\n", cur_live.tm.to_string()); } break; @@ -812,7 +849,7 @@ void upd765_family_device::live_run(attotime limit) if(read_one_bit(limit)) return; - LOGSHIFT("%s: shift = %04x data=%02x counter=%d\n", tts(cur_live.tm), cur_live.shift_reg, + LOGSHIFT("%s: shift = %04x data=%02x counter=%d\n", cur_live.tm.to_string(), cur_live.shift_reg, (cur_live.shift_reg & 0x4000 ? 0x80 : 0x00) | (cur_live.shift_reg & 0x1000 ? 0x40 : 0x00) | (cur_live.shift_reg & 0x0400 ? 0x20 : 0x00) | @@ -832,11 +869,11 @@ void upd765_family_device::live_run(attotime limit) if(cur_live.shift_reg != 0x4489) cur_live.state = SEARCH_ADDRESS_MARK_HEADER; else - LOGLIVE("%s: Found A1\n", tts(cur_live.tm)); + LOGLIVE("%s: Found A1\n", cur_live.tm.to_string()); break; } if(cur_live.data_reg != 0xfe) { - LOGLIVE("%s: No ident byte found after triple-A1, continue search\n", tts(cur_live.tm)); + LOGLIVE("%s: No ident byte found after triple-A1, continue search\n", cur_live.tm.to_string()); cur_live.state = SEARCH_ADDRESS_MARK_HEADER; break; } @@ -854,7 +891,7 @@ void upd765_family_device::live_run(attotime limit) break; int slot = (cur_live.bit_counter >> 4)-1; - LOGLIVE("%s: slot=%d data=%02x crc=%04x\n", tts(cur_live.tm), slot, cur_live.data_reg, cur_live.crc); + LOGLIVE("%s: slot=%d data=%02x crc=%04x\n", cur_live.tm.to_string(), slot, cur_live.data_reg, cur_live.crc); cur_live.idbuf[slot] = cur_live.data_reg; if(slot == 5) { live_delay(IDLE); @@ -867,7 +904,7 @@ void upd765_family_device::live_run(attotime limit) if(read_one_bit(limit)) return; - LOGSHIFT("%s: shift = %04x data=%02x c=%d.%x\n", tts(cur_live.tm), cur_live.shift_reg, + LOGSHIFT("%s: shift = %04x data=%02x c=%d.%x\n", cur_live.tm.to_string(), cur_live.shift_reg, (cur_live.shift_reg & 0x4000 ? 0x80 : 0x00) | (cur_live.shift_reg & 0x1000 ? 0x40 : 0x00) | (cur_live.shift_reg & 0x0400 ? 0x20 : 0x00) | @@ -912,7 +949,7 @@ void upd765_family_device::live_run(attotime limit) if(read_one_bit(limit)) return; - LOGSHIFT("%s: shift = %04x data=%02x counter=%d\n", tts(cur_live.tm), cur_live.shift_reg, + LOGSHIFT("%s: shift = %04x data=%02x counter=%d\n", cur_live.tm.to_string(), cur_live.shift_reg, (cur_live.shift_reg & 0x4000 ? 0x80 : 0x00) | (cur_live.shift_reg & 0x1000 ? 0x40 : 0x00) | (cur_live.shift_reg & 0x0400 ? 0x20 : 0x00) | @@ -1218,7 +1255,7 @@ void upd765_family_device::live_run(attotime limit) break; default: - LOGWARN("%s: Unknown live state %d\n", tts(cur_live.tm), cur_live.state); + LOGWARN("%s: Unknown live state %d\n", cur_live.tm.to_string(), cur_live.state); return; } } @@ -2412,17 +2449,6 @@ bool upd765_family_device::get_irq() const return cur_irq; } -std::string upd765_family_device::tts(attotime t) -{ - const char *sign = ""; - if(t.seconds() < 0) { - t = attotime::zero - t; - sign = "-"; - } - int const nsec = t.attoseconds() / ATTOSECONDS_PER_NANOSECOND; - return util::string_format("%s%04d.%03d,%03d,%03d", sign, int(t.seconds()), nsec/1000000, (nsec/1000)%1000, nsec % 1000); -} - std::string upd765_family_device::results() const { std::ostringstream stream; @@ -2440,7 +2466,7 @@ std::string upd765_family_device::results() const std::string upd765_family_device::ttsn() const { - return tts(machine().time()); + return machine().time().to_string(); } void upd765_family_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) @@ -2623,7 +2649,7 @@ bool upd765_family_device::write_one_bit(const attotime &limit) void upd765_family_device::live_write_raw(uint16_t raw) { - LOGLIVE("%s: write %04x %04x\n", tts(cur_live.tm), raw, cur_live.crc); + LOGLIVE("%s: write %04x %04x\n", cur_live.tm.to_string(), raw, cur_live.crc); cur_live.shift_reg = raw; cur_live.data_bit_context = raw & 1; } @@ -2643,7 +2669,7 @@ void upd765_family_device::live_write_mfm(uint8_t mfm) cur_live.data_reg = mfm; cur_live.shift_reg = raw; cur_live.data_bit_context = context; - LOGLIVE("%s: write %02x %04x %04x\n", tts(cur_live.tm), mfm, cur_live.crc, raw); + LOGLIVE("%s: write %02x %04x %04x\n", cur_live.tm.to_string(), mfm, cur_live.crc, raw); } void upd765_family_device::live_write_fm(uint8_t fm) @@ -2655,7 +2681,7 @@ void upd765_family_device::live_write_fm(uint8_t fm) cur_live.data_reg = fm; cur_live.shift_reg = raw; cur_live.data_bit_context = fm & 1; - LOGLIVE("%s: write %02x %04x %04x\n", tts(cur_live.tm), fm, cur_live.crc, raw); + LOGLIVE("%s: write %02x %04x %04x\n", cur_live.tm.to_string(), fm, cur_live.crc, raw); } bool upd765_family_device::sector_matches() const @@ -2672,17 +2698,17 @@ bool upd765_family_device::sector_matches() const upd765a_device::upd765a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : upd765_family_device(mconfig, UPD765A, tag, owner, clock) { - dor_reset = 0x0c; + has_dor = false; } upd765b_device::upd765b_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : upd765_family_device(mconfig, UPD765B, tag, owner, clock) { - dor_reset = 0x0c; + has_dor = false; } i8272a_device::i8272a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : upd765_family_device(mconfig, I8272A, tag, owner, clock) { - dor_reset = 0x0c; + has_dor = false; } upd72065_device::upd72065_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : upd72065_device(mconfig, UPD72065, tag, owner, clock) @@ -2691,7 +2717,7 @@ upd72065_device::upd72065_device(const machine_config &mconfig, const char *tag, upd72065_device::upd72065_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : upd765_family_device(mconfig, type, tag, owner, clock) { - dor_reset = 0x0c; + has_dor = false; recalibrate_steps = 255; } @@ -2713,7 +2739,7 @@ upd72069_device::upd72069_device(const machine_config &mconfig, const char *tag, i82072_device::i82072_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : upd765_family_device(mconfig, I82072, tag, owner, clock) { - dor_reset = 0x0c; + has_dor = false; recalibrate_steps = 255; } @@ -3089,7 +3115,7 @@ mcs3201_device::mcs3201_device(const machine_config &mconfig, const char *tag, d upd765_family_device(mconfig, MCS3201, tag, owner, clock), m_input_handler(*this) { - dor_reset = 0x0c; + has_dor = true; ready_polled = false; ready_connected = false; select_connected = true; diff --git a/src/devices/machine/upd765.h b/src/devices/machine/upd765.h index 0c81f5aaa77..0ba8aa6d1c7 100644 --- a/src/devices/machine/upd765.h +++ b/src/devices/machine/upd765.h @@ -49,6 +49,7 @@ public: void ready_w(bool val); DECLARE_WRITE_LINE_MEMBER(tc_line_w) { tc_w(state == ASSERT_LINE); } + DECLARE_WRITE_LINE_MEMBER(reset_w); void set_rate(int rate); // rate in bps, to be used when the fdc is externally frequency-controlled @@ -231,7 +232,7 @@ protected: static constexpr int rates[4] = { 500000, 300000, 250000, 1000000 }; - bool ready_connected, ready_polled, select_connected, select_multiplexed; + bool ready_connected, ready_polled, select_connected, select_multiplexed, has_dor; bool external_ready; @@ -250,7 +251,7 @@ protected: bool fifo_write; uint8_t dor, dsr, msr, fifo[16], command[16], result[16]; uint8_t st1, st2, st3; - uint8_t fifocfg, dor_reset; + uint8_t fifocfg; uint8_t precomp; uint16_t spec; int sector_size; @@ -259,7 +260,6 @@ protected: emu_timer *poll_timer; - static std::string tts(attotime t); std::string results() const; std::string ttsn() const; @@ -288,6 +288,8 @@ protected: C_INCOMPLETE }; + void end_reset(); + void delay_cycles(emu_timer *tm, int cycles); void check_irq(); void fifo_expect(int size, bool write); diff --git a/src/devices/sound/namco.cpp b/src/devices/sound/namco.cpp index 46f04d4c34d..694dad0cd29 100644 --- a/src/devices/sound/namco.cpp +++ b/src/devices/sound/namco.cpp @@ -52,7 +52,6 @@ namco_audio_device::namco_audio_device(const machine_config &mconfig, device_typ , device_sound_interface(mconfig, *this) , m_wave_ptr(*this, DEVICE_SELF) , m_last_channel(nullptr) - , m_soundregs(nullptr) , m_wavedata(nullptr) , m_wave_size(0) , m_sound_enable(false) @@ -67,11 +66,13 @@ namco_audio_device::namco_audio_device(const machine_config &mconfig, device_typ namco_device::namco_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : namco_audio_device(mconfig, NAMCO, tag, owner, clock) + , m_soundregs(nullptr) { } namco_15xx_device::namco_15xx_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :namco_audio_device(mconfig, NAMCO_15XX, tag, owner, clock) + , m_soundregs(nullptr) { } @@ -87,13 +88,9 @@ namco_cus30_device::namco_cus30_device(const machine_config &mconfig, const char void namco_audio_device::device_start() { - sound_channel *voice; - /* extract globals from the interface */ m_last_channel = m_channel_list + m_voices; - m_soundregs = auto_alloc_array_clear(machine(), uint8_t, 0x400); - /* build the waveform table */ build_decoded_waveform(m_wave_ptr); @@ -107,20 +104,17 @@ void namco_audio_device::device_start() m_sound_enable = true; /* register with the save state system */ - save_pointer(NAME(m_soundregs), 0x400); - if (m_wave_ptr == nullptr) save_pointer(NAME(m_wavedata), 0x400); save_item(NAME(m_voices)); save_item(NAME(m_sound_enable)); - save_pointer(NAME(m_waveform[0]), MAX_VOLUME * 32 * 8 * (1+m_wave_size)); + for (int v = 0; v < MAX_VOLUME; v++) + save_pointer(NAME(m_waveform[v]), 32 * 8 * (1+m_wave_size), v); /* reset all the voices */ - for (voice = m_channel_list; voice < m_last_channel; voice++) + for (sound_channel *voice = m_channel_list; voice < m_last_channel; voice++) { - int voicenum = voice - m_channel_list; - voice->frequency = 0; voice->volume[0] = voice->volume[1] = 0; voice->waveform_select = 0; @@ -130,18 +124,36 @@ void namco_audio_device::device_start() voice->noise_seed = 1; voice->noise_counter = 0; voice->noise_hold = 0; - - /* register with the save state system */ - save_item(NAME(voice->frequency), voicenum); - save_item(NAME(voice->counter), voicenum); - save_item(NAME(voice->volume), voicenum); - save_item(NAME(voice->noise_sw), voicenum); - save_item(NAME(voice->noise_state), voicenum); - save_item(NAME(voice->noise_seed), voicenum); - save_item(NAME(voice->noise_hold), voicenum); - save_item(NAME(voice->noise_counter), voicenum); - save_item(NAME(voice->waveform_select), voicenum); } + + /* register with the save state system */ + save_pointer(STRUCT_MEMBER(m_channel_list, frequency), m_voices); + save_pointer(STRUCT_MEMBER(m_channel_list, counter), m_voices); + save_pointer(STRUCT_MEMBER(m_channel_list, volume), m_voices); + save_pointer(STRUCT_MEMBER(m_channel_list, noise_sw), m_voices); + save_pointer(STRUCT_MEMBER(m_channel_list, noise_state), m_voices); + save_pointer(STRUCT_MEMBER(m_channel_list, noise_seed), m_voices); + save_pointer(STRUCT_MEMBER(m_channel_list, noise_hold), m_voices); + save_pointer(STRUCT_MEMBER(m_channel_list, noise_counter), m_voices); + save_pointer(STRUCT_MEMBER(m_channel_list, waveform_select), m_voices); +} + + +void namco_device::device_start() +{ + namco_audio_device::device_start(); + + m_soundregs = make_unique_clear<uint8_t[]>(0x400); + save_pointer(NAME(m_soundregs), 0x400); +} + + +void namco_15xx_device::device_start() +{ + namco_audio_device::device_start(); + + m_soundregs = make_unique_clear<uint8_t[]>(0x400); + save_pointer(NAME(m_soundregs), 0x400); } @@ -196,14 +208,16 @@ void namco_audio_device::update_namco_waveform(int offset, uint8_t data) /* build the decoded waveform table */ void namco_audio_device::build_decoded_waveform(uint8_t *rgnbase) { - int16_t *p; - int size; - int offset; - int v; - - m_wavedata = (rgnbase != nullptr) ? rgnbase : auto_alloc_array_clear(machine(), uint8_t, 0x400); + if (rgnbase != nullptr) + m_wavedata = rgnbase; + else + { + m_waveram_alloc = make_unique_clear<uint8_t[]>(0x400); + m_wavedata = m_waveram_alloc.get(); + } /* 20pacgal has waves in RAM but old sound system */ + int size; if (rgnbase == nullptr && m_voices != 3) { m_wave_size = 1; @@ -215,20 +229,11 @@ void namco_audio_device::build_decoded_waveform(uint8_t *rgnbase) size = 32 * 8; /* 32 samples, 8 waveforms */ } - p = auto_alloc_array(machine(), int16_t, size * MAX_VOLUME); + for (int v = 0; v < MAX_VOLUME; v++) + m_waveform[v] = std::make_unique<int16_t[]>(size); - for (v = 0; v < MAX_VOLUME; v++) - { - m_waveform[v] = p; - p += size; - } - - /* We need waveform data. It fails if region is not specified. */ - if (m_wavedata) - { - for (offset = 0; offset < 256; offset++) - update_namco_waveform(offset, m_wavedata[offset]); - } + for (int offset = 0; offset < 256; offset++) + update_namco_waveform(offset, m_wavedata[offset]); } @@ -327,15 +332,17 @@ void namco_cus30_device::pacman_sound_w(offs_t offset, uint8_t data) sound_channel *voice; int ch; + uint8_t *soundregs = &m_wavedata[0x100]; + data &= 0x0f; - if (m_soundregs[offset] == data) + if (soundregs[offset] == data) return; /* update the streams */ m_stream->update(); /* set the register */ - m_soundregs[offset] = data; + soundregs[offset] = data; if (offset < 0x10) ch = (offset - 5) / 5; @@ -362,11 +369,11 @@ void namco_cus30_device::pacman_sound_w(offs_t offset, uint8_t data) case 0x14: /* the frequency has 20 bits */ /* the first voice has extra frequency bits */ - voice->frequency = (ch == 0) ? m_soundregs[0x10] : 0; - voice->frequency += (m_soundregs[ch * 5 + 0x11] << 4); - voice->frequency += (m_soundregs[ch * 5 + 0x12] << 8); - voice->frequency += (m_soundregs[ch * 5 + 0x13] << 12); - voice->frequency += (m_soundregs[ch * 5 + 0x14] << 16); /* always 0 */ + voice->frequency = (ch == 0) ? soundregs[0x10] : 0; + voice->frequency += (soundregs[ch * 5 + 0x11] << 4); + voice->frequency += (soundregs[ch * 5 + 0x12] << 8); + voice->frequency += (soundregs[ch * 5 + 0x13] << 12); + voice->frequency += (soundregs[ch * 5 + 0x14] << 16); /* always 0 */ break; case 0x15: @@ -566,16 +573,16 @@ void namco_cus30_device::namcos1_sound_w(offs_t offset, uint8_t data) return; } - m_soundregs = m_wavedata + 0x100; + uint8_t *soundregs = &m_wavedata[0x100]; - if (m_soundregs[offset] == data) + if (soundregs[offset] == data) return; /* update the streams */ m_stream->update(); /* set the register */ - m_soundregs[offset] = data; + soundregs[offset] = data; ch = offset / 8; if (ch >= m_voices) @@ -594,9 +601,9 @@ void namco_cus30_device::namcos1_sound_w(offs_t offset, uint8_t data) case 0x02: case 0x03: /* the frequency has 20 bits */ - voice->frequency = (m_soundregs[ch * 8 + 0x01] & 15) << 16; /* high bits are from here */ - voice->frequency += m_soundregs[ch * 8 + 0x02] << 8; - voice->frequency += m_soundregs[ch * 8 + 0x03]; + voice->frequency = (soundregs[ch * 8 + 0x01] & 15) << 16; /* high bits are from here */ + voice->frequency += soundregs[ch * 8 + 0x02] << 8; + voice->frequency += soundregs[ch * 8 + 0x03]; break; case 0x04: diff --git a/src/devices/sound/namco.h b/src/devices/sound/namco.h index 6b3cee6a1f5..f032a71a536 100644 --- a/src/devices/sound/namco.h +++ b/src/devices/sound/namco.h @@ -52,7 +52,6 @@ protected: /* data about the sound system */ sound_channel m_channel_list[MAX_VOICES]; sound_channel *m_last_channel; - uint8_t *m_soundregs; uint8_t *m_wavedata; /* global sound parameters */ @@ -66,8 +65,10 @@ protected: int m_voices; /* number of voices */ bool m_stereo; /* set to indicate stereo (e.g., System 1) */ + std::unique_ptr<uint8_t[]> m_waveram_alloc; + /* decoded waveform table */ - int16_t *m_waveform[MAX_VOLUME]; + std::unique_ptr<int16_t[]> m_waveform[MAX_VOLUME]; virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; }; @@ -79,13 +80,17 @@ public: void pacman_sound_w(offs_t offset, uint8_t data); - void polepos_sound_enable(int enable); - uint8_t polepos_sound_r(offs_t offset); void polepos_sound_w(offs_t offset, uint8_t data); protected: + // device-level overrides + virtual void device_start() override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; + +private: + std::unique_ptr<uint8_t[]> m_soundregs; }; @@ -99,7 +104,13 @@ public: void sharedram_w(offs_t offset, uint8_t data); protected: + // device-level overrides + virtual void device_start() override; + virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; + +private: + std::unique_ptr<uint8_t[]> m_soundregs; }; diff --git a/src/devices/sound/spu.cpp b/src/devices/sound/spu.cpp index 2f85c6c87f7..9a8f503cf04 100644 --- a/src/devices/sound/spu.cpp +++ b/src/devices/sound/spu.cpp @@ -272,7 +272,8 @@ public: invalid_end, loopaddr, last_update_end; - signed short *data,*loop,*dend; + std::unique_ptr<signed short []> data; + signed short *loop,*dend; adpcm_decoder decoder, update_decoder; mutable int ref_count; bool valid, @@ -301,8 +302,8 @@ public: ref_count--; if (ref_count==0) { - cache_size-=(dend-data)<<1; - global_free(this); + cache_size-=(dend-data.get())<<1; + delete this; } } @@ -521,7 +522,7 @@ public: head=xam->offset; marker_tail=xam->prev; if (marker_tail) marker_tail->next=nullptr; - global_free(xam); + delete xam; } // Set marker head to nullptr if the list is now empty @@ -544,7 +545,7 @@ public: { stream_marker *m=marker_head; marker_head=marker_head->next; - global_free(m); + delete m; } marker_head=marker_tail=nullptr; @@ -566,7 +567,7 @@ public: stream_marker *xam=marker_head; marker_head=xam->next; - global_free(xam); + delete xam; if (marker_head) marker_head->prev=nullptr; } @@ -606,12 +607,12 @@ static inline int clamp(const int v) spu_device::sample_cache::~sample_cache() { - global_free_array(data); + data.reset(); while (loop_cache) { sample_loop_cache *lc=loop_cache; loop_cache=lc->next; - global_free(lc); + delete lc; } } @@ -623,7 +624,7 @@ signed short *spu_device::sample_cache::get_sample_pointer(const unsigned int ad { if ((addr>=start) && (addr<end)) { - return data+(((addr-start)>>4)*28); + return &data[((addr-start)>>4)*28]; } else { return nullptr; @@ -668,9 +669,9 @@ bool spu_device::sample_cache::get_loop_pointer(cache_pointer *cp) unsigned int spu_device::sample_cache::get_sample_address(const signed short *ptr) const { - if ((ptr>=data) && (ptr<=dend)) + if ((ptr>=data.get()) && (ptr<=dend)) { - return start+(((ptr-data)/28)<<4); + return start+(((ptr-data.get())/28)<<4); } else { return -1; @@ -705,7 +706,7 @@ void spu_device::sample_cache::add_loop_cache(sample_loop_cache *lc) bool spu_device::sample_cache::is_valid_pointer(signed short *ptr) const { - if ((ptr>=data) && (data<=dend)) return true; + if ((ptr>=data.get()) && (data.get()<=dend)) return true; for (sample_loop_cache *slc=loop_cache; slc; slc=slc->next) if ((ptr>=slc->data) && (ptr<(slc->data+num_loop_cache_samples))) return true; @@ -720,7 +721,7 @@ bool spu_device::sample_cache::try_update(spu_device *spu) { if ((invalid_start>=start) && (invalid_end<=end)) { - adpcm_packet *ap=(adpcm_packet *)(spu->spu_ram+start); + adpcm_packet *ap=(adpcm_packet *)&spu->spu_ram[start]; unsigned int a; unsigned int loop=0; @@ -756,8 +757,8 @@ bool spu_device::sample_cache::try_update(spu_device *spu) printf("\n"); #endif - signed short *dp=data+(((invalid_start-start)>>4)*28); - ap=(adpcm_packet *)(spu->spu_ram+invalid_start); + signed short *dp=&data[((invalid_start-start)>>4)*28]; + ap=(adpcm_packet *)&spu->spu_ram[invalid_start]; for (a=invalid_start; a<invalid_end; a+=16, ap++) dp=update_decoder.decode_packet(ap,dp); @@ -779,7 +780,7 @@ bool spu_device::sample_cache::try_update(spu_device *spu) signed short *dpend=dp+lc->len; unsigned int adr=lc->loopstart; for (unsigned int i=0; ((i<num_loop_cache_packets) && (dp<dpend)); i++, adr+=16) - dp=tmp.decode_packet((adpcm_packet *)(spu->spu_ram+adr),dp); + dp=tmp.decode_packet((adpcm_packet *)&spu->spu_ram[adr],dp); } } @@ -847,7 +848,7 @@ bool spu_device::cache_pointer::update(spu_device *spu) // Cache is invalid, calculate play address offset from start of // old cache block - unsigned int off=ptr-cache->data, + unsigned int off=ptr-cache->data.get(), addr=cache->start; // Release cache block and get updated one @@ -856,7 +857,7 @@ bool spu_device::cache_pointer::update(spu_device *spu) // Calculate play address in new cache block - ptr=cache->data+off; + ptr=&cache->data[off]; if (ptr>=cache->dend) { @@ -870,7 +871,7 @@ bool spu_device::cache_pointer::update(spu_device *spu) // Return false if we do not have a cache block or the play address is invalid - if ((cache) && ((ptr>=cache->data) && (ptr<cache->dend))) + if ((cache) && ((ptr>=cache->data.get()) && (ptr<cache->dend))) { return true; } else @@ -967,15 +968,15 @@ void spu_device::device_start() m_irq_handler.resolve_safe(); voice=new voiceinfo [24]; - spu_ram=new unsigned char [spu_ram_size]; + spu_ram=std::make_unique<unsigned char []>(spu_ram_size); xa_buffer=new spu_stream_buffer(xa_sector_size,xa_buffer_sectors); cdda_buffer=new spu_stream_buffer(cdda_sector_size,cdda_buffer_sectors); init_stream(); - cache=new sample_cache *[spu_ram_size>>4]; - memset(cache,0,(spu_ram_size>>4)*sizeof(sample_cache *)); + cache=std::make_unique<sample_cache * []>(spu_ram_size>>4); + std::fill_n(cache.get(), spu_ram_size>>4, nullptr); // register save state stuff save_item(NAME(reg)); // this covers all spureg.* plus the reverb parameter block @@ -1031,16 +1032,16 @@ void spu_device::device_reset() cdda_playing=false; m_cd_out_ptr = 0; - memset(spu_ram,0,spu_ram_size); + memset(spu_ram.get(),0,spu_ram_size); memset(reg,0,0x200); memset(voice,0,sizeof(voiceinfo)*24); spureg.status|=(1<<7)|(1<<10); - memset(cache,0,(spu_ram_size>>4)*sizeof(sample_cache *)); + std::fill_n(cache.get(), spu_ram_size>>4, nullptr); for (auto & elem : output_buf) - elem=new unsigned char [output_buffer_size]; + elem=std::make_unique<unsigned char []>(output_buffer_size); output_head=output_tail=output_size=0; noise_t=0; @@ -1058,7 +1059,7 @@ void spu_device::device_post_load() dirty_flags = -1; // kill and reallocate reverb to avoid artifacts - global_free(rev); + delete rev; rev = new reverb(44100); // and do some update processing @@ -1074,16 +1075,16 @@ void spu_device::device_post_load() void spu_device::device_stop() { for (auto & elem : output_buf) - global_free_array(elem); + elem.reset(); kill_stream(); - global_free_array(spu_ram); + spu_ram.reset(); invalidate_cache(0,spu_ram_size); - global_free_array(cache); - global_free(xa_buffer); - global_free(cdda_buffer); - global_free_array(voice); + cache.reset(); + delete xa_buffer; + delete cdda_buffer; + delete [] voice; } // // @@ -1107,7 +1108,7 @@ void spu_device::init_stream() void spu_device::kill_stream() { - global_free(rev); + delete rev; rev=nullptr; } @@ -1262,7 +1263,7 @@ void spu_device::write_data(const unsigned short data) assert(taddr<spu_ram_size); if (cache[taddr>>4]) flush_cache(cache[taddr>>4],taddr,taddr+2); - *((unsigned short *)(spu_ram+taddr))=data; + *((unsigned short *)&spu_ram[taddr])=data; taddr+=2; } @@ -1342,7 +1343,7 @@ spu_device::sample_cache *spu_device::get_sample_cache(const unsigned int addr) sc->start=addr; sc->loop=nullptr; - adpcm_packet *ap=(adpcm_packet *)(spu_ram+sc->start); + adpcm_packet *ap=(adpcm_packet *)&spu_ram[sc->start]; unsigned int a; for (a=addr; a<(512*1024); a+=16, ap++) { @@ -1358,13 +1359,13 @@ spu_device::sample_cache *spu_device::get_sample_cache(const unsigned int addr) sc->end=(std::min)(spu_ram_size,a+16); unsigned int sz=((sc->end-sc->start)>>4)*28; - sc->data=new signed short [sz]; + sc->data=std::make_unique<signed short []>(sz); sample_cache::cache_size+=sz<<1; sc->loopaddr=loop; - if (loop) sc->loop=sc->data+(((loop-sc->start)>>4)*28); + if (loop) sc->loop=&sc->data[((loop-sc->start)>>4)*28]; - signed short *dp=sc->data; - ap=(adpcm_packet *)(spu_ram+sc->start); + signed short *dp=sc->data.get(); + ap=(adpcm_packet *)&spu_ram[sc->start]; for (a=sc->start; a<sc->end; a+=16, ap++) dp=sc->decoder.decode_packet(ap,dp); @@ -1389,7 +1390,7 @@ bool spu_device::translate_sample_addr(const unsigned int addr, cache_pointer *c cp->reset(); if ((cp->cache=get_sample_cache(addr))) { - cp->ptr=cp->cache->data+(((addr-cp->cache->start)>>4)*28); + cp->ptr=&cp->cache->data[((addr-cp->cache->start)>>4)*28]; cp->cache->add_ref(); return true; } @@ -1530,7 +1531,7 @@ spu_device::sample_loop_cache *spu_device::get_loop_cache(sample_cache *cache, c signed short *dp=lc->data; for (unsigned int i=0; ((i<num_loop_cache_packets) && (adr<lpcache->end)); i++, adr+=16) - dp=tmp.decode_packet((adpcm_packet *)(spu_ram+adr),dp); + dp=tmp.decode_packet((adpcm_packet *)&spu_ram[adr],dp); #ifdef log_loop_cache log(log_spu,"spu: add loop cache %08x %08x->%08x (end at %08x)\n",lc,lpen,lpst,adr); @@ -1572,7 +1573,7 @@ void spu_device::update_voice_loop(const unsigned int v) { ra=spureg.voice[v].repaddr<<3; ra=(ra+0xf)&~0xf; - const adpcm_packet *ap=ra?(adpcm_packet *)(spu_ram+ra):nullptr; + const adpcm_packet *ap=ra?(adpcm_packet *)&spu_ram[ra]:nullptr; if (ap) { @@ -2393,8 +2394,8 @@ void spu_device::generate_xa(void *ptr, const unsigned int sz) // Write to SPU XA buffer (for emulation purposes - some games read this // back to do analysers, etc...) - *(signed short *)(spu_ram+xa_out_ptr)=vl; - *(signed short *)(spu_ram+xa_out_ptr+0x800)=vr; + *(signed short *)&spu_ram[xa_out_ptr]=vl; + *(signed short *)&spu_ram[xa_out_ptr+0x800]=vr; xa_out_ptr=(xa_out_ptr+2)&0x7ff; // Mix samples into output buffer @@ -2430,7 +2431,7 @@ void spu_device::generate_xa(void *ptr, const unsigned int sz) { xa_playing=false; - memset(spu_ram,0,0x1000); + memset(spu_ram.get(),0,0x1000); xa_out_ptr=0; } } @@ -2465,8 +2466,8 @@ void spu_device::generate_cdda(void *ptr, const unsigned int sz) int16_t vr = ((sp[1]*volr)>>15); // if the volume adjusted samples are stored here, vibribbon does nothing - *(signed short *)(spu_ram+m_cd_out_ptr)=sp[0]; - *(signed short *)(spu_ram+m_cd_out_ptr+0x400)=sp[1]; + *(signed short *)&spu_ram[m_cd_out_ptr]=sp[0]; + *(signed short *)&spu_ram[m_cd_out_ptr+0x400]=sp[1]; m_cd_out_ptr=(m_cd_out_ptr+2)&0x3ff; //if((m_cd_out_ptr == ((spureg.irq_addr << 3) & ~0x400)) && (spureg.ctrl & spuctrl_irq_enable)) @@ -2575,10 +2576,10 @@ void spu_device::generate(void *ptr, const unsigned int sz) while ((left) && (output_size)) { unsigned int n=(std::min)((std::min)(left,output_buffer_size-output_head),output_size); - memcpy(dp,output_buf[0]+output_head,n); + memcpy(dp,&output_buf[0][output_head],n); rev->process((signed short *)dp, - (signed short *)(output_buf[1]+output_head), + (signed short *)&output_buf[1][output_head], spu_reverb_cfg, (signed short)spureg.rvol_l, (signed short)spureg.rvol_r, @@ -2683,10 +2684,10 @@ void spu_device::process_until(const unsigned int tsample) process_samples=(std::min)(process_samples, (output_buffer_size-output_tail)>>2); - unsigned char *outptr=output_buf[0]+output_tail, - *reverbptr=output_buf[1]+output_tail, - *fmptr=output_buf[2]+output_tail, - *noiseptr=output_buf[3]+output_tail; + unsigned char *outptr=&output_buf[0][output_tail], + *reverbptr=&output_buf[1][output_tail], + *fmptr=&output_buf[2][output_tail], + *noiseptr=&output_buf[3][output_tail]; output_tail+=process_samples<<2; output_tail&=(output_buffer_size-1); @@ -2796,13 +2797,13 @@ void spu_device::start_dma(uint8_t *mainram, bool to_spu, uint32_t size) { invalidate_cache(st,en); - memcpy(spu_ram+(spureg.trans_addr<<3), mainram, size); + memcpy(&spu_ram[spureg.trans_addr<<3], mainram, size); dirty_flags|=dirtyflag_ram; } else { - memcpy(mainram, spu_ram+(spureg.trans_addr<<3), size); + memcpy(mainram, &spu_ram[spureg.trans_addr<<3], size); } } diff --git a/src/devices/sound/spu.h b/src/devices/sound/spu.h index 54942d9d324..7aee602e38c 100644 --- a/src/devices/sound/spu.h +++ b/src/devices/sound/spu.h @@ -49,7 +49,7 @@ protected: // internal state devcb_write_line m_irq_handler; - unsigned char *spu_ram; + std::unique_ptr<unsigned char []> spu_ram; reverb *rev; unsigned int taddr; unsigned int sample_t; @@ -73,13 +73,13 @@ protected: bool status_enabled, xa_playing, cdda_playing; int xa_voll, xa_volr, changed_xa_vol; voiceinfo *voice; - sample_cache **cache; + std::unique_ptr<sample_cache * []> cache; float samples_per_frame; float samples_per_cycle; static float freq_multiplier; - unsigned char *output_buf[4]; + std::unique_ptr<unsigned char []> output_buf[4]; unsigned int output_head; unsigned int output_tail; unsigned int output_size; diff --git a/src/devices/sound/spureverb.cpp b/src/devices/sound/spureverb.cpp index cf747af1acb..e57c33d448d 100644 --- a/src/devices/sound/spureverb.cpp +++ b/src/devices/sound/spureverb.cpp @@ -34,15 +34,11 @@ spu_device::reverb::reverb(const int hz, const int maxdelay) for (int c=0; c<2; c++) { for (int f=0; f<4; f++) { - y[c][f]=new signed short [maxdelay]; - memset(y[c][f], 0, sizeof(signed short) * maxdelay); + y[c][f]=make_unique_clear<signed short []>(maxdelay); } - x[c]=new signed short [maxdelay]; - memset(x[c], 0, sizeof(signed short) * maxdelay); - ax[c]=new signed short [maxdelay]; - memset(ax[c], 0, sizeof(signed short) * maxdelay); - ay[c]=new signed short [maxdelay]; - memset(ay[c], 0, sizeof(signed short) * maxdelay); + x[c]=make_unique_clear<signed short []>(maxdelay); + ax[c]=make_unique_clear<signed short []>(maxdelay); + ay[c]=make_unique_clear<signed short []>(maxdelay); } memset(bx1,0,sizeof(bx1)); memset(by1,0,sizeof(by1)); @@ -54,14 +50,6 @@ spu_device::reverb::reverb(const int hz, const int maxdelay) spu_device::reverb::~reverb() { - for (int c=0; c<2; c++) - { - for (int f=0; f<4; f++) - global_free_array(y[c][f]); - global_free_array(x[c]); - global_free_array(ax[c]); - global_free_array(ay[c]); - } } // diff --git a/src/devices/sound/spureverb.h b/src/devices/sound/spureverb.h index 64b174bcfb6..d87c3a6b4b8 100644 --- a/src/devices/sound/spureverb.h +++ b/src/devices/sound/spureverb.h @@ -29,12 +29,12 @@ struct spu_device::reverb_preset class spu_device::reverb { - signed short - *y[2][4], - *x[2], - *ax[2], - *ay[2], - bx1[2][2],by1[2]; + std::unique_ptr<signed short []> + y[2][4], + x[2], + ax[2], + ay[2]; + signed short bx1[2][2],by1[2]; int yp, max_delay, sound_hz; typedef int comb_param[2][4]; diff --git a/src/devices/sound/votrax.cpp b/src/devices/sound/votrax.cpp index f3a6e4d9234..067e639ed78 100644 --- a/src/devices/sound/votrax.cpp +++ b/src/devices/sound/votrax.cpp @@ -877,8 +877,11 @@ void votrax_sc01_device::build_lowpass_filter(double *a, double *b, double c1t, // Unswitched cap, over amp-op, top double c1b) // Switched cap, over amp-op, bottom { + // The caps values puts the cutoff at around 150Hz, put that's no good. + // Recordings shows we want it around 4K, so fuzz it. + // Compute the only coefficient we care about - double k = c1b / (m_cclock * c1t); + double k = c1b / (m_cclock * c1t) * (150.0/4000.0); // Compute the filter cutoff frequency double fpeak = 1/(2*M_PI*k); @@ -1001,7 +1004,7 @@ void votrax_sc01_device::build_injection_filter(double *a, double *b, b[1] = k1 + m; // That ends up in a numerically unstable filter. Neutralize it for now. - a[0] = 1; + a[0] = 0; a[1] = 0; b[0] = 1; b[1] = 0; diff --git a/src/emu/addrmap.cpp b/src/emu/addrmap.cpp index 61f7375d236..604e05ab864 100644 --- a/src/emu/addrmap.cpp +++ b/src/emu/addrmap.cpp @@ -873,7 +873,7 @@ void address_map::global_mask(offs_t mask) address_map_entry &address_map::operator()(offs_t start, offs_t end) { - address_map_entry *ptr = global_alloc(address_map_entry(*m_device, *this, start, end)); + address_map_entry *ptr = new address_map_entry(*m_device, *this, start, end); m_entrylist.append(*ptr); return *ptr; } diff --git a/src/emu/debug/debugvw.cpp b/src/emu/debug/debugvw.cpp index 1d88f0485e2..a104bb82529 100644 --- a/src/emu/debug/debugvw.cpp +++ b/src/emu/debug/debugvw.cpp @@ -326,7 +326,7 @@ debug_view_manager::~debug_view_manager() { debug_view *oldhead = m_viewlist; m_viewlist = oldhead->m_next; - global_free(oldhead); + delete oldhead; } } @@ -340,25 +340,25 @@ debug_view *debug_view_manager::alloc_view(debug_view_type type, debug_view_osd_ switch (type) { case DVT_CONSOLE: - return append(global_alloc(debug_view_console(machine(), osdupdate, osdprivate))); + return append(new debug_view_console(machine(), osdupdate, osdprivate)); case DVT_STATE: - return append(global_alloc(debug_view_state(machine(), osdupdate, osdprivate))); + return append(new debug_view_state(machine(), osdupdate, osdprivate)); case DVT_DISASSEMBLY: - return append(global_alloc(debug_view_disasm(machine(), osdupdate, osdprivate))); + return append(new debug_view_disasm(machine(), osdupdate, osdprivate)); case DVT_MEMORY: - return append(global_alloc(debug_view_memory(machine(), osdupdate, osdprivate))); + return append(new debug_view_memory(machine(), osdupdate, osdprivate)); case DVT_LOG: - return append(global_alloc(debug_view_log(machine(), osdupdate, osdprivate))); + return append(new debug_view_log(machine(), osdupdate, osdprivate)); case DVT_BREAK_POINTS: - return append(global_alloc(debug_view_breakpoints(machine(), osdupdate, osdprivate))); + return append(new debug_view_breakpoints(machine(), osdupdate, osdprivate)); case DVT_WATCH_POINTS: - return append(global_alloc(debug_view_watchpoints(machine(), osdupdate, osdprivate))); + return append(new debug_view_watchpoints(machine(), osdupdate, osdprivate)); default: fatalerror("Attempt to create invalid debug view type %d\n", type); @@ -378,7 +378,7 @@ void debug_view_manager::free_view(debug_view &view) if (*viewptr == &view) { *viewptr = view.m_next; - global_free(&view); + delete &view; break; } } diff --git a/src/emu/emualloc.cpp b/src/emu/emualloc.cpp index bc08416abb9..1dd78feaeed 100644 --- a/src/emu/emualloc.cpp +++ b/src/emu/emualloc.cpp @@ -143,7 +143,7 @@ void resource_pool::remove(void *ptr) // delete the object and break if (LOG_ALLOCS) fprintf(stderr, "#%06d, delete %d bytes\n", u32(deleteme->m_id), u32(deleteme->m_size)); - global_free(deleteme); + delete deleteme; break; } } diff --git a/src/emu/emualloc.h b/src/emu/emualloc.h index 0ed7cc7ea75..630c3d0a1fd 100644 --- a/src/emu/emualloc.h +++ b/src/emu/emualloc.h @@ -26,10 +26,10 @@ //************************************************************************** // pool allocation helpers -#define pool_alloc(_pool, _type) (_pool).add_object(global_alloc(_type)) -#define pool_alloc_clear(_pool, _type) (_pool).add_object(global_alloc_clear _type) -#define pool_alloc_array(_pool, _type, _num) (_pool).add_array(global_alloc_array(_type,_num), (_num)) -#define pool_alloc_array_clear(_pool, _type, _num) (_pool).add_array(global_alloc_array_clear<_type>(_num), (_num)) +#define pool_alloc(_pool, _type) (_pool).add_object(new _type) +#define pool_alloc_clear(_pool, _type) (_pool).add_object(make_unique_clear _type .release()) +#define pool_alloc_array(_pool, _type, _num) (_pool).add_array(new _type [_num], (_num)) +#define pool_alloc_array_clear(_pool, _type, _num) (_pool).add_array(make_unique_clear<_type []>(_num).release(), (_num)) #define pool_free(_pool, v) (_pool).remove(v) diff --git a/src/emu/ioport.cpp b/src/emu/ioport.cpp index f406ee6420b..bad25e4030a 100644 --- a/src/emu/ioport.cpp +++ b/src/emu/ioport.cpp @@ -1282,7 +1282,7 @@ void ioport_field::expand_diplocation(const char *location, std::string &errorbu errorbuf.append(string_format("Switch location '%s' has invalid format!\n", location)); // allocate a new entry - m_diploclist.append(*global_alloc(ioport_diplocation(name.c_str(), swnum, invert))); + m_diploclist.append(*new ioport_diplocation(name.c_str(), swnum, invert)); entries++; // advance to the next item @@ -1618,15 +1618,15 @@ ioport_port_live::ioport_port_live(ioport_port &port) // allocate analog state if it's analog analog_field *analog = nullptr; if (field.is_analog()) - analog = &analoglist.append(*global_alloc(analog_field(field))); + analog = &analoglist.append(*new analog_field(field)); // allocate a dynamic field for reading if (field.has_dynamic_read()) - readlist.append(*global_alloc(dynamic_field(field))); + readlist.append(*new dynamic_field(field)); // allocate a dynamic field for writing if (field.has_dynamic_write()) - writelist.append(*global_alloc(dynamic_field(field))); + writelist.append(*new dynamic_field(field)); // let the field initialize its live state field.init_live_state(analog); @@ -1956,7 +1956,7 @@ digital_joystick &ioport_manager::digjoystick(int player, int number) return joystick; // create a new one - return m_joystick_list.append(*global_alloc(digital_joystick(player, number))); + return m_joystick_list.append(*new digital_joystick(player, number)); } @@ -3011,7 +3011,7 @@ ioport_configurer& ioport_configurer::field_alloc(ioport_type type, ioport_value // append the field if (type != IPT_UNKNOWN && type != IPT_UNUSED) m_curport->m_active |= mask; - m_curfield = &m_curport->m_fieldlist.append(*global_alloc(ioport_field(*m_curport, type, defval, mask, string_from_token(name)))); + m_curfield = &m_curport->m_fieldlist.append(*new ioport_field(*m_curport, type, defval, mask, string_from_token(name))); // reset the current setting m_cursetting = nullptr; @@ -3068,7 +3068,7 @@ ioport_configurer& ioport_configurer::setting_alloc(ioport_value value, const ch if (m_curfield == nullptr) throw emu_fatalerror("alloc_setting called with no active field (value=%X name=%s)\n", value, name); - m_cursetting = global_alloc(ioport_setting(*m_curfield, value & m_curfield->mask(), string_from_token(name))); + m_cursetting = new ioport_setting(*m_curfield, value & m_curfield->mask(), string_from_token(name)); // append a new setting m_curfield->m_settinglist.append(*m_cursetting); return *this; diff --git a/src/emu/render.cpp b/src/emu/render.cpp index 817ae6e14cc..83cd3524532 100644 --- a/src/emu/render.cpp +++ b/src/emu/render.cpp @@ -337,11 +337,10 @@ void render_texture::reset(render_manager &manager, texture_scaler_func scaler, void render_texture::release() { // free all scaled versions - for (auto & elem : m_scaled) + for (auto &elem : m_scaled) { - m_manager->invalidate_all(elem.bitmap); - global_free(elem.bitmap); - elem.bitmap = nullptr; + m_manager->invalidate_all(elem.bitmap.get()); + elem.bitmap.reset(); elem.seqid = 0; } @@ -378,12 +377,9 @@ void render_texture::set_bitmap(bitmap_t &bitmap, const rectangle &sbounds, text // invalidate all scaled versions for (auto & elem : m_scaled) { - if (elem.bitmap != nullptr) - { - m_manager->invalidate_all(elem.bitmap); - global_free(elem.bitmap); - } - elem.bitmap = nullptr; + if (elem.bitmap) + m_manager->invalidate_all(elem.bitmap.get()); + elem.bitmap.reset(); elem.seqid = 0; } } @@ -460,21 +456,21 @@ void render_texture::get_scaled(u32 dwidth, u32 dheight, render_texinfo &texinfo // didn't find one -- take the entry with the lowest seqnum for (scalenum = 0; scalenum < ARRAY_LENGTH(m_scaled); scalenum++) - if ((lowest == -1 || m_scaled[scalenum].seqid < m_scaled[lowest].seqid) && !primlist.has_reference(m_scaled[scalenum].bitmap)) + if ((lowest == -1 || m_scaled[scalenum].seqid < m_scaled[lowest].seqid) && !primlist.has_reference(m_scaled[scalenum].bitmap.get())) lowest = scalenum; if (-1 == lowest) throw emu_fatalerror("render_texture::get_scaled: Too many live texture instances!"); // throw out any existing entries scaled = &m_scaled[lowest]; - if (scaled->bitmap != nullptr) + if (scaled->bitmap) { - m_manager->invalidate_all(scaled->bitmap); - global_free(scaled->bitmap); + m_manager->invalidate_all(scaled->bitmap.get()); + scaled->bitmap.reset(); } // allocate a new bitmap - scaled->bitmap = global_alloc(bitmap_argb32(dwidth, dheight)); + scaled->bitmap = std::make_unique<bitmap_argb32>(dwidth, dheight); scaled->seqid = ++m_curseq; // let the scaler do the work @@ -482,7 +478,7 @@ void render_texture::get_scaled(u32 dwidth, u32 dheight, render_texinfo &texinfo } // finally fill out the new info - primlist.add_reference(scaled->bitmap); + primlist.add_reference(scaled->bitmap.get()); texinfo.base = &scaled->bitmap->pix(0); texinfo.rowpixels = scaled->bitmap->rowpixels(); texinfo.width = dwidth; @@ -1086,13 +1082,14 @@ unsigned render_target::configured_view(const char *viewname, int targetindex, i screen_device const &screen = screens[index() % screens.size()]; for (unsigned i = 0; !view && (m_views.size() > i); ++i) { - for (screen_device const &viewscreen : m_views[i].first.get().screens()) + for (layout_view::item &viewitem : m_views[i].first.get().items()) { - if (&viewscreen == &screen) + screen_device const *const viewscreen(viewitem.screen()); + if (viewscreen == &screen) { view = &m_views[i].first.get(); } - else + else if (viewscreen) { view = nullptr; break; @@ -1107,9 +1104,8 @@ unsigned render_target::configured_view(const char *viewname, int targetindex, i for (unsigned i = 0; !view && (m_views.size() > i); ++i) { layout_view &curview = m_views[i].first; - if (curview.screen_count() >= screens.size()) - if (std::find_if(screens.begin(), screens.end(), [&curview] (screen_device &screen) { return !curview.has_screen(screen); }) == screens.end()) - view = &curview; + if (std::find_if(screens.begin(), screens.end(), [&curview] (screen_device &screen) { return !curview.has_screen(screen); }) == screens.end()) + view = &curview; } } } @@ -1471,7 +1467,7 @@ bool render_target::map_point_container(s32 target_x, s32 target_y, render_conta std::swap(target_f.first, target_f.second); // try to find the right container - auto const &items(current_view().screen_items()); + auto const &items(current_view().visible_screen_items()); auto const found(std::find_if( items.begin(), items.end(), @@ -1909,20 +1905,17 @@ void render_target::load_additional_layout_files(const char *basename, bool have int viewindex(0); for (layout_view *view = nth_view(viewindex); need_tiles && view; view = nth_view(++viewindex)) { - if (view->screen_count() >= screens.size()) + bool screen_missing(false); + for (screen_device &screen : iter) { - bool screen_missing(false); - for (screen_device &screen : iter) + if (!view->has_screen(screen)) { - if (!view->has_screen(screen)) - { - screen_missing = true; - break; - } + screen_missing = true; + break; } - if (!screen_missing) - need_tiles = false; } + if (!screen_missing) + need_tiles = false; } } if (need_tiles) @@ -3051,11 +3044,11 @@ done: //------------------------------------------------- render_manager::render_manager(running_machine &machine) - : m_machine(machine), - m_ui_target(nullptr), - m_live_textures(0), - m_texture_id(0), - m_ui_container(global_alloc(render_container(*this))) + : m_machine(machine) + , m_ui_target(nullptr) + , m_live_textures(0) + , m_texture_id(0) + , m_ui_container(new render_container(*this)) { // register callbacks machine.configuration().config_register("video", config_load_delegate(&render_manager::config_load, this), config_save_delegate(&render_manager::config_save, this)); @@ -3093,7 +3086,7 @@ bool render_manager::is_live(screen_device &screen) const if (!target.hidden()) { layout_view const *view = &target.current_view(); - if (view->has_screen(screen)) + if (view->has_visible_screen(screen)) return true; } } @@ -3129,12 +3122,12 @@ float render_manager::max_update_rate() const render_target *render_manager::target_alloc(const internal_layout *layoutfile, u32 flags) { - return &m_targetlist.append(*global_alloc(render_target(*this, layoutfile, flags))); + return &m_targetlist.append(*new render_target(*this, layoutfile, flags)); } render_target *render_manager::target_alloc(util::xml::data_node const &layout, u32 flags) { - return &m_targetlist.append(*global_alloc(render_target(*this, layout, flags))); + return &m_targetlist.append(*new render_target(*this, layout, flags)); } @@ -3251,19 +3244,9 @@ void render_manager::texture_free(render_texture *texture) // font_alloc - allocate a new font instance //------------------------------------------------- -render_font *render_manager::font_alloc(const char *filename) -{ - return global_alloc(render_font(*this, filename)); -} - - -//------------------------------------------------- -// font_free - release a font instance -//------------------------------------------------- - -void render_manager::font_free(render_font *font) +std::unique_ptr<render_font> render_manager::font_alloc(const char *filename) { - global_free(font); + return std::unique_ptr<render_font>(new render_font(*this, filename)); } @@ -3301,7 +3284,7 @@ void render_manager::resolve_tags() render_container *render_manager::container_alloc(screen_device *screen) { - auto container = global_alloc(render_container(*this, screen)); + auto container = new render_container(*this, screen); if (screen != nullptr) m_screen_container_list.append(*container); return container; diff --git a/src/emu/render.h b/src/emu/render.h index 1545a3f041d..5ca922b408a 100644 --- a/src/emu/render.h +++ b/src/emu/render.h @@ -411,8 +411,8 @@ private: // a scaled_texture contains a single scaled entry for a texture struct scaled_texture { - bitmap_argb32 * bitmap; // final bitmap - u32 seqid; // sequence number + std::unique_ptr<bitmap_argb32> bitmap; // final bitmap + u32 seqid; // sequence number }; // internal state @@ -901,16 +901,17 @@ public: // getters item_list &items() { return m_items; } + bool has_screen(screen_device &screen); const std::string &name() const { return m_name; } - size_t screen_count() const { return m_screens.size(); } + size_t visible_screen_count() const { return m_screens.size(); } float effective_aspect() const { return m_effaspect; } const render_bounds &bounds() const { return m_bounds; } - bool has_screen(screen_device &screen) const; - const item_ref_vector &screen_items() const { return m_screen_items; } + bool has_visible_screen(screen_device &screen) const; + const item_ref_vector &visible_screen_items() const { return m_screen_items; } const item_ref_vector &interactive_items() const { return m_interactive_items; } const edge_vector &interactive_edges_x() const { return m_interactive_edges_x; } const edge_vector &interactive_edges_y() const { return m_interactive_edges_y; } - const screen_ref_vector &screens() const { return m_screens; } + const screen_ref_vector &visible_screens() const { return m_screens; } const visibility_toggle_vector &visibility_toggles() const { return m_vistoggles; } u32 default_visibility_mask() const { return m_defvismask; } bool has_art() const { return m_has_art; } @@ -1192,8 +1193,7 @@ public: void texture_free(render_texture *texture); // fonts - render_font *font_alloc(const char *filename = nullptr); - void font_free(render_font *font); + std::unique_ptr<render_font> font_alloc(const char *filename = nullptr); // reference tracking void invalidate_all(void *refptr); diff --git a/src/emu/rendfont.h b/src/emu/rendfont.h index aa04a094d75..fc0c4853733 100644 --- a/src/emu/rendfont.h +++ b/src/emu/rendfont.h @@ -27,9 +27,10 @@ class render_font // construction/destruction render_font(render_manager &manager, const char *filename); - virtual ~render_font(); public: + virtual ~render_font(); + // getters render_manager &manager() const { return m_manager; } diff --git a/src/emu/rendlay.cpp b/src/emu/rendlay.cpp index de64a98bf30..4c76c72a0c1 100644 --- a/src/emu/rendlay.cpp +++ b/src/emu/rendlay.cpp @@ -1587,9 +1587,8 @@ protected: // overrides virtual void draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override { - render_font *font = machine.render().font_alloc("default"); + auto font = machine.render().font_alloc("default"); draw_text(*font, dest, bounds, m_string.c_str(), m_textalign, color(state)); - machine.render().font_free(font); } private: @@ -2278,9 +2277,8 @@ protected: virtual void draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) override { - render_font *const font = machine.render().font_alloc("default"); + auto font = machine.render().font_alloc("default"); draw_text(*font, dest, bounds, string_format("%0*d", m_digits, state).c_str(), m_textalign, color(state)); - machine.render().font_free(font); } private: @@ -2375,7 +2373,7 @@ protected: u32 const a = c.a * 255.0f; // get the width of the string - render_font *font = machine.render().font_alloc("default"); + auto font = machine.render().font_alloc("default"); float aspect = 1.0f; s32 width; @@ -2517,7 +2515,6 @@ protected: } // free the temporary bitmap and font - machine.render().font_free(font); } private: @@ -2537,7 +2534,7 @@ private: u32 const a = c.a * 255.0f; // get the width of the string - render_font *font = machine.render().font_alloc("default"); + auto font = machine.render().font_alloc("default"); float aspect = 1.0f; s32 width; int currx = 0; @@ -2678,7 +2675,6 @@ private: } // free the temporary bitmap and font - machine.render().font_free(font); } void load_reel_bitmap(int number) @@ -3450,7 +3446,18 @@ layout_view::~layout_view() // the given screen //------------------------------------------------- -bool layout_view::has_screen(screen_device &screen) const +bool layout_view::has_screen(screen_device &screen) +{ + return std::find_if(m_items.begin(), m_items.end(), [&screen] (auto &itm) { return itm.screen() == &screen; }) != m_items.end(); +} + + +//------------------------------------------------- +// has_visible_screen - return true if this view +// has the given screen visble +//------------------------------------------------- + +bool layout_view::has_visible_screen(screen_device &screen) const { return std::find_if(m_screens.begin(), m_screens.end(), [&screen] (auto const &scr) { return &scr.get() == &screen; }) != m_screens.end(); } diff --git a/src/emu/tilemap.cpp b/src/emu/tilemap.cpp index 4252b9259a2..5757f35341f 100644 --- a/src/emu/tilemap.cpp +++ b/src/emu/tilemap.cpp @@ -1611,14 +1611,14 @@ tilemap_manager::~tilemap_manager() tilemap_t &tilemap_manager::create(device_gfx_interface &decoder, tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, u16 tilewidth, u16 tileheight, u32 cols, u32 rows, tilemap_t *allocated) { if (!allocated) - allocated = global_alloc(tilemap_t)(machine().root_device()); + allocated = new tilemap_t(machine().root_device()); return m_tilemap_list.append(allocated->init(*this, decoder, tile_get_info, mapper, tilewidth, tileheight, cols, rows)); } tilemap_t &tilemap_manager::create(device_gfx_interface &decoder, tilemap_get_info_delegate tile_get_info, tilemap_standard_mapper mapper, u16 tilewidth, u16 tileheight, u32 cols, u32 rows, tilemap_t *allocated) { if (!allocated) - allocated = global_alloc(tilemap_t)(machine().root_device()); + allocated = new tilemap_t(machine().root_device()); return m_tilemap_list.append(allocated->init(*this, decoder, tile_get_info, mapper, tilewidth, tileheight, cols, rows)); } diff --git a/src/frontend/mame/clifront.cpp b/src/frontend/mame/clifront.cpp index 4bd4a0545b8..0a667dc4856 100644 --- a/src/frontend/mame/clifront.cpp +++ b/src/frontend/mame/clifront.cpp @@ -343,7 +343,7 @@ int cli_frontend::execute(std::vector<std::string> &args) } util::archive_file::cache_clear(); - global_free(manager); + delete manager; return m_result; } diff --git a/src/frontend/mame/mame.cpp b/src/frontend/mame/mame.cpp index 908da0e2bf6..b996bae1dc0 100644 --- a/src/frontend/mame/mame.cpp +++ b/src/frontend/mame/mame.cpp @@ -10,38 +10,44 @@ #include "emu.h" #include "mame.h" + +#include "ui/inifile.h" +#include "ui/selgame.h" +#include "ui/simpleselgame.h" +#include "ui/ui.h" + +#include "cheat.h" +#include "clifront.h" #include "emuopts.h" +#include "luaengine.h" #include "mameopts.h" #include "pluginopts.h" -#include "osdepend.h" #include "validity.h" -#include "clifront.h" -#include "luaengine.h" -#include <ctime> -#include "ui/ui.h" -#include "ui/selgame.h" -#include "ui/simpleselgame.h" -#include "cheat.h" -#include "ui/inifile.h" + #include "xmlfile.h" +#include "osdepend.h" + +#include <ctime> + + //************************************************************************** // MACHINE MANAGER //************************************************************************** -mame_machine_manager* mame_machine_manager::m_manager = nullptr; +mame_machine_manager *mame_machine_manager::s_manager = nullptr; mame_machine_manager* mame_machine_manager::instance(emu_options &options, osd_interface &osd) { - if (!m_manager) - m_manager = global_alloc(mame_machine_manager(options, osd)); + if (!s_manager) + s_manager = new mame_machine_manager(options, osd); - return m_manager; + return s_manager; } mame_machine_manager* mame_machine_manager::instance() { - return m_manager; + return s_manager; } //------------------------------------------------- @@ -51,7 +57,7 @@ mame_machine_manager* mame_machine_manager::instance() mame_machine_manager::mame_machine_manager(emu_options &options,osd_interface &osd) : machine_manager(options, osd), m_plugins(std::make_unique<plugin_options>()), - m_lua(global_alloc(lua_engine)), + m_lua(std::make_unique<lua_engine>()), m_new_driver_pending(nullptr), m_firstrun(true), m_autoboot_timer(nullptr) @@ -65,8 +71,8 @@ mame_machine_manager::mame_machine_manager(emu_options &options,osd_interface &o mame_machine_manager::~mame_machine_manager() { - global_free(m_lua); - m_manager = nullptr; + m_lua.reset(); + s_manager = nullptr; } diff --git a/src/frontend/mame/mame.h b/src/frontend/mame/mame.h index 041612de758..037d714b39c 100644 --- a/src/frontend/mame/mame.h +++ b/src/frontend/mame/mame.h @@ -35,7 +35,7 @@ public: ~mame_machine_manager(); plugin_options &plugins() const { return *m_plugins; } - lua_engine *lua() { return m_lua; } + lua_engine *lua() { return m_lua.get(); } virtual void update_machine() override; @@ -72,12 +72,12 @@ private: mame_machine_manager &operator=(mame_machine_manager &&) = delete; std::unique_ptr<plugin_options> m_plugins; // pointer to plugin options - lua_engine * m_lua; + std::unique_ptr<lua_engine> m_lua; const game_driver * m_new_driver_pending; // pointer to the next pending driver bool m_firstrun; - static mame_machine_manager* m_manager; + static mame_machine_manager *s_manager; emu_timer *m_autoboot_timer; // autoboot timer std::unique_ptr<mame_ui_manager> m_ui; // internal data from ui.cpp std::unique_ptr<cheat_manager> m_cheat; // internal data from cheat.cpp diff --git a/src/frontend/mame/ui/menu.cpp b/src/frontend/mame/ui/menu.cpp index 7ce0beb0fb1..b1bcbb908b7 100644 --- a/src/frontend/mame/ui/menu.cpp +++ b/src/frontend/mame/ui/menu.cpp @@ -1234,7 +1234,7 @@ uint32_t menu::ui_handler(render_container &container, mame_ui_manager &mui) // if we have no menus stacked up, start with the main menu if (!state->topmost_menu<menu>()) - state->stack_push(std::unique_ptr<menu>(global_alloc_clear<menu_main>(mui, container))); + state->stack_push(std::unique_ptr<menu>(make_unique_clear<menu_main>(mui, container))); // update the menu state if (state->topmost_menu<menu>()) diff --git a/src/frontend/mame/ui/menu.h b/src/frontend/mame/ui/menu.h index 800b0b6ca7b..5a7d4374bf6 100644 --- a/src/frontend/mame/ui/menu.h +++ b/src/frontend/mame/ui/menu.h @@ -100,12 +100,12 @@ public: template <typename T, typename... Params> static void stack_push(Params &&... args) { - stack_push(std::unique_ptr<menu>(global_alloc_clear<T>(std::forward<Params>(args)...))); + stack_push(std::unique_ptr<menu>(make_unique_clear<T>(std::forward<Params>(args)...))); } template <typename T, typename... Params> static void stack_push_special_main(Params &&... args) { - std::unique_ptr<menu> ptr(global_alloc_clear<T>(std::forward<Params>(args)...)); + std::unique_ptr<menu> ptr(make_unique_clear<T>(std::forward<Params>(args)...)); ptr->set_special_main_menu(true); stack_push(std::move(ptr)); } diff --git a/src/frontend/mame/ui/text.cpp b/src/frontend/mame/ui/text.cpp index 6df9ff29049..0e61b1710db 100644 --- a/src/frontend/mame/ui/text.cpp +++ b/src/frontend/mame/ui/text.cpp @@ -295,7 +295,7 @@ float text_layout::actual_height() const void text_layout::start_new_line(text_layout::text_justify justify, float height) { // create a new line - std::unique_ptr<line> new_line(global_alloc_clear<line>(*this, justify, actual_height(), height * yscale())); + std::unique_ptr<line> new_line(std::make_unique<line>(*this, justify, actual_height(), height * yscale())); // update the current line m_current_line = new_line.get(); @@ -303,7 +303,7 @@ void text_layout::start_new_line(text_layout::text_justify justify, float height m_truncating = false; // append it - m_lines.push_back(std::move(new_line)); + m_lines.emplace_back(std::move(new_line)); } diff --git a/src/frontend/mame/ui/text.h b/src/frontend/mame/ui/text.h index c5755c39813..fdf000c850a 100644 --- a/src/frontend/mame/ui/text.h +++ b/src/frontend/mame/ui/text.h @@ -7,16 +7,17 @@ Text functionality for MAME's crude user interface ***************************************************************************/ +#ifndef MAME_FRONTEND_UI_TEXT_H +#define MAME_FRONTEND_UI_TEXT_H #pragma once -#ifndef MAME_FRONTEND_UI_TEXT_H -#define MAME_FRONTEND_UI_TEXT_H class render_font; class render_container; namespace ui { + /*************************************************************************** TYPE DEFINITIONS ***************************************************************************/ diff --git a/src/frontend/mame/ui/ui.cpp b/src/frontend/mame/ui/ui.cpp index 785f558a752..df10800608b 100644 --- a/src/frontend/mame/ui/ui.cpp +++ b/src/frontend/mame/ui/ui.cpp @@ -163,7 +163,7 @@ static uint32_t const mouse_bitmap[32*32] = mame_ui_manager::mame_ui_manager(running_machine &machine) : ui_manager(machine) - , m_font(nullptr) + , m_font() , m_handler_callback(nullptr) , m_handler_callback_type(ui_callback_type::GENERAL) , m_handler_param(0) @@ -245,11 +245,7 @@ void mame_ui_manager::exit() m_mouse_arrow_texture = nullptr; // free the font - if (m_font != nullptr) - { - machine().render().font_free(m_font); - m_font = nullptr; - } + m_font.reset(); } @@ -642,9 +638,9 @@ void mame_ui_manager::update_and_render(render_container &container) render_font *mame_ui_manager::get_font() { // allocate the font and messagebox string - if (m_font == nullptr) + if (!m_font) m_font = machine().render().font_alloc(machine().options().ui_font()); - return m_font; + return m_font.get(); } diff --git a/src/frontend/mame/ui/ui.h b/src/frontend/mame/ui/ui.h index 7cb5610a44b..cc666f5ae52 100644 --- a/src/frontend/mame/ui/ui.h +++ b/src/frontend/mame/ui/ui.h @@ -276,7 +276,7 @@ private: using device_feature_set = std::set<std::pair<std::string, std::string> >; // instance variables - render_font * m_font; + std::unique_ptr<render_font> m_font; handler_callback_func m_handler_callback; ui_callback_type m_handler_callback_type; uint32_t m_handler_param; diff --git a/src/lib/formats/imd_dsk.cpp b/src/lib/formats/imd_dsk.cpp index 0489bf28b5e..631eac9b297 100644 --- a/src/lib/formats/imd_dsk.cpp +++ b/src/lib/formats/imd_dsk.cpp @@ -158,18 +158,18 @@ static floperr_t imd_expand_file(floppy_image_legacy *floppy , uint64_t offset , return FLOPPY_ERROR_SUCCESS; } - auto buffer = global_alloc_array(uint8_t , size_after_off); + auto buffer = std::make_unique<uint8_t []>(size_after_off); // Read the part of file after offset - floppy_image_read(floppy , buffer , offset , size_after_off); + floppy_image_read(floppy, buffer.get(), offset, size_after_off); // Add zeroes - floppy_image_write_filler(floppy , 0 , offset , amount); + floppy_image_write_filler(floppy, 0, offset, amount); // Write back the part of file after offset - floppy_image_write(floppy, buffer, offset + amount, size_after_off); + floppy_image_write(floppy, buffer.get(), offset + amount, size_after_off); - global_free_array(buffer); + buffer.reset(); // Update track offsets struct imddsk_tag *tag = get_tag(floppy); @@ -528,7 +528,7 @@ bool imd_format::load(io_generic *io, uint32_t form_factor, floppy_image *image) sects[i].bad_crc = stype == 5 || stype == 6 || stype == 7 || stype == 8; if(stype == 2 || stype == 4 || stype == 6 || stype == 8) { - sects[i].data = global_alloc_array(uint8_t, actual_size); + sects[i].data = new uint8_t [actual_size]; memset(sects[i].data, img[pos++], actual_size); } else { sects[i].data = &img[pos]; @@ -547,7 +547,7 @@ bool imd_format::load(io_generic *io, uint32_t form_factor, floppy_image *image) for(int i=0; i< m_sector_count.back(); i++) if(sects[i].data && (sects[i].data < &img[0] || sects[i].data >= (&img[0] + size))) - global_free_array(sects[i].data); + delete [] sects[i].data; } return true; diff --git a/src/lib/formats/ipf_dsk.cpp b/src/lib/formats/ipf_dsk.cpp index ed6505fd385..fc81ffe66ce 100644 --- a/src/lib/formats/ipf_dsk.cpp +++ b/src/lib/formats/ipf_dsk.cpp @@ -1,12 +1,27 @@ // license:BSD-3-Clause // copyright-holders:Olivier Galibert -#include <cassert> #include "ipf_dsk.h" +#include <cassert> + + const floppy_format_type FLOPPY_IPF_FORMAT = &floppy_image_format_creator<ipf_format>; -ipf_format::ipf_format(): tinfos(nullptr), tcount(0), type(0), release(0), revision(0), encoder_type(0), -encoder_revision(0), origin(0), min_cylinder(0), max_cylinder(0), min_head(0), max_head(0), credit_day(0), credit_time(0) +ipf_format::ipf_format() : + tinfos(), + tcount(0), + type(0), + release(0), + revision(0), + encoder_type(0), + encoder_revision(0), + origin(0), + min_cylinder(0), + max_cylinder(0), + min_head(0), + max_head(0), + credit_day(0), + credit_time(0) { } @@ -84,12 +99,11 @@ bool ipf_format::parse(std::vector<uint8_t> &data, floppy_image *image) { image->set_variant(floppy_image::DSDD); // Not handling anything else yet tcount = 84*2+1; // Usual max - tinfos = global_alloc_array_clear<track_info>(tcount); + tinfos.resize(tcount); bool res = scan_all_tags(data); if(res) res = generate_tracks(image); - global_free_array(tinfos); - tinfos = nullptr; + tinfos.clear(); return res; } @@ -121,14 +135,11 @@ ipf_format::track_info *ipf_format::get_index(uint32_t idx) if(idx > 1000) return nullptr; if(idx >= tcount) { - auto ti1 = global_alloc_array_clear<track_info>(idx+1); - memcpy(ti1, tinfos, tcount*sizeof(tinfos)); - global_free_array(tinfos); + tinfos.resize(idx+1); tcount = idx+1; - tinfos = ti1; } - return tinfos+idx; + return &tinfos[idx]; } bool ipf_format::parse_imge(const uint8_t *imge) @@ -246,7 +257,7 @@ bool ipf_format::scan_all_tags(std::vector<uint8_t> &data) bool ipf_format::generate_tracks(floppy_image *image) { for(uint32_t i = 0; i != tcount; i++) { - track_info *t = tinfos + i; + track_info *t = &tinfos[i]; if(t->info_set && t->data) { if(!generate_track(t, image)) return false; diff --git a/src/lib/formats/ipf_dsk.h b/src/lib/formats/ipf_dsk.h index 7db2415afd4..e026cab2c4c 100644 --- a/src/lib/formats/ipf_dsk.h +++ b/src/lib/formats/ipf_dsk.h @@ -24,22 +24,22 @@ public: private: struct track_info { - uint32_t cylinder, head, type; - uint32_t sigtype, process, reserved[3]; - uint32_t size_bytes, size_cells; - uint32_t index_bytes, index_cells; - uint32_t datasize_cells, gapsize_cells; - uint32_t block_count, weak_bits; + uint32_t cylinder = 0, head = 0, type = 0; + uint32_t sigtype = 0, process = 0, reserved[3] = { 0, 0, 0 }; + uint32_t size_bytes = 0, size_cells = 0; + uint32_t index_bytes = 0, index_cells = 0; + uint32_t datasize_cells = 0, gapsize_cells = 0; + uint32_t block_count = 0, weak_bits = 0; - uint32_t data_size_bits; + uint32_t data_size_bits = 0; - bool info_set; + bool info_set = false; - const uint8_t *data; - uint32_t data_size; + const uint8_t *data = nullptr; + uint32_t data_size = 0; }; - track_info *tinfos; + std::vector<track_info> tinfos; uint32_t tcount; uint32_t type, release, revision; diff --git a/src/lib/formats/mfi_dsk.cpp b/src/lib/formats/mfi_dsk.cpp index 0f118ce620f..eb86d8d80da 100644 --- a/src/lib/formats/mfi_dsk.cpp +++ b/src/lib/formats/mfi_dsk.cpp @@ -187,8 +187,8 @@ bool mfi_format::save(io_generic *io, floppy_image *image) int pos = sizeof(header) + (tracks << resolution)*heads*sizeof(entry); int epos = 0; - auto precomp = global_alloc_array(uint32_t, max_track_size); - auto postcomp = global_alloc_array(uint8_t, max_track_size*4 + 1000); + auto precomp = std::make_unique<uint32_t []>(max_track_size); + auto postcomp = std::make_unique<uint8_t []>(max_track_size*4 + 1000); for(int track=0; track <= (tracks-1) << 2; track += 4 >> resolution) for(int head=0; head<heads; head++) { @@ -199,7 +199,7 @@ bool mfi_format::save(io_generic *io, floppy_image *image) continue; } - memcpy(precomp, &buffer[0], tsize*4); + memcpy(&precomp[0], &buffer[0], tsize*4); for(int j=0; j<tsize-1; j++) precomp[j] = (precomp[j] & floppy_image::MG_MASK) | ((precomp[j+1] & floppy_image::TIME_MASK) - @@ -208,11 +208,8 @@ bool mfi_format::save(io_generic *io, floppy_image *image) (200000000 - (precomp[tsize-1] & floppy_image::TIME_MASK)); uLongf csize = max_track_size*4 + 1000; - if(compress(postcomp, &csize, (const Bytef *)precomp, tsize*4) != Z_OK) { - global_free_array(precomp); - global_free_array(postcomp); + if(compress(postcomp.get(), &csize, (const Bytef *)precomp.get(), tsize*4) != Z_OK) return false; - } entries[epos].offset = pos; entries[epos].uncompressed_size = tsize*4; @@ -220,13 +217,11 @@ bool mfi_format::save(io_generic *io, floppy_image *image) entries[epos].write_splice = image->get_write_splice_position(track >> 2, head, track & 3); epos++; - io_generic_write(io, postcomp, pos, csize); + io_generic_write(io, postcomp.get(), pos, csize); pos += csize; } io_generic_write(io, entries, sizeof(header), (tracks << resolution)*heads*sizeof(entry)); - global_free_array(precomp); - global_free_array(postcomp); return true; } diff --git a/src/lib/netlist/build/makefile b/src/lib/netlist/build/makefile index 9d8c14e1b54..a324acb463b 100644 --- a/src/lib/netlist/build/makefile +++ b/src/lib/netlist/build/makefile @@ -58,7 +58,7 @@ TIDY_SOURCES = $(ALLSOURCES) #TIDY_SOURCES = $(SRC)/devices/nld_7442.cpp $(SRC)/devices/nld_7492.cpp -TIDY_FLAGS = -p $(OBJ) -checks=llvm-include-order,llvm-namespace-comment,modernize-use-override,modernize-use-using -fix +#TIDY_FLAGS = -p $(OBJ) -checks=llvm-include-order,llvm-namespace-comment,modernize-use-override,modernize-use-using -fix #TIDY_FLAGS = -checks=llvm-include-order -fix #TIDY_FLAGS = -checks=llvm-namespace-comment -fix #TIDY_FLAGS = -checks=modernize-use-override -fix diff --git a/src/lib/netlist/core/exec.h b/src/lib/netlist/core/exec.h index be796ab95fd..50c718e3da6 100644 --- a/src/lib/netlist/core/exec.h +++ b/src/lib/netlist/core/exec.h @@ -38,10 +38,8 @@ namespace netlist void process_queue(netlist_time_ext delta) noexcept; void abort_current_queue_slice() noexcept { - if (!NL_USE_QUEUE_STATS || !m_use_stats) - m_queue.retime<false>(detail::queue_t::entry_t(m_time, nullptr)); - else - m_queue.retime<true>(detail::queue_t::entry_t(m_time, nullptr)); + qremove(nullptr); + qpush(m_time, nullptr); } const detail::queue_t &queue() const noexcept { return m_queue; } @@ -95,9 +93,8 @@ namespace netlist const log_type &log() const noexcept { return m_state.log(); } void print_stats() const; - bool use_stats() const { return m_use_stats; } - bool stats_enabled() const noexcept { return m_use_stats; } + constexpr bool stats_enabled() const noexcept { return m_use_stats; } void enable_stats(bool val) noexcept { m_use_stats = val; } private: @@ -115,8 +112,8 @@ namespace netlist //PALIGNAS_CACHELINE() //PALIGNAS(16) - detail::queue_t m_queue; bool m_use_stats; + detail::queue_t m_queue; // performance plib::pperftime_t<true> m_stat_mainloop; plib::pperfcount_t<true> m_perf_out_processed; diff --git a/src/lib/netlist/core/netlist_state.h b/src/lib/netlist/core/netlist_state.h index dc9888579f5..fd0a1449217 100644 --- a/src/lib/netlist/core/netlist_state.h +++ b/src/lib/netlist/core/netlist_state.h @@ -236,6 +236,11 @@ namespace netlist /// void free_setup_resources(); + std::vector<detail::core_terminal_t *> &core_terms(const detail::net_t &net) noexcept + { + return m_core_terms[&net]; + } + private: device_arena m_pool; // must be deleted last! @@ -253,6 +258,8 @@ namespace netlist devices_collection_type m_devices; // sole use is to manage lifetime of family objects family_collection_type m_family_cache; + // all terms for a net + std::unordered_map<const detail::net_t *, std::vector<detail::core_terminal_t *>> m_core_terms; // dummy version int m_dummy_version; }; diff --git a/src/lib/netlist/core/nets.h b/src/lib/netlist/core/nets.h index 8fe7ab6bb3c..7062f1572aa 100644 --- a/src/lib/netlist/core/nets.h +++ b/src/lib/netlist/core/nets.h @@ -67,29 +67,26 @@ namespace netlist void push_to_queue(const netlist_time &delay) noexcept { - if (has_connections()) - { - if (!!is_queued()) - exec().qremove(this); + if (!!is_queued()) + exec().qremove(this); - m_next_scheduled_time = exec().time() + delay; + m_next_scheduled_time = exec().time() + delay; #if (AVOID_NOOP_QUEUE_PUSHES) m_in_queue = (m_list_active.empty() ? queue_status::DELAYED_DUE_TO_INACTIVE : (m_new_Q != m_cur_Q ? queue_status::QUEUED : queue_status::DELIVERED)); - if (m_in_queue == queue_status::QUEUED) - exec().qpush(m_next_scheduled_time, this); + if (m_in_queue == queue_status::QUEUED) + exec().qpush(m_next_scheduled_time, this); else update_inputs(); #else - m_in_queue = m_list_active.empty() ? queue_status::DELAYED_DUE_TO_INACTIVE : queue_status::QUEUED; - if (m_in_queue == queue_status::QUEUED) - exec().qpush(m_next_scheduled_time, this); - else - update_inputs(); + m_in_queue = m_list_active.empty() ? queue_status::DELAYED_DUE_TO_INACTIVE : queue_status::QUEUED; + if (m_in_queue == queue_status::QUEUED) + exec().qpush(m_next_scheduled_time, this); + else + update_inputs(); #endif - } } - bool is_queued() const noexcept { return m_in_queue == queue_status::QUEUED; } + constexpr bool is_queued() const noexcept { return m_in_queue == queue_status::QUEUED; } // ----------------------------------------------------------------------------- // Very hot @@ -138,14 +135,12 @@ namespace netlist } } - const netlist_time_ext &next_scheduled_time() const noexcept { return m_next_scheduled_time; } + constexpr const netlist_time_ext &next_scheduled_time() const noexcept { return m_next_scheduled_time; } void set_next_scheduled_time(netlist_time_ext ntime) noexcept { m_next_scheduled_time = ntime; } bool is_rail_net() const noexcept { return !(m_railterminal == nullptr); } core_terminal_t & railterminal() const noexcept { return *m_railterminal; } - bool has_connections() const noexcept { return !m_core_terms.empty(); } - void add_to_active_list(core_terminal_t &term) noexcept { if (!m_list_active.empty()) @@ -207,7 +202,7 @@ namespace netlist void rebuild_list(); // rebuild m_list after a load - std::vector<core_terminal_t *> &core_terms() noexcept { return m_core_terms; } + //std::vector<core_terminal_t *> &core_terms() noexcept { return state().m_core_terms[this]; } void update_inputs() noexcept { @@ -221,7 +216,7 @@ namespace netlist protected: // only used for logic nets - const netlist_sig_t &Q() const noexcept { return m_cur_Q; } + constexpr const netlist_sig_t &Q() const noexcept { return m_cur_Q; } // only used for logic nets void initial(netlist_sig_t val) noexcept @@ -269,7 +264,7 @@ namespace netlist state_var<netlist_time_ext> m_next_scheduled_time; core_terminal_t * m_railterminal; - std::vector<core_terminal_t *> m_core_terms; // save post-start m_list ... + //std::vector<core_terminal_t *> m_core_terms; // save post-start m_list ... }; } // namespace detail diff --git a/src/lib/netlist/core/queue.h b/src/lib/netlist/core/queue.h index 7e38c3f0ef9..350329ed3f1 100644 --- a/src/lib/netlist/core/queue.h +++ b/src/lib/netlist/core/queue.h @@ -21,12 +21,13 @@ #include <unordered_map> #include <utility> #include <vector> +#include <queue> namespace netlist { namespace detail { // Use timed_queue_heap to use stdc++ heap functions instead of linear processing. - // This slows down processing by about 25% on a Kaby Lake. + // This slows down processing by about 35% on a Kaby Lake. // template <class T, bool TS> // using timed_queue = plib::timed_queue_heap<T, TS>; diff --git a/src/lib/netlist/devices/nld_4029.cpp b/src/lib/netlist/devices/nld_4029.cpp index a3de0e7192b..4582746bf24 100644 --- a/src/lib/netlist/devices/nld_4029.cpp +++ b/src/lib/netlist/devices/nld_4029.cpp @@ -146,7 +146,7 @@ namespace devices , m_CLK(*this, "CLK", NETLIB_DELEGATE(clk)) , m_clk_old(*this, "m_clk_old", false) , m_Q(*this, {"Q1", "Q2", "Q3", "Q4"}) - , m_CO(*this, "CO", 0) + , m_CO(*this, "CO", false) , m_cnt(*this, "m_cnt", 0) , m_power_pins(*this) { diff --git a/src/lib/netlist/devices/nld_9321.cpp b/src/lib/netlist/devices/nld_9321.cpp index 5adffc3a313..29d63b2b3fc 100644 --- a/src/lib/netlist/devices/nld_9321.cpp +++ b/src/lib/netlist/devices/nld_9321.cpp @@ -50,7 +50,7 @@ namespace netlist NETLIB_HANDLERI(e) { - m_enable = m_E() ? 0 : 1; + m_enable = m_E() ? false : true; m_o = (m_A[1]() << 1) | m_A[0](); for (std::size_t i=0; i<4; i++) m_D[i].push((i == m_o && m_enable) ? 0 : 1, NLTIME_FROM_NS(18)); diff --git a/src/lib/netlist/devices/nlid_truthtable.cpp b/src/lib/netlist/devices/nlid_truthtable.cpp index 74e0f37c92b..db2471a704e 100644 --- a/src/lib/netlist/devices/nlid_truthtable.cpp +++ b/src/lib/netlist/devices/nlid_truthtable.cpp @@ -75,7 +75,7 @@ namespace devices #endif } for (auto &q : m_Q) - if (q.has_net() && q.net().has_connections()) + if (q.has_net() && !exec().nlstate().core_terms(q.net()).empty()) active_outputs++; set_active_outputs(active_outputs); } diff --git a/src/lib/netlist/examples/2N6027.cpp b/src/lib/netlist/examples/2n6027.cpp index bfad3c065ec..bfad3c065ec 100644 --- a/src/lib/netlist/examples/2N6027.cpp +++ b/src/lib/netlist/examples/2n6027.cpp diff --git a/src/lib/netlist/examples/LM3900_test.cpp b/src/lib/netlist/examples/lm3900_test.cpp index a48a2cd8a78..a48a2cd8a78 100644 --- a/src/lib/netlist/examples/LM3900_test.cpp +++ b/src/lib/netlist/examples/lm3900_test.cpp diff --git a/src/lib/netlist/generated/nld_devinc.h b/src/lib/netlist/generated/nld_devinc.h index 1a2fa7eeca3..e916998c93e 100755 --- a/src/lib/netlist/generated/nld_devinc.h +++ b/src/lib/netlist/generated/nld_devinc.h @@ -103,7 +103,7 @@ NET_REGISTER_DEVEXT(CS, __VA_ARGS__) // --------------------------------------------------------------------- -// Source: ../devices/nld_2102A.cpp +// Source: ../devices/nld_2102a.cpp // --------------------------------------------------------------------- // usage : RAM_2102A(name, CEQ, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, RWQ, DI) @@ -520,7 +520,7 @@ NET_REGISTER_DEVEXT(TTL_8277, __VA_ARGS__) // --------------------------------------------------------------------- -// Source: ../devices/nld_82S115.cpp +// Source: ../devices/nld_82s115.cpp // --------------------------------------------------------------------- // usage : PROM_82S115(name, CE1Q, CE2, A0, A1, A2, A3, A4, A5, A6, A7, A8, STROBE) @@ -529,7 +529,7 @@ NET_REGISTER_DEVEXT(PROM_82S115, __VA_ARGS__) // --------------------------------------------------------------------- -// Source: ../devices/nld_82S16.cpp +// Source: ../devices/nld_82s16.cpp // --------------------------------------------------------------------- // usage : TTL_82S16(name, ) diff --git a/src/lib/netlist/generated/nlm_modules_lib.cpp b/src/lib/netlist/generated/nlm_modules_lib.cpp index 7f91075ac40..7162c84023d 100755 --- a/src/lib/netlist/generated/nlm_modules_lib.cpp +++ b/src/lib/netlist/generated/nlm_modules_lib.cpp @@ -1,7 +1,7 @@ // license:CC0 // copyright-holders:Couriersud -// File programmatically created Sun Sep 13 20:49:39 2020 +// File programmatically created Wed Sep 30 11:02:38 2020 #include "devices/net_lib.h" diff --git a/src/lib/netlist/generated/static_solvers.cpp b/src/lib/netlist/generated/static_solvers.cpp index 3dfe1def465..29f37500718 100644 --- a/src/lib/netlist/generated/static_solvers.cpp +++ b/src/lib/netlist/generated/static_solvers.cpp @@ -72340,399 +72340,399 @@ const plib::dynlib_static_sym nl_static_solver_syms[] = { #if !defined(__EMSCRIPTEN__) // elim - {"nl_gcr_11c2ae166b240b6e_10_double_double", reinterpret_cast<void *>(&nl_gcr_11c2ae166b240b6e_10_double_double)}, + {"nl_gcr_11c2ae166b240b6e_10_double_double", reinterpret_cast<void *>(&nl_gcr_11c2ae166b240b6e_10_double_double)}, // NOLINT // tankbatt - {"nl_gcr_124f7aa10f044582_16_double_double", reinterpret_cast<void *>(&nl_gcr_124f7aa10f044582_16_double_double)}, + {"nl_gcr_124f7aa10f044582_16_double_double", reinterpret_cast<void *>(&nl_gcr_124f7aa10f044582_16_double_double)}, // NOLINT // armora - {"nl_gcr_1250f340dea396ae_22_double_double", reinterpret_cast<void *>(&nl_gcr_1250f340dea396ae_22_double_double)}, + {"nl_gcr_1250f340dea396ae_22_double_double", reinterpret_cast<void *>(&nl_gcr_1250f340dea396ae_22_double_double)}, // NOLINT // astrob - {"nl_gcr_13833bf8c127deaa_154_double_double", reinterpret_cast<void *>(&nl_gcr_13833bf8c127deaa_154_double_double)}, + {"nl_gcr_13833bf8c127deaa_154_double_double", reinterpret_cast<void *>(&nl_gcr_13833bf8c127deaa_154_double_double)}, // NOLINT // pongf - {"nl_gcr_13e7b5ac1a260dbf_10_double_double", reinterpret_cast<void *>(&nl_gcr_13e7b5ac1a260dbf_10_double_double)}, + {"nl_gcr_13e7b5ac1a260dbf_10_double_double", reinterpret_cast<void *>(&nl_gcr_13e7b5ac1a260dbf_10_double_double)}, // NOLINT // tailg - {"nl_gcr_144ed14e6bafdb_119_double_double", reinterpret_cast<void *>(&nl_gcr_144ed14e6bafdb_119_double_double)}, + {"nl_gcr_144ed14e6bafdb_119_double_double", reinterpret_cast<void *>(&nl_gcr_144ed14e6bafdb_119_double_double)}, // NOLINT // spacewar - {"nl_gcr_15e8f6fb021de0f9_28_double_double", reinterpret_cast<void *>(&nl_gcr_15e8f6fb021de0f9_28_double_double)}, + {"nl_gcr_15e8f6fb021de0f9_28_double_double", reinterpret_cast<void *>(&nl_gcr_15e8f6fb021de0f9_28_double_double)}, // NOLINT // dpatrol - {"nl_gcr_18f4d9160b51d613_20_double_double", reinterpret_cast<void *>(&nl_gcr_18f4d9160b51d613_20_double_double)}, + {"nl_gcr_18f4d9160b51d613_20_double_double", reinterpret_cast<void *>(&nl_gcr_18f4d9160b51d613_20_double_double)}, // NOLINT // starhawk - {"nl_gcr_1f1086787c94f97c_40_double_double", reinterpret_cast<void *>(&nl_gcr_1f1086787c94f97c_40_double_double)}, + {"nl_gcr_1f1086787c94f97c_40_double_double", reinterpret_cast<void *>(&nl_gcr_1f1086787c94f97c_40_double_double)}, // NOLINT // zac1b11142 - {"nl_gcr_1fad5cda2646cf42_30_double_double", reinterpret_cast<void *>(&nl_gcr_1fad5cda2646cf42_30_double_double)}, + {"nl_gcr_1fad5cda2646cf42_30_double_double", reinterpret_cast<void *>(&nl_gcr_1fad5cda2646cf42_30_double_double)}, // NOLINT // sspeedr - {"nl_gcr_2294220d3c91e762_176_double_double", reinterpret_cast<void *>(&nl_gcr_2294220d3c91e762_176_double_double)}, + {"nl_gcr_2294220d3c91e762_176_double_double", reinterpret_cast<void *>(&nl_gcr_2294220d3c91e762_176_double_double)}, // NOLINT // 280zzzap - {"nl_gcr_24643c159711f292_95_double_double", reinterpret_cast<void *>(&nl_gcr_24643c159711f292_95_double_double)}, + {"nl_gcr_24643c159711f292_95_double_double", reinterpret_cast<void *>(&nl_gcr_24643c159711f292_95_double_double)}, // NOLINT // zac1b11142 - {"nl_gcr_287a160e7c36b5b0_96_double_double", reinterpret_cast<void *>(&nl_gcr_287a160e7c36b5b0_96_double_double)}, + {"nl_gcr_287a160e7c36b5b0_96_double_double", reinterpret_cast<void *>(&nl_gcr_287a160e7c36b5b0_96_double_double)}, // NOLINT // elim - {"nl_gcr_28b736fe552777a9_45_double_double", reinterpret_cast<void *>(&nl_gcr_28b736fe552777a9_45_double_double)}, + {"nl_gcr_28b736fe552777a9_45_double_double", reinterpret_cast<void *>(&nl_gcr_28b736fe552777a9_45_double_double)}, // NOLINT // kidniki - {"nl_gcr_294dde1e0ecca6d0_37_double_double", reinterpret_cast<void *>(&nl_gcr_294dde1e0ecca6d0_37_double_double)}, + {"nl_gcr_294dde1e0ecca6d0_37_double_double", reinterpret_cast<void *>(&nl_gcr_294dde1e0ecca6d0_37_double_double)}, // NOLINT // ripoff - {"nl_gcr_295cf2e2f3d489bf_12_double_double", reinterpret_cast<void *>(&nl_gcr_295cf2e2f3d489bf_12_double_double)}, + {"nl_gcr_295cf2e2f3d489bf_12_double_double", reinterpret_cast<void *>(&nl_gcr_295cf2e2f3d489bf_12_double_double)}, // NOLINT // spacfury - {"nl_gcr_2a153513d3e8e2cc_53_double_double", reinterpret_cast<void *>(&nl_gcr_2a153513d3e8e2cc_53_double_double)}, + {"nl_gcr_2a153513d3e8e2cc_53_double_double", reinterpret_cast<void *>(&nl_gcr_2a153513d3e8e2cc_53_double_double)}, // NOLINT // boxingb - {"nl_gcr_2f84bc98d737730b_22_double_double", reinterpret_cast<void *>(&nl_gcr_2f84bc98d737730b_22_double_double)}, + {"nl_gcr_2f84bc98d737730b_22_double_double", reinterpret_cast<void *>(&nl_gcr_2f84bc98d737730b_22_double_double)}, // NOLINT // tankbatt - {"nl_gcr_328d886b444b586b_137_double_double", reinterpret_cast<void *>(&nl_gcr_328d886b444b586b_137_double_double)}, + {"nl_gcr_328d886b444b586b_137_double_double", reinterpret_cast<void *>(&nl_gcr_328d886b444b586b_137_double_double)}, // NOLINT // astrob - {"nl_gcr_339c6b457f339538_159_double_double", reinterpret_cast<void *>(&nl_gcr_339c6b457f339538_159_double_double)}, + {"nl_gcr_339c6b457f339538_159_double_double", reinterpret_cast<void *>(&nl_gcr_339c6b457f339538_159_double_double)}, // NOLINT // solarq - {"nl_gcr_34e910fc1896999f_76_double_double", reinterpret_cast<void *>(&nl_gcr_34e910fc1896999f_76_double_double)}, + {"nl_gcr_34e910fc1896999f_76_double_double", reinterpret_cast<void *>(&nl_gcr_34e910fc1896999f_76_double_double)}, // NOLINT // sspeedr - {"nl_gcr_3e833834e5ce5aee_13_double_double", reinterpret_cast<void *>(&nl_gcr_3e833834e5ce5aee_13_double_double)}, + {"nl_gcr_3e833834e5ce5aee_13_double_double", reinterpret_cast<void *>(&nl_gcr_3e833834e5ce5aee_13_double_double)}, // NOLINT // astrob - {"nl_gcr_41c6441d98369158_20_double_double", reinterpret_cast<void *>(&nl_gcr_41c6441d98369158_20_double_double)}, + {"nl_gcr_41c6441d98369158_20_double_double", reinterpret_cast<void *>(&nl_gcr_41c6441d98369158_20_double_double)}, // NOLINT // warrior - {"nl_gcr_42a31ce5c187b308_12_double_double", reinterpret_cast<void *>(&nl_gcr_42a31ce5c187b308_12_double_double)}, + {"nl_gcr_42a31ce5c187b308_12_double_double", reinterpret_cast<void *>(&nl_gcr_42a31ce5c187b308_12_double_double)}, // NOLINT // 280zzzap - {"nl_gcr_42c57d523cac30d0_122_double_double", reinterpret_cast<void *>(&nl_gcr_42c57d523cac30d0_122_double_double)}, + {"nl_gcr_42c57d523cac30d0_122_double_double", reinterpret_cast<void *>(&nl_gcr_42c57d523cac30d0_122_double_double)}, // NOLINT // ripoff - {"nl_gcr_43188bf576854ae0_10_double_double", reinterpret_cast<void *>(&nl_gcr_43188bf576854ae0_10_double_double)}, + {"nl_gcr_43188bf576854ae0_10_double_double", reinterpret_cast<void *>(&nl_gcr_43188bf576854ae0_10_double_double)}, // NOLINT // destroyr - {"nl_gcr_4334c95878d1be92_399_double_double", reinterpret_cast<void *>(&nl_gcr_4334c95878d1be92_399_double_double)}, + {"nl_gcr_4334c95878d1be92_399_double_double", reinterpret_cast<void *>(&nl_gcr_4334c95878d1be92_399_double_double)}, // NOLINT // kidniki - {"nl_gcr_43f7ff9bc651cc7a_198_double_double", reinterpret_cast<void *>(&nl_gcr_43f7ff9bc651cc7a_198_double_double)}, + {"nl_gcr_43f7ff9bc651cc7a_198_double_double", reinterpret_cast<void *>(&nl_gcr_43f7ff9bc651cc7a_198_double_double)}, // NOLINT // gamemachine - {"nl_gcr_491f95430bfdfd05_19_double_double", reinterpret_cast<void *>(&nl_gcr_491f95430bfdfd05_19_double_double)}, + {"nl_gcr_491f95430bfdfd05_19_double_double", reinterpret_cast<void *>(&nl_gcr_491f95430bfdfd05_19_double_double)}, // NOLINT // sspeedr - {"nl_gcr_4a8e2b707bbac8a6_95_double_double", reinterpret_cast<void *>(&nl_gcr_4a8e2b707bbac8a6_95_double_double)}, + {"nl_gcr_4a8e2b707bbac8a6_95_double_double", reinterpret_cast<void *>(&nl_gcr_4a8e2b707bbac8a6_95_double_double)}, // NOLINT // ripoff - {"nl_gcr_4b5ecfbb8f9fa97b_29_double_double", reinterpret_cast<void *>(&nl_gcr_4b5ecfbb8f9fa97b_29_double_double)}, + {"nl_gcr_4b5ecfbb8f9fa97b_29_double_double", reinterpret_cast<void *>(&nl_gcr_4b5ecfbb8f9fa97b_29_double_double)}, // NOLINT // gtrak10 - {"nl_gcr_4c46fdf7c0037727_43_double_double", reinterpret_cast<void *>(&nl_gcr_4c46fdf7c0037727_43_double_double)}, + {"nl_gcr_4c46fdf7c0037727_43_double_double", reinterpret_cast<void *>(&nl_gcr_4c46fdf7c0037727_43_double_double)}, // NOLINT // solarq - {"nl_gcr_4cb524006206eb1a_25_double_double", reinterpret_cast<void *>(&nl_gcr_4cb524006206eb1a_25_double_double)}, + {"nl_gcr_4cb524006206eb1a_25_double_double", reinterpret_cast<void *>(&nl_gcr_4cb524006206eb1a_25_double_double)}, // NOLINT // spacfury - {"nl_gcr_4dbd0f2aec7ef707_110_double_double", reinterpret_cast<void *>(&nl_gcr_4dbd0f2aec7ef707_110_double_double)}, + {"nl_gcr_4dbd0f2aec7ef707_110_double_double", reinterpret_cast<void *>(&nl_gcr_4dbd0f2aec7ef707_110_double_double)}, // NOLINT // solarq - {"nl_gcr_4e4931ccbfb7a3c_70_double_double", reinterpret_cast<void *>(&nl_gcr_4e4931ccbfb7a3c_70_double_double)}, + {"nl_gcr_4e4931ccbfb7a3c_70_double_double", reinterpret_cast<void *>(&nl_gcr_4e4931ccbfb7a3c_70_double_double)}, // NOLINT // fireone - {"nl_gcr_4f2b2f3cdc384f75_41_double_double", reinterpret_cast<void *>(&nl_gcr_4f2b2f3cdc384f75_41_double_double)}, + {"nl_gcr_4f2b2f3cdc384f75_41_double_double", reinterpret_cast<void *>(&nl_gcr_4f2b2f3cdc384f75_41_double_double)}, // NOLINT // boxingb - {"nl_gcr_50f5194a994d56ec_16_double_double", reinterpret_cast<void *>(&nl_gcr_50f5194a994d56ec_16_double_double)}, + {"nl_gcr_50f5194a994d56ec_16_double_double", reinterpret_cast<void *>(&nl_gcr_50f5194a994d56ec_16_double_double)}, // NOLINT // starhawk - {"nl_gcr_528a27fe9ed07d67_45_double_double", reinterpret_cast<void *>(&nl_gcr_528a27fe9ed07d67_45_double_double)}, + {"nl_gcr_528a27fe9ed07d67_45_double_double", reinterpret_cast<void *>(&nl_gcr_528a27fe9ed07d67_45_double_double)}, // NOLINT // astrob - {"nl_gcr_536c3652eb3bc075_46_double_double", reinterpret_cast<void *>(&nl_gcr_536c3652eb3bc075_46_double_double)}, + {"nl_gcr_536c3652eb3bc075_46_double_double", reinterpret_cast<void *>(&nl_gcr_536c3652eb3bc075_46_double_double)}, // NOLINT // boxingb - {"nl_gcr_53e1117fdb16f546_23_double_double", reinterpret_cast<void *>(&nl_gcr_53e1117fdb16f546_23_double_double)}, + {"nl_gcr_53e1117fdb16f546_23_double_double", reinterpret_cast<void *>(&nl_gcr_53e1117fdb16f546_23_double_double)}, // NOLINT // cheekyms - {"nl_gcr_546396f65ce48700_12_double_double", reinterpret_cast<void *>(&nl_gcr_546396f65ce48700_12_double_double)}, + {"nl_gcr_546396f65ce48700_12_double_double", reinterpret_cast<void *>(&nl_gcr_546396f65ce48700_12_double_double)}, // NOLINT // dpatrol - {"nl_gcr_59cb6bf7cb9d17dc_7_double_double", reinterpret_cast<void *>(&nl_gcr_59cb6bf7cb9d17dc_7_double_double)}, + {"nl_gcr_59cb6bf7cb9d17dc_7_double_double", reinterpret_cast<void *>(&nl_gcr_59cb6bf7cb9d17dc_7_double_double)}, // NOLINT // breakout - {"nl_gcr_5a3419e2809520de_13_double_double", reinterpret_cast<void *>(&nl_gcr_5a3419e2809520de_13_double_double)}, + {"nl_gcr_5a3419e2809520de_13_double_double", reinterpret_cast<void *>(&nl_gcr_5a3419e2809520de_13_double_double)}, // NOLINT // segausb - {"nl_gcr_5b73834d5f313d38_12_double_double", reinterpret_cast<void *>(&nl_gcr_5b73834d5f313d38_12_double_double)}, + {"nl_gcr_5b73834d5f313d38_12_double_double", reinterpret_cast<void *>(&nl_gcr_5b73834d5f313d38_12_double_double)}, // NOLINT // tailg - {"nl_gcr_5ccf7da1202da2e5_31_double_double", reinterpret_cast<void *>(&nl_gcr_5ccf7da1202da2e5_31_double_double)}, + {"nl_gcr_5ccf7da1202da2e5_31_double_double", reinterpret_cast<void *>(&nl_gcr_5ccf7da1202da2e5_31_double_double)}, // NOLINT // starcas - {"nl_gcr_5d550fc7441617a2_109_double_double", reinterpret_cast<void *>(&nl_gcr_5d550fc7441617a2_109_double_double)}, + {"nl_gcr_5d550fc7441617a2_109_double_double", reinterpret_cast<void *>(&nl_gcr_5d550fc7441617a2_109_double_double)}, // NOLINT // zac1b11142 - {"nl_gcr_6041272373b8603c_178_double_double", reinterpret_cast<void *>(&nl_gcr_6041272373b8603c_178_double_double)}, + {"nl_gcr_6041272373b8603c_178_double_double", reinterpret_cast<void *>(&nl_gcr_6041272373b8603c_178_double_double)}, // NOLINT // astrob - {"nl_gcr_62464664b1c5aa1e_27_double_double", reinterpret_cast<void *>(&nl_gcr_62464664b1c5aa1e_27_double_double)}, + {"nl_gcr_62464664b1c5aa1e_27_double_double", reinterpret_cast<void *>(&nl_gcr_62464664b1c5aa1e_27_double_double)}, // NOLINT // solarq - {"nl_gcr_62612f71055b8fd4_303_double_double", reinterpret_cast<void *>(&nl_gcr_62612f71055b8fd4_303_double_double)}, + {"nl_gcr_62612f71055b8fd4_303_double_double", reinterpret_cast<void *>(&nl_gcr_62612f71055b8fd4_303_double_double)}, // NOLINT // konami1x - {"nl_gcr_62b99b9904a8c804_49_double_double", reinterpret_cast<void *>(&nl_gcr_62b99b9904a8c804_49_double_double)}, + {"nl_gcr_62b99b9904a8c804_49_double_double", reinterpret_cast<void *>(&nl_gcr_62b99b9904a8c804_49_double_double)}, // NOLINT // fireone - {"nl_gcr_643133e86b2b1628_73_double_double", reinterpret_cast<void *>(&nl_gcr_643133e86b2b1628_73_double_double)}, + {"nl_gcr_643133e86b2b1628_73_double_double", reinterpret_cast<void *>(&nl_gcr_643133e86b2b1628_73_double_double)}, // NOLINT // starfire - {"nl_gcr_649ebca7fa6793ed_27_double_double", reinterpret_cast<void *>(&nl_gcr_649ebca7fa6793ed_27_double_double)}, + {"nl_gcr_649ebca7fa6793ed_27_double_double", reinterpret_cast<void *>(&nl_gcr_649ebca7fa6793ed_27_double_double)}, // NOLINT // armora - {"nl_gcr_64e460d8f716cd89_58_double_double", reinterpret_cast<void *>(&nl_gcr_64e460d8f716cd89_58_double_double)}, + {"nl_gcr_64e460d8f716cd89_58_double_double", reinterpret_cast<void *>(&nl_gcr_64e460d8f716cd89_58_double_double)}, // NOLINT // flyball - {"nl_gcr_6622b53554e3776_291_double_double", reinterpret_cast<void *>(&nl_gcr_6622b53554e3776_291_double_double)}, + {"nl_gcr_6622b53554e3776_291_double_double", reinterpret_cast<void *>(&nl_gcr_6622b53554e3776_291_double_double)}, // NOLINT // solarq - {"nl_gcr_66496d6073aca98e_20_double_double", reinterpret_cast<void *>(&nl_gcr_66496d6073aca98e_20_double_double)}, + {"nl_gcr_66496d6073aca98e_20_double_double", reinterpret_cast<void *>(&nl_gcr_66496d6073aca98e_20_double_double)}, // NOLINT // starhawk - {"nl_gcr_67838e11f714c455_12_double_double", reinterpret_cast<void *>(&nl_gcr_67838e11f714c455_12_double_double)}, + {"nl_gcr_67838e11f714c455_12_double_double", reinterpret_cast<void *>(&nl_gcr_67838e11f714c455_12_double_double)}, // NOLINT // ripoff - {"nl_gcr_698d5dd47fb16d5_16_double_double", reinterpret_cast<void *>(&nl_gcr_698d5dd47fb16d5_16_double_double)}, + {"nl_gcr_698d5dd47fb16d5_16_double_double", reinterpret_cast<void *>(&nl_gcr_698d5dd47fb16d5_16_double_double)}, // NOLINT // astrob - {"nl_gcr_6c24726f30e8dc34_15_double_double", reinterpret_cast<void *>(&nl_gcr_6c24726f30e8dc34_15_double_double)}, + {"nl_gcr_6c24726f30e8dc34_15_double_double", reinterpret_cast<void *>(&nl_gcr_6c24726f30e8dc34_15_double_double)}, // NOLINT // spacfury - {"nl_gcr_6eae7b15cd376318_43_double_double", reinterpret_cast<void *>(&nl_gcr_6eae7b15cd376318_43_double_double)}, + {"nl_gcr_6eae7b15cd376318_43_double_double", reinterpret_cast<void *>(&nl_gcr_6eae7b15cd376318_43_double_double)}, // NOLINT // barrier - {"nl_gcr_6ef39a62161d596c_47_double_double", reinterpret_cast<void *>(&nl_gcr_6ef39a62161d596c_47_double_double)}, + {"nl_gcr_6ef39a62161d596c_47_double_double", reinterpret_cast<void *>(&nl_gcr_6ef39a62161d596c_47_double_double)}, // NOLINT // starhawk - {"nl_gcr_723fa454468a93d_7_double_double", reinterpret_cast<void *>(&nl_gcr_723fa454468a93d_7_double_double)}, + {"nl_gcr_723fa454468a93d_7_double_double", reinterpret_cast<void *>(&nl_gcr_723fa454468a93d_7_double_double)}, // NOLINT // cheekyms - {"nl_gcr_733c72a820fdbd1f_7_double_double", reinterpret_cast<void *>(&nl_gcr_733c72a820fdbd1f_7_double_double)}, + {"nl_gcr_733c72a820fdbd1f_7_double_double", reinterpret_cast<void *>(&nl_gcr_733c72a820fdbd1f_7_double_double)}, // NOLINT // tailg - {"nl_gcr_7388106355fb27c3_12_double_double", reinterpret_cast<void *>(&nl_gcr_7388106355fb27c3_12_double_double)}, + {"nl_gcr_7388106355fb27c3_12_double_double", reinterpret_cast<void *>(&nl_gcr_7388106355fb27c3_12_double_double)}, // NOLINT // tp1985 - {"nl_gcr_73f2ba8ad4a45b26_10_double_double", reinterpret_cast<void *>(&nl_gcr_73f2ba8ad4a45b26_10_double_double)}, + {"nl_gcr_73f2ba8ad4a45b26_10_double_double", reinterpret_cast<void *>(&nl_gcr_73f2ba8ad4a45b26_10_double_double)}, // NOLINT // zac1b11142 - {"nl_gcr_7425594cec8024ad_30_double_double", reinterpret_cast<void *>(&nl_gcr_7425594cec8024ad_30_double_double)}, + {"nl_gcr_7425594cec8024ad_30_double_double", reinterpret_cast<void *>(&nl_gcr_7425594cec8024ad_30_double_double)}, // NOLINT // tp1985 - {"nl_gcr_74349e9889a2630b_7_double_double", reinterpret_cast<void *>(&nl_gcr_74349e9889a2630b_7_double_double)}, + {"nl_gcr_74349e9889a2630b_7_double_double", reinterpret_cast<void *>(&nl_gcr_74349e9889a2630b_7_double_double)}, // NOLINT // gunfight - {"nl_gcr_743595e64cee0a5e_112_double_double", reinterpret_cast<void *>(&nl_gcr_743595e64cee0a5e_112_double_double)}, + {"nl_gcr_743595e64cee0a5e_112_double_double", reinterpret_cast<void *>(&nl_gcr_743595e64cee0a5e_112_double_double)}, // NOLINT // ripoff - {"nl_gcr_76c9e236353caed1_35_double_double", reinterpret_cast<void *>(&nl_gcr_76c9e236353caed1_35_double_double)}, + {"nl_gcr_76c9e236353caed1_35_double_double", reinterpret_cast<void *>(&nl_gcr_76c9e236353caed1_35_double_double)}, // NOLINT // gamemachine - {"nl_gcr_782d79b5cbe953b1_7_double_double", reinterpret_cast<void *>(&nl_gcr_782d79b5cbe953b1_7_double_double)}, + {"nl_gcr_782d79b5cbe953b1_7_double_double", reinterpret_cast<void *>(&nl_gcr_782d79b5cbe953b1_7_double_double)}, // NOLINT // barrier - {"nl_gcr_79e756c5892cf87d_31_double_double", reinterpret_cast<void *>(&nl_gcr_79e756c5892cf87d_31_double_double)}, + {"nl_gcr_79e756c5892cf87d_31_double_double", reinterpret_cast<void *>(&nl_gcr_79e756c5892cf87d_31_double_double)}, // NOLINT // breakout - {"nl_gcr_7a42b97d838ca073_7_double_double", reinterpret_cast<void *>(&nl_gcr_7a42b97d838ca073_7_double_double)}, + {"nl_gcr_7a42b97d838ca073_7_double_double", reinterpret_cast<void *>(&nl_gcr_7a42b97d838ca073_7_double_double)}, // NOLINT // fireone - {"nl_gcr_7aee4423e3fdbfda_128_double_double", reinterpret_cast<void *>(&nl_gcr_7aee4423e3fdbfda_128_double_double)}, + {"nl_gcr_7aee4423e3fdbfda_128_double_double", reinterpret_cast<void *>(&nl_gcr_7aee4423e3fdbfda_128_double_double)}, // NOLINT // astrob - {"nl_gcr_7c86a9bc1c6aef4c_7_double_double", reinterpret_cast<void *>(&nl_gcr_7c86a9bc1c6aef4c_7_double_double)}, + {"nl_gcr_7c86a9bc1c6aef4c_7_double_double", reinterpret_cast<void *>(&nl_gcr_7c86a9bc1c6aef4c_7_double_double)}, // NOLINT // solarq - {"nl_gcr_7caaa135bff3d9f3_15_double_double", reinterpret_cast<void *>(&nl_gcr_7caaa135bff3d9f3_15_double_double)}, + {"nl_gcr_7caaa135bff3d9f3_15_double_double", reinterpret_cast<void *>(&nl_gcr_7caaa135bff3d9f3_15_double_double)}, // NOLINT // warrior - {"nl_gcr_8003d4625273fa4d_10_double_double", reinterpret_cast<void *>(&nl_gcr_8003d4625273fa4d_10_double_double)}, + {"nl_gcr_8003d4625273fa4d_10_double_double", reinterpret_cast<void *>(&nl_gcr_8003d4625273fa4d_10_double_double)}, // NOLINT // kidniki - {"nl_gcr_8046625a0fe0959_21_double_double", reinterpret_cast<void *>(&nl_gcr_8046625a0fe0959_21_double_double)}, + {"nl_gcr_8046625a0fe0959_21_double_double", reinterpret_cast<void *>(&nl_gcr_8046625a0fe0959_21_double_double)}, // NOLINT // mario - {"nl_gcr_80b4b1e5cc58d303_29_double_double", reinterpret_cast<void *>(&nl_gcr_80b4b1e5cc58d303_29_double_double)}, + {"nl_gcr_80b4b1e5cc58d303_29_double_double", reinterpret_cast<void *>(&nl_gcr_80b4b1e5cc58d303_29_double_double)}, // NOLINT // elim - {"nl_gcr_81f40a54af2ca202_10_double_double", reinterpret_cast<void *>(&nl_gcr_81f40a54af2ca202_10_double_double)}, + {"nl_gcr_81f40a54af2ca202_10_double_double", reinterpret_cast<void *>(&nl_gcr_81f40a54af2ca202_10_double_double)}, // NOLINT // sundance - {"nl_gcr_8446e63d7842f6a6_70_double_double", reinterpret_cast<void *>(&nl_gcr_8446e63d7842f6a6_70_double_double)}, + {"nl_gcr_8446e63d7842f6a6_70_double_double", reinterpret_cast<void *>(&nl_gcr_8446e63d7842f6a6_70_double_double)}, // NOLINT // dpatrol - {"nl_gcr_85652d3e3ada285a_10_double_double", reinterpret_cast<void *>(&nl_gcr_85652d3e3ada285a_10_double_double)}, + {"nl_gcr_85652d3e3ada285a_10_double_double", reinterpret_cast<void *>(&nl_gcr_85652d3e3ada285a_10_double_double)}, // NOLINT // zac1b11142 - {"nl_gcr_861d39f81d29d51_12_double_double", reinterpret_cast<void *>(&nl_gcr_861d39f81d29d51_12_double_double)}, + {"nl_gcr_861d39f81d29d51_12_double_double", reinterpret_cast<void *>(&nl_gcr_861d39f81d29d51_12_double_double)}, // NOLINT // 280zzzap - {"nl_gcr_864a61c57bac9c38_123_double_double", reinterpret_cast<void *>(&nl_gcr_864a61c57bac9c38_123_double_double)}, + {"nl_gcr_864a61c57bac9c38_123_double_double", reinterpret_cast<void *>(&nl_gcr_864a61c57bac9c38_123_double_double)}, // NOLINT // zac1b11142 - {"nl_gcr_87cb2c78a2628efd_7_double_double", reinterpret_cast<void *>(&nl_gcr_87cb2c78a2628efd_7_double_double)}, + {"nl_gcr_87cb2c78a2628efd_7_double_double", reinterpret_cast<void *>(&nl_gcr_87cb2c78a2628efd_7_double_double)}, // NOLINT // starcas - {"nl_gcr_88a8ef5f6bd43d48_12_double_double", reinterpret_cast<void *>(&nl_gcr_88a8ef5f6bd43d48_12_double_double)}, + {"nl_gcr_88a8ef5f6bd43d48_12_double_double", reinterpret_cast<void *>(&nl_gcr_88a8ef5f6bd43d48_12_double_double)}, // NOLINT // breakout - {"nl_gcr_8a1565d1413f42f7_31_double_double", reinterpret_cast<void *>(&nl_gcr_8a1565d1413f42f7_31_double_double)}, + {"nl_gcr_8a1565d1413f42f7_31_double_double", reinterpret_cast<void *>(&nl_gcr_8a1565d1413f42f7_31_double_double)}, // NOLINT // starhawk - {"nl_gcr_8b1ac1e181eec3fc_40_double_double", reinterpret_cast<void *>(&nl_gcr_8b1ac1e181eec3fc_40_double_double)}, + {"nl_gcr_8b1ac1e181eec3fc_40_double_double", reinterpret_cast<void *>(&nl_gcr_8b1ac1e181eec3fc_40_double_double)}, // NOLINT // rebound - {"nl_gcr_8bec817b324dcc3_28_double_double", reinterpret_cast<void *>(&nl_gcr_8bec817b324dcc3_28_double_double)}, + {"nl_gcr_8bec817b324dcc3_28_double_double", reinterpret_cast<void *>(&nl_gcr_8bec817b324dcc3_28_double_double)}, // NOLINT // cocoloco - {"nl_gcr_8c0f7f2284333de5_16_double_double", reinterpret_cast<void *>(&nl_gcr_8c0f7f2284333de5_16_double_double)}, + {"nl_gcr_8c0f7f2284333de5_16_double_double", reinterpret_cast<void *>(&nl_gcr_8c0f7f2284333de5_16_double_double)}, // NOLINT // spacfury - {"nl_gcr_8c1dd4afcf0f8ea2_15_double_double", reinterpret_cast<void *>(&nl_gcr_8c1dd4afcf0f8ea2_15_double_double)}, + {"nl_gcr_8c1dd4afcf0f8ea2_15_double_double", reinterpret_cast<void *>(&nl_gcr_8c1dd4afcf0f8ea2_15_double_double)}, // NOLINT // fireone - {"nl_gcr_8c512fd6a6dabc50_35_double_double", reinterpret_cast<void *>(&nl_gcr_8c512fd6a6dabc50_35_double_double)}, + {"nl_gcr_8c512fd6a6dabc50_35_double_double", reinterpret_cast<void *>(&nl_gcr_8c512fd6a6dabc50_35_double_double)}, // NOLINT // segausb - {"nl_gcr_8cc4eb213eaeef9b_30_double_double", reinterpret_cast<void *>(&nl_gcr_8cc4eb213eaeef9b_30_double_double)}, + {"nl_gcr_8cc4eb213eaeef9b_30_double_double", reinterpret_cast<void *>(&nl_gcr_8cc4eb213eaeef9b_30_double_double)}, // NOLINT // starcrus - {"nl_gcr_8d7bddf33d942482_129_double_double", reinterpret_cast<void *>(&nl_gcr_8d7bddf33d942482_129_double_double)}, + {"nl_gcr_8d7bddf33d942482_129_double_double", reinterpret_cast<void *>(&nl_gcr_8d7bddf33d942482_129_double_double)}, // NOLINT // tank - {"nl_gcr_930b64361c2cdba8_328_double_double", reinterpret_cast<void *>(&nl_gcr_930b64361c2cdba8_328_double_double)}, + {"nl_gcr_930b64361c2cdba8_328_double_double", reinterpret_cast<void *>(&nl_gcr_930b64361c2cdba8_328_double_double)}, // NOLINT // gamemachine - {"nl_gcr_934712b55bb3b2b2_10_double_double", reinterpret_cast<void *>(&nl_gcr_934712b55bb3b2b2_10_double_double)}, + {"nl_gcr_934712b55bb3b2b2_10_double_double", reinterpret_cast<void *>(&nl_gcr_934712b55bb3b2b2_10_double_double)}, // NOLINT // kidniki - {"nl_gcr_9a5874c8e2da79d2_37_double_double", reinterpret_cast<void *>(&nl_gcr_9a5874c8e2da79d2_37_double_double)}, + {"nl_gcr_9a5874c8e2da79d2_37_double_double", reinterpret_cast<void *>(&nl_gcr_9a5874c8e2da79d2_37_double_double)}, // NOLINT // fireone - {"nl_gcr_9aa159329f86ca8b_70_double_double", reinterpret_cast<void *>(&nl_gcr_9aa159329f86ca8b_70_double_double)}, + {"nl_gcr_9aa159329f86ca8b_70_double_double", reinterpret_cast<void *>(&nl_gcr_9aa159329f86ca8b_70_double_double)}, // NOLINT // warrior - {"nl_gcr_9c975530a1a529d6_7_double_double", reinterpret_cast<void *>(&nl_gcr_9c975530a1a529d6_7_double_double)}, + {"nl_gcr_9c975530a1a529d6_7_double_double", reinterpret_cast<void *>(&nl_gcr_9c975530a1a529d6_7_double_double)}, // NOLINT // kidniki - {"nl_gcr_9f141889c2091efc_24_double_double", reinterpret_cast<void *>(&nl_gcr_9f141889c2091efc_24_double_double)}, + {"nl_gcr_9f141889c2091efc_24_double_double", reinterpret_cast<void *>(&nl_gcr_9f141889c2091efc_24_double_double)}, // NOLINT // segas16b_audio - {"nl_gcr_9f7104c5e25c87dd_111_double_double", reinterpret_cast<void *>(&nl_gcr_9f7104c5e25c87dd_111_double_double)}, + {"nl_gcr_9f7104c5e25c87dd_111_double_double", reinterpret_cast<void *>(&nl_gcr_9f7104c5e25c87dd_111_double_double)}, // NOLINT // boxingb - {"nl_gcr_a0bf548977306172_25_double_double", reinterpret_cast<void *>(&nl_gcr_a0bf548977306172_25_double_double)}, + {"nl_gcr_a0bf548977306172_25_double_double", reinterpret_cast<void *>(&nl_gcr_a0bf548977306172_25_double_double)}, // NOLINT // boxingb - {"nl_gcr_a1132c8737d5d463_96_double_double", reinterpret_cast<void *>(&nl_gcr_a1132c8737d5d463_96_double_double)}, + {"nl_gcr_a1132c8737d5d463_96_double_double", reinterpret_cast<void *>(&nl_gcr_a1132c8737d5d463_96_double_double)}, // NOLINT // astrob - {"nl_gcr_a41a44bd5c424f88_13_double_double", reinterpret_cast<void *>(&nl_gcr_a41a44bd5c424f88_13_double_double)}, + {"nl_gcr_a41a44bd5c424f88_13_double_double", reinterpret_cast<void *>(&nl_gcr_a41a44bd5c424f88_13_double_double)}, // NOLINT // tp1985 - {"nl_gcr_a4540ffea06b4346_26_double_double", reinterpret_cast<void *>(&nl_gcr_a4540ffea06b4346_26_double_double)}, + {"nl_gcr_a4540ffea06b4346_26_double_double", reinterpret_cast<void *>(&nl_gcr_a4540ffea06b4346_26_double_double)}, // NOLINT // tailg - {"nl_gcr_a46301cd3479b8db_15_double_double", reinterpret_cast<void *>(&nl_gcr_a46301cd3479b8db_15_double_double)}, + {"nl_gcr_a46301cd3479b8db_15_double_double", reinterpret_cast<void *>(&nl_gcr_a46301cd3479b8db_15_double_double)}, // NOLINT // barrier - {"nl_gcr_a50a4b733e95414a_10_double_double", reinterpret_cast<void *>(&nl_gcr_a50a4b733e95414a_10_double_double)}, + {"nl_gcr_a50a4b733e95414a_10_double_double", reinterpret_cast<void *>(&nl_gcr_a50a4b733e95414a_10_double_double)}, // NOLINT // starcas - {"nl_gcr_a582a424cb61c678_62_double_double", reinterpret_cast<void *>(&nl_gcr_a582a424cb61c678_62_double_double)}, + {"nl_gcr_a582a424cb61c678_62_double_double", reinterpret_cast<void *>(&nl_gcr_a582a424cb61c678_62_double_double)}, // NOLINT // tank - {"nl_gcr_a63d1344e34bef4b_36_double_double", reinterpret_cast<void *>(&nl_gcr_a63d1344e34bef4b_36_double_double)}, + {"nl_gcr_a63d1344e34bef4b_36_double_double", reinterpret_cast<void *>(&nl_gcr_a63d1344e34bef4b_36_double_double)}, // NOLINT // boxingb - {"nl_gcr_a6b734322b3ea924_22_double_double", reinterpret_cast<void *>(&nl_gcr_a6b734322b3ea924_22_double_double)}, + {"nl_gcr_a6b734322b3ea924_22_double_double", reinterpret_cast<void *>(&nl_gcr_a6b734322b3ea924_22_double_double)}, // NOLINT // armora - {"nl_gcr_a6cfda6668b153c2_22_double_double", reinterpret_cast<void *>(&nl_gcr_a6cfda6668b153c2_22_double_double)}, + {"nl_gcr_a6cfda6668b153c2_22_double_double", reinterpret_cast<void *>(&nl_gcr_a6cfda6668b153c2_22_double_double)}, // NOLINT // boxingb - {"nl_gcr_a6f74be7f61e6db2_29_double_double", reinterpret_cast<void *>(&nl_gcr_a6f74be7f61e6db2_29_double_double)}, + {"nl_gcr_a6f74be7f61e6db2_29_double_double", reinterpret_cast<void *>(&nl_gcr_a6f74be7f61e6db2_29_double_double)}, // NOLINT // carpolo - {"nl_gcr_a8f1d076330f06b7_34_double_double", reinterpret_cast<void *>(&nl_gcr_a8f1d076330f06b7_34_double_double)}, + {"nl_gcr_a8f1d076330f06b7_34_double_double", reinterpret_cast<void *>(&nl_gcr_a8f1d076330f06b7_34_double_double)}, // NOLINT // breakout - {"nl_gcr_a971eeb2ef76f75f_13_double_double", reinterpret_cast<void *>(&nl_gcr_a971eeb2ef76f75f_13_double_double)}, + {"nl_gcr_a971eeb2ef76f75f_13_double_double", reinterpret_cast<void *>(&nl_gcr_a971eeb2ef76f75f_13_double_double)}, // NOLINT // ripoff - {"nl_gcr_aa07266ef5d420d1_11_double_double", reinterpret_cast<void *>(&nl_gcr_aa07266ef5d420d1_11_double_double)}, + {"nl_gcr_aa07266ef5d420d1_11_double_double", reinterpret_cast<void *>(&nl_gcr_aa07266ef5d420d1_11_double_double)}, // NOLINT // 280zzzap - {"nl_gcr_ab9144d965a37e4_113_double_double", reinterpret_cast<void *>(&nl_gcr_ab9144d965a37e4_113_double_double)}, + {"nl_gcr_ab9144d965a37e4_113_double_double", reinterpret_cast<void *>(&nl_gcr_ab9144d965a37e4_113_double_double)}, // NOLINT // sspeedr - {"nl_gcr_ac1e401ddf971e15_10_double_double", reinterpret_cast<void *>(&nl_gcr_ac1e401ddf971e15_10_double_double)}, + {"nl_gcr_ac1e401ddf971e15_10_double_double", reinterpret_cast<void *>(&nl_gcr_ac1e401ddf971e15_10_double_double)}, // NOLINT // starfire - {"nl_gcr_aceb6035dfb557c9_12_double_double", reinterpret_cast<void *>(&nl_gcr_aceb6035dfb557c9_12_double_double)}, + {"nl_gcr_aceb6035dfb557c9_12_double_double", reinterpret_cast<void *>(&nl_gcr_aceb6035dfb557c9_12_double_double)}, // NOLINT // sundance - {"nl_gcr_ad6dba01ff2425c3_12_double_double", reinterpret_cast<void *>(&nl_gcr_ad6dba01ff2425c3_12_double_double)}, + {"nl_gcr_ad6dba01ff2425c3_12_double_double", reinterpret_cast<void *>(&nl_gcr_ad6dba01ff2425c3_12_double_double)}, // NOLINT // rebound - {"nl_gcr_ae15f7f8a55fc96_7_double_double", reinterpret_cast<void *>(&nl_gcr_ae15f7f8a55fc96_7_double_double)}, + {"nl_gcr_ae15f7f8a55fc96_7_double_double", reinterpret_cast<void *>(&nl_gcr_ae15f7f8a55fc96_7_double_double)}, // NOLINT // armora - {"nl_gcr_afcde432efdafb81_56_double_double", reinterpret_cast<void *>(&nl_gcr_afcde432efdafb81_56_double_double)}, + {"nl_gcr_afcde432efdafb81_56_double_double", reinterpret_cast<void *>(&nl_gcr_afcde432efdafb81_56_double_double)}, // NOLINT // mario - {"nl_gcr_afce66fb47d3c5f3_62_double_double", reinterpret_cast<void *>(&nl_gcr_afce66fb47d3c5f3_62_double_double)}, + {"nl_gcr_afce66fb47d3c5f3_62_double_double", reinterpret_cast<void *>(&nl_gcr_afce66fb47d3c5f3_62_double_double)}, // NOLINT // spacewar - {"nl_gcr_b09deef9a25aecaf_24_double_double", reinterpret_cast<void *>(&nl_gcr_b09deef9a25aecaf_24_double_double)}, + {"nl_gcr_b09deef9a25aecaf_24_double_double", reinterpret_cast<void *>(&nl_gcr_b09deef9a25aecaf_24_double_double)}, // NOLINT // spacfury - {"nl_gcr_b1db23287df1da54_175_double_double", reinterpret_cast<void *>(&nl_gcr_b1db23287df1da54_175_double_double)}, + {"nl_gcr_b1db23287df1da54_175_double_double", reinterpret_cast<void *>(&nl_gcr_b1db23287df1da54_175_double_double)}, // NOLINT // segaspeech - {"nl_gcr_b22769fbf3159a8d_21_double_double", reinterpret_cast<void *>(&nl_gcr_b22769fbf3159a8d_21_double_double)}, + {"nl_gcr_b22769fbf3159a8d_21_double_double", reinterpret_cast<void *>(&nl_gcr_b22769fbf3159a8d_21_double_double)}, // NOLINT // breakout - {"nl_gcr_b66ff415b228d5f8_10_double_double", reinterpret_cast<void *>(&nl_gcr_b66ff415b228d5f8_10_double_double)}, + {"nl_gcr_b66ff415b228d5f8_10_double_double", reinterpret_cast<void *>(&nl_gcr_b66ff415b228d5f8_10_double_double)}, // NOLINT // starcas - {"nl_gcr_b7344e05aac90017_65_double_double", reinterpret_cast<void *>(&nl_gcr_b7344e05aac90017_65_double_double)}, + {"nl_gcr_b7344e05aac90017_65_double_double", reinterpret_cast<void *>(&nl_gcr_b7344e05aac90017_65_double_double)}, // NOLINT // starfire - {"nl_gcr_b75e0baeb501e907_23_double_double", reinterpret_cast<void *>(&nl_gcr_b75e0baeb501e907_23_double_double)}, + {"nl_gcr_b75e0baeb501e907_23_double_double", reinterpret_cast<void *>(&nl_gcr_b75e0baeb501e907_23_double_double)}, // NOLINT // spacfury - {"nl_gcr_b7b209d222c0a9a6_91_double_double", reinterpret_cast<void *>(&nl_gcr_b7b209d222c0a9a6_91_double_double)}, + {"nl_gcr_b7b209d222c0a9a6_91_double_double", reinterpret_cast<void *>(&nl_gcr_b7b209d222c0a9a6_91_double_double)}, // NOLINT // boxingb - {"nl_gcr_b8d6d148a50bdb8f_55_double_double", reinterpret_cast<void *>(&nl_gcr_b8d6d148a50bdb8f_55_double_double)}, + {"nl_gcr_b8d6d148a50bdb8f_55_double_double", reinterpret_cast<void *>(&nl_gcr_b8d6d148a50bdb8f_55_double_double)}, // NOLINT // 280zzzap - {"nl_gcr_bb501e6a23177009_57_double_double", reinterpret_cast<void *>(&nl_gcr_bb501e6a23177009_57_double_double)}, + {"nl_gcr_bb501e6a23177009_57_double_double", reinterpret_cast<void *>(&nl_gcr_bb501e6a23177009_57_double_double)}, // NOLINT // elim - {"nl_gcr_bb56fa5325163fc3_15_double_double", reinterpret_cast<void *>(&nl_gcr_bb56fa5325163fc3_15_double_double)}, + {"nl_gcr_bb56fa5325163fc3_15_double_double", reinterpret_cast<void *>(&nl_gcr_bb56fa5325163fc3_15_double_double)}, // NOLINT // starfire - {"nl_gcr_bd1514d7defd4062_9_double_double", reinterpret_cast<void *>(&nl_gcr_bd1514d7defd4062_9_double_double)}, + {"nl_gcr_bd1514d7defd4062_9_double_double", reinterpret_cast<void *>(&nl_gcr_bd1514d7defd4062_9_double_double)}, // NOLINT // ripoff - {"nl_gcr_be7c805100c522fd_59_double_double", reinterpret_cast<void *>(&nl_gcr_be7c805100c522fd_59_double_double)}, + {"nl_gcr_be7c805100c522fd_59_double_double", reinterpret_cast<void *>(&nl_gcr_be7c805100c522fd_59_double_double)}, // NOLINT // elim - {"nl_gcr_be831e5faa508573_150_double_double", reinterpret_cast<void *>(&nl_gcr_be831e5faa508573_150_double_double)}, + {"nl_gcr_be831e5faa508573_150_double_double", reinterpret_cast<void *>(&nl_gcr_be831e5faa508573_150_double_double)}, // NOLINT // warrior - {"nl_gcr_bff07f8d339f7cc4_89_double_double", reinterpret_cast<void *>(&nl_gcr_bff07f8d339f7cc4_89_double_double)}, + {"nl_gcr_bff07f8d339f7cc4_89_double_double", reinterpret_cast<void *>(&nl_gcr_bff07f8d339f7cc4_89_double_double)}, // NOLINT // fireone - {"nl_gcr_c1d22fe6e895255d_79_double_double", reinterpret_cast<void *>(&nl_gcr_c1d22fe6e895255d_79_double_double)}, + {"nl_gcr_c1d22fe6e895255d_79_double_double", reinterpret_cast<void *>(&nl_gcr_c1d22fe6e895255d_79_double_double)}, // NOLINT // starcrus - {"nl_gcr_c2e616f3de30f15b_31_double_double", reinterpret_cast<void *>(&nl_gcr_c2e616f3de30f15b_31_double_double)}, + {"nl_gcr_c2e616f3de30f15b_31_double_double", reinterpret_cast<void *>(&nl_gcr_c2e616f3de30f15b_31_double_double)}, // NOLINT // tailg - {"nl_gcr_c4cec7aed23b7b94_23_double_double", reinterpret_cast<void *>(&nl_gcr_c4cec7aed23b7b94_23_double_double)}, + {"nl_gcr_c4cec7aed23b7b94_23_double_double", reinterpret_cast<void *>(&nl_gcr_c4cec7aed23b7b94_23_double_double)}, // NOLINT // segausb - {"nl_gcr_c61e08cf5e35918_84_double_double", reinterpret_cast<void *>(&nl_gcr_c61e08cf5e35918_84_double_double)}, + {"nl_gcr_c61e08cf5e35918_84_double_double", reinterpret_cast<void *>(&nl_gcr_c61e08cf5e35918_84_double_double)}, // NOLINT // popeye - {"nl_gcr_c6f25bb06e161d1c_50_double_double", reinterpret_cast<void *>(&nl_gcr_c6f25bb06e161d1c_50_double_double)}, + {"nl_gcr_c6f25bb06e161d1c_50_double_double", reinterpret_cast<void *>(&nl_gcr_c6f25bb06e161d1c_50_double_double)}, // NOLINT // flyball - {"nl_gcr_c74b1a65978d7121_7_double_double", reinterpret_cast<void *>(&nl_gcr_c74b1a65978d7121_7_double_double)}, + {"nl_gcr_c74b1a65978d7121_7_double_double", reinterpret_cast<void *>(&nl_gcr_c74b1a65978d7121_7_double_double)}, // NOLINT // stuntcyc - {"nl_gcr_c924fe5960b1479e_20_double_double", reinterpret_cast<void *>(&nl_gcr_c924fe5960b1479e_20_double_double)}, + {"nl_gcr_c924fe5960b1479e_20_double_double", reinterpret_cast<void *>(&nl_gcr_c924fe5960b1479e_20_double_double)}, // NOLINT // dpatrol - {"nl_gcr_ca68d70bd8f2f62e_22_double_double", reinterpret_cast<void *>(&nl_gcr_ca68d70bd8f2f62e_22_double_double)}, + {"nl_gcr_ca68d70bd8f2f62e_22_double_double", reinterpret_cast<void *>(&nl_gcr_ca68d70bd8f2f62e_22_double_double)}, // NOLINT // breakout - {"nl_gcr_cb2aae3366e0ac1c_7_double_double", reinterpret_cast<void *>(&nl_gcr_cb2aae3366e0ac1c_7_double_double)}, + {"nl_gcr_cb2aae3366e0ac1c_7_double_double", reinterpret_cast<void *>(&nl_gcr_cb2aae3366e0ac1c_7_double_double)}, // NOLINT // barrier - {"nl_gcr_cc913f9c3f9293e7_19_double_double", reinterpret_cast<void *>(&nl_gcr_cc913f9c3f9293e7_19_double_double)}, + {"nl_gcr_cc913f9c3f9293e7_19_double_double", reinterpret_cast<void *>(&nl_gcr_cc913f9c3f9293e7_19_double_double)}, // NOLINT // fireone - {"nl_gcr_cca3d1a4219e2ec0_153_double_double", reinterpret_cast<void *>(&nl_gcr_cca3d1a4219e2ec0_153_double_double)}, + {"nl_gcr_cca3d1a4219e2ec0_153_double_double", reinterpret_cast<void *>(&nl_gcr_cca3d1a4219e2ec0_153_double_double)}, // NOLINT // 1942 - {"nl_gcr_ce766957cb26ff3e_90_double_double", reinterpret_cast<void *>(&nl_gcr_ce766957cb26ff3e_90_double_double)}, + {"nl_gcr_ce766957cb26ff3e_90_double_double", reinterpret_cast<void *>(&nl_gcr_ce766957cb26ff3e_90_double_double)}, // NOLINT // astrob - {"nl_gcr_cf1018e7ed626623_43_double_double", reinterpret_cast<void *>(&nl_gcr_cf1018e7ed626623_43_double_double)}, + {"nl_gcr_cf1018e7ed626623_43_double_double", reinterpret_cast<void *>(&nl_gcr_cf1018e7ed626623_43_double_double)}, // NOLINT // zac1b11142 - {"nl_gcr_cfd3bbf5fbba4765_71_double_double", reinterpret_cast<void *>(&nl_gcr_cfd3bbf5fbba4765_71_double_double)}, + {"nl_gcr_cfd3bbf5fbba4765_71_double_double", reinterpret_cast<void *>(&nl_gcr_cfd3bbf5fbba4765_71_double_double)}, // NOLINT // gunfight - {"nl_gcr_d05b3dbe370c7904_14_double_double", reinterpret_cast<void *>(&nl_gcr_d05b3dbe370c7904_14_double_double)}, + {"nl_gcr_d05b3dbe370c7904_14_double_double", reinterpret_cast<void *>(&nl_gcr_d05b3dbe370c7904_14_double_double)}, // NOLINT // barrier - {"nl_gcr_d06bd7ddbfd17b5e_15_double_double", reinterpret_cast<void *>(&nl_gcr_d06bd7ddbfd17b5e_15_double_double)}, + {"nl_gcr_d06bd7ddbfd17b5e_15_double_double", reinterpret_cast<void *>(&nl_gcr_d06bd7ddbfd17b5e_15_double_double)}, // NOLINT // elim - {"nl_gcr_d13f9c6838af6aeb_13_double_double", reinterpret_cast<void *>(&nl_gcr_d13f9c6838af6aeb_13_double_double)}, + {"nl_gcr_d13f9c6838af6aeb_13_double_double", reinterpret_cast<void *>(&nl_gcr_d13f9c6838af6aeb_13_double_double)}, // NOLINT // elim - {"nl_gcr_d190a0e3b8e1f4a7_7_double_double", reinterpret_cast<void *>(&nl_gcr_d190a0e3b8e1f4a7_7_double_double)}, + {"nl_gcr_d190a0e3b8e1f4a7_7_double_double", reinterpret_cast<void *>(&nl_gcr_d190a0e3b8e1f4a7_7_double_double)}, // NOLINT // elim - {"nl_gcr_d224211d1af6811d_12_double_double", reinterpret_cast<void *>(&nl_gcr_d224211d1af6811d_12_double_double)}, + {"nl_gcr_d224211d1af6811d_12_double_double", reinterpret_cast<void *>(&nl_gcr_d224211d1af6811d_12_double_double)}, // NOLINT // armora - {"nl_gcr_d27a39bc93616187_45_double_double", reinterpret_cast<void *>(&nl_gcr_d27a39bc93616187_45_double_double)}, + {"nl_gcr_d27a39bc93616187_45_double_double", reinterpret_cast<void *>(&nl_gcr_d27a39bc93616187_45_double_double)}, // NOLINT // elim - {"nl_gcr_d2ea3f267b959e8b_20_double_double", reinterpret_cast<void *>(&nl_gcr_d2ea3f267b959e8b_20_double_double)}, + {"nl_gcr_d2ea3f267b959e8b_20_double_double", reinterpret_cast<void *>(&nl_gcr_d2ea3f267b959e8b_20_double_double)}, // NOLINT // starfire - {"nl_gcr_d32effa2b0ea54a1_438_double_double", reinterpret_cast<void *>(&nl_gcr_d32effa2b0ea54a1_438_double_double)}, + {"nl_gcr_d32effa2b0ea54a1_438_double_double", reinterpret_cast<void *>(&nl_gcr_d32effa2b0ea54a1_438_double_double)}, // NOLINT // spacfury - {"nl_gcr_d4c34516ff6aa139_46_double_double", reinterpret_cast<void *>(&nl_gcr_d4c34516ff6aa139_46_double_double)}, + {"nl_gcr_d4c34516ff6aa139_46_double_double", reinterpret_cast<void *>(&nl_gcr_d4c34516ff6aa139_46_double_double)}, // NOLINT // boxingb - {"nl_gcr_d7d45dc58b08cab9_10_double_double", reinterpret_cast<void *>(&nl_gcr_d7d45dc58b08cab9_10_double_double)}, + {"nl_gcr_d7d45dc58b08cab9_10_double_double", reinterpret_cast<void *>(&nl_gcr_d7d45dc58b08cab9_10_double_double)}, // NOLINT // kidniki - {"nl_gcr_d8c511d38cef5f6f_34_double_double", reinterpret_cast<void *>(&nl_gcr_d8c511d38cef5f6f_34_double_double)}, + {"nl_gcr_d8c511d38cef5f6f_34_double_double", reinterpret_cast<void *>(&nl_gcr_d8c511d38cef5f6f_34_double_double)}, // NOLINT // warrior - {"nl_gcr_da598f43329e823_27_double_double", reinterpret_cast<void *>(&nl_gcr_da598f43329e823_27_double_double)}, + {"nl_gcr_da598f43329e823_27_double_double", reinterpret_cast<void *>(&nl_gcr_da598f43329e823_27_double_double)}, // NOLINT // pongf - {"nl_gcr_dbafc5ddaf7a08f8_35_double_double", reinterpret_cast<void *>(&nl_gcr_dbafc5ddaf7a08f8_35_double_double)}, + {"nl_gcr_dbafc5ddaf7a08f8_35_double_double", reinterpret_cast<void *>(&nl_gcr_dbafc5ddaf7a08f8_35_double_double)}, // NOLINT // fireone - {"nl_gcr_dcbecbc127c5868f_36_double_double", reinterpret_cast<void *>(&nl_gcr_dcbecbc127c5868f_36_double_double)}, + {"nl_gcr_dcbecbc127c5868f_36_double_double", reinterpret_cast<void *>(&nl_gcr_dcbecbc127c5868f_36_double_double)}, // NOLINT // sundance - {"nl_gcr_e02a162cb515a958_100_double_double", reinterpret_cast<void *>(&nl_gcr_e02a162cb515a958_100_double_double)}, + {"nl_gcr_e02a162cb515a958_100_double_double", reinterpret_cast<void *>(&nl_gcr_e02a162cb515a958_100_double_double)}, // NOLINT // speedfrk - {"nl_gcr_e07b5b086812756c_7_double_double", reinterpret_cast<void *>(&nl_gcr_e07b5b086812756c_7_double_double)}, + {"nl_gcr_e07b5b086812756c_7_double_double", reinterpret_cast<void *>(&nl_gcr_e07b5b086812756c_7_double_double)}, // NOLINT // solarq - {"nl_gcr_e081f90c2e0313f6_45_double_double", reinterpret_cast<void *>(&nl_gcr_e081f90c2e0313f6_45_double_double)}, + {"nl_gcr_e081f90c2e0313f6_45_double_double", reinterpret_cast<void *>(&nl_gcr_e081f90c2e0313f6_45_double_double)}, // NOLINT // spacewar - {"nl_gcr_e0b492db40bba291_20_double_double", reinterpret_cast<void *>(&nl_gcr_e0b492db40bba291_20_double_double)}, + {"nl_gcr_e0b492db40bba291_20_double_double", reinterpret_cast<void *>(&nl_gcr_e0b492db40bba291_20_double_double)}, // NOLINT // flyball - {"nl_gcr_e15d9316d59cdad9_7_double_double", reinterpret_cast<void *>(&nl_gcr_e15d9316d59cdad9_7_double_double)}, + {"nl_gcr_e15d9316d59cdad9_7_double_double", reinterpret_cast<void *>(&nl_gcr_e15d9316d59cdad9_7_double_double)}, // NOLINT // speedfrk - {"nl_gcr_e4f2ffbf201a3d0c_37_double_double", reinterpret_cast<void *>(&nl_gcr_e4f2ffbf201a3d0c_37_double_double)}, + {"nl_gcr_e4f2ffbf201a3d0c_37_double_double", reinterpret_cast<void *>(&nl_gcr_e4f2ffbf201a3d0c_37_double_double)}, // NOLINT // pongf - {"nl_gcr_e51b463cd890ef6d_7_double_double", reinterpret_cast<void *>(&nl_gcr_e51b463cd890ef6d_7_double_double)}, + {"nl_gcr_e51b463cd890ef6d_7_double_double", reinterpret_cast<void *>(&nl_gcr_e51b463cd890ef6d_7_double_double)}, // NOLINT // sundance - {"nl_gcr_e5b7711fac1ea80c_8_double_double", reinterpret_cast<void *>(&nl_gcr_e5b7711fac1ea80c_8_double_double)}, + {"nl_gcr_e5b7711fac1ea80c_8_double_double", reinterpret_cast<void *>(&nl_gcr_e5b7711fac1ea80c_8_double_double)}, // NOLINT // ripoff - {"nl_gcr_e60314070a75e121_20_double_double", reinterpret_cast<void *>(&nl_gcr_e60314070a75e121_20_double_double)}, + {"nl_gcr_e60314070a75e121_20_double_double", reinterpret_cast<void *>(&nl_gcr_e60314070a75e121_20_double_double)}, // NOLINT // cheekyms - {"nl_gcr_e75302e17c866419_150_double_double", reinterpret_cast<void *>(&nl_gcr_e75302e17c866419_150_double_double)}, + {"nl_gcr_e75302e17c866419_150_double_double", reinterpret_cast<void *>(&nl_gcr_e75302e17c866419_150_double_double)}, // NOLINT // elim - {"nl_gcr_e76692c10e79997e_36_double_double", reinterpret_cast<void *>(&nl_gcr_e76692c10e79997e_36_double_double)}, + {"nl_gcr_e76692c10e79997e_36_double_double", reinterpret_cast<void *>(&nl_gcr_e76692c10e79997e_36_double_double)}, // NOLINT // fireone - {"nl_gcr_e7fb484f621b3ab9_7_double_double", reinterpret_cast<void *>(&nl_gcr_e7fb484f621b3ab9_7_double_double)}, + {"nl_gcr_e7fb484f621b3ab9_7_double_double", reinterpret_cast<void *>(&nl_gcr_e7fb484f621b3ab9_7_double_double)}, // NOLINT // elim - {"nl_gcr_e8aeb165b69427ec_18_double_double", reinterpret_cast<void *>(&nl_gcr_e8aeb165b69427ec_18_double_double)}, + {"nl_gcr_e8aeb165b69427ec_18_double_double", reinterpret_cast<void *>(&nl_gcr_e8aeb165b69427ec_18_double_double)}, // NOLINT // spacewar - {"nl_gcr_e9e8211f43d8f4b3_22_double_double", reinterpret_cast<void *>(&nl_gcr_e9e8211f43d8f4b3_22_double_double)}, + {"nl_gcr_e9e8211f43d8f4b3_22_double_double", reinterpret_cast<void *>(&nl_gcr_e9e8211f43d8f4b3_22_double_double)}, // NOLINT // boxingb - {"nl_gcr_ea2b6e3a05e6ef0b_23_double_double", reinterpret_cast<void *>(&nl_gcr_ea2b6e3a05e6ef0b_23_double_double)}, + {"nl_gcr_ea2b6e3a05e6ef0b_23_double_double", reinterpret_cast<void *>(&nl_gcr_ea2b6e3a05e6ef0b_23_double_double)}, // NOLINT // starcas - {"nl_gcr_ec4f6d2dad5961b9_64_double_double", reinterpret_cast<void *>(&nl_gcr_ec4f6d2dad5961b9_64_double_double)}, + {"nl_gcr_ec4f6d2dad5961b9_64_double_double", reinterpret_cast<void *>(&nl_gcr_ec4f6d2dad5961b9_64_double_double)}, // NOLINT // barrier - {"nl_gcr_ecf17036ce1c07cf_10_double_double", reinterpret_cast<void *>(&nl_gcr_ecf17036ce1c07cf_10_double_double)}, + {"nl_gcr_ecf17036ce1c07cf_10_double_double", reinterpret_cast<void *>(&nl_gcr_ecf17036ce1c07cf_10_double_double)}, // NOLINT // armora - {"nl_gcr_ee2cacaa15d32491_67_double_double", reinterpret_cast<void *>(&nl_gcr_ee2cacaa15d32491_67_double_double)}, + {"nl_gcr_ee2cacaa15d32491_67_double_double", reinterpret_cast<void *>(&nl_gcr_ee2cacaa15d32491_67_double_double)}, // NOLINT // astrob - {"nl_gcr_ee61dcaa355fc625_285_double_double", reinterpret_cast<void *>(&nl_gcr_ee61dcaa355fc625_285_double_double)}, + {"nl_gcr_ee61dcaa355fc625_285_double_double", reinterpret_cast<void *>(&nl_gcr_ee61dcaa355fc625_285_double_double)}, // NOLINT // starcrus - {"nl_gcr_ef2f49641f433a74_94_double_double", reinterpret_cast<void *>(&nl_gcr_ef2f49641f433a74_94_double_double)}, + {"nl_gcr_ef2f49641f433a74_94_double_double", reinterpret_cast<void *>(&nl_gcr_ef2f49641f433a74_94_double_double)}, // NOLINT // spacfury - {"nl_gcr_f365c3863b050e35_45_double_double", reinterpret_cast<void *>(&nl_gcr_f365c3863b050e35_45_double_double)}, + {"nl_gcr_f365c3863b050e35_45_double_double", reinterpret_cast<void *>(&nl_gcr_f365c3863b050e35_45_double_double)}, // NOLINT // spacfury - {"nl_gcr_f3c9a6d53371d709_227_double_double", reinterpret_cast<void *>(&nl_gcr_f3c9a6d53371d709_227_double_double)}, + {"nl_gcr_f3c9a6d53371d709_227_double_double", reinterpret_cast<void *>(&nl_gcr_f3c9a6d53371d709_227_double_double)}, // NOLINT // barrier - {"nl_gcr_f425d4008ae1d2c6_13_double_double", reinterpret_cast<void *>(&nl_gcr_f425d4008ae1d2c6_13_double_double)}, + {"nl_gcr_f425d4008ae1d2c6_13_double_double", reinterpret_cast<void *>(&nl_gcr_f425d4008ae1d2c6_13_double_double)}, // NOLINT // boxingb - {"nl_gcr_f43cf2a28a5a5561_23_double_double", reinterpret_cast<void *>(&nl_gcr_f43cf2a28a5a5561_23_double_double)}, + {"nl_gcr_f43cf2a28a5a5561_23_double_double", reinterpret_cast<void *>(&nl_gcr_f43cf2a28a5a5561_23_double_double)}, // NOLINT // spacfury - {"nl_gcr_f4da1503eabe16cf_16_double_double", reinterpret_cast<void *>(&nl_gcr_f4da1503eabe16cf_16_double_double)}, + {"nl_gcr_f4da1503eabe16cf_16_double_double", reinterpret_cast<void *>(&nl_gcr_f4da1503eabe16cf_16_double_double)}, // NOLINT // elim - {"nl_gcr_f4f4e2ee05cb584e_13_double_double", reinterpret_cast<void *>(&nl_gcr_f4f4e2ee05cb584e_13_double_double)}, + {"nl_gcr_f4f4e2ee05cb584e_13_double_double", reinterpret_cast<void *>(&nl_gcr_f4f4e2ee05cb584e_13_double_double)}, // NOLINT // konami2x - {"nl_gcr_f6900d3f36a91049_85_double_double", reinterpret_cast<void *>(&nl_gcr_f6900d3f36a91049_85_double_double)}, + {"nl_gcr_f6900d3f36a91049_85_double_double", reinterpret_cast<void *>(&nl_gcr_f6900d3f36a91049_85_double_double)}, // NOLINT // breakout - {"nl_gcr_f7dc4f87b5a8ba93_7_double_double", reinterpret_cast<void *>(&nl_gcr_f7dc4f87b5a8ba93_7_double_double)}, + {"nl_gcr_f7dc4f87b5a8ba93_7_double_double", reinterpret_cast<void *>(&nl_gcr_f7dc4f87b5a8ba93_7_double_double)}, // NOLINT // fireone - {"nl_gcr_f8f6a951fd1af6bc_7_double_double", reinterpret_cast<void *>(&nl_gcr_f8f6a951fd1af6bc_7_double_double)}, + {"nl_gcr_f8f6a951fd1af6bc_7_double_double", reinterpret_cast<void *>(&nl_gcr_f8f6a951fd1af6bc_7_double_double)}, // NOLINT // zektor - {"nl_gcr_fbff020f5f5d5a5_144_double_double", reinterpret_cast<void *>(&nl_gcr_fbff020f5f5d5a5_144_double_double)}, + {"nl_gcr_fbff020f5f5d5a5_144_double_double", reinterpret_cast<void *>(&nl_gcr_fbff020f5f5d5a5_144_double_double)}, // NOLINT // kidniki - {"nl_gcr_fc02559fdbfb0e10_67_double_double", reinterpret_cast<void *>(&nl_gcr_fc02559fdbfb0e10_67_double_double)}, + {"nl_gcr_fc02559fdbfb0e10_67_double_double", reinterpret_cast<void *>(&nl_gcr_fc02559fdbfb0e10_67_double_double)}, // NOLINT // 280zzzap - {"nl_gcr_fc9971724787b82b_149_double_double", reinterpret_cast<void *>(&nl_gcr_fc9971724787b82b_149_double_double)}, + {"nl_gcr_fc9971724787b82b_149_double_double", reinterpret_cast<void *>(&nl_gcr_fc9971724787b82b_149_double_double)}, // NOLINT // elim - {"nl_gcr_fcce97532ad2f49d_18_double_double", reinterpret_cast<void *>(&nl_gcr_fcce97532ad2f49d_18_double_double)}, + {"nl_gcr_fcce97532ad2f49d_18_double_double", reinterpret_cast<void *>(&nl_gcr_fcce97532ad2f49d_18_double_double)}, // NOLINT // fireone - {"nl_gcr_fd2796828f1ebd00_36_double_double", reinterpret_cast<void *>(&nl_gcr_fd2796828f1ebd00_36_double_double)}, + {"nl_gcr_fd2796828f1ebd00_36_double_double", reinterpret_cast<void *>(&nl_gcr_fd2796828f1ebd00_36_double_double)}, // NOLINT // starfire - {"nl_gcr_feae15b80dd73620_7_double_double", reinterpret_cast<void *>(&nl_gcr_feae15b80dd73620_7_double_double)}, + {"nl_gcr_feae15b80dd73620_7_double_double", reinterpret_cast<void *>(&nl_gcr_feae15b80dd73620_7_double_double)}, // NOLINT #endif {"", nullptr} diff --git a/src/lib/netlist/nl_base.cpp b/src/lib/netlist/nl_base.cpp index 2baf96d73fc..d92b8e505c5 100644 --- a/src/lib/netlist/nl_base.cpp +++ b/src/lib/netlist/nl_base.cpp @@ -86,14 +86,14 @@ namespace netlist // ---------------------------------------------------------------------------------------- netlist_t::netlist_t(netlist_state_t &state, const pstring &aname) - : m_state(state) - , m_solver(nullptr) - , m_time(netlist_time_ext::zero()) - , m_mainclock(nullptr) - , m_queue(config::MAX_QUEUE_SIZE::value, - detail::queue_t::id_delegate(&netlist_state_t :: find_net_id, &state), - detail::queue_t::obj_delegate(&netlist_state_t :: net_by_id, &state)) - , m_use_stats(false) + : m_state(state) + , m_solver(nullptr) + , m_time(netlist_time_ext::zero()) + , m_mainclock(nullptr) + , m_use_stats(false) + , m_queue(config::MAX_QUEUE_SIZE::value, + detail::queue_t::id_delegate(&netlist_state_t :: find_net_id, &state), + detail::queue_t::obj_delegate(&netlist_state_t :: net_by_id, &state)) { state.save(*this, static_cast<plib::state_manager_t::callback_t &>(m_queue), aname, "m_queue"); state.save(*this, m_time, aname, "m_time"); @@ -245,6 +245,7 @@ namespace netlist ENTRY_EX(sizeof(base_device_t)) ENTRY_EX(sizeof(device_t)) + ENTRY_EX(sizeof(logic_t)) ENTRY_EX(sizeof(logic_input_t)) ENTRY_EX(sizeof(logic_output_t)) ENTRY_EX(sizeof(param_model_t)) @@ -252,6 +253,7 @@ namespace netlist ENTRY_EX(sizeof(state_var<int>)) ENTRY_EX(sizeof(pstring)) ENTRY_EX(sizeof(core_device_t::stats_t)) + ENTRY_EX(sizeof(std::vector<detail::core_terminal_t *>)) ENTRY_EX(sizeof(plib::plog_level)) ENTRY_EX(sizeof(nldelegate)) @@ -337,7 +339,7 @@ namespace netlist for (auto &n : m_nets) { n->update_inputs(); // only used if USE_COPY_INSTEAD_OF_REFERENCE == 1 - for (auto & term : n->core_terms()) + for (auto & term : core_terms(*n)) { if (!plib::container::contains(t, &term->delegate())) { @@ -431,7 +433,6 @@ namespace netlist log().verbose("Queue Pushes {1:15}", si.m_queue.m_prof_call()); log().verbose("Queue Moves {1:15}", si.m_queue.m_prof_sortmove()); log().verbose("Queue Removes {1:15}", si.m_queue.m_prof_remove()); - log().verbose("Queue Retimes {1:15}", si.m_queue.m_prof_retime()); log().verbose(""); log().verbose("Take the next lines with a grain of salt. They depend on the measurement implementation."); @@ -618,7 +619,7 @@ namespace netlist // rebuild m_list m_list_active.clear(); - for (auto & term : core_terms()) + for (auto & term : exec().nlstate().core_terms(*this)) if (term->terminal_state() != logic_t::STATE_INP_PASSIVE) { m_list_active.push_back(term); @@ -643,7 +644,7 @@ namespace netlist // rebuild m_list and reset terminals to active or analog out state m_list_active.clear(); - for (core_terminal_t *ct : core_terms()) + for (core_terminal_t *ct : exec().nlstate().core_terms(*this)) { ct->reset(); if (ct->terminal_state() != logic_t::STATE_INP_PASSIVE) diff --git a/src/lib/netlist/nl_setup.cpp b/src/lib/netlist/nl_setup.cpp index 8392f156117..2247bf111d4 100644 --- a/src/lib/netlist/nl_setup.cpp +++ b/src/lib/netlist/nl_setup.cpp @@ -732,7 +732,7 @@ devices::nld_base_proxy *setup_t::get_d_a_proxy(const detail::core_terminal_t &o m_proxy_cnt++; // connect all existing terminals to new net - for (auto & p : out.net().core_terms()) + for (auto & p : nlstate().core_terms(out.net())) { p->clear_net(); // de-link from all nets ... if (!connect(new_proxy->proxy_term(), *p)) @@ -743,7 +743,7 @@ devices::nld_base_proxy *setup_t::get_d_a_proxy(const detail::core_terminal_t &o new_proxy->proxy_term().name(), (*p).name())); } } - out.net().core_terms().clear(); + nlstate().core_terms(out.net()).clear(); add_terminal(out.net(), new_proxy->in()); @@ -784,7 +784,7 @@ devices::nld_base_proxy *setup_t::get_a_d_proxy(detail::core_terminal_t &inp) if (inp.has_net()) { - for (detail::core_terminal_t * p : inp.net().core_terms()) + for (detail::core_terminal_t * p : nlstate().core_terms(inp.net())) { // inp may already belongs to the logic net. Thus skip it here. // It will be removed by the clear further down. @@ -800,7 +800,7 @@ devices::nld_base_proxy *setup_t::get_a_d_proxy(detail::core_terminal_t &inp) } } } - inp.net().core_terms().clear(); // clear the list + nlstate().core_terms(inp.net()).clear(); // clear the list } inp.clear_net(); add_terminal(ret->out().net(), inp); @@ -974,7 +974,7 @@ bool setup_t::connect_input_input(detail::core_terminal_t &t1, detail::core_term ret = connect(t2, t1.net().railterminal()); if (!ret) { - for (auto & t : t1.net().core_terms()) + for (auto & t : nlstate().core_terms(t1.net())) { if (t->is_type(detail::terminal_type::TERMINAL)) ret = connect(t2, *t); @@ -989,7 +989,7 @@ bool setup_t::connect_input_input(detail::core_terminal_t &t1, detail::core_term ret = connect(t1, t2.net().railterminal()); if (!ret) { - for (auto & t : t2.net().core_terms()) + for (auto & t : nlstate().core_terms(t2.net())) { if (t->is_type(detail::terminal_type::TERMINAL)) ret = connect(t1, *t); @@ -1175,7 +1175,7 @@ void setup_t::resolve_inputs() log().error(ME_TERMINAL_1_WITHOUT_NET(name_da)); err = true; } - else if (!term->net().has_connections()) + else if (nlstate().core_terms(term->net()).empty()) { if (term->is_logic_input()) log().warning(MW_LOGIC_INPUT_1_WITHOUT_CONNECTIONS(name_da)); @@ -1226,7 +1226,7 @@ void setup_t::resolve_inputs() void setup_t::add_terminal(detail::net_t &net, detail::core_terminal_t &terminal) noexcept(false) { - for (auto &t : net.core_terms()) + for (auto &t : nlstate().core_terms(net)) if (t == &terminal) { log().fatal(MF_NET_1_DUPLICATE_TERMINAL_2(net.name(), t->name())); @@ -1235,15 +1235,15 @@ void setup_t::add_terminal(detail::net_t &net, detail::core_terminal_t &terminal terminal.set_net(&net); - net.core_terms().push_back(&terminal); + nlstate().core_terms(net).push_back(&terminal); } void setup_t::remove_terminal(detail::net_t &net, detail::core_terminal_t &terminal) noexcept(false) { - if (plib::container::contains(net.core_terms(), &terminal)) + if (plib::container::contains(nlstate().core_terms(net), &terminal)) { terminal.set_net(nullptr); - plib::container::remove(net.core_terms(), &terminal); + plib::container::remove(nlstate().core_terms(net), &terminal); } else { @@ -1254,9 +1254,9 @@ void setup_t::remove_terminal(detail::net_t &net, detail::core_terminal_t &termi void setup_t::move_connections(detail::net_t &net, detail::net_t &dest_net) { - for (auto &ct : net.core_terms()) + for (auto &ct : nlstate().core_terms(net)) add_terminal(dest_net, *ct); - net.core_terms().clear(); + nlstate().core_terms(net).clear(); } @@ -1531,8 +1531,9 @@ void setup_t::delete_empty_nets() std::remove_if(m_nlstate.nets().begin(), m_nlstate.nets().end(), [](device_arena::owned_ptr<detail::net_t> &net) { - if (!net->has_connections()) + if (net->state().core_terms(*net).empty()) { + // FIXME: need to remove from state->m_core_terms as well. net->state().log().verbose("Deleting net {1} ...", net->name()); net->state().run_state_manager().remove_save_items(net.get()); return true; @@ -1683,7 +1684,7 @@ void setup_t::prepare_to_run() for (auto &n : m_nlstate.nets()) { - for (auto & term : n->core_terms()) + for (auto & term : m_nlstate.core_terms(*n)) if (!term->delegate()) { log().fatal(MF_DELEGATE_NOT_SET_1(term->name())); diff --git a/src/lib/netlist/plib/parray.h b/src/lib/netlist/plib/parray.h index 61220366775..54d72484ac2 100644 --- a/src/lib/netlist/plib/parray.h +++ b/src/lib/netlist/plib/parray.h @@ -105,12 +105,9 @@ namespace plib { { } - // osx clang doesn't like COPYASSIGNMOVE(parray, default) - // it will generate some weird error messages about move assignment - // constructor having a different noexcept status. - parray(const parray &rhs) : m_a(rhs.m_a), m_size(rhs.m_size) {} parray(parray &&rhs) noexcept : m_a(std::move(rhs.m_a)), m_size(std::move(rhs.m_size)) {} + parray &operator=(const parray &rhs) noexcept // NOLINT(bugprone-unhandled-self-assignment, cert-oop54-cpp) { if (this == &rhs) @@ -135,11 +132,11 @@ namespace plib { constexpr reference operator[](size_type i) noexcept { - return data()[i]; + return m_a[i]; } constexpr const_reference operator[](size_type i) const noexcept { - return data()[i]; + return m_a[i]; } pointer data() noexcept { return m_a.data(); } @@ -157,6 +154,7 @@ namespace plib { public: using size_type = std::size_t; + using base_type = parray<parray<FT, SIZE2>, SIZE1>; parray2D(size_type size1, size_type size2) : parray<parray<FT, SIZE2>, SIZE1>(size1) @@ -168,7 +166,10 @@ namespace plib { } } - PCOPYASSIGNMOVE(parray2D, default) + parray2D(const parray2D &) = default; + parray2D &operator=(const parray2D &) = default; + parray2D(parray2D &&) noexcept(std::is_nothrow_move_constructible<base_type>::value) = default; + parray2D &operator=(parray2D &&) noexcept(std::is_nothrow_move_assignable<base_type>::value) = default; ~parray2D() noexcept = default; diff --git a/src/lib/netlist/plib/pchrono.h b/src/lib/netlist/plib/pchrono.h index 694099936b9..ce06fd7b55d 100644 --- a/src/lib/netlist/plib/pchrono.h +++ b/src/lib/netlist/plib/pchrono.h @@ -194,32 +194,32 @@ namespace plib { struct guard_t { guard_t() = delete; - explicit guard_t(timer &m) noexcept : m_m(m) { m_m.m_time -= T::start(); } + explicit constexpr guard_t(timer &m) noexcept : m_m(m) { m_m.m_time -= T::start(); } ~guard_t() noexcept { m_m.m_time += T::stop(); ++m_m.m_count; } - guard_t(const guard_t &) = default; - guard_t &operator=(const guard_t &) = default; - guard_t(guard_t &&) noexcept = default; - guard_t &operator=(guard_t &&) noexcept = default; + constexpr guard_t(const guard_t &) = default; + constexpr guard_t &operator=(const guard_t &) = default; + constexpr guard_t(guard_t &&) noexcept = default; + constexpr guard_t &operator=(guard_t &&) noexcept = default; private: timer &m_m; }; - timer() : m_time(0), m_count(0) { } + constexpr timer() : m_time(0), m_count(0) { } - type operator()() const { return m_time; } + constexpr type operator()() const { return m_time; } void reset() noexcept { m_time = 0; m_count = 0; } - type average() const noexcept { return (m_count == 0) ? 0 : m_time / m_count; } - type total() const noexcept { return m_time; } - ctype count() const noexcept { return m_count; } + constexpr type average() const noexcept { return (m_count == 0) ? 0 : m_time / m_count; } + constexpr type total() const noexcept { return m_time; } + constexpr ctype count() const noexcept { return m_count; } template <typename S> - S as_seconds() const noexcept { return narrow_cast<S>(total()) + constexpr S as_seconds() const noexcept { return narrow_cast<S>(total()) / narrow_cast<S>(T::per_second()); } - guard_t guard() noexcept { return guard_t(*this); } + constexpr guard_t guard() noexcept { return guard_t(*this); } // pause must be followed by cont(inue) void stop() noexcept { m_time += T::stop(); } @@ -239,12 +239,12 @@ namespace plib { struct guard_t { - guard_t() = default; + constexpr guard_t() = default; - guard_t(const guard_t &) = default; - guard_t &operator=(const guard_t &) = default; - guard_t(guard_t &&) noexcept = default; - guard_t &operator=(guard_t &&) noexcept = default; + constexpr guard_t(const guard_t &) = default; + constexpr guard_t &operator=(const guard_t &) = default; + constexpr guard_t(guard_t &&) noexcept = default; + constexpr guard_t &operator=(guard_t &&) noexcept = default; // using default constructor will trigger warning on // unused local variable. @@ -259,7 +259,7 @@ namespace plib { constexpr type total() const noexcept { return 0; } constexpr ctype count() const noexcept { return 0; } template <typename S> - S as_seconds() const noexcept { return narrow_cast<S>(0); } + constexpr S as_seconds() const noexcept { return narrow_cast<S>(0); } constexpr static bool enabled = false; guard_t guard() { return guard_t(); } }; diff --git a/src/lib/netlist/plib/pconfig.h b/src/lib/netlist/plib/pconfig.h index 8e34b01a3b8..4253ff355b1 100644 --- a/src/lib/netlist/plib/pconfig.h +++ b/src/lib/netlist/plib/pconfig.h @@ -75,8 +75,13 @@ #define PALIGN_MIN_SIZE (16) +#if (PUSE_ALIGNED_OPTIMIZATIONS) #define PALIGNAS_CACHELINE() PALIGNAS(PALIGN_CACHELINE) #define PALIGNAS_VECTOROPT() PALIGNAS(PALIGN_VECTOROPT) +#else +#define PALIGNAS_CACHELINE() +#define PALIGNAS_VECTOROPT() +#endif // FIXME: Breaks mame build on windows mingw due to -Wattribute // also triggers -Wattribute on ARM diff --git a/src/lib/netlist/plib/pexception.cpp b/src/lib/netlist/plib/pexception.cpp index 0b8b96faed9..d974c6b9a4e 100644 --- a/src/lib/netlist/plib/pexception.cpp +++ b/src/lib/netlist/plib/pexception.cpp @@ -102,7 +102,7 @@ namespace plib { } - bool fpsignalenabler::m_enable = false; + bool fpsignalenabler::m_enable = false; // NOLINT //FIXME: mingw needs to be compiled with "-fnon-call-exceptions" diff --git a/src/lib/netlist/plib/pexception.h b/src/lib/netlist/plib/pexception.h index 7c5cf233306..efed23d6178 100644 --- a/src/lib/netlist/plib/pexception.h +++ b/src/lib/netlist/plib/pexception.h @@ -125,7 +125,7 @@ namespace plib { private: int m_last_enabled; - static bool m_enable; + static bool m_enable; // NOLINT }; diff --git a/src/lib/netlist/plib/pfmtlog.h b/src/lib/netlist/plib/pfmtlog.h index 733de4fddc2..fd04f58bc73 100644 --- a/src/lib/netlist/plib/pfmtlog.h +++ b/src/lib/netlist/plib/pfmtlog.h @@ -451,7 +451,7 @@ namespace plib { fatal(logger) {} - PCOPYASSIGNMOVE(plog_base, default) + PCOPYASSIGNMOVE(plog_base, delete) virtual ~plog_base() noexcept = default; plog_channel<plog_level::DEBUG, debug_enabled> debug; diff --git a/src/lib/netlist/plib/pfunction.cpp b/src/lib/netlist/plib/pfunction.cpp index 3ab937735cf..0cf4fc4cdc2 100644 --- a/src/lib/netlist/plib/pfunction.cpp +++ b/src/lib/netlist/plib/pfunction.cpp @@ -118,7 +118,7 @@ namespace plib { auto p = pcmds().find(cmd); if (p != pcmds().end()) { - rc.m_cmd = p->second.cmd; + rc = rpn_inst(p->second.cmd); stk -= p->second.adj; } else @@ -127,23 +127,20 @@ namespace plib { { if (inputs[i] == cmd) { - rc.m_cmd = PUSH_INPUT; - rc.m_param.index = i; + rc = rpn_inst(PUSH_INPUT, i); stk += 1; break; } } - if (rc.m_cmd != PUSH_INPUT) + if (rc.cmd() != PUSH_INPUT) { - using fl_t = decltype(rc.m_param.val); - rc.m_cmd = PUSH_CONST; bool err(false); auto rs(plib::right(cmd,1)); - auto r=units_si<fl_t>().find(rs); - if (r == units_si<fl_t>().end()) - rc.m_param.val = plib::pstonum_ne<fl_t>(cmd, err); + auto r=units_si<NT>().find(rs); + if (r == units_si<NT>().end()) + rc = rpn_inst(plib::pstonum_ne<NT>(cmd, err)); else - rc.m_param.val = plib::pstonum_ne<fl_t>(plib::left(cmd, cmd.length()-1), err) * r->second; + rc = rpn_inst(plib::pstonum_ne<NT>(plib::left(cmd, cmd.length()-1), err) * r->second); if (err) throw pexception(plib::pfmt("pfunction: unknown/misformatted token <{1}> in <{2}>")(cmd)(expr)); stk += 1; @@ -157,6 +154,7 @@ namespace plib { } if (stk != 1) throw pexception(plib::pfmt("pfunction: stack count {1} different to one on <{2}>")(stk, expr)); + compress(); } static bool is_number(const pstring &n) @@ -339,27 +337,105 @@ namespace plib { return narrow_cast<NT>(lfsr); } #endif - #define ST0 stack[ptr+1] - #define ST1 stack[ptr] - #define ST2 stack[ptr-1] + #define ST0 *(ptr+1) + #define ST1 *ptr + #define ST2 *(ptr-1) #define OP(OP, ADJ, EXPR) \ case OP: \ ptr-= (ADJ); \ - stack[ptr-1] = (EXPR); \ + *(ptr-1) = (EXPR); \ + break; + + #define OP0(OP, EXPR) \ + case OP: \ + *(ptr++) = (EXPR); \ break; template <typename NT> NT pfunction<NT>::evaluate(const values_container &values) noexcept { - std::array<value_type, MAX_STACK> stack = { plib::constants<value_type>::zero() }; + std::array<value_type, MAX_STACK> stack; // NOLINT + value_type *ptr = stack.data(); + constexpr const auto zero = plib::constants<value_type>::zero(); + constexpr const auto one = plib::constants<value_type>::one(); + for (const auto &rc : m_precompiled) + { + switch (rc.cmd()) + { + OP(ADD, 1, ST2 + ST1) + OP(MULT, 1, ST2 * ST1) + OP(SUB, 1, ST2 - ST1) + OP(DIV, 1, ST2 / ST1) + OP(EQ, 1, ST2 == ST1 ? one : zero) + OP(NE, 1, ST2 != ST1 ? one : zero) + OP(GT, 1, ST2 > ST1 ? one : zero) + OP(LT, 1, ST2 < ST1 ? one : zero) + OP(LE, 1, ST2 <= ST1 ? one : zero) + OP(GE, 1, ST2 >= ST1 ? one : zero) + OP(IF, 2, (ST2 != zero) ? ST1 : ST0) + OP(NEG, 0, -ST2) + OP(POW, 1, plib::pow(ST2, ST1)) + OP(LOG, 0, plib::log(ST2)) + OP(SIN, 0, plib::sin(ST2)) + OP(COS, 0, plib::cos(ST2)) + OP(MAX, 1, std::max(ST2, ST1)) + OP(MIN, 1, std::min(ST2, ST1)) + OP(TRUNC, 0, plib::trunc(ST2)) + OP0(RAND, lfsr_random<value_type>(m_lfsr)) + OP0(PUSH_INPUT, values[rc.index()]) + OP0(PUSH_CONST, rc.value()) + // please compiler + case LP: + case RP: + break; + } + } + return *(ptr-1); + } + +#undef ST0 +#undef ST1 +#undef ST2 +#undef OP +#undef OP0 + +#define ST0 m_precompiled[ptr+0].value() +#define ST1 m_precompiled[ptr-1].value() +#define ST2 m_precompiled[ptr-2].value() + +#define OP(OP, ADJ, EXPR) \ + case OP: \ + if (ADJ == 2) {\ + if (m_precompiled[ptr-3].cmd() == PUSH_CONST && m_precompiled[ptr-2].cmd() == PUSH_CONST && m_precompiled[ptr-1].cmd() == PUSH_CONST) \ + { ptr--; m_precompiled[ptr-2] = rpn_inst(EXPR); n -= 3; ptr++; std::copy(m_precompiled.begin()+(ptr+1), m_precompiled.end(), m_precompiled.begin()+(ptr-2)); ptr-=2;} \ + else { ptr++; } \ + } else if (ADJ == 1) {\ + if (m_precompiled[ptr-2].cmd() == PUSH_CONST && m_precompiled[ptr-1].cmd() == PUSH_CONST) \ + { m_precompiled[ptr-2] = rpn_inst(EXPR); n -= 2; std::copy(m_precompiled.begin()+(ptr+1), m_precompiled.end(), m_precompiled.begin()+(ptr-1)); ptr--;} \ + else { ptr++; } \ + } else if (ADJ == 0) {\ + if (m_precompiled[ptr-1].cmd() == PUSH_CONST) \ + { ptr++; m_precompiled[ptr-2] = rpn_inst(EXPR); n -= 1; ptr--; std::copy(m_precompiled.begin()+(ptr+1), m_precompiled.end(), m_precompiled.begin()+(ptr)); } \ + else { ptr++; } \ + } else ptr++; \ + break; + +#define OP0(OP, EXPR) \ + case OP: \ + ptr++; \ + break; + + template <typename NT> + void pfunction<NT>::compress() + { + constexpr const auto zero = plib::constants<value_type>::zero(); + constexpr const auto one = plib::constants<value_type>::one(); unsigned ptr = 0; - constexpr auto zero = plib::constants<value_type>::zero(); - constexpr auto one = plib::constants<value_type>::one(); - stack[0] = plib::constants<value_type>::zero(); - for (auto &rc : m_precompiled) + auto n = m_precompiled.size(); + for (; ptr < n; ) { - switch (rc.m_cmd) + switch (m_precompiled[ptr].cmd()) { OP(ADD, 1, ST2 + ST1) OP(MULT, 1, ST2 * ST1) @@ -380,22 +456,17 @@ namespace plib { OP(MAX, 1, std::max(ST2, ST1)) OP(MIN, 1, std::min(ST2, ST1)) OP(TRUNC, 0, plib::trunc(ST2)) - case RAND: - stack[ptr++] = lfsr_random<value_type>(m_lfsr); - break; - case PUSH_INPUT: - stack[ptr++] = values[rc.m_param.index]; - break; - case PUSH_CONST: - stack[ptr++] = rc.m_param.val; - break; + OP0(RAND, lfsr_random<value_type>(m_lfsr)) + OP0(PUSH_INPUT, values[rc.index()]) + OP0(PUSH_CONST, rc.value()) // please compiler case LP: case RP: break; } } - return stack[ptr-1]; + //printf("func %lld %lld\n", m_precompiled.size(), n); + m_precompiled.resize(n); } template class pfunction<float>; diff --git a/src/lib/netlist/plib/pfunction.h b/src/lib/netlist/plib/pfunction.h index 0178e81c04e..9c2450d427c 100644 --- a/src/lib/netlist/plib/pfunction.h +++ b/src/lib/netlist/plib/pfunction.h @@ -58,10 +58,32 @@ namespace plib { { struct rpn_inst { - rpn_inst() : m_cmd(ADD) + constexpr rpn_inst() : m_cmd(ADD) { m_param.val = plib::constants<NT>::zero(); } + constexpr rpn_inst(rpn_cmd cmd, std::size_t index = 0) + : m_cmd(cmd) + { + m_param.index = index; + } + constexpr rpn_inst(NT v) : m_cmd(PUSH_CONST) + { + m_param.val = v; + } + constexpr const rpn_cmd &cmd() const noexcept + { + return m_cmd; + } + constexpr const NT &value() const noexcept + { + return m_param.val; // NOLINT + } + constexpr const std::size_t &index() const noexcept + { + return m_param.index; // NOLINT + } + private: rpn_cmd m_cmd; union { @@ -138,6 +160,7 @@ namespace plib { private: + void compress(); void compile_postfix(const inputs_container &inputs, const std::vector<pstring> &cmds, const pstring &expr); diff --git a/src/lib/netlist/plib/plists.h b/src/lib/netlist/plib/plists.h index 19c34717126..41f68d989c2 100755 --- a/src/lib/netlist/plib/plists.h +++ b/src/lib/netlist/plib/plists.h @@ -42,7 +42,11 @@ namespace plib { //uninitialised_array_t() noexcept = default; uninitialised_array() noexcept = default; - PCOPYASSIGNMOVE(uninitialised_array, delete) + uninitialised_array(const uninitialised_array &) = default; + uninitialised_array &operator=(const uninitialised_array &) = default; + uninitialised_array(uninitialised_array &&) noexcept = default; + uninitialised_array &operator=(uninitialised_array &&) noexcept = default; + ~uninitialised_array() noexcept = default; constexpr size_t size() const noexcept { return N; } @@ -111,7 +115,11 @@ namespace plib { { } - PCOPYASSIGNMOVE(static_vector, delete) + static_vector(const static_vector &) = default; + static_vector &operator=(const static_vector &) = default; + static_vector(static_vector &&) noexcept = default; + static_vector &operator=(static_vector &&) noexcept = default; + ~static_vector() noexcept { clear(); @@ -187,7 +195,10 @@ namespace plib { constexpr element_t() : m_next(nullptr), m_prev(nullptr) {} ~element_t() noexcept = default; - PCOPYASSIGNMOVE(element_t, default) + element_t(const element_t &) = default; \ + element_t &operator=(const element_t &) = default; + element_t(element_t &&) noexcept = default; + element_t &operator=(element_t &&) noexcept = default; constexpr LC * &next() noexcept { return m_next; } constexpr LC * &prev() noexcept { return m_prev; } diff --git a/src/lib/netlist/plib/pmatrix2d.h b/src/lib/netlist/plib/pmatrix2d.h index d0fbac26194..d0ce462ebfa 100755 --- a/src/lib/netlist/plib/pmatrix2d.h +++ b/src/lib/netlist/plib/pmatrix2d.h @@ -51,7 +51,10 @@ namespace plib ::new(&m_v[i]) T(); } - PCOPYASSIGNMOVE(pmatrix2d, delete) + pmatrix2d(const pmatrix2d &) = delete; + pmatrix2d &operator=(const pmatrix2d &) = delete; + pmatrix2d(pmatrix2d &&) = delete; + pmatrix2d &operator=(pmatrix2d &&) = delete; ~pmatrix2d() { @@ -157,7 +160,11 @@ namespace plib m_v.resize(N); //FIXME } - PCOPYASSIGNMOVE(pmatrix2d_vrl, default) + pmatrix2d_vrl(const pmatrix2d_vrl &) = default; + pmatrix2d_vrl &operator=(const pmatrix2d_vrl &) = default; + pmatrix2d_vrl(pmatrix2d_vrl &&) = default; + pmatrix2d_vrl &operator=(pmatrix2d_vrl &&) = default; + ~pmatrix2d_vrl() = default; void resize(size_type N, size_type M) diff --git a/src/lib/netlist/plib/pmatrix_cr.h b/src/lib/netlist/plib/pmatrix_cr.h index 38457650e5e..05ba82f1b0e 100644 --- a/src/lib/netlist/plib/pmatrix_cr.h +++ b/src/lib/netlist/plib/pmatrix_cr.h @@ -35,7 +35,10 @@ namespace plib static constexpr const int NSQ = (N < 0 ? -N * N : N * N); static constexpr const int Np1 = (N == 0) ? 0 : (N < 0 ? N - 1 : N + 1); - PCOPYASSIGNMOVE(pmatrix_cr, default) + pmatrix_cr(const pmatrix_cr &) = default; + pmatrix_cr &operator=(const pmatrix_cr &) = default; + pmatrix_cr(pmatrix_cr &&) noexcept(std::is_nothrow_move_constructible<parray<value_type, NSQ>>::value) = default; + pmatrix_cr &operator=(pmatrix_cr &&) noexcept(std::is_nothrow_move_assignable<parray<value_type, NSQ>>::value && std::is_nothrow_move_assignable<pmatrix2d_vrl<index_type>>::value) = default; enum constants_e { @@ -243,10 +246,13 @@ namespace plib template<typename B> struct pGEmatrix_cr : public B { - using base = B; - using index_type = typename base::index_type; + using base_type = B; + using index_type = typename base_type::index_type; - PCOPYASSIGNMOVE(pGEmatrix_cr, default) + pGEmatrix_cr(const pGEmatrix_cr &) = default; + pGEmatrix_cr &operator=(const pGEmatrix_cr &) = default; + pGEmatrix_cr(pGEmatrix_cr &&) noexcept(std::is_nothrow_move_constructible<base_type>::value) = default; + pGEmatrix_cr &operator=(pGEmatrix_cr &&) noexcept(std::is_nothrow_move_assignable<base_type>::value) = default; explicit pGEmatrix_cr(std::size_t n) : B(n) @@ -266,14 +272,14 @@ namespace plib ops++; // 1/A(k,k) for (std::size_t row = k + 1; row < fill.size(); row++) { - if (fill[row][k] < base::FILL_INFINITY) + if (fill[row][k] < base_type::FILL_INFINITY) { ops++; for (std::size_t col = k + 1; col < fill[row].size(); col++) //if (fill[k][col] < FILL_INFINITY) { auto f = std::min(fill[row][col], 1 + fill[row][k] + fill[k][col]); - if (f < base::FILL_INFINITY) + if (f < base_type::FILL_INFINITY) { if (f > fill_max) fill_max = f; @@ -291,37 +297,37 @@ namespace plib template <typename V> void gaussian_elimination(V & RHS) { - const std::size_t iN = base::size(); + const std::size_t iN = base_type::size(); for (std::size_t i = 0; i < iN - 1; i++) { std::size_t nzbdp = 0; - std::size_t pi = base::diag[i]; - auto f = reciprocal(base::A[pi++]); - const std::size_t piie = base::row_idx[i+1]; + std::size_t pi = base_type::diag[i]; + auto f = reciprocal(base_type::A[pi++]); + const std::size_t piie = base_type::row_idx[i+1]; - const auto *nz = base::m_nzbd[i]; + const auto *nz = base_type::m_nzbd[i]; while (auto j = nz[nzbdp++]) // NOLINT(bugprone-infinite-loop) { // proceed to column i - std::size_t pj = base::row_idx[j]; - std::size_t pje = base::row_idx[j+1]; + std::size_t pj = base_type::row_idx[j]; + std::size_t pje = base_type::row_idx[j+1]; - while (base::col_idx[pj] < i) + while (base_type::col_idx[pj] < i) pj++; - const typename base::value_type f1 = - base::A[pj++] * f; + const typename base_type::value_type f1 = - base_type::A[pj++] * f; // subtract row i from j // fill-in available assumed, i.e. matrix was prepared for (std::size_t pii = pi; pii<piie && pj < pje; pii++) { - while (base::col_idx[pj] < base::col_idx[pii]) + while (base_type::col_idx[pj] < base_type::col_idx[pii]) pj++; - if (base::col_idx[pj] == base::col_idx[pii]) - base::A[pj++] += base::A[pii] * f1; + if (base_type::col_idx[pj] == base_type::col_idx[pii]) + base_type::A[pj++] += base_type::A[pii] * f1; } RHS[j] += f1 * RHS[i]; @@ -342,35 +348,35 @@ namespace plib { //printf("omp: %ld %d %d\n", m_ge_par.size(), nz_num, (int)m_ge_par[m_ge_par.size()-2].size()); for (auto l = 0UL; l < m_ge_par.size(); l++) - plib::omp::for_static(base::nz_num, 0UL, m_ge_par[l].size(), [this, &RHS, &l] (unsigned ll) + plib::omp::for_static(base_type::nz_num, 0UL, m_ge_par[l].size(), [this, &RHS, &l] (unsigned ll) { auto &i = m_ge_par[l][ll]; { std::size_t nzbdp = 0; - std::size_t pi = base::diag[i]; - const auto f = reciprocal(base::A[pi++]); - const std::size_t piie = base::row_idx[i+1]; - const auto &nz = base::nzbd[i]; + std::size_t pi = base_type::diag[i]; + const auto f = reciprocal(base_type::A[pi++]); + const std::size_t piie = base_type::row_idx[i+1]; + const auto &nz = base_type::nzbd[i]; while (auto j = nz[nzbdp++]) { // proceed to column i - std::size_t pj = base::row_idx[j]; + std::size_t pj = base_type::row_idx[j]; - while (base::col_idx[pj] < i) + while (base_type::col_idx[pj] < i) pj++; - auto f1 = - base::A[pj++] * f; + auto f1 = - base_type::A[pj++] * f; // subtract row i from j // fill-in available assumed, i.e. matrix was prepared for (std::size_t pii = pi; pii<piie; pii++) { - while (base::col_idx[pj] < base::col_idx[pii]) + while (base_type::col_idx[pj] < base_type::col_idx[pii]) pj++; - if (base::col_idx[pj] == base::col_idx[pii]) - base::A[pj++] += base::A[pii] * f1; + if (base_type::col_idx[pj] == base_type::col_idx[pii]) + base_type::A[pj++] += base_type::A[pii] * f1; } RHS[j] += f1 * RHS[i]; } @@ -381,36 +387,36 @@ namespace plib template <typename V1, typename V2> void gaussian_back_substitution(V1 &V, const V2 &RHS) { - const std::size_t iN = base::size(); + const std::size_t iN = base_type::size(); // row n-1 - V[iN - 1] = RHS[iN - 1] / base::A[base::diag[iN - 1]]; + V[iN - 1] = RHS[iN - 1] / base_type::A[base_type::diag[iN - 1]]; for (std::size_t j = iN - 1; j-- > 0;) { - typename base::value_type tmp = 0; - const auto jdiag = base::diag[j]; - const std::size_t e = base::row_idx[j+1]; + typename base_type::value_type tmp = 0; + const auto jdiag = base_type::diag[j]; + const std::size_t e = base_type::row_idx[j+1]; for (std::size_t pk = jdiag + 1; pk < e; pk++) - tmp += base::A[pk] * V[base::col_idx[pk]]; - V[j] = (RHS[j] - tmp) / base::A[jdiag]; + tmp += base_type::A[pk] * V[base_type::col_idx[pk]]; + V[j] = (RHS[j] - tmp) / base_type::A[jdiag]; } } template <typename V1> void gaussian_back_substitution(V1 &V) { - const std::size_t iN = base::size(); + const std::size_t iN = base_type::size(); // row n-1 - V[iN - 1] = V[iN - 1] / base::A[base::diag[iN - 1]]; + V[iN - 1] = V[iN - 1] / base_type::A[base_type::diag[iN - 1]]; for (std::size_t j = iN - 1; j-- > 0;) { - typename base::value_type tmp = 0; - const auto jdiag = base::diag[j]; - const std::size_t e = base::row_idx[j+1]; + typename base_type::value_type tmp = 0; + const auto jdiag = base_type::diag[j]; + const std::size_t e = base_type::row_idx[j+1]; for (std::size_t pk = jdiag + 1; pk < e; pk++) - tmp += base::A[pk] * V[base::col_idx[pk]]; - V[j] = (V[j] - tmp) / base::A[jdiag]; + tmp += base_type::A[pk] * V[base_type::col_idx[pk]]; + V[j] = (V[j] - tmp) / base_type::A[jdiag]; } } @@ -419,27 +425,27 @@ namespace plib void build_parallel_gaussian_execution_scheme(const M &fill) { // calculate parallel scheme for gaussian elimination - std::vector<std::vector<std::size_t>> rt(base::size()); - for (std::size_t k = 0; k < base::size(); k++) + std::vector<std::vector<std::size_t>> rt(base_type::size()); + for (std::size_t k = 0; k < base_type::size(); k++) { - for (std::size_t j = k+1; j < base::size(); j++) + for (std::size_t j = k+1; j < base_type::size(); j++) { - if (fill[j][k] < base::FILL_INFINITY) + if (fill[j][k] < base_type::FILL_INFINITY) { rt[k].push_back(j); } } } - std::vector<std::size_t> levGE(base::size(), 0); + std::vector<std::size_t> levGE(base_type::size(), 0); std::size_t cl = 0; - for (std::size_t k = 0; k < base::size(); k++ ) + for (std::size_t k = 0; k < base_type::size(); k++ ) { if (levGE[k] >= cl) { std::vector<std::size_t> t = rt[k]; - for (std::size_t j = k+1; j < base::size(); j++ ) + for (std::size_t j = k+1; j < base_type::size(); j++ ) { bool overlap = false; // is there overlap @@ -466,7 +472,7 @@ namespace plib m_ge_par.clear(); m_ge_par.resize(cl+1); - for (std::size_t k = 0; k < base::size(); k++) + for (std::size_t k = 0; k < base_type::size(); k++) m_ge_par[levGE[k]].push_back(k); //for (std::size_t k = 0; k < m_ge_par.size(); k++) // printf("%d %d\n", (int) k, (int) m_ge_par[k].size()); @@ -477,10 +483,13 @@ namespace plib template<typename B> struct pLUmatrix_cr : public B { - using base = B; - using index_type = typename base::index_type; + using base_type = B; + using index_type = typename base_type::index_type; - PCOPYASSIGNMOVE(pLUmatrix_cr, default) + pLUmatrix_cr(const pLUmatrix_cr &) = default; + pLUmatrix_cr &operator=(const pLUmatrix_cr &) = default; + pLUmatrix_cr(pLUmatrix_cr &&) noexcept(std::is_nothrow_move_constructible<base_type>::value) = default; + pLUmatrix_cr &operator=(pLUmatrix_cr &&) noexcept(std::is_nothrow_move_assignable<base_type>::value) = default; explicit pLUmatrix_cr(std::size_t n) : B(n) @@ -539,7 +548,7 @@ namespace plib /// k=k+1 /// i=i+1 /// - void incomplete_LU_factorization(const base &mat) + void incomplete_LU_factorization(const base_type &mat) { if (m_ILUp < 1) this->raw_copy_from(mat); @@ -549,27 +558,27 @@ namespace plib std::size_t p(0); while (auto i = ilu_rows[p++]) // NOLINT(bugprone-infinite-loop) { - const auto p_i_end = base::row_idx[i + 1]; + const auto p_i_end = base_type::row_idx[i + 1]; // loop over all columns k left of diag in row i //if (row_idx[i] < diag[i]) // printf("occ %d\n", (int)i); - for (auto i_k = base::row_idx[i]; i_k < base::diag[i]; i_k++) + for (auto i_k = base_type::row_idx[i]; i_k < base_type::diag[i]; i_k++) { - const auto k(base::col_idx[i_k]); - const auto p_k_end(base::row_idx[k + 1]); - const typename base::value_type LUp_i_k = base::A[i_k] = base::A[i_k] / base::A[base::diag[k]]; + const auto k(base_type::col_idx[i_k]); + const auto p_k_end(base_type::row_idx[k + 1]); + const typename base_type::value_type LUp_i_k = base_type::A[i_k] = base_type::A[i_k] / base_type::A[base_type::diag[k]]; - std::size_t k_j(base::diag[k] + 1); + std::size_t k_j(base_type::diag[k] + 1); std::size_t i_j(i_k + 1); while (i_j < p_i_end && k_j < p_k_end ) // pj = (i, j) { // we can assume that within a row ja increases continuously - const std::size_t c_i_j(base::col_idx[i_j]); // row i, column j - const auto c_k_j(base::col_idx[k_j]); // row k, column j + const std::size_t c_i_j(base_type::col_idx[i_j]); // row i, column j + const auto c_k_j(base_type::col_idx[k_j]); // row k, column j if (c_k_j == c_i_j) - base::A[i_j] -= LUp_i_k * base::A[k_j]; + base_type::A[i_j] -= LUp_i_k * base_type::A[k_j]; k_j += (c_k_j <= c_i_j ? 1 : 0); i_j += (c_k_j >= c_i_j ? 1 : 0); @@ -604,29 +613,29 @@ namespace plib template <typename R> void solveLU (R &r) { - for (std::size_t i = 1; i < base::size(); ++i ) + for (std::size_t i = 1; i < base_type::size(); ++i ) { - typename base::value_type tmp(0); - const auto j1(base::row_idx[i]); - const auto j2(base::diag[i]); + typename base_type::value_type tmp(0); + const auto j1(base_type::row_idx[i]); + const auto j2(base_type::diag[i]); for (auto j = j1; j < j2; ++j ) - tmp += base::A[j] * r[base::col_idx[j]]; + tmp += base_type::A[j] * r[base_type::col_idx[j]]; r[i] -= tmp; } // i now is equal to n; - for (std::size_t i = base::size(); i-- > 0; ) + for (std::size_t i = base_type::size(); i-- > 0; ) { - typename base::value_type tmp(0); - const auto di(base::diag[i]); - const auto j2(base::row_idx[i+1]); + typename base_type::value_type tmp(0); + const auto di(base_type::diag[i]); + const auto j2(base_type::row_idx[i+1]); for (std::size_t j = di + 1; j < j2; j++ ) - tmp += base::A[j] * r[base::col_idx[j]]; - r[i] = (r[i] - tmp) / base::A[di]; + tmp += base_type::A[j] * r[base_type::col_idx[j]]; + r[i] = (r[i] - tmp) / base_type::A[di]; } } private: - parray<index_type, base::Np1> ilu_rows; + parray<index_type, base_type::Np1> ilu_rows; std::size_t m_ILUp; }; diff --git a/src/lib/netlist/plib/pmempool.h b/src/lib/netlist/plib/pmempool.h index 4e678cb09d6..b83f08e0f49 100644 --- a/src/lib/netlist/plib/pmempool.h +++ b/src/lib/netlist/plib/pmempool.h @@ -168,8 +168,11 @@ namespace plib { struct info { info(block *b, size_type p) : m_block(b), m_pos(p) { } + info(const info &) = default; + info &operator=(const info &) = default; + info(info &&) noexcept = default; + info &operator=(info &&) noexcept = default; ~info() = default; - PCOPYASSIGNMOVE(info, default) block * m_block; size_type m_pos; diff --git a/src/lib/netlist/plib/prandom.h b/src/lib/netlist/plib/prandom.h index b2f9c89a9cf..669228f23fe 100644 --- a/src/lib/netlist/plib/prandom.h +++ b/src/lib/netlist/plib/prandom.h @@ -101,7 +101,7 @@ namespace plib } private: - void twist() + void twist() noexcept { const T lowest_w(~T(0) >> (sizeof(T)*8 - w)); const T lower_mask((T(1) << r) - 1); // That is, the binary number of r 1's @@ -121,10 +121,10 @@ namespace plib }; template <typename FT, typename T> - FT normalize_uniform(T &p, FT m = constants<FT>::one(), FT b = constants<FT>::zero()) + FT normalize_uniform(T &p, FT m = constants<FT>::one(), FT b = constants<FT>::zero()) noexcept { - const auto mmin(narrow_cast<FT>(p.min())); - const auto mmax(narrow_cast<FT>(p.max())); + constexpr const auto mmin(narrow_cast<FT>(T::min())); + constexpr const auto mmax(narrow_cast<FT>(T::max())); // -> 0 to a return (narrow_cast<FT>(p())- mmin) / (mmax - mmin) * m - b; } diff --git a/src/lib/netlist/plib/pstream.h b/src/lib/netlist/plib/pstream.h index 231d75e9ebb..bdbcb34b099 100644 --- a/src/lib/netlist/plib/pstream.h +++ b/src/lib/netlist/plib/pstream.h @@ -64,7 +64,7 @@ namespace plib { } istream_uptr(const istream_uptr &) = delete; istream_uptr &operator=(const istream_uptr &) = delete; - istream_uptr(istream_uptr &&rhs) + istream_uptr(istream_uptr &&rhs) noexcept { m_strm = std::move(rhs.m_strm); m_filename = std::move(rhs.m_filename); diff --git a/src/lib/netlist/plib/ptests.h b/src/lib/netlist/plib/ptests.h index 191233f26fa..b72ef38fc5c 100644 --- a/src/lib/netlist/plib/ptests.h +++ b/src/lib/netlist/plib/ptests.h @@ -83,8 +83,8 @@ namespace testing Test(const Test &) = delete; Test &operator=(const Test &) = delete; - Test(Test &&) noexcept = delete; - Test &operator=(Test &&) noexcept = delete; + Test(Test &&) = delete; + Test &operator=(Test &&) = delete; virtual void run() {} virtual void SetUp() {} @@ -102,8 +102,8 @@ namespace testing reg_entry_base(const reg_entry_base &) = delete; reg_entry_base &operator=(const reg_entry_base &) = delete; - reg_entry_base(reg_entry_base &&) noexcept = delete; - reg_entry_base &operator=(reg_entry_base &&) noexcept = delete; + reg_entry_base(reg_entry_base &&) = delete; + reg_entry_base &operator=(reg_entry_base &&) = delete; virtual ~reg_entry_base() = default; diff --git a/src/lib/netlist/plib/ptimed_queue.h b/src/lib/netlist/plib/ptimed_queue.h index 1807625b6b3..33c14f3bdb9 100644 --- a/src/lib/netlist/plib/ptimed_queue.h +++ b/src/lib/netlist/plib/ptimed_queue.h @@ -38,7 +38,10 @@ namespace plib { constexpr pqentry_t() noexcept : m_exec_time(), m_object(nullptr) { } constexpr pqentry_t(const Time &t, const Element &o) noexcept : m_exec_time(t), m_object(o) { } - PCOPYASSIGNMOVE(pqentry_t, default) + pqentry_t(const pqentry_t &) = default; + pqentry_t &operator=(const pqentry_t &) = default; + pqentry_t(pqentry_t &&) noexcept = default; + pqentry_t &operator=(pqentry_t &&) noexcept = default; ~pqentry_t() = default; @@ -147,6 +150,7 @@ namespace plib { } void pop() noexcept { --m_end; } + const T &top() const noexcept { return *(m_end-1); } template <bool KEEPSTAT, class R> @@ -168,34 +172,6 @@ namespace plib { //printf("Element not found in delete %s\n", elem->name().c_str()); } - template <bool KEEPSTAT, class R> - void retime(R && elem) noexcept - { - // Lock - lock_guard_type lck(m_lock); - if (KEEPSTAT) - m_prof_retime.inc(); - - for (R * i = m_end - 1; i > &m_list[0]; --i) - { - if (*i == elem) // partial equal! - { - *i = std::forward<R>(elem); - while (*(i-1) < *i) - { - std::swap(*(i-1), *i); - --i; - } - while (i < m_end && *i < *(i+1)) - { - std::swap(*(i+1), *i); - ++i; - } - return; - } - } - } - void clear() noexcept { lock_guard_type lck(m_lock); @@ -227,7 +203,6 @@ namespace plib { pperfcount_t<true> m_prof_sortmove; // NOLINT pperfcount_t<true> m_prof_call; // NOLINT pperfcount_t<true> m_prof_remove; // NOLINT - pperfcount_t<true> m_prof_retime; // NOLINT }; template <class T, bool TS> @@ -237,7 +212,7 @@ namespace plib { struct compare { - constexpr bool operator()(const T &a, const T &b) const { return b <= a; } + constexpr bool operator()(const T &a, const T &b) const noexcept { return b <= a; } }; explicit timed_queue_heap(const std::size_t list_size) @@ -252,6 +227,17 @@ namespace plib { std::size_t capacity() const noexcept { return m_list.capacity(); } bool empty() const noexcept { return &m_list[0] == m_end; } + template<bool KEEPSTAT, typename... Args> + void emplace(Args&&... args) noexcept + { + // Lock + lock_guard_type lck(m_lock); + *m_end++ = T(std::forward<Args>(args)...); + std::push_heap(&m_list[0], m_end, compare()); + if (KEEPSTAT) + m_prof_call.inc(); + } + template <bool KEEPSTAT> void push(T &&e) noexcept { @@ -263,12 +249,10 @@ namespace plib { m_prof_call.inc(); } - T pop() noexcept + void pop() noexcept { - T ret(m_list[0]); std::pop_heap(&m_list[0], m_end, compare()); m_end--; - return ret; } const T &top() const noexcept { return m_list[0]; } @@ -292,24 +276,6 @@ namespace plib { } } - template <bool KEEPSTAT> - void retime(const T &elem) noexcept - { - // Lock - lock_guard_type lck(m_lock); - if (KEEPSTAT) - m_prof_retime.inc(); - for (T * i = m_end - 1; i >= &m_list[0]; i--) - { - if (*i == elem) // partial equal! - { - *i = elem; - std::make_heap(&m_list[0], m_end, compare()); - return; - } - } - } - void clear() { lock_guard_type lck(m_lock); @@ -326,19 +292,17 @@ namespace plib { using mutex_type = pspin_mutex<TS>; using lock_guard_type = std::lock_guard<mutex_type>; - mutex_type m_lock; - std::vector<T> m_list; - T *m_end; + mutex_type m_lock; + T * m_end; + aligned_vector<T> m_list; public: // profiling pperfcount_t<true> m_prof_sortmove; // NOLINT pperfcount_t<true> m_prof_call; // NOLINT pperfcount_t<true> m_prof_remove; // NOLINT - pperfcount_t<true> m_prof_retime; // NOLINT }; } // namespace plib #endif // PTIMED_QUEUE_H_ -#include <cstdlib> diff --git a/src/lib/netlist/prg/nltool.cpp b/src/lib/netlist/prg/nltool.cpp index 313ec4e8b2e..21f1f0725fa 100644 --- a/src/lib/netlist/prg/nltool.cpp +++ b/src/lib/netlist/prg/nltool.cpp @@ -703,7 +703,7 @@ void tool_app_t::static_compile() for (auto &e : map) { sout << "// " << putf8string(e.second.m_module) << "\n"; - sout << "\t{\"" << putf8string(e.first) << "\", reinterpret_cast<void *>(&" << putf8string(e.first) << ")},\n"; + sout << "\t{\"" << putf8string(e.first) << "\", reinterpret_cast<void *>(&" << putf8string(e.first) << ")}, // NOLINT\n"; } sout << "#endif\n\n"; sout << "{\"\", nullptr}\n"; @@ -1174,7 +1174,7 @@ void tool_app_t::listmodels() { auto model = nt.setup().models().get_model(e); - elems.push_back({model.type(), e}); + elems.emplace_back(model.type(), e); } std::sort(elems.begin(), elems.end(), comp); diff --git a/src/lib/netlist/solver/nld_matrix_solver.cpp b/src/lib/netlist/solver/nld_matrix_solver.cpp index 02cf471b397..944234fa8c8 100644 --- a/src/lib/netlist/solver/nld_matrix_solver.cpp +++ b/src/lib/netlist/solver/nld_matrix_solver.cpp @@ -86,15 +86,15 @@ namespace solver for (std::size_t k = 0; k < nets.size(); k++) { - analog_net_t *net = nets[k]; + analog_net_t &net = *nets[k]; - log().debug("adding net with {1} populated connections\n", net->core_terms().size()); + log().debug("adding net with {1} populated connections\n", setup.nlstate().core_terms(net).size()); - net->set_solver(this); + net.set_solver(this); - for (auto &p : net->core_terms()) + for (auto &p : setup.nlstate().core_terms(net)) { - log().debug("{1} {2} {3}\n", p->name(), net->name(), net->is_rail_net()); + log().debug("{1} {2} {3}\n", p->name(), net.name(), net.is_rail_net()); switch (p->type()) { case detail::terminal_type::TERMINAL: diff --git a/src/lib/netlist/solver/nld_solver.cpp b/src/lib/netlist/solver/nld_solver.cpp index 09a43178e55..4993c2e06c0 100644 --- a/src/lib/netlist/solver/nld_solver.cpp +++ b/src/lib/netlist/solver/nld_solver.cpp @@ -34,7 +34,7 @@ namespace devices NETLIB_RESET(solver) { - if (exec().use_stats()) + if (exec().stats_enabled()) m_fb_step.set_delegate(NETLIB_DELEGATE(fb_step<true>)); for (auto &s : m_mat_solvers) s->reset(); @@ -278,20 +278,20 @@ namespace devices struct net_splitter { - void run(netlist_state_t &netlist) + void run(netlist_state_t &nlstate) { - for (auto & net : netlist.nets()) + for (auto & net : nlstate.nets()) { - netlist.log().verbose("processing {1}", net->name()); - if (!net->is_rail_net() && net->has_connections()) + nlstate.log().verbose("processing {1}", net->name()); + if (!net->is_rail_net() && !nlstate.core_terms(*net).empty()) { - netlist.log().verbose(" ==> not a rail net"); + nlstate.log().verbose(" ==> not a rail net"); // Must be an analog net auto &n = dynamic_cast<analog_net_t &>(*net); if (!already_processed(n)) { groupspre.emplace_back(NETLIB_NAME(solver)::net_list_t()); - process_net(netlist, n); + process_net(nlstate, n); } } } @@ -344,30 +344,30 @@ namespace devices } // NOLINTNEXTLINE(misc-no-recursion) - void process_net(netlist_state_t &netlist, analog_net_t &n) + void process_net(netlist_state_t &nlstate, analog_net_t &n) { // ignore empty nets. FIXME: print a warning message - netlist.log().verbose("Net {}", n.name()); - if (n.has_connections()) + nlstate.log().verbose("Net {}", n.name()); + if (!nlstate.core_terms(n).empty()) { // add the net groupspre.back().push_back(&n); // process all terminals connected to this net - for (auto &term : n.core_terms()) + for (auto &term : nlstate.core_terms(n)) { - netlist.log().verbose("Term {} {}", term->name(), static_cast<int>(term->type())); + nlstate.log().verbose("Term {} {}", term->name(), static_cast<int>(term->type())); // only process analog terminals if (term->is_type(detail::terminal_type::TERMINAL)) { auto &pt = dynamic_cast<terminal_t &>(*term); // check the connected terminal - auto connected_terminals = netlist.setup().get_connected_terminals(pt); - for (auto ct = connected_terminals->begin(); *ct != nullptr; ct++) + const auto *const connected_terminals = nlstate.setup().get_connected_terminals(pt); + for (const auto *ct = connected_terminals->begin(); *ct != nullptr; ct++) { analog_net_t &connected_net = (*ct)->net(); - netlist.log().verbose(" Connected net {}", connected_net.name()); + nlstate.log().verbose(" Connected net {}", connected_net.name()); if (!check_if_processed_and_join(connected_net)) - process_net(netlist, connected_net); + process_net(nlstate, connected_net); } } } @@ -407,7 +407,7 @@ namespace devices state().log().error(ME_SOLVER_CONSISTENCY_RAIL_NET(n->name())); num_errors++; } - for (const auto &t : n->core_terms()) + for (const auto &t : state().core_terms(*n)) { if (!t->has_net()) { @@ -472,9 +472,9 @@ namespace devices for (auto &n : grp) { log().verbose("Net {1}", n->name()); - for (const auto &pcore : n->core_terms()) + for (const auto &t : state().core_terms(*n)) { - log().verbose(" {1}", pcore->name()); + log().verbose(" {1}", t->name()); } } diff --git a/src/lib/util/corealloc.h b/src/lib/util/corealloc.h index 5d1f055e19b..db8aacf6cb2 100644 --- a/src/lib/util/corealloc.h +++ b/src/lib/util/corealloc.h @@ -8,54 +8,24 @@ ***************************************************************************/ -#pragma once - #ifndef MAME_LIB_UTIL_COREALLOC_H #define MAME_LIB_UTIL_COREALLOC_H -#include "osdcore.h" +#pragma once -#include <cstdlib> +#include "osdcore.h" #include <cstddef> +#include <cstdlib> #include <cstring> -#include <new> #include <memory> +#include <new> #include <type_traits> #include <utility> -//************************************************************************** -// MACROS -//************************************************************************** - -// global allocation helpers -- use these instead of new and delete -#define global_alloc(Type) new Type -#define global_alloc_array(Type, Num) new Type[Num] -#define global_free(Ptr) do { delete Ptr; } while (0) -#define global_free_array(Ptr) do { delete[] Ptr; } while (0) - - - -template<typename T, typename... Params> -inline T* global_alloc_clear(Params &&... args) -{ - void *const ptr = ::operator new(sizeof(T)); // allocate memory - std::memset(ptr, 0, sizeof(T)); - return new(ptr) T(std::forward<Params>(args)...); -} - -template<typename T> -inline T* global_alloc_array_clear(std::size_t num) -{ - auto const size = sizeof(T) * num; - void *const ptr = new unsigned char[size]; // allocate memory - std::memset(ptr, 0, size); - return new(ptr) T[num](); -} - - +// global allocation helpers template<typename Tp> struct MakeUniqClearT { typedef std::unique_ptr<Tp> single_object; }; diff --git a/src/lib/util/coretmpl.h b/src/lib/util/coretmpl.h index 95d8230f565..a06c4fb8a46 100644 --- a/src/lib/util/coretmpl.h +++ b/src/lib/util/coretmpl.h @@ -202,7 +202,7 @@ public: if (m_tail == &toreplace) m_tail = &object; object.m_next = toreplace.m_next; - global_free(&toreplace); + delete &toreplace; return object; } return append(object); @@ -253,7 +253,7 @@ public: // remove the given object and free its memory void remove(ElementType &object) noexcept { - global_free(&detach(object)); + delete &detach(object); } // find an object by index in the list @@ -305,7 +305,7 @@ public: { ItemType *result = m_freelist.detach_head(); if (result == nullptr) - result = global_alloc(ItemType); + result = new ItemType; return result; } diff --git a/src/mame/drivers/ac1.cpp b/src/mame/drivers/ac1.cpp index cf6f2bf9658..ea8fae0c277 100644 --- a/src/mame/drivers/ac1.cpp +++ b/src/mame/drivers/ac1.cpp @@ -254,9 +254,9 @@ static INPUT_PORTS_START( ac1 ) PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR(']') + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('{') PORT_CHAR('}') + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}') PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_END) PORT_CHAR('^') PORT_CHAR('~') PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR('_') PORT_CHAR(127) diff --git a/src/mame/drivers/champbas.cpp b/src/mame/drivers/champbas.cpp index 472b2a4fc7f..d802707a1b4 100644 --- a/src/mame/drivers/champbas.cpp +++ b/src/mame/drivers/champbas.cpp @@ -281,6 +281,13 @@ void exctsccr_state::exctsccr_sound_io_map(address_map &map) map(0x8e, 0x8f).w("ay4", FUNC(ay8910_device::data_address_w)); } +void exctsccr_state::exctscc2_sound_io_map(address_map &map) +{ + map.global_mask(0x00ff); + map(0x8a, 0x8b).w("ay1", FUNC(ay8910_device::data_address_w)); + map(0x8e, 0x8f).w("ay2", FUNC(ay8910_device::data_address_w)); +} + /************************************* @@ -715,6 +722,19 @@ void exctsccr_state::exctsccr(machine_config &config) vref.add_route(0, "dac2", 1.0, DAC_VREF_POS_INPUT); vref.add_route(0, "dac2", -1.0, DAC_VREF_NEG_INPUT); } +void exctsccr_state::exctscc2(machine_config &config) +{ + exctsccr(config); + + m_audiocpu->set_addrmap(AS_IO, &exctsccr_state::exctscc2_sound_io_map); + + subdevice<ay8910_device>("ay1")->set_clock(XTAL(14'318'181)/8); // measured on PCB + + // Exciting Soccer II only has two AYs + config.device_remove("ay3"); + config.device_remove("ay4"); +} + /* Bootleg running on a modified Champion Baseball board */ void exctsccr_state::exctsccrb(machine_config &config) { @@ -1184,9 +1204,9 @@ ROM_END ROM_START( exctscc2 ) // 2-PCB stack: CPU & SOUND BOARD + DISPLAY BOARD N. 58AS51-1 ROM_REGION( 0x10000, "maincpu", 0 ) // on CPU & sound board - ROM_LOAD( "eprom_1_vr_alpha_denshi.3j", 0x0000, 0x2000, CRC(c6115362) SHA1(6a258631abd72ef6b8d7968bb4b2bc88e89e597d) ) + ROM_LOAD( "eprom_1_vr_b_alpha_denshi.3j", 0x0000, 0x2000, CRC(c6115362) SHA1(6a258631abd72ef6b8d7968bb4b2bc88e89e597d) ) // B handwritten ROM_LOAD( "eprom_2_vr_alpha_denshi.3k", 0x2000, 0x2000, CRC(de36ba00) SHA1(0a0d92e710b8c749f145571bc8a204609456d19d) ) - ROM_LOAD( "eprom_3_vr_alpha_denshi.3l", 0x4000, 0x2000, CRC(1ddfdf65) SHA1(313d0a7f13fc2de15aa32492c38a59fbafad9f01) ) + ROM_LOAD( "eprom_3_vr_v_alpha_denshi.3l", 0x4000, 0x2000, CRC(1ddfdf65) SHA1(313d0a7f13fc2de15aa32492c38a59fbafad9f01) ) // V handwritten ROM_REGION( 0x10000, "audiocpu", 0 ) // on CPU & sound board ROM_LOAD( "eprom_0_vr_alpha_denshi.7d", 0x0000, 0x2000, CRC(2c675a43) SHA1(aa0a8dbcae955e3da92c435202f2a1ed238c377e) ) // yes 0, not 10 @@ -1198,21 +1218,21 @@ ROM_START( exctscc2 ) // 2-PCB stack: CPU & SOUND BOARD + DISPLAY BOARD N. 58AS5 ROM_REGION( 0x2000, "alpha_8201:mcu", 0 ) // on CPU & sound board ROM_LOAD( "alpha-8303_44801b42.1d", 0x0000, 0x2000, CRC(66adcb37) SHA1(e1c72ecb161129dcbddc0b16dd90e716d0c79311) ) - ROM_REGION( 0x04000, "gfx1", 0 ) // 3bpp chars + sprites: rearranged by DRIVER_INIT to leave only chars, on display board + ROM_REGION( 0x04000, "gfx1", 0 ) // 3bpp chars + sprites: rearranged by init_exctsccr() to leave only chars, on display board ROM_LOAD( "eprom_4_vr_alpha_denshi.5a", 0x0000, 0x2000, CRC(4ff1783d) SHA1(c45074864c3a4bcbf3a87d164027ae16dca53d9c) ) // planes 0,1 ROM_LOAD( "eprom_6_vr_alpha_denshi.5c", 0x2000, 0x2000, CRC(1fb84ee6) SHA1(56ceb86c509be783f806403ac21e7c9684760d5f) ) // plane 3 - ROM_REGION( 0x04000, "gfx2", 0 ) // 3bpp chars + sprites: rearranged by DRIVER_INIT to leave only sprites, on display board + ROM_REGION( 0x04000, "gfx2", 0 ) // 3bpp chars + sprites: rearranged by init_exctsccr() to leave only sprites, on display board ROM_LOAD( "eprom_5_vr_alpha_denshi.5b", 0x0000, 0x2000, CRC(5605b60b) SHA1(19d5909896ae4a3d7552225c369d30475c56793b) ) // planes 0,1 ROM_REGION( 0x02000, "gfx3", 0 ) // 4bpp sprites, on display board ROM_LOAD( "eprom_7_vr_alpha_denshi.5k", 0x0000, 0x1000, CRC(1d37edfa) SHA1(184fa6dd7b1b3fff4c5fc19b42301ccb7979ac84) ) ROM_LOAD( "eprom_8_vr_alpha_denshi.5l", 0x1000, 0x1000, CRC(b97f396c) SHA1(4ffe512acf047230bd593911a615fc0ef66b481d) ) - ROM_REGION( 0x0220, "proms", 0 ) // it's suspected these weren't dumped for this set, but taken from an Exciting Soccer (see MT5026) - ROM_LOAD( "prom1.5j", 0x0000, 0x0020, BAD_DUMP CRC(d9b10bf0) SHA1(bc1263331968f4bf37eb70ec4f56a8cb763c29d2) ) // palette, marked as 7051 on CPU & sound board - ROM_LOAD( "prom3.60h", 0x0020, 0x0100, BAD_DUMP CRC(b5db1c2c) SHA1(900aaaac6b674a9c5c7b7804a4b0c3d5cce761aa) ) // lookup table, marked as 7052 on display board - ROM_LOAD( "prom2.61d", 0x0120, 0x0100, BAD_DUMP CRC(8a9c0edf) SHA1(8aad387e9409cff0eeb42eeb57e9ea88770a8c9a) ) // lookup table, marked as 7052 on display board + ROM_REGION( 0x0220, "proms", 0 ) // colors match video from PCB (even the field one) + ROM_LOAD( "tbp18s030.5j", 0x0000, 0x0020, CRC(899d153d) SHA1(669f1a2de387ae7cdce16c2714a384c9586ed255) ) // palette, marked as 7051 on CPU & sound board + ROM_LOAD( "tbp24s10.61d", 0x0020, 0x0100, CRC(75613784) SHA1(38dc1c1d2d0f33d58f035942e71665c9810fdab1) ) // lookup table, marked as 7052 on display board + ROM_LOAD( "tbp24s10.60h", 0x0120, 0x0100, CRC(1a52d6eb) SHA1(cd0c8cbaf5d8df14df34103cde2ec595039a6d51) ) // lookup table, marked as 7052 on display board ROM_END @@ -1291,4 +1311,4 @@ GAME( 1983, exctsccra, exctsccr, exctsccr, exctsccr, exctsccr_state, init_exc GAME( 1983, exctsccrj, exctsccr, exctsccr, exctsccr, exctsccr_state, init_exctsccr, ROT270, "Alpha Denshi Co.", "Exciting Soccer (Japan)", MACHINE_SUPPORTS_SAVE ) GAME( 1983, exctsccrjo, exctsccr, exctsccr, exctsccr, exctsccr_state, init_exctsccr, ROT270, "Alpha Denshi Co.", "Exciting Soccer (Japan, older)", MACHINE_SUPPORTS_SAVE ) GAME( 1983, exctsccrb, exctsccr, exctsccrb, exctsccr, exctsccr_state, init_exctsccr, ROT270, "bootleg (Kazutomi)", "Exciting Soccer (bootleg)", MACHINE_SUPPORTS_SAVE ) // on champbasj hardware -GAME( 1984, exctscc2, 0, exctsccr, exctsccr, exctsccr_state, init_exctsccr, ROT270, "Alpha Denshi Co.", "Exciting Soccer II", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, exctscc2, 0, exctscc2, exctsccr, exctsccr_state, init_exctsccr, ROT270, "Alpha Denshi Co.", "Exciting Soccer II", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/darius.cpp b/src/mame/drivers/darius.cpp index 71ed723f5cf..6ef7140a0ec 100644 --- a/src/mame/drivers/darius.cpp +++ b/src/mame/drivers/darius.cpp @@ -324,8 +324,8 @@ void darius_state::update_psg1(int port) void darius_state::update_da() { - const int left = m_def_vol[(m_pan[4] >> 4) & 0x0f]; - const int right = m_def_vol[(m_pan[4] >> 0) & 0x0f]; + const int left = m_def_vol[(m_pan[4] >> 0) & 0x0f]; + const int right = m_def_vol[(m_pan[4] >> 4) & 0x0f]; if (m_msm5205_l != nullptr) m_msm5205_l->flt_volume_set_volume(left / 100.0); diff --git a/src/mame/drivers/dragon.cpp b/src/mame/drivers/dragon.cpp index 2e5df2d838f..570716dd2da 100644 --- a/src/mame/drivers/dragon.cpp +++ b/src/mame/drivers/dragon.cpp @@ -2,10 +2,12 @@ // copyright-holders:Nathan Woods /*************************************************************************** - dragon.c + dragon.cpp Dragon + Bug? dragon200e hangs when single-quote is typed. + ***************************************************************************/ #include "emu.h" @@ -148,9 +150,9 @@ static INPUT_PORTS_START( dragon_keyboard ) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, 0) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, 0) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, 0) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP), '^') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, 0) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN), 10) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, 0) PORT_NAME("DOWN") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN), 10) PORT_CHAR('[') PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, 0) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(UCHAR_MAMEKEY(LEFT), 8) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, 0) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT), 9) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, 0) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT), 9) PORT_CHAR(']') PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, 0) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_START("row6") @@ -174,6 +176,7 @@ static INPUT_PORTS_START( dragon200e_keyboard ) PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, 0) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR(';') PORT_CHAR('+') PORT_MODIFY("row5") + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, 0) PORT_NAME("UP") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP), '^') PORT_CHAR('_') PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, 0) PORT_NAME("DOWN \xC2\xA1") PORT_CODE(KEYCODE_DOWN) PORT_CHAR(10) PORT_CHAR(0xA1) PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, 0) PORT_NAME("RIGHT \xC2\xBF") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(9) PORT_CHAR(0xBF) PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, dragon_state, keyboard_changed, 0) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_CHAR(0xA7) diff --git a/src/mame/drivers/drdmania.cpp b/src/mame/drivers/drdmania.cpp index 7e8c9a9b890..95e66fd299e 100644 --- a/src/mame/drivers/drdmania.cpp +++ b/src/mame/drivers/drdmania.cpp @@ -57,6 +57,8 @@ #include "machine/nvram.h" #include "sound/ay8910.h" #include "screen.h" +#include "tilemap.h" +#include "emupal.h" #include "speaker.h" class drdmania_state : public driver_device @@ -65,39 +67,123 @@ public: drdmania_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu") + , m_screen(*this, "screen") + , m_gfxdecode(*this, "gfxdecode") + , m_fgram(*this, "fgram") { } void drdmania(machine_config &config); + void init_drdmania(); + +protected: + virtual void video_start() override; + private: void mem_map(address_map &map); void io_map(address_map &map); required_device<cpu_device> m_maincpu; + required_device<screen_device> m_screen; + required_device<gfxdecode_device> m_gfxdecode; + required_shared_ptr<uint8_t> m_fgram; + + tilemap_t *m_fg_tilemap; + + uint8_t unk_port00_r(); + + void fgram_w(offs_t offset, uint8_t data); + TILE_GET_INFO_MEMBER(get_fg_tile_info); + + uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); }; void drdmania_state::mem_map(address_map &map) { - map(0x0000, 0x7fff).rom().region("maincpu", 0); + map(0x0000, 0xbfff).rom().region("maincpu", 0x0000); + + map(0xc000, 0xc7ff).ram(); // stack is here, but also writes ASCII strings as if it were a tilemap, but tile ROMs don't decode as ASCII + map(0xd000, 0xd3ff).ram().w(FUNC(drdmania_state::fgram_w)).share("fgram"); // vram? fills with value of blank tile } +uint8_t drdmania_state::unk_port00_r() +{ + return machine().rand(); +} + + void drdmania_state::io_map(address_map &map) { + map(0x00, 0x00).r(FUNC(drdmania_state::unk_port00_r)); + + map.global_mask(0xff); } static INPUT_PORTS_START(drdmania) INPUT_PORTS_END +static const gfx_layout tiles8x8_layout = +{ + 8,8, + RGN_FRAC(1,3), + 3, + { RGN_FRAC(0,3), RGN_FRAC(1,3), RGN_FRAC(2,3) }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, + 8*8 +}; + +static GFXDECODE_START( gfxa ) + GFXDECODE_ENTRY( "gfx1", 0, tiles8x8_layout, 0, 1 ) +GFXDECODE_END + +void drdmania_state::fgram_w(offs_t offset, uint8_t data) +{ + m_fgram[offset] = data; + m_fg_tilemap->mark_tile_dirty(offset); +} + + +TILE_GET_INFO_MEMBER(drdmania_state::get_fg_tile_info) +{ + int code = m_fgram[tile_index]; + tileinfo.set(0,code,0,0); +} + + +void drdmania_state::video_start() +{ + m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(drdmania_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); +} + +uint32_t drdmania_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + return 0; +} + + + void drdmania_state::drdmania(machine_config &config) { Z80(config, m_maincpu, 18.432_MHz_XTAL / 4); // divider not verified m_maincpu->set_addrmap(AS_PROGRAM, &drdmania_state::mem_map); m_maincpu->set_addrmap(AS_IO, &drdmania_state::io_map); + m_maincpu->set_vblank_int("screen", FUNC(drdmania_state::irq0_line_hold)); //NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); // MK48Z02B-20 - //SCREEN(config, "screen", SCREEN_TYPE_RASTER); + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_refresh_hz(60); + m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(0)); + m_screen->set_size(256, 256); + m_screen->set_visarea(0, 256-1, 0, 256-1); + m_screen->set_screen_update(FUNC(drdmania_state::screen_update)); + + GFXDECODE(config, m_gfxdecode, "palette", gfxa); + + PALETTE(config, "palette").set_format(palette_device::xRGB_444, 0x100).set_endianness(ENDIANNESS_BIG); SPEAKER(config, "mono").front_center(); @@ -105,17 +191,36 @@ void drdmania_state::drdmania(machine_config &config) } ROM_START(drdmania) - ROM_REGION(0x08000, "maincpu", 0) + ROM_REGION(0x0c000, "maincpu", 0) ROM_LOAD( "dardomania_dmp01_v2.1.ic38", 0x00000, 0x8000, CRC(9f24336f) SHA1(9a82b851d5c67a50118a3669d3bc5793e94219e4) ) - - ROM_REGION(0x20000, "unsorted", 0) - ROM_LOAD( "dardomania_dmp02_v2.1.ic33", 0x00000, 0x8000, CRC(e5dbf948) SHA1(241be0f2969b962bba602548dab3e2bdbf8f0696) ) // 1ST AND 2ND HALF IDENTICAL - ROM_LOAD( "dardomania_dmp03_v2.1.ic21", 0x08000, 0x8000, CRC(b458975e) SHA1(862d62d147ac09b86aa8d2c54b2e03a6c5436f85) ) // 1ST AND 2ND HALF IDENTICAL - ROM_LOAD( "dardomania_dmp04_v2.1.ic16", 0x10000, 0x8000, CRC(8564d0ba) SHA1(38c81173f1cf788d1a524abfae9ef7b6697383e4) ) // 1ST AND 2ND HALF IDENTICAL - ROM_LOAD( "dardomania_dmp05_v2.1.ic10", 0x18000, 0x8000, CRC(e24f2a02) SHA1(16f3a9c80b3d60c66b070521a90c958b0fc690e7) ) // 1ST AND 2ND HALF IDENTICAL + // seems to have some bad bytes eg rst $08 instructions which should be calls but end up resetting it instead, see init + ROM_LOAD( "dardomania_dmp02_v2.1.ic33", 0x08000, 0x4000, BAD_DUMP CRC(e5dbf948) SHA1(241be0f2969b962bba602548dab3e2bdbf8f0696) ) // 1ST AND 2ND HALF IDENTICAL + ROM_IGNORE(0x4000) + + ROM_REGION(0xc000, "gfx1", 0) + ROM_LOAD( "dardomania_dmp03_v2.1.ic21", 0x00000, 0x4000, CRC(b458975e) SHA1(862d62d147ac09b86aa8d2c54b2e03a6c5436f85) ) // 1ST AND 2ND HALF IDENTICAL + ROM_IGNORE(0x4000) + ROM_LOAD( "dardomania_dmp04_v2.1.ic16", 0x04000, 0x4000, CRC(8564d0ba) SHA1(38c81173f1cf788d1a524abfae9ef7b6697383e4) ) // 1ST AND 2ND HALF IDENTICAL + ROM_IGNORE(0x4000) + ROM_LOAD( "dardomania_dmp05_v2.1.ic10", 0x08000, 0x4000, CRC(e24f2a02) SHA1(16f3a9c80b3d60c66b070521a90c958b0fc690e7) ) // 1ST AND 2ND HALF IDENTICAL + ROM_IGNORE(0x4000) ROM_REGION(0x20, "proms", 0) ROM_LOAD( "n82s123n.ic49", 0x00, 0x20, CRC(dcbd2352) SHA1(ce72e84129ed1b455aaf648e1dfaa4333e7e7628) ) ROM_END -GAME(1994, drdmania, 0, drdmania, drdmania, drdmania_state, empty_init, ROT0, "Sleic", "Dardomania (v2.1)", MACHINE_IS_SKELETON_MECHANICAL) +void drdmania_state::init_drdmania() +{ + uint8_t *ROM = memregion("maincpu")->base(); + ROM[0x8de0] ^= 0x02; // these are 0xcf in ROM so bit 0x02 got flipped? 3 calls in a row are incorrect in this way, so call addresses are suspect too + ROM[0x8de1] ^= 0x02; // call address + + ROM[0x8de3] ^= 0x02; // call opcode + + ROM[0x8de6] ^= 0x02; // call opcode + ROM[0x8de7] ^= 0x02; // call address + + ROM[0x8e00] ^= 0x02; // wrong, different bit flipped? +} + +GAME(1994, drdmania, 0, drdmania, drdmania, drdmania_state, init_drdmania, ROT0, "Sleic", "Dardomania (v2.1)", MACHINE_NOT_WORKING | MACHINE_MECHANICAL ) diff --git a/src/mame/drivers/duet16.cpp b/src/mame/drivers/duet16.cpp index 54d3e4b246e..e008bd8283a 100644 --- a/src/mame/drivers/duet16.cpp +++ b/src/mame/drivers/duet16.cpp @@ -111,8 +111,7 @@ void duet16_state::fdcctrl_w(u8 data) m_fd[0]->get_device()->mon_w(!BIT(data, 0)); m_fd[1]->get_device()->mon_w(!BIT(data, 0)); - if(!BIT(data, 1)) - m_fdc->soft_reset(); + m_fdc->reset_w(!BIT(data, 1)); // TODO: bit 3 = LSPD } diff --git a/src/mame/drivers/elekscmp.cpp b/src/mame/drivers/elekscmp.cpp index e0f7e012ee8..b3a43fc765b 100644 --- a/src/mame/drivers/elekscmp.cpp +++ b/src/mame/drivers/elekscmp.cpp @@ -12,8 +12,9 @@ To Use: - Press MINUS to enter data input mode - Press UP or DOWN to cycle through addresses -At the moment Paste cannot be tested, but if it worked, you could -paste this in: -0F0011^22^33^44^55^66^77^88^99^ +Paste test: +paste this in: -0F0011^22^33^44^55^66^77^88^99^N-0F00 +Now press UP to verify the data that was entered. It seems the only way to exit each mode is to press NRST. @@ -190,7 +191,7 @@ static INPUT_PORTS_START( elekscmp ) PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Run") PORT_CODE(KEYCODE_ENTER) PORT_CHAR('X') PORT_START("RESET") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("NRST") PORT_CODE(KEYCODE_LALT) PORT_CHANGED_MEMBER(DEVICE_SELF, elekscmp_state, reset_button, 0) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("NRST") PORT_CODE(KEYCODE_F1) PORT_CHANGED_MEMBER(DEVICE_SELF, elekscmp_state, reset_button, 0) PORT_CHAR('N') INPUT_PORTS_END INPUT_CHANGED_MEMBER(elekscmp_state::reset_button) diff --git a/src/mame/drivers/fs3216.cpp b/src/mame/drivers/fs3216.cpp index ba4522b4601..a8ca0327d8e 100644 --- a/src/mame/drivers/fs3216.cpp +++ b/src/mame/drivers/fs3216.cpp @@ -343,9 +343,9 @@ void fs3216_state::floppy_control_w(u8 data) m_floppy_status &= 0xef; } + m_fdc->reset_w(!BIT(data, 1)); if (!BIT(data, 1)) { - m_fdc->soft_reset(); m_fdc_dma_count = 0; m_fdc->tc_w(0); } diff --git a/src/mame/drivers/generalplus_gpl162xx_lcdtype.cpp b/src/mame/drivers/generalplus_gpl162xx_lcdtype.cpp new file mode 100644 index 00000000000..c7b03fbacba --- /dev/null +++ b/src/mame/drivers/generalplus_gpl162xx_lcdtype.cpp @@ -0,0 +1,886 @@ +// license:BSD-3-Clause +// copyright-holders:David Haywood + +/* These contain a similar game selection to the devices in unk6502_st2xxx.cpp but on updated hardware + + The hardware appears to be an abuse of the GPL16250 SoC. The palette and sprite banks are used, but as work-ram + rather than for their intended purpose, and the rest of the GPL16250 video hardware is either entirely bypassed + or doesn't exist. All video is software rendered and output directly to the LCD Controller. + + If this is confirmed via a decap then this should be merged with the GPL16250 implementation. + + The coding of these is similar to the unk6502_st2xxx.cpp too, with all game specific function calls being loaded + on the fly from the SPI to a tiny portion of work RAM, with graphics likewise being loaded and decompressed for + every draw call. + + pcp8718 / pcp8728 / bkid218 + to access test mode hold up + left on startup. + (bkid218 cursor in test menu can't be moved in emulation, works on unit, why?) +*/ + + +#include "emu.h" + +#include "cpu/unsp/unsp.h" +#include "machine/bl_handhelds_menucontrol.h" + +#include "emupal.h" +#include "screen.h" +#include "speaker.h" + +#define LOG_GPL162XX_LCDTYPE (1U << 1) +#define LOG_GPL162XX_LCDTYPE_SELECT_SIM (1U << 2) +#define LOG_GPL162XX_LCDTYPE_IO_PORT (1U << 3) + +#define LOG_ALL (LOG_GPL162XX_LCDTYPE | LOG_GPL162XX_LCDTYPE_SELECT_SIM | LOG_GPL162XX_LCDTYPE_IO_PORT) +#define VERBOSE (0) + +#include "logmacro.h" + + +class gpl162xx_lcdtype_state : public driver_device +{ +public: + gpl162xx_lcdtype_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_mainrom(*this, "maincpu"), + m_mainram(*this, "mainram"), + m_palette(*this, "palette"), + m_screen(*this, "screen"), + m_spirom(*this, "spi"), + m_io_in0(*this, "IN0"), + m_io_in1(*this, "IN1"), + m_menucontrol(*this, "menucontrol") + { } + + void gpl162xx_lcdtype(machine_config &config); + +private: + virtual void machine_start() override; + virtual void machine_reset() override; + + uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + required_device<unsp_20_device> m_maincpu; + required_region_ptr<uint16_t> m_mainrom; + required_shared_ptr<uint16_t> m_mainram; + + required_device<palette_device> m_palette; + required_device<screen_device> m_screen; + + void map(address_map &map); + + required_region_ptr<uint8_t> m_spirom; + + uint16_t unk_7abf_r(); + uint16_t io_7860_r(); + uint16_t unk_780f_r(); + + void io_7860_w(uint16_t data); + uint16_t m_7860; + + void unk_7862_w(uint16_t data); + void unk_7863_w(uint16_t data); + + void unk_7868_w(uint16_t data); + uint16_t unk_7868_r(); + uint16_t m_7868; + + void bankswitch_707e_w(uint16_t data); + uint16_t bankswitch_707e_r(); + uint16_t m_707e_bank; + + void bankswitch_703a_w(uint16_t data); + uint16_t bankswitch_703a_r(); + uint16_t m_703a_bank; + + void bankedram_7300_w(offs_t offset, uint16_t data); + uint16_t bankedram_7300_r(offs_t offset); + uint16_t m_bankedram_7300[0x400]; + + void bankedram_7400_w(offs_t offset, uint16_t data); + uint16_t bankedram_7400_r(offs_t offset); + uint16_t m_bankedram_7400[0x800]; + + void system_dma_params_channel0_w(offs_t offset, uint16_t data); + uint16_t system_dma_params_channel0_r(offs_t offset); + + uint16_t m_dmaregs[8]; + + void lcd_w(uint16_t data); + void lcd_command_w(uint16_t data); + + uint16_t spi_misc_control_r(); + uint16_t spi_rx_fifo_r(); + void spi_tx_fifo_w(uint16_t data); + + void spi_control_w(uint16_t data); + + void spi_process_tx_data(uint8_t data); + uint8_t spi_process_rx(); + uint8_t spi_rx(); + uint8_t spi_rx_fast(); + + uint8_t m_rx_fifo[5]; // actually 8 bytes? or 8 half-bytes? + + uint32_t m_spiaddress; + + uint16_t unk_78a1_r(); + uint16_t m_78a1; + uint16_t unk_78d8_r(); + void unk_78d8_w(uint16_t data); + + enum spistate : const int + { + SPI_STATE_READY = 0, + SPI_STATE_WAITING_HIGH_ADDR = 1, + SPI_STATE_WAITING_MID_ADDR = 2, + SPI_STATE_WAITING_LOW_ADDR = 3, + // probably not + SPI_STATE_WAITING_DUMMY1_ADDR = 4, + SPI_STATE_WAITING_DUMMY2_ADDR = 5, + SPI_STATE_READING = 6, + + SPI_STATE_WAITING_HIGH_ADDR_FAST = 8, + SPI_STATE_WAITING_MID_ADDR_FAST = 9, + SPI_STATE_WAITING_LOW_ADDR_FAST = 10, + SPI_STATE_WAITING_LOW_ADDR_FAST_DUMMY = 11, + SPI_STATE_READING_FAST = 12 + + }; + + spistate m_spistate; + + enum lcdstate : const int + { + LCD_STATE_READY = 0, + LCD_STATE_WAITING_FOR_COMMAND = 1, + LCD_STATE_PROCESSING_COMMAND = 2 + }; + + lcdstate m_lcdstate; + int m_lastlcdcommand; + + uint8_t m_displaybuffer[0x40000]; + int m_lcdaddr; + + uint16_t io_7870_r(); + required_ioport m_io_in0; + required_ioport m_io_in1; + required_device<bl_handhelds_menucontrol_device> m_menucontrol; + + DECLARE_WRITE_LINE_MEMBER(screen_vblank); +}; + +uint32_t gpl162xx_lcdtype_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + int count = 0; + for (int y = 0; y < 256; y++) + { + uint32_t *const dst = &bitmap.pix(y); + + for (int x = 0; x < 320; x++) + { + // 8-bit values get pumped through a 256 word table in internal ROM and converted to words + uint16_t dat = m_displaybuffer[(count * 2) + 1] | (m_displaybuffer[(count * 2) + 0] << 8); + + int b = ((dat >> 0) & 0x1f) << 3; + int g = ((dat >> 5) & 0x3f) << 2; + int r = ((dat >> 11) & 0x1f) << 3; + + dst[x] = (r << 16) | (g << 8) | (b << 0); + count++; + } + } + + return 0; +} + + +static INPUT_PORTS_START( gpl162xx_lcdtype ) + PORT_START("IN0") + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_UNUSED ) // causes lag if state is inverted, investigate + PORT_DIPNAME( 0x0002, 0x0002, "P0:0002" ) + PORT_DIPSETTING( 0x0000, "0000" ) + PORT_DIPSETTING( 0x0002, "0002" ) + PORT_DIPNAME( 0x0004, 0x0000, "Show Vs in Test Mode" ) + PORT_DIPSETTING( 0x0000, "0000" ) + PORT_DIPSETTING( 0x0004, "0004" ) + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("menucontrol", bl_handhelds_menucontrol_device, status_r) + PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("menucontrol", bl_handhelds_menucontrol_device, data_r) + PORT_DIPNAME( 0x0020, 0x0020, "P0:0020" ) + PORT_DIPSETTING( 0x0000, "0000" ) + PORT_DIPSETTING( 0x0020, "0020" ) + PORT_DIPNAME( 0x0040, 0x0040, "P0:0040" ) + PORT_DIPSETTING( 0x0000, "0000" ) + PORT_DIPSETTING( 0x0040, "0040" ) + PORT_DIPNAME( 0x0080, 0x0080, "P0:0080" ) + PORT_DIPSETTING( 0x0000, "0000" ) + PORT_DIPSETTING( 0x0080, "0080" ) + PORT_DIPNAME( 0x0100, 0x0100, "P0:0100" ) + PORT_DIPSETTING( 0x0000, "0000" ) + PORT_DIPSETTING( 0x0100, "0100" ) + PORT_DIPNAME( 0x0200, 0x0000, "Battery Level" ) + PORT_DIPSETTING( 0x0000, "Normal" ) + PORT_DIPSETTING( 0x0200, "Low" ) + PORT_DIPNAME( 0x0400, 0x0400, "P0:0400" ) + PORT_DIPSETTING( 0x0000, "0000" ) + PORT_DIPSETTING( 0x0400, "0400" ) + PORT_DIPNAME( 0x0800, 0x0800, "P0:0800" ) + PORT_DIPSETTING( 0x0000, "0000" ) + PORT_DIPSETTING( 0x0800, "0800" ) + PORT_DIPNAME( 0x1000, 0x1000, "P0:1000" ) + PORT_DIPSETTING( 0x0000, "0000" ) + PORT_DIPSETTING( 0x1000, "1000" ) + PORT_DIPNAME( 0x2000, 0x2000, "P0:2000" ) + PORT_DIPSETTING( 0x0000, "0000" ) + PORT_DIPSETTING( 0x2000, "2000" ) + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_START1 ) + PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) + + PORT_START("IN1") + PORT_DIPNAME( 0x0001, 0x0001, "P1:0001" ) + PORT_DIPSETTING( 0x0000, "0000" ) + PORT_DIPSETTING( 0x0001, "0001" ) + PORT_DIPNAME( 0x0002, 0x0002, "P1:0002" ) + PORT_DIPSETTING( 0x0000, "0000" ) + PORT_DIPSETTING( 0x0002, "0002" ) + PORT_DIPNAME( 0x0004, 0x0004, "P1:0004" ) + PORT_DIPSETTING( 0x0000, "0000" ) + PORT_DIPSETTING( 0x0004, "0004" ) + PORT_DIPNAME( 0x0008, 0x0008, "P1:0008" ) + PORT_DIPSETTING( 0x0000, "0000" ) + PORT_DIPSETTING( 0x0008, "0008" ) + PORT_DIPNAME( 0x0010, 0x0010, "P1:0010" ) + PORT_DIPSETTING( 0x0000, "0000" ) + PORT_DIPSETTING( 0x0010, "0010" ) + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("SOUND") + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("A") + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("B") + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("ON/OFF") + PORT_DIPNAME( 0x1000, 0x1000, "P1:1000" ) + PORT_DIPSETTING( 0x0000, "0000" ) + PORT_DIPSETTING( 0x1000, "1000" ) + PORT_DIPNAME( 0x2000, 0x2000, "P1:2000" ) + PORT_DIPSETTING( 0x0000, "0000" ) + PORT_DIPSETTING( 0x2000, "2000" ) + PORT_DIPNAME( 0x4000, 0x4000, "P1:4000" ) + PORT_DIPSETTING( 0x0000, "0000" ) + PORT_DIPSETTING( 0x4000, "4000" ) + PORT_DIPNAME( 0x8000, 0x8000, "P1:8000" ) + PORT_DIPSETTING( 0x0000, "0000" ) + PORT_DIPSETTING( 0x8000, "8000" ) +INPUT_PORTS_END + +uint16_t gpl162xx_lcdtype_state::unk_7abf_r() +{ + return 0x0001; +} + +uint16_t gpl162xx_lcdtype_state::io_7860_r() +{ + uint16_t ret = m_io_in0->read(); + LOGMASKED(LOG_GPL162XX_LCDTYPE_IO_PORT, "%s: io_7860_r %02x\n", machine().describe_context(), ret); + return ret; +} + +void gpl162xx_lcdtype_state::io_7860_w(uint16_t data) +{ + m_menucontrol->data_w((data & 0x10)>>4); + m_menucontrol->clock_w((data & 0x20)>>5); + + m_7860 = data; +} + +void gpl162xx_lcdtype_state::unk_7862_w(uint16_t data) +{ +} + +void gpl162xx_lcdtype_state::unk_7863_w(uint16_t data) +{ + // probably port direction (or 7862 is?) + if (data == 0x3cf7) + { + m_menucontrol->reset_w(1); + } +} + +uint16_t gpl162xx_lcdtype_state::unk_780f_r() +{ + return 0x0002; +} + +uint16_t gpl162xx_lcdtype_state::spi_misc_control_r() +{ + LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: spi_misc_control_r\n", machine().describe_context()); + return 0x0000; +} + +uint16_t gpl162xx_lcdtype_state::spi_rx_fifo_r() +{ + if (m_spistate == SPI_STATE_READING_FAST) + return spi_rx_fast(); + + LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: spi_rx_fifo_r\n", machine().describe_context()); + return spi_rx(); +} + +void gpl162xx_lcdtype_state::spi_process_tx_data(uint8_t data) +{ + LOGMASKED(LOG_GPL162XX_LCDTYPE,"transmitting %02x\n", data); + + switch (m_spistate) + { + case SPI_STATE_READY: + { + if (data == 0x03) + { + LOGMASKED(LOG_GPL162XX_LCDTYPE,"set to read mode (need address) %02x\n", data); + m_spistate = SPI_STATE_WAITING_HIGH_ADDR; + } + else if (data == 0x0b) + { + LOGMASKED(LOG_GPL162XX_LCDTYPE,"set to fast read mode (need address) %02x\n", data); + m_spistate = SPI_STATE_WAITING_HIGH_ADDR_FAST; + //machine().debug_break(); + } + else + { + LOGMASKED(LOG_GPL162XX_LCDTYPE,"invalid state request %02x\n", data); + } + break; + } + + case SPI_STATE_WAITING_HIGH_ADDR: + { + m_spiaddress = (m_spiaddress & 0xff00ffff) | data << 16; + LOGMASKED(LOG_GPL162XX_LCDTYPE,"set to high address %02x address is now %08x\n", data, m_spiaddress); + m_spistate = SPI_STATE_WAITING_MID_ADDR; + break; + } + + case SPI_STATE_WAITING_MID_ADDR: + { + m_spiaddress = (m_spiaddress & 0xffff00ff) | data << 8; + LOGMASKED(LOG_GPL162XX_LCDTYPE,"set to mid address %02x address is now %08x\n", data, m_spiaddress); + m_spistate = SPI_STATE_WAITING_LOW_ADDR; + break; + } + + case SPI_STATE_WAITING_LOW_ADDR: + { + m_spiaddress = (m_spiaddress & 0xffffff00) | data; + LOGMASKED(LOG_GPL162XX_LCDTYPE,"set to low address %02x address is now %08x\n", data, m_spiaddress); + m_spistate = SPI_STATE_READING; + break; + } + + case SPI_STATE_READING: + { + // writes when in read mode clock in data? + LOGMASKED(LOG_GPL162XX_LCDTYPE,"write while in read mode (clock data?)\n", data, m_spiaddress); + break; + } + + case SPI_STATE_WAITING_DUMMY1_ADDR: + { + m_spistate = SPI_STATE_WAITING_DUMMY2_ADDR; + break; + } + + case SPI_STATE_WAITING_DUMMY2_ADDR: + { + // m_spistate = SPI_STATE_READY; + break; + } + + + case SPI_STATE_WAITING_HIGH_ADDR_FAST: + { + m_spiaddress = (m_spiaddress & 0xff00ffff) | data << 16; + LOGMASKED(LOG_GPL162XX_LCDTYPE,"set to high address %02x address is now %08x\n", data, m_spiaddress); + m_spistate = SPI_STATE_WAITING_MID_ADDR_FAST; + break; + } + + case SPI_STATE_WAITING_MID_ADDR_FAST: + { + m_spiaddress = (m_spiaddress & 0xffff00ff) | data << 8; + LOGMASKED(LOG_GPL162XX_LCDTYPE,"set to mid address %02x address is now %08x\n", data, m_spiaddress); + m_spistate = SPI_STATE_WAITING_LOW_ADDR_FAST; + break; + } + + case SPI_STATE_WAITING_LOW_ADDR_FAST: + { + m_spiaddress = (m_spiaddress & 0xffffff00) | data; + LOGMASKED(LOG_GPL162XX_LCDTYPE,"set to low address %02x address is now %08x\n", data, m_spiaddress); + m_spistate = SPI_STATE_WAITING_LOW_ADDR_FAST_DUMMY; + + break; + } + + case SPI_STATE_WAITING_LOW_ADDR_FAST_DUMMY: + { + LOGMASKED(LOG_GPL162XX_LCDTYPE,"dummy write %08x\n", data, m_spiaddress); + m_spistate = SPI_STATE_READING_FAST; + break; + } + + case SPI_STATE_READING_FAST: + { + // writes when in read mode clock in data? + LOGMASKED(LOG_GPL162XX_LCDTYPE,"write while in read mode (clock data?)\n", data, m_spiaddress); + break; + } + + } +} + +uint8_t gpl162xx_lcdtype_state::spi_process_rx() +{ + + switch (m_spistate) + { + case SPI_STATE_READING: + case SPI_STATE_READING_FAST: + { + uint8_t dat = m_spirom[m_spiaddress & 0x7fffff]; + + LOGMASKED(LOG_GPL162XX_LCDTYPE,"reading SPI %02x from SPI Address %08x (adjusted word offset %08x)\n", dat, m_spiaddress, (m_spiaddress/2)+0x20000); + m_spiaddress++; + return dat; + } + + default: + { + LOGMASKED(LOG_GPL162XX_LCDTYPE,"reading FIFO in unknown state\n"); + return 0x00; + } + } + + return 0x00; +} + + +uint8_t gpl162xx_lcdtype_state::spi_rx() +{ + uint8_t ret = m_rx_fifo[0]; + + m_rx_fifo[0] = m_rx_fifo[1]; + m_rx_fifo[1] = m_rx_fifo[2]; + m_rx_fifo[2] = m_rx_fifo[3]; + m_rx_fifo[3] = spi_process_rx(); + + return ret; +} + +uint8_t gpl162xx_lcdtype_state::spi_rx_fast() +{ + uint8_t ret = m_rx_fifo[0]; + + m_rx_fifo[0] = m_rx_fifo[1]; + m_rx_fifo[1] = m_rx_fifo[2]; + m_rx_fifo[2] = m_rx_fifo[3]; + m_rx_fifo[3] = m_rx_fifo[4]; + m_rx_fifo[4] = spi_process_rx(); + + return ret; +} + +void gpl162xx_lcdtype_state::spi_tx_fifo_w(uint16_t data) +{ + data &= 0x00ff; + LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: spi_tx_fifo_w %04x\n", machine().describe_context(), data); + + spi_process_tx_data(data); +} + +// this is probably 'port b' but when SPI is enabled some points of this can become SPI control pins +// it's accessed after each large data transfer, probably to reset the SPI into 'ready for command' state? +void gpl162xx_lcdtype_state::unk_7868_w(uint16_t data) +{ + LOGMASKED(LOG_GPL162XX_LCDTYPE_IO_PORT, "%s: unk_7868_w %04x (Port B + SPI reset?)\n", machine().describe_context(), data); + + if ((m_7868 & 0x0100) != (data & 0x0100)) + { + if (!(data & 0x0100)) + { + for (int i = 0; i < 4; i++) + m_rx_fifo[i] = 0xff; + + m_spistate = SPI_STATE_READY; + } + } + + m_7868 = data; +} + +uint16_t gpl162xx_lcdtype_state::unk_7868_r() +{ + return m_7868; +} + +void gpl162xx_lcdtype_state::bankswitch_707e_w(uint16_t data) +{ + LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: bankswitch_707e_w %04x\n", machine().describe_context(), data); + m_707e_bank = data; +} + +uint16_t gpl162xx_lcdtype_state::bankswitch_707e_r() +{ + return m_707e_bank; +} + + +void gpl162xx_lcdtype_state::bankswitch_703a_w(uint16_t data) +{ + LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: bankswitch_703a_w %04x\n", machine().describe_context(), data); + m_703a_bank = data; +} + +uint16_t gpl162xx_lcdtype_state::bankswitch_703a_r() +{ + return m_703a_bank; +} + +void gpl162xx_lcdtype_state::bankedram_7300_w(offs_t offset, uint16_t data) +{ + offset |= (m_703a_bank & 0x000c) << 6; + m_bankedram_7300[offset] = data; +} + +uint16_t gpl162xx_lcdtype_state::bankedram_7300_r(offs_t offset) +{ + offset |= (m_703a_bank & 0x000c) << 6; + return m_bankedram_7300[offset]; +} + +void gpl162xx_lcdtype_state::bankedram_7400_w(offs_t offset, uint16_t data) +{ + if (m_707e_bank & 1) + { + m_bankedram_7400[offset + 0x400] = data; + } + else + { + m_bankedram_7400[offset] = data; + } +} + +uint16_t gpl162xx_lcdtype_state::bankedram_7400_r(offs_t offset) +{ + if (m_707e_bank & 1) + { + return m_bankedram_7400[offset + 0x400]; + } + else + { + return m_bankedram_7400[offset]; + } +} + +void gpl162xx_lcdtype_state::system_dma_params_channel0_w(offs_t offset, uint16_t data) +{ + m_dmaregs[offset] = data; + + switch (offset) + { + case 0: + { + LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: system_dma_params_channel0_w %01x %04x (DMA Mode)\n", machine().describe_context(), offset, data); + + uint16_t mode = m_dmaregs[0]; + uint32_t source = m_dmaregs[1] | (m_dmaregs[4] << 16); + uint32_t dest = m_dmaregs[2] | (m_dmaregs[5] << 16) ; + uint32_t length = m_dmaregs[3] | (m_dmaregs[6] << 16); + + if ((mode != 0x0200) && (mode != 0x4009) && (mode != 0x6009)) + fatalerror("unknown dma mode write %04x\n", data); + + if ((mode == 0x4009) || (mode == 0x6009)) + { + address_space& mem = m_maincpu->space(AS_PROGRAM); + + for (int i = 0; i < length; i++) + { + uint16_t dat = mem.read_word(source); + + if (mode & 0x2000) + { + // Racing Car and Elevator Action need this logic + mem.write_word(dest, dat & 0xff); + dest++; + mem.write_word(dest, dat >> 8); + dest++; + } + else + { + mem.write_word(dest, dat); + dest++; + } + + source++; + } + } + + break; + } + case 1: + LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: system_dma_params_channel0_w %01x %04x (DMA Source Low)\n", machine().describe_context(), offset, data); + break; + + case 2: + LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: system_dma_params_channel0_w %01x %04x (DMA Dest Low)\n", machine().describe_context(), offset, data); + break; + + case 3: + LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: system_dma_params_channel0_w %01x %04x (DMA Length Low)\n", machine().describe_context(), offset, data); + break; + + case 4: + LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: system_dma_params_channel0_w %01x %04x (DMA Source High)\n", machine().describe_context(), offset, data); + break; + + case 5: + LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: system_dma_params_channel0_w %01x %04x (DMA Dest High)\n", machine().describe_context(), offset, data); + break; + + case 6: + LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: system_dma_params_channel0_w %01x %04x (DMA Length High)\n", machine().describe_context(), offset, data); + break; + + case 7: + LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: system_dma_params_channel0_w %01x %04x (DMA unknown)\n", machine().describe_context(), offset, data); + break; + } +} + +uint16_t gpl162xx_lcdtype_state::system_dma_params_channel0_r(offs_t offset) +{ + LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: system_dma_params_channel0_r %01x\n", machine().describe_context(), offset); + return m_dmaregs[offset]; +} + +uint16_t gpl162xx_lcdtype_state::io_7870_r() +{ + LOGMASKED(LOG_GPL162XX_LCDTYPE_IO_PORT, "%s: io_7870_r (IO port)\n", machine().describe_context() ); + return m_io_in1->read(); +} + +void gpl162xx_lcdtype_state::spi_control_w(uint16_t data) +{ + LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: spi_control_w %04x\n", machine().describe_context(), data); +} + +uint16_t gpl162xx_lcdtype_state::unk_78a1_r() +{ + // checked in interrupt, code skipped entirely if this isn't set + return m_78a1; +} + +uint16_t gpl162xx_lcdtype_state::unk_78d8_r() +{ + return 0xffff; +} + +void gpl162xx_lcdtype_state::unk_78d8_w(uint16_t data) +{ + // written in IRQ, possible ack + if (data & 0x8000) + m_78a1 &= ~0x8000; +} + + +void gpl162xx_lcdtype_state::map(address_map &map) +{ + // there are calls to 01xxx and 02xxx regions + // (RAM populated by internal ROM?, TODO: check to make sure code copied there isn't from SPI ROM like the GPL16250 bootstrap + // does from NAND, it doesn't seem to have a header in the same format at least) + map(0x000000, 0x006fff).ram().share("mainram"); + + // registers at 7xxx are similar to GPL16250, but not identical? (different video system? or just GPL16250 with the video part unused?) + + map(0x00703a, 0x00703a).rw(FUNC(gpl162xx_lcdtype_state::bankswitch_703a_r), FUNC(gpl162xx_lcdtype_state::bankswitch_703a_w)); + map(0x00707e, 0x00707e).rw(FUNC(gpl162xx_lcdtype_state::bankswitch_707e_r), FUNC(gpl162xx_lcdtype_state::bankswitch_707e_w)); + + map(0x007100, 0x0071ff).ram(); // rowscroll on gpl16250 + map(0x007300, 0x0073ff).rw(FUNC(gpl162xx_lcdtype_state::bankedram_7300_r), FUNC(gpl162xx_lcdtype_state::bankedram_7300_w)); // palette on gpl16250 + map(0x007400, 0x0077ff).rw(FUNC(gpl162xx_lcdtype_state::bankedram_7400_r), FUNC(gpl162xx_lcdtype_state::bankedram_7400_w)); // spriteram on gpl16250 + + map(0x00780f, 0x00780f).r(FUNC(gpl162xx_lcdtype_state::unk_780f_r)); + + + map(0x007860, 0x007860).rw(FUNC(gpl162xx_lcdtype_state::io_7860_r),FUNC(gpl162xx_lcdtype_state::io_7860_w)); // Port A? + map(0x007862, 0x007862).w(FUNC(gpl162xx_lcdtype_state::unk_7862_w)); + map(0x007863, 0x007863).w(FUNC(gpl162xx_lcdtype_state::unk_7863_w)); + + map(0x007868, 0x007868).rw(FUNC(gpl162xx_lcdtype_state::unk_7868_r), FUNC(gpl162xx_lcdtype_state::unk_7868_w)); // Port B? + + map(0x007870, 0x007870).r(FUNC(gpl162xx_lcdtype_state::io_7870_r)); // Port C? + + map(0x0078a1, 0x0078a1).r(FUNC(gpl162xx_lcdtype_state::unk_78a1_r)); + + map(0x0078d8, 0x0078d8).rw(FUNC(gpl162xx_lcdtype_state::unk_78d8_r), FUNC(gpl162xx_lcdtype_state::unk_78d8_w)); + + + map(0x007940, 0x007940).w(FUNC(gpl162xx_lcdtype_state::spi_control_w)); + // 7941 SPI Transmit Status + map(0x007942, 0x007942).w(FUNC(gpl162xx_lcdtype_state::spi_tx_fifo_w)); + // 7943 SPI Receive Status + map(0x007944, 0x007944).r(FUNC(gpl162xx_lcdtype_state::spi_rx_fifo_r)); + map(0x007945, 0x007945).r(FUNC(gpl162xx_lcdtype_state::spi_misc_control_r)); + + map(0x007a80, 0x007a87).rw(FUNC(gpl162xx_lcdtype_state::system_dma_params_channel0_r), FUNC(gpl162xx_lcdtype_state::system_dma_params_channel0_w)); + + map(0x007abf, 0x007abf).r(FUNC(gpl162xx_lcdtype_state::unk_7abf_r)); + + // there are calls to 0x0f000 (internal ROM?) + map(0x00f000, 0x00ffff).rom().region("maincpu", 0x00000); + + // external LCD controller + map(0x200000, 0x200000).w(FUNC(gpl162xx_lcdtype_state::lcd_command_w)); + map(0x20fc00, 0x20fc00).w(FUNC(gpl162xx_lcdtype_state::lcd_w)); +} + +void gpl162xx_lcdtype_state::lcd_command_w(uint16_t data) +{ + data &= 0xff; + + switch (m_lcdstate) + { + case LCD_STATE_READY: + case LCD_STATE_PROCESSING_COMMAND: + { + if (data == 0x0000) + { + m_lcdstate = LCD_STATE_WAITING_FOR_COMMAND; + m_lastlcdcommand = 0; + } + break; + } + + case LCD_STATE_WAITING_FOR_COMMAND: + { + m_lastlcdcommand = data; + m_lcdstate = LCD_STATE_PROCESSING_COMMAND; + break; + } + + } +} + +void gpl162xx_lcdtype_state::lcd_w(uint16_t data) +{ + data &= 0xff; // definitely looks like 8-bit port as 16-bit values are shifted and rewritten + LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: lcd_w %02x\n", machine().describe_context(), data); + + if ((m_lcdstate == LCD_STATE_PROCESSING_COMMAND) && (m_lastlcdcommand == 0x22)) + { + m_displaybuffer[m_lcdaddr] = data; + m_lcdaddr++; + + if (m_lcdaddr >= ((320 * 240) * 2)) + m_lcdaddr = 0; + + //m_lcdaddr &= 0x3ffff; + } +} + + +void gpl162xx_lcdtype_state::machine_start() +{ +} + + +void gpl162xx_lcdtype_state::machine_reset() +{ + m_spistate = SPI_STATE_READY; + m_spiaddress = 0; + + for (int i = 0; i < 320*240*2; i++) + m_displaybuffer[i] = 0x00; + + m_lcdaddr = 0; + + m_lcdstate = LCD_STATE_READY; + m_lastlcdcommand = 0; + + m_78a1 = 0; + +// first menu index is stored here +// m_spirom[0x16000] = gamenum & 0xff; +// m_spirom[0x16001] = (gamenum>>8) & 0xff; +} + +WRITE_LINE_MEMBER(gpl162xx_lcdtype_state::screen_vblank) +{ + if (state) + { + // probably a timer + m_maincpu->set_input_line(UNSP_IRQ4_LINE, ASSERT_LINE); + m_78a1 |= 0x8000; + } + else + { + m_maincpu->set_input_line(UNSP_IRQ4_LINE, CLEAR_LINE); + } +} + +void gpl162xx_lcdtype_state::gpl162xx_lcdtype(machine_config &config) +{ + + UNSP_20(config, m_maincpu, 96000000); // unknown CPU, unsp20 based, 96Mhz is listed as the maximum for most unSP2.0 chips, and appears correct here + m_maincpu->set_addrmap(AS_PROGRAM, &gpl162xx_lcdtype_state::map); + + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_refresh_hz(60); + m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(10)); + m_screen->set_size(64*8, 32*8); + m_screen->set_visarea(0*8, 320-1, 0*8, 240-1); + m_screen->set_screen_update(FUNC(gpl162xx_lcdtype_state::screen_update)); + m_screen->screen_vblank().set(FUNC(gpl162xx_lcdtype_state::screen_vblank)); + + PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x8000); + + BL_HANDHELDS_MENUCONTROL(config, m_menucontrol, 0); + m_menucontrol->set_is_unsp_type_hack(); + +} + +// pcp8718 and pcp8728 both contain user data (player name?) and will need to be factory defaulted once they work +// the ROM code is slightly different between them + +ROM_START( pcp8718 ) + ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "internal.rom", 0x000000, 0x2000, CRC(ea119561) SHA1(a2680577e20fe1155efc40a5781cf1ec80ccec3a) ) + + ROM_REGION( 0x800000, "spi", ROMREGION_ERASEFF ) + //ROM_LOAD16_WORD_SWAP( "8718_en25f32.bin", 0x000000, 0x400000, CRC(cc138db4) SHA1(379af3d94ae840f52c06416d6cf32e25923af5ae) ) // bad dump, some blocks are corrupt + ROM_LOAD( "eyecare_25q32av1g_ef4016.bin", 0x000000, 0x400000, CRC(58415e10) SHA1(b1adcc03f2ad8d741544204671677740e904ce1a) ) +ROM_END + +ROM_START( pcp8728 ) + ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "internal.rom", 0x000000, 0x2000, CRC(ea119561) SHA1(a2680577e20fe1155efc40a5781cf1ec80ccec3a) ) + + ROM_REGION( 0x800000, "spi", ROMREGION_ERASEFF ) + ROM_LOAD( "pcp 8728 788 in 1.bin", 0x000000, 0x400000, CRC(60115f21) SHA1(e15c39f11e442a76fae3823b6d510178f6166926) ) +ROM_END + +ROM_START( bkid218 ) + ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASEFF ) + ROM_LOAD( "internal.rom", 0x000000, 0x2000, CRC(ea119561) SHA1(a2680577e20fe1155efc40a5781cf1ec80ccec3a) ) + + ROM_REGION( 0x800000, "spi", ROMREGION_ERASEFF ) + ROM_LOAD( "218n1_25q64csig_c84017.bin", 0x000000, 0x800000, CRC(94f35dbd) SHA1(a1bd6defd2465ae14753cd83be5c31f99e9158ec) ) +ROM_END + + +CONS( 200?, pcp8718, 0, 0, gpl162xx_lcdtype, gpl162xx_lcdtype, gpl162xx_lcdtype_state, empty_init, "PCP", "PCP 8718 - HD 360 Degrees Rocker Palm Eyecare Console - 788 in 1", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +CONS( 200?, pcp8728, 0, 0, gpl162xx_lcdtype, gpl162xx_lcdtype, gpl162xx_lcdtype_state, empty_init, "PCP", "PCP 8728 - 788 in 1", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) // what name was this sold under? +CONS( 200?, bkid218, 0, 0, gpl162xx_lcdtype, gpl162xx_lcdtype, gpl162xx_lcdtype_state, empty_init, "BornKid", "Handheld Game Console BC-19 - 218 in 1", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/generalplus_gpl_unknown.cpp b/src/mame/drivers/generalplus_gpl_unknown.cpp index 405158d73b5..957bd0bcd19 100644 --- a/src/mame/drivers/generalplus_gpl_unknown.cpp +++ b/src/mame/drivers/generalplus_gpl_unknown.cpp @@ -1,60 +1,31 @@ // license:BSD-3-Clause // copyright-holders:David Haywood -/* These contain a similar game selection to the devices in unk6502_st2xxx.cpp but on updated hardware - - The hardware appears to be an abuse of the GPL16250 SoC. The palette and sprite banks are used, but as work-ram - rather than for their intended purpose, and the rest of the GPL16250 video hardware is either entirely bypassed - or doesn't exist. All video is software rendered and output directly to the LCD Controller. - - If this is confirmed via a decap then this should be merged with the GPL16250 implementation. - - The coding of these is similar to the unk6502_st2xxx.cpp too, with all game specific function calls being loaded - on the fly from the SPI to a tiny portion of work RAM, with graphics likewise being loaded and decompressed for - every draw call. - - pcp8718 / pcp8728 / bkid218 - to access test mode hold up + left on startup. - (bkid218 cursor in test menu can't be moved in emulation, works on unit, why?) -*/ - - #include "emu.h" #include "cpu/unsp/unsp.h" -#include "machine/bl_handhelds_menucontrol.h" #include "emupal.h" #include "screen.h" #include "speaker.h" -#define LOG_GPL162XX_LCDTYPE (1U << 1) -#define LOG_GPL162XX_LCDTYPE_SELECT_SIM (1U << 2) -#define LOG_GPL162XX_LCDTYPE_IO_PORT (1U << 3) - -#define LOG_ALL (LOG_GPL162XX_LCDTYPE | LOG_GPL162XX_LCDTYPE_SELECT_SIM | LOG_GPL162XX_LCDTYPE_IO_PORT) -#define VERBOSE (0) - #include "logmacro.h" -class gpl162xx_lcdtype_state : public driver_device +class generalplus_gpl_unknown_state : public driver_device { public: - gpl162xx_lcdtype_state(const machine_config &mconfig, device_type type, const char *tag) : + generalplus_gpl_unknown_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), - m_mainrom(*this, "maincpu"), - m_mainram(*this, "mainram"), + //m_mainrom(*this, "maincpu"), + //m_mainram(*this, "mainram"), m_palette(*this, "palette"), m_screen(*this, "screen"), - m_spirom(*this, "spi"), - m_io_in0(*this, "IN0"), - m_io_in1(*this, "IN1"), - m_menucontrol(*this, "menucontrol") + m_spirom(*this, "spi") { } - - void gpl162xx_lcdtype(machine_config &config); + + void generalplus_gpl_unknown(machine_config &config); private: virtual void machine_start() override; @@ -63,835 +34,76 @@ private: uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); required_device<unsp_20_device> m_maincpu; - required_region_ptr<uint16_t> m_mainrom; - required_shared_ptr<uint16_t> m_mainram; + //required_region_ptr<uint16_t> m_mainrom; + //required_shared_ptr<uint16_t> m_mainram; required_device<palette_device> m_palette; required_device<screen_device> m_screen; - - void map(address_map &map); - required_region_ptr<uint8_t> m_spirom; - uint16_t unk_7abf_r(); - uint16_t io_7860_r(); - uint16_t unk_780f_r(); - - void io_7860_w(uint16_t data); - uint16_t m_7860; - - void unk_7862_w(uint16_t data); - void unk_7863_w(uint16_t data); - - void unk_7868_w(uint16_t data); - uint16_t unk_7868_r(); - uint16_t m_7868; - - void bankswitch_707e_w(uint16_t data); - uint16_t bankswitch_707e_r(); - uint16_t m_707e_bank; - - void bankswitch_703a_w(uint16_t data); - uint16_t bankswitch_703a_r(); - uint16_t m_703a_bank; - - void bankedram_7300_w(offs_t offset, uint16_t data); - uint16_t bankedram_7300_r(offs_t offset); - uint16_t m_bankedram_7300[0x400]; - - void bankedram_7400_w(offs_t offset, uint16_t data); - uint16_t bankedram_7400_r(offs_t offset); - uint16_t m_bankedram_7400[0x800]; - - void system_dma_params_channel0_w(offs_t offset, uint16_t data); - uint16_t system_dma_params_channel0_r(offs_t offset); - - uint16_t m_dmaregs[8]; - - void lcd_w(uint16_t data); - void lcd_command_w(uint16_t data); - - uint16_t spi_misc_control_r(); - uint16_t spi_rx_fifo_r(); - void spi_tx_fifo_w(uint16_t data); - - void spi_control_w(uint16_t data); - - void spi_process_tx_data(uint8_t data); - uint8_t spi_process_rx(); - uint8_t spi_rx(); - uint8_t spi_rx_fast(); - - uint8_t m_rx_fifo[5]; // actually 8 bytes? or 8 half-bytes? - - uint32_t m_spiaddress; - - uint16_t unk_78a1_r(); - uint16_t m_78a1; - uint16_t unk_78d8_r(); - void unk_78d8_w(uint16_t data); - - enum spistate : const int - { - SPI_STATE_READY = 0, - SPI_STATE_WAITING_HIGH_ADDR = 1, - SPI_STATE_WAITING_MID_ADDR = 2, - SPI_STATE_WAITING_LOW_ADDR = 3, - // probably not - SPI_STATE_WAITING_DUMMY1_ADDR = 4, - SPI_STATE_WAITING_DUMMY2_ADDR = 5, - SPI_STATE_READING = 6, - - SPI_STATE_WAITING_HIGH_ADDR_FAST = 8, - SPI_STATE_WAITING_MID_ADDR_FAST = 9, - SPI_STATE_WAITING_LOW_ADDR_FAST = 10, - SPI_STATE_WAITING_LOW_ADDR_FAST_DUMMY = 11, - SPI_STATE_READING_FAST = 12 - - }; - - spistate m_spistate; - - enum lcdstate : const int - { - LCD_STATE_READY = 0, - LCD_STATE_WAITING_FOR_COMMAND = 1, - LCD_STATE_PROCESSING_COMMAND = 2 - }; - - lcdstate m_lcdstate; - int m_lastlcdcommand; - - uint8_t m_displaybuffer[0x40000]; - int m_lcdaddr; - - uint16_t io_7870_r(); - required_ioport m_io_in0; - required_ioport m_io_in1; - required_device<bl_handhelds_menucontrol_device> m_menucontrol; - - DECLARE_WRITE_LINE_MEMBER(screen_vblank); + void map(address_map &map); }; -uint32_t gpl162xx_lcdtype_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +uint32_t generalplus_gpl_unknown_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - int count = 0; - for (int y = 0; y < 256; y++) - { - uint32_t *const dst = &bitmap.pix(y); - - for (int x = 0; x < 320; x++) - { - // 8-bit values get pumped through a 256 word table in internal ROM and converted to words - uint16_t dat = m_displaybuffer[(count * 2) + 1] | (m_displaybuffer[(count * 2) + 0] << 8); - - int b = ((dat >> 0) & 0x1f) << 3; - int g = ((dat >> 5) & 0x3f) << 2; - int r = ((dat >> 11) & 0x1f) << 3; - - dst[x] = (r << 16) | (g << 8) | (b << 0); - count++; - } - } - return 0; } -static INPUT_PORTS_START( gpl162xx_lcdtype ) - PORT_START("IN0") - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_UNUSED ) // causes lag if state is inverted, investigate - PORT_DIPNAME( 0x0002, 0x0002, "P0:0002" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x0002, "0002" ) - PORT_DIPNAME( 0x0004, 0x0000, "Show Vs in Test Mode" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x0004, "0004" ) - PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("menucontrol", bl_handhelds_menucontrol_device, status_r) - PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("menucontrol", bl_handhelds_menucontrol_device, data_r) - PORT_DIPNAME( 0x0020, 0x0020, "P0:0020" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x0020, "0020" ) - PORT_DIPNAME( 0x0040, 0x0040, "P0:0040" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x0040, "0040" ) - PORT_DIPNAME( 0x0080, 0x0080, "P0:0080" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x0080, "0080" ) - PORT_DIPNAME( 0x0100, 0x0100, "P0:0100" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x0100, "0100" ) - PORT_DIPNAME( 0x0200, 0x0000, "Battery Level" ) - PORT_DIPSETTING( 0x0000, "Normal" ) - PORT_DIPSETTING( 0x0200, "Low" ) - PORT_DIPNAME( 0x0400, 0x0400, "P0:0400" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x0400, "0400" ) - PORT_DIPNAME( 0x0800, 0x0800, "P0:0800" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x0800, "0800" ) - PORT_DIPNAME( 0x1000, 0x1000, "P0:1000" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x1000, "1000" ) - PORT_DIPNAME( 0x2000, 0x2000, "P0:2000" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x2000, "2000" ) - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_START1 ) - PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) - - PORT_START("IN1") - PORT_DIPNAME( 0x0001, 0x0001, "P1:0001" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x0001, "0001" ) - PORT_DIPNAME( 0x0002, 0x0002, "P1:0002" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x0002, "0002" ) - PORT_DIPNAME( 0x0004, 0x0004, "P1:0004" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x0004, "0004" ) - PORT_DIPNAME( 0x0008, 0x0008, "P1:0008" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x0008, "0008" ) - PORT_DIPNAME( 0x0010, 0x0010, "P1:0010" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x0010, "0010" ) - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("SOUND") - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("A") - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("B") - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("ON/OFF") - PORT_DIPNAME( 0x1000, 0x1000, "P1:1000" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x1000, "1000" ) - PORT_DIPNAME( 0x2000, 0x2000, "P1:2000" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x2000, "2000" ) - PORT_DIPNAME( 0x4000, 0x4000, "P1:4000" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x4000, "4000" ) - PORT_DIPNAME( 0x8000, 0x8000, "P1:8000" ) - PORT_DIPSETTING( 0x0000, "0000" ) - PORT_DIPSETTING( 0x8000, "8000" ) +static INPUT_PORTS_START( generalplus_gpl_unknown ) INPUT_PORTS_END -uint16_t gpl162xx_lcdtype_state::unk_7abf_r() -{ - return 0x0001; -} - -uint16_t gpl162xx_lcdtype_state::io_7860_r() -{ - uint16_t ret = m_io_in0->read(); - LOGMASKED(LOG_GPL162XX_LCDTYPE_IO_PORT, "%s: io_7860_r %02x\n", machine().describe_context(), ret); - return ret; -} - -void gpl162xx_lcdtype_state::io_7860_w(uint16_t data) -{ - m_menucontrol->data_w((data & 0x10)>>4); - m_menucontrol->clock_w((data & 0x20)>>5); - - m_7860 = data; -} - -void gpl162xx_lcdtype_state::unk_7862_w(uint16_t data) -{ -} - -void gpl162xx_lcdtype_state::unk_7863_w(uint16_t data) -{ - // probably port direction (or 7862 is?) - if (data == 0x3cf7) - { - m_menucontrol->reset_w(1); - } -} -uint16_t gpl162xx_lcdtype_state::unk_780f_r() +void generalplus_gpl_unknown_state::map(address_map &map) { - return 0x0002; -} - -uint16_t gpl162xx_lcdtype_state::spi_misc_control_r() -{ - LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: spi_misc_control_r\n", machine().describe_context()); - return 0x0000; -} - -uint16_t gpl162xx_lcdtype_state::spi_rx_fifo_r() -{ - if (m_spistate == SPI_STATE_READING_FAST) - return spi_rx_fast(); - - LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: spi_rx_fifo_r\n", machine().describe_context()); - return spi_rx(); -} - -void gpl162xx_lcdtype_state::spi_process_tx_data(uint8_t data) -{ - LOGMASKED(LOG_GPL162XX_LCDTYPE,"transmitting %02x\n", data); - - switch (m_spistate) - { - case SPI_STATE_READY: - { - if (data == 0x03) - { - LOGMASKED(LOG_GPL162XX_LCDTYPE,"set to read mode (need address) %02x\n", data); - m_spistate = SPI_STATE_WAITING_HIGH_ADDR; - } - else if (data == 0x0b) - { - LOGMASKED(LOG_GPL162XX_LCDTYPE,"set to fast read mode (need address) %02x\n", data); - m_spistate = SPI_STATE_WAITING_HIGH_ADDR_FAST; - //machine().debug_break(); - } - else - { - LOGMASKED(LOG_GPL162XX_LCDTYPE,"invalid state request %02x\n", data); - } - break; - } - - case SPI_STATE_WAITING_HIGH_ADDR: - { - m_spiaddress = (m_spiaddress & 0xff00ffff) | data << 16; - LOGMASKED(LOG_GPL162XX_LCDTYPE,"set to high address %02x address is now %08x\n", data, m_spiaddress); - m_spistate = SPI_STATE_WAITING_MID_ADDR; - break; - } - - case SPI_STATE_WAITING_MID_ADDR: - { - m_spiaddress = (m_spiaddress & 0xffff00ff) | data << 8; - LOGMASKED(LOG_GPL162XX_LCDTYPE,"set to mid address %02x address is now %08x\n", data, m_spiaddress); - m_spistate = SPI_STATE_WAITING_LOW_ADDR; - break; - } - - case SPI_STATE_WAITING_LOW_ADDR: - { - m_spiaddress = (m_spiaddress & 0xffffff00) | data; - LOGMASKED(LOG_GPL162XX_LCDTYPE,"set to low address %02x address is now %08x\n", data, m_spiaddress); - m_spistate = SPI_STATE_READING; - break; - } - - case SPI_STATE_READING: - { - // writes when in read mode clock in data? - LOGMASKED(LOG_GPL162XX_LCDTYPE,"write while in read mode (clock data?)\n", data, m_spiaddress); - break; - } - - case SPI_STATE_WAITING_DUMMY1_ADDR: - { - m_spistate = SPI_STATE_WAITING_DUMMY2_ADDR; - break; - } - - case SPI_STATE_WAITING_DUMMY2_ADDR: - { - // m_spistate = SPI_STATE_READY; - break; - } - - - case SPI_STATE_WAITING_HIGH_ADDR_FAST: - { - m_spiaddress = (m_spiaddress & 0xff00ffff) | data << 16; - LOGMASKED(LOG_GPL162XX_LCDTYPE,"set to high address %02x address is now %08x\n", data, m_spiaddress); - m_spistate = SPI_STATE_WAITING_MID_ADDR_FAST; - break; - } - - case SPI_STATE_WAITING_MID_ADDR_FAST: - { - m_spiaddress = (m_spiaddress & 0xffff00ff) | data << 8; - LOGMASKED(LOG_GPL162XX_LCDTYPE,"set to mid address %02x address is now %08x\n", data, m_spiaddress); - m_spistate = SPI_STATE_WAITING_LOW_ADDR_FAST; - break; - } - - case SPI_STATE_WAITING_LOW_ADDR_FAST: - { - m_spiaddress = (m_spiaddress & 0xffffff00) | data; - LOGMASKED(LOG_GPL162XX_LCDTYPE,"set to low address %02x address is now %08x\n", data, m_spiaddress); - m_spistate = SPI_STATE_WAITING_LOW_ADDR_FAST_DUMMY; - - break; - } - - case SPI_STATE_WAITING_LOW_ADDR_FAST_DUMMY: - { - LOGMASKED(LOG_GPL162XX_LCDTYPE,"dummy write %08x\n", data, m_spiaddress); - m_spistate = SPI_STATE_READING_FAST; - break; - } - - case SPI_STATE_READING_FAST: - { - // writes when in read mode clock in data? - LOGMASKED(LOG_GPL162XX_LCDTYPE,"write while in read mode (clock data?)\n", data, m_spiaddress); - break; - } - - } -} - -uint8_t gpl162xx_lcdtype_state::spi_process_rx() -{ - - switch (m_spistate) - { - case SPI_STATE_READING: - case SPI_STATE_READING_FAST: - { - uint8_t dat = m_spirom[m_spiaddress & 0x7fffff]; - - LOGMASKED(LOG_GPL162XX_LCDTYPE,"reading SPI %02x from SPI Address %08x (adjusted word offset %08x)\n", dat, m_spiaddress, (m_spiaddress/2)+0x20000); - m_spiaddress++; - return dat; - } - - default: - { - LOGMASKED(LOG_GPL162XX_LCDTYPE,"reading FIFO in unknown state\n"); - return 0x00; - } - } - - return 0x00; -} - - -uint8_t gpl162xx_lcdtype_state::spi_rx() -{ - uint8_t ret = m_rx_fifo[0]; - - m_rx_fifo[0] = m_rx_fifo[1]; - m_rx_fifo[1] = m_rx_fifo[2]; - m_rx_fifo[2] = m_rx_fifo[3]; - m_rx_fifo[3] = spi_process_rx(); - - return ret; -} - -uint8_t gpl162xx_lcdtype_state::spi_rx_fast() -{ - uint8_t ret = m_rx_fifo[0]; - - m_rx_fifo[0] = m_rx_fifo[1]; - m_rx_fifo[1] = m_rx_fifo[2]; - m_rx_fifo[2] = m_rx_fifo[3]; - m_rx_fifo[3] = m_rx_fifo[4]; - m_rx_fifo[4] = spi_process_rx(); - - return ret; -} - -void gpl162xx_lcdtype_state::spi_tx_fifo_w(uint16_t data) -{ - data &= 0x00ff; - LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: spi_tx_fifo_w %04x\n", machine().describe_context(), data); - - spi_process_tx_data(data); -} - -// this is probably 'port b' but when SPI is enabled some points of this can become SPI control pins -// it's accessed after each large data transfer, probably to reset the SPI into 'ready for command' state? -void gpl162xx_lcdtype_state::unk_7868_w(uint16_t data) -{ - LOGMASKED(LOG_GPL162XX_LCDTYPE_IO_PORT, "%s: unk_7868_w %04x (Port B + SPI reset?)\n", machine().describe_context(), data); - - if ((m_7868 & 0x0100) != (data & 0x0100)) - { - if (!(data & 0x0100)) - { - for (int i = 0; i < 4; i++) - m_rx_fifo[i] = 0xff; - - m_spistate = SPI_STATE_READY; - } - } - - m_7868 = data; -} - -uint16_t gpl162xx_lcdtype_state::unk_7868_r() -{ - return m_7868; -} - -void gpl162xx_lcdtype_state::bankswitch_707e_w(uint16_t data) -{ - LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: bankswitch_707e_w %04x\n", machine().describe_context(), data); - m_707e_bank = data; -} - -uint16_t gpl162xx_lcdtype_state::bankswitch_707e_r() -{ - return m_707e_bank; -} - - -void gpl162xx_lcdtype_state::bankswitch_703a_w(uint16_t data) -{ - LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: bankswitch_703a_w %04x\n", machine().describe_context(), data); - m_703a_bank = data; -} - -uint16_t gpl162xx_lcdtype_state::bankswitch_703a_r() -{ - return m_703a_bank; -} - -void gpl162xx_lcdtype_state::bankedram_7300_w(offs_t offset, uint16_t data) -{ - offset |= (m_703a_bank & 0x000c) << 6; - m_bankedram_7300[offset] = data; -} - -uint16_t gpl162xx_lcdtype_state::bankedram_7300_r(offs_t offset) -{ - offset |= (m_703a_bank & 0x000c) << 6; - return m_bankedram_7300[offset]; -} - -void gpl162xx_lcdtype_state::bankedram_7400_w(offs_t offset, uint16_t data) -{ - if (m_707e_bank & 1) - { - m_bankedram_7400[offset + 0x400] = data; - } - else - { - m_bankedram_7400[offset] = data; - } -} - -uint16_t gpl162xx_lcdtype_state::bankedram_7400_r(offs_t offset) -{ - if (m_707e_bank & 1) - { - return m_bankedram_7400[offset + 0x400]; - } - else - { - return m_bankedram_7400[offset]; - } -} - -void gpl162xx_lcdtype_state::system_dma_params_channel0_w(offs_t offset, uint16_t data) -{ - m_dmaregs[offset] = data; - - switch (offset) - { - case 0: - { - LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: system_dma_params_channel0_w %01x %04x (DMA Mode)\n", machine().describe_context(), offset, data); - - uint16_t mode = m_dmaregs[0]; - uint32_t source = m_dmaregs[1] | (m_dmaregs[4] << 16); - uint32_t dest = m_dmaregs[2] | (m_dmaregs[5] << 16) ; - uint32_t length = m_dmaregs[3] | (m_dmaregs[6] << 16); - - if ((mode != 0x0200) && (mode != 0x4009) && (mode != 0x6009)) - fatalerror("unknown dma mode write %04x\n", data); - - if ((mode == 0x4009) || (mode == 0x6009)) - { - address_space& mem = m_maincpu->space(AS_PROGRAM); - - for (int i = 0; i < length; i++) - { - uint16_t dat = mem.read_word(source); - - if (mode & 0x2000) - { - // Racing Car and Elevator Action need this logic - mem.write_word(dest, dat & 0xff); - dest++; - mem.write_word(dest, dat >> 8); - dest++; - } - else - { - mem.write_word(dest, dat); - dest++; - } - - source++; - } - } - - break; - } - case 1: - LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: system_dma_params_channel0_w %01x %04x (DMA Source Low)\n", machine().describe_context(), offset, data); - break; - - case 2: - LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: system_dma_params_channel0_w %01x %04x (DMA Dest Low)\n", machine().describe_context(), offset, data); - break; - - case 3: - LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: system_dma_params_channel0_w %01x %04x (DMA Length Low)\n", machine().describe_context(), offset, data); - break; - - case 4: - LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: system_dma_params_channel0_w %01x %04x (DMA Source High)\n", machine().describe_context(), offset, data); - break; - - case 5: - LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: system_dma_params_channel0_w %01x %04x (DMA Dest High)\n", machine().describe_context(), offset, data); - break; - - case 6: - LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: system_dma_params_channel0_w %01x %04x (DMA Length High)\n", machine().describe_context(), offset, data); - break; - - case 7: - LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: system_dma_params_channel0_w %01x %04x (DMA unknown)\n", machine().describe_context(), offset, data); - break; - } -} - -uint16_t gpl162xx_lcdtype_state::system_dma_params_channel0_r(offs_t offset) -{ - LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: system_dma_params_channel0_r %01x\n", machine().describe_context(), offset); - return m_dmaregs[offset]; -} - -uint16_t gpl162xx_lcdtype_state::io_7870_r() -{ - LOGMASKED(LOG_GPL162XX_LCDTYPE_IO_PORT, "%s: io_7870_r (IO port)\n", machine().describe_context() ); - return m_io_in1->read(); -} - -void gpl162xx_lcdtype_state::spi_control_w(uint16_t data) -{ - LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: spi_control_w %04x\n", machine().describe_context(), data); -} - -uint16_t gpl162xx_lcdtype_state::unk_78a1_r() -{ - // checked in interrupt, code skipped entirely if this isn't set - return m_78a1; -} - -uint16_t gpl162xx_lcdtype_state::unk_78d8_r() -{ - return 0xffff; -} - -void gpl162xx_lcdtype_state::unk_78d8_w(uint16_t data) -{ - // written in IRQ, possible ack - if (data & 0x8000) - m_78a1 &= ~0x8000; -} - - -void gpl162xx_lcdtype_state::map(address_map &map) -{ - // there are calls to 01xxx and 02xxx regions - // (RAM populated by internal ROM?, TODO: check to make sure code copied there isn't from SPI ROM like the GPL16250 bootstrap - // does from NAND, it doesn't seem to have a header in the same format at least) - map(0x000000, 0x006fff).ram().share("mainram"); - - // registers at 7xxx are similar to GPL16250, but not identical? (different video system? or just GPL16250 with the video part unused?) - - map(0x00703a, 0x00703a).rw(FUNC(gpl162xx_lcdtype_state::bankswitch_703a_r), FUNC(gpl162xx_lcdtype_state::bankswitch_703a_w)); - map(0x00707e, 0x00707e).rw(FUNC(gpl162xx_lcdtype_state::bankswitch_707e_r), FUNC(gpl162xx_lcdtype_state::bankswitch_707e_w)); - - map(0x007100, 0x0071ff).ram(); // rowscroll on gpl16250 - map(0x007300, 0x0073ff).rw(FUNC(gpl162xx_lcdtype_state::bankedram_7300_r), FUNC(gpl162xx_lcdtype_state::bankedram_7300_w)); // palette on gpl16250 - map(0x007400, 0x0077ff).rw(FUNC(gpl162xx_lcdtype_state::bankedram_7400_r), FUNC(gpl162xx_lcdtype_state::bankedram_7400_w)); // spriteram on gpl16250 - - map(0x00780f, 0x00780f).r(FUNC(gpl162xx_lcdtype_state::unk_780f_r)); - - - map(0x007860, 0x007860).rw(FUNC(gpl162xx_lcdtype_state::io_7860_r),FUNC(gpl162xx_lcdtype_state::io_7860_w)); // Port A? - map(0x007862, 0x007862).w(FUNC(gpl162xx_lcdtype_state::unk_7862_w)); - map(0x007863, 0x007863).w(FUNC(gpl162xx_lcdtype_state::unk_7863_w)); - - map(0x007868, 0x007868).rw(FUNC(gpl162xx_lcdtype_state::unk_7868_r), FUNC(gpl162xx_lcdtype_state::unk_7868_w)); // Port B? - - map(0x007870, 0x007870).r(FUNC(gpl162xx_lcdtype_state::io_7870_r)); // Port C? - - map(0x0078a1, 0x0078a1).r(FUNC(gpl162xx_lcdtype_state::unk_78a1_r)); - - map(0x0078d8, 0x0078d8).rw(FUNC(gpl162xx_lcdtype_state::unk_78d8_r), FUNC(gpl162xx_lcdtype_state::unk_78d8_w)); - - - map(0x007940, 0x007940).w(FUNC(gpl162xx_lcdtype_state::spi_control_w)); - // 7941 SPI Transmit Status - map(0x007942, 0x007942).w(FUNC(gpl162xx_lcdtype_state::spi_tx_fifo_w)); - // 7943 SPI Receive Status - map(0x007944, 0x007944).r(FUNC(gpl162xx_lcdtype_state::spi_rx_fifo_r)); - map(0x007945, 0x007945).r(FUNC(gpl162xx_lcdtype_state::spi_misc_control_r)); - - map(0x007a80, 0x007a87).rw(FUNC(gpl162xx_lcdtype_state::system_dma_params_channel0_r), FUNC(gpl162xx_lcdtype_state::system_dma_params_channel0_w)); - - map(0x007abf, 0x007abf).r(FUNC(gpl162xx_lcdtype_state::unk_7abf_r)); + map(0x000000, 0x00ffff).ram(); // unknown, RAM/ROM? there are jumps to this region, doesn't seem the usual unSP 8000-ffff ROM mapping // there are calls to 0x0f000 (internal ROM?) - map(0x00f000, 0x00ffff).rom().region("maincpu", 0x00000); - - // external LCD controller - map(0x200000, 0x200000).w(FUNC(gpl162xx_lcdtype_state::lcd_command_w)); - map(0x20fc00, 0x20fc00).w(FUNC(gpl162xx_lcdtype_state::lcd_w)); -} - -void gpl162xx_lcdtype_state::lcd_command_w(uint16_t data) -{ - data &= 0xff; - - switch (m_lcdstate) - { - case LCD_STATE_READY: - case LCD_STATE_PROCESSING_COMMAND: - { - if (data == 0x0000) - { - m_lcdstate = LCD_STATE_WAITING_FOR_COMMAND; - m_lastlcdcommand = 0; - } - break; - } - - case LCD_STATE_WAITING_FOR_COMMAND: - { - m_lastlcdcommand = data; - m_lcdstate = LCD_STATE_PROCESSING_COMMAND; - break; - } - - } -} - -void gpl162xx_lcdtype_state::lcd_w(uint16_t data) -{ - data &= 0xff; // definitely looks like 8-bit port as 16-bit values are shifted and rewritten - LOGMASKED(LOG_GPL162XX_LCDTYPE,"%s: lcd_w %02x\n", machine().describe_context(), data); - - if ((m_lcdstate == LCD_STATE_PROCESSING_COMMAND) && (m_lastlcdcommand == 0x22)) - { - m_displaybuffer[m_lcdaddr] = data; - m_lcdaddr++; - - if (m_lcdaddr >= ((320 * 240) * 2)) - m_lcdaddr = 0; - - //m_lcdaddr &= 0x3ffff; - } -} - - -void gpl162xx_lcdtype_state::machine_start() -{ + map(0x200000, 0x3fffff).ram(); // almost certainly RAM where the SPI ROM gets copied } -void gpl162xx_lcdtype_state::machine_reset() +void generalplus_gpl_unknown_state::machine_start() { - m_spistate = SPI_STATE_READY; - m_spiaddress = 0; - - for (int i = 0; i < 320*240*2; i++) - m_displaybuffer[i] = 0x00; - - m_lcdaddr = 0; - - m_lcdstate = LCD_STATE_READY; - m_lastlcdcommand = 0; - - m_78a1 = 0; - -// first menu index is stored here -// m_spirom[0x16000] = gamenum & 0xff; -// m_spirom[0x16001] = (gamenum>>8) & 0xff; } -WRITE_LINE_MEMBER(gpl162xx_lcdtype_state::screen_vblank) +void generalplus_gpl_unknown_state::machine_reset() { - if (state) - { - // probably a timer - m_maincpu->set_input_line(UNSP_IRQ4_LINE, ASSERT_LINE); - m_78a1 |= 0x8000; - } - else + address_space& mem = m_maincpu->space(AS_PROGRAM); + for (int j = 0; j < 0x200000/2; j++) { - m_maincpu->set_input_line(UNSP_IRQ4_LINE, CLEAR_LINE); + uint16_t data = (m_spirom[(j*2)+1] << 8) | (m_spirom[(j*2)+0]); + mem.write_word(0x200000+j, data); } + + m_maincpu->set_state_int(UNSP_PC, 0x1000); // this is not the boot code, everything in the SPI ROM seems like relatively small functions (that never touch internal registers) only the very last one in SPI ROM has no callers from in the SPI ROM code + m_maincpu->set_state_int(UNSP_SR, 0x0020); } -void gpl162xx_lcdtype_state::gpl162xx_lcdtype(machine_config &config) +void generalplus_gpl_unknown_state::generalplus_gpl_unknown(machine_config &config) { - UNSP_20(config, m_maincpu, 96000000); // unknown CPU, unsp20 based, 96Mhz is listed as the maximum for most unSP2.0 chips, and appears correct here - m_maincpu->set_addrmap(AS_PROGRAM, &gpl162xx_lcdtype_state::map); + UNSP_20(config, m_maincpu, 96000000); // unknown CPU, no unSP2.0 opcodes? + m_maincpu->set_addrmap(AS_PROGRAM, &generalplus_gpl_unknown_state::map); SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_refresh_hz(60); m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(10)); m_screen->set_size(64*8, 32*8); m_screen->set_visarea(0*8, 320-1, 0*8, 240-1); - m_screen->set_screen_update(FUNC(gpl162xx_lcdtype_state::screen_update)); - m_screen->screen_vblank().set(FUNC(gpl162xx_lcdtype_state::screen_vblank)); + m_screen->set_screen_update(FUNC(generalplus_gpl_unknown_state::screen_update)); + //m_screen->screen_vblank().set(FUNC(generalplus_gpl_unknown_state::screen_vblank)); PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x8000); - - BL_HANDHELDS_MENUCONTROL(config, m_menucontrol, 0); - m_menucontrol->set_is_unsp_type_hack(); - } -// pcp8718 and pcp8728 both contain user data (player name?) and will need to be factory defaulted once they work -// the ROM code is slightly different between them - -ROM_START( pcp8718 ) - ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "internal.rom", 0x000000, 0x2000, CRC(ea119561) SHA1(a2680577e20fe1155efc40a5781cf1ec80ccec3a) ) - - ROM_REGION( 0x800000, "spi", ROMREGION_ERASEFF ) - //ROM_LOAD16_WORD_SWAP( "8718_en25f32.bin", 0x000000, 0x400000, CRC(cc138db4) SHA1(379af3d94ae840f52c06416d6cf32e25923af5ae) ) // bad dump, some blocks are corrupt - ROM_LOAD( "eyecare_25q32av1g_ef4016.bin", 0x000000, 0x400000, CRC(58415e10) SHA1(b1adcc03f2ad8d741544204671677740e904ce1a) ) -ROM_END - -ROM_START( pcp8728 ) - ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "internal.rom", 0x000000, 0x2000, CRC(ea119561) SHA1(a2680577e20fe1155efc40a5781cf1ec80ccec3a) ) - - ROM_REGION( 0x800000, "spi", ROMREGION_ERASEFF ) - ROM_LOAD( "pcp 8728 788 in 1.bin", 0x000000, 0x400000, CRC(60115f21) SHA1(e15c39f11e442a76fae3823b6d510178f6166926) ) -ROM_END - -ROM_START( bkid218 ) - ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "internal.rom", 0x000000, 0x2000, CRC(ea119561) SHA1(a2680577e20fe1155efc40a5781cf1ec80ccec3a) ) - - ROM_REGION( 0x800000, "spi", ROMREGION_ERASEFF ) - ROM_LOAD( "218n1_25q64csig_c84017.bin", 0x000000, 0x800000, CRC(94f35dbd) SHA1(a1bd6defd2465ae14753cd83be5c31f99e9158ec) ) -ROM_END - ROM_START( unkunsp ) - ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD16_WORD_SWAP( "internal.rom", 0x000000, 0x2000, NO_DUMP ) // exact size unknown + //ROM_REGION( 0x2000, "maincpu", ROMREGION_ERASEFF ) + //ROM_LOAD16_WORD_SWAP( "internal.rom", 0x000000, 0x2000, NO_DUMP ) // exact size unknown ROM_REGION( 0x800000, "spi", ROMREGION_ERASEFF ) // this simply maps at 200000, and contains jumps to lower areas that suggest even the ROM/internal RAM mapping is very different ROM_LOAD( "fm25q16a.bin", 0x000000, 0x200000, CRC(aeb472ac) SHA1(500c24b725f6d3308ef8cbdf4259f5be556c7c92) ) ROM_END - -CONS( 200?, pcp8718, 0, 0, gpl162xx_lcdtype, gpl162xx_lcdtype, gpl162xx_lcdtype_state, empty_init, "PCP", "PCP 8718 - HD 360 Degrees Rocker Palm Eyecare Console - 788 in 1", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) -CONS( 200?, pcp8728, 0, 0, gpl162xx_lcdtype, gpl162xx_lcdtype, gpl162xx_lcdtype_state, empty_init, "PCP", "PCP 8728 - 788 in 1", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) // what name was this sold under? -CONS( 200?, bkid218, 0, 0, gpl162xx_lcdtype, gpl162xx_lcdtype, gpl162xx_lcdtype_state, empty_init, "BornKid", "Handheld Game Console BC-19 - 218 in 1", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) - // different hardware, first 0x2000 bytes in ROM are blank, maps fully in RAM at 200000 -CONS( 200?, unkunsp, 0, 0, gpl162xx_lcdtype, gpl162xx_lcdtype, gpl162xx_lcdtype_state, empty_init, "<unknown>", "unknown unSP-based handheld", MACHINE_IS_SKELETON ) +CONS( 2017, unkunsp, 0, 0, generalplus_gpl_unknown, generalplus_gpl_unknown, generalplus_gpl_unknown_state, empty_init, "Super Impulse", "Pac-Man (Micro Arcade)", MACHINE_IS_SKELETON ) diff --git a/src/mame/drivers/ibmpcjr.cpp b/src/mame/drivers/ibmpcjr.cpp index 86f3f34e528..26ef951ef54 100644 --- a/src/mame/drivers/ibmpcjr.cpp +++ b/src/mame/drivers/ibmpcjr.cpp @@ -404,8 +404,7 @@ void pcjr_state::pcjr_fdc_dor_w(uint8_t data) else m_fdc->set_floppy(nullptr); - if((pdor^m_pcjr_dor) & 0x80) - m_fdc->soft_reset(); + m_fdc->reset_w(!BIT(m_pcjr_dor, 7)); if(m_pcjr_dor & 0x20) { if((pdor & 0x40) && !(m_pcjr_dor & 0x40)) diff --git a/src/mame/drivers/korgdss1.cpp b/src/mame/drivers/korgdss1.cpp index 69b13016ebd..317137c4a23 100644 --- a/src/mame/drivers/korgdss1.cpp +++ b/src/mame/drivers/korgdss1.cpp @@ -72,7 +72,6 @@ private: void bank_switch_w(u8 data); void panel_led_w(u8 data); - DECLARE_WRITE_LINE_MEMBER(fdc_reset_w); DECLARE_WRITE_LINE_MEMBER(fdc_tc_w); DECLARE_WRITE_LINE_MEMBER(sed9420c_trgin_w); u8 fdc_r(offs_t offset); @@ -156,12 +155,6 @@ void korg_dss1_state::panel_led_w(u8 data) // TODO } -WRITE_LINE_MEMBER(korg_dss1_state::fdc_reset_w) -{ - if (!state) - m_fdc->soft_reset(); -} - WRITE_LINE_MEMBER(korg_dss1_state::fdc_tc_w) { if (m_cpu1.found()) @@ -444,7 +437,7 @@ void korg_dss1_state::klm780(machine_config &config) m_io1->out_pc_callback().set(m_lcdc, FUNC(hd44780_device::e_w)).bit(0); m_io1->out_pc_callback().append(m_lcdc, FUNC(hd44780_device::rw_w)).bit(1); m_io1->out_pc_callback().append(m_lcdc, FUNC(hd44780_device::rs_w)).bit(2); - m_io1->out_pc_callback().append(FUNC(korg_dss1_state::fdc_reset_w)).bit(3); + m_io1->out_pc_callback().append(m_fdc, FUNC(upd765a_device::reset_w)).bit(3).invert(); m_io1->out_pc_callback().append(FUNC(korg_dss1_state::fdc_tc_w)).bit(4); m_io1->out_pc_callback().append(FUNC(korg_dss1_state::sed9420c_trgin_w)).bit(5); diff --git a/src/mame/drivers/mikromik.cpp b/src/mame/drivers/mikromik.cpp index 75c4f6fa5dd..cddf5908c14 100644 --- a/src/mame/drivers/mikromik.cpp +++ b/src/mame/drivers/mikromik.cpp @@ -154,7 +154,7 @@ WRITE_LINE_MEMBER( mm1_state::recall_w ) { LOG("RECALL %u\n", state); m_recall = state; - if (state) m_fdc->soft_reset(); + m_fdc->reset_w(state); } diff --git a/src/mame/drivers/partner.cpp b/src/mame/drivers/partner.cpp index 442e019c79f..c86cb285ff1 100644 --- a/src/mame/drivers/partner.cpp +++ b/src/mame/drivers/partner.cpp @@ -54,7 +54,7 @@ static INPUT_PORTS_START( partner ) PORT_START("LINE0") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_HOME) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_INSERT) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC),27) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3)) @@ -92,7 +92,7 @@ static INPUT_PORTS_START( partner ) PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') PORT_START("LINE4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR(' ') PORT_CHAR('@') // without shift, this should be a Russian character, but we don't have yet these characters... + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('@') PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C') @@ -128,7 +128,7 @@ static INPUT_PORTS_START( partner ) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('~') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('^') PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_START("LINE8") @@ -136,9 +136,9 @@ static INPUT_PORTS_START( partner ) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) // Apparently in partner is Shift to switch between Latin and Russian Keyboard! - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Rus/Lat") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) // This is a toggle to switch between Latin and Russian Keyboard! + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_SHIFT_1) // This is the real shift + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Rus/Lat") PORT_CODE(KEYCODE_LALT) PORT_CODE(KEYCODE_RALT) // doesn't do anything useful PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) INPUT_PORTS_END diff --git a/src/mame/drivers/pc1512.cpp b/src/mame/drivers/pc1512.cpp index 172db10ea9f..0ac54756ba3 100644 --- a/src/mame/drivers/pc1512.cpp +++ b/src/mame/drivers/pc1512.cpp @@ -995,12 +995,7 @@ void pc1512_base_state::drive_select_w(uint8_t data) img->mon_w((data & 0x03) == n && BIT(data, n + 4) ? 0 : 1); } - if (m_dreset != BIT(data, 2)) - { - m_dreset = BIT(data, 2); - m_fdc->soft_reset(); - } - + m_fdc->reset_w(!BIT(data, 2)); m_nden = BIT(data, 3); update_fdc_int(); update_fdc_drq(); @@ -1091,7 +1086,6 @@ void pc1512_base_state::machine_start() save_item(NAME(m_nden)); save_item(NAME(m_dint)); save_item(NAME(m_ddrq)); - save_item(NAME(m_dreset)); save_item(NAME(m_neop)); save_item(NAME(m_ack_int_enable)); save_item(NAME(m_centronics_ack)); diff --git a/src/mame/drivers/pc9801.cpp b/src/mame/drivers/pc9801.cpp index 55edd570c65..558b06b916a 100644 --- a/src/mame/drivers/pc9801.cpp +++ b/src/mame/drivers/pc9801.cpp @@ -439,11 +439,9 @@ uint8_t pc9801_state::fdc_2hd_ctrl_r() void pc9801_state::fdc_2hd_ctrl_w(uint8_t data) { //logerror("%02x ctrl\n",data); - if(((m_fdc_2hd_ctrl & 0x80) == 0) && (data & 0x80)) - m_fdc_2hd->soft_reset(); + m_fdc_2hd->reset_w(BIT(data, 7)); m_fdc_2hd_ctrl = data; - if(data & 0x40) { m_fdc_2hd->set_ready_line_connected(0); @@ -475,8 +473,7 @@ uint8_t pc9801_state::fdc_2dd_ctrl_r() void pc9801_state::fdc_2dd_ctrl_w(uint8_t data) { logerror("%02x ctrl\n",data); - if(((m_fdc_2dd_ctrl & 0x80) == 0) && (data & 0x80)) - m_fdc_2dd->soft_reset(); + m_fdc_2dd->reset_w(BIT(data, 7)); m_fdc_2dd_ctrl = data; m_fdc_2dd->subdevice<floppy_connector>("0")->get_device()->mon_w(data & 8 ? CLEAR_LINE : ASSERT_LINE); diff --git a/src/mame/drivers/prof80.cpp b/src/mame/drivers/prof80.cpp index 703cba82c62..f9111ba0088 100644 --- a/src/mame/drivers/prof80.cpp +++ b/src/mame/drivers/prof80.cpp @@ -94,15 +94,9 @@ WRITE_LINE_MEMBER(prof80_state::select_w) } -WRITE_LINE_MEMBER(prof80_state::resf_w) -{ - if (state) - m_fdc->soft_reset(); -} - - WRITE_LINE_MEMBER(prof80_state::mini_w) { + m_fdc->set_unscaled_clock(16_MHz_XTAL / (state ? 4 : 2)); } @@ -453,7 +447,7 @@ void prof80_state::machine_start() void prof80_state::prof80(machine_config &config) { // basic machine hardware - Z80(config, m_maincpu, XTAL(6'000'000)); + Z80(config, m_maincpu, 6_MHz_XTAL); m_maincpu->set_addrmap(AS_PROGRAM, &prof80_state::prof80_mem); m_maincpu->set_addrmap(AS_IO, &prof80_state::prof80_io); @@ -465,7 +459,7 @@ void prof80_state::prof80(machine_config &config) UPD1990A(config, m_rtc); // FDC - UPD765A(config, m_fdc, 8'000'000, true, true); + UPD765A(config, m_fdc, 16_MHz_XTAL / 2, true, true); // clocked through FDC9229B FLOPPY_CONNECTOR(config, UPD765_TAG ":0", prof80_floppies, "525qd", floppy_image_device::default_floppy_formats); FLOPPY_CONNECTOR(config, UPD765_TAG ":1", prof80_floppies, "525qd", floppy_image_device::default_floppy_formats); FLOPPY_CONNECTOR(config, UPD765_TAG ":2", prof80_floppies, nullptr, floppy_image_device::default_floppy_formats); @@ -483,7 +477,7 @@ void prof80_state::prof80(machine_config &config) m_flra->q_out_cb<6>().set(FUNC(prof80_state::motor_w)); // _MOTOR m_flra->q_out_cb<7>().set(FUNC(prof80_state::select_w)); // SELECT LS259(config, m_flrb); - m_flrb->q_out_cb<0>().set(FUNC(prof80_state::resf_w)); // RESF + m_flrb->q_out_cb<0>().set(m_fdc, FUNC(upd765a_device::reset_w)); // RESF m_flrb->q_out_cb<1>().set(FUNC(prof80_state::mini_w)); // MINI m_flrb->q_out_cb<2>().set(m_rs232a, FUNC(rs232_port_device::write_rts)); // _RTS m_flrb->q_out_cb<3>().set(m_rs232a, FUNC(rs232_port_device::write_txd)); // TX diff --git a/src/mame/drivers/radio86.cpp b/src/mame/drivers/radio86.cpp index 81588e076c0..882f4a46867 100644 --- a/src/mame/drivers/radio86.cpp +++ b/src/mame/drivers/radio86.cpp @@ -176,7 +176,7 @@ INPUT_PORTS_START( radio86 ) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('~') + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('^') PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_START("LINE8") @@ -195,7 +195,7 @@ INPUT_PORTS_END INPUT_PORTS_START( kr03 ) PORT_START("LINE0") PORT_BIT(0x001, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) - PORT_BIT(0x002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC)) + PORT_BIT(0x002, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC),27) PORT_BIT(0x004, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') PORT_BIT(0x008, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_BIT(0x010, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2)) diff --git a/src/mame/drivers/sdk86.cpp b/src/mame/drivers/sdk86.cpp index 57fc3891182..cef0f11989d 100644 --- a/src/mame/drivers/sdk86.cpp +++ b/src/mame/drivers/sdk86.cpp @@ -14,6 +14,11 @@ The user manual is available from: http://www.bitsavers.org/pdf/intel/8086/98006 2009-11-29 Some fleshing out by Lord Nightmare 2011-06-22 Working [Robbbert] + +Paste Test: + N0100^11^22^33^44^55^66^77^88^99^X0100^ + Press UP to verify the data. + ToDo: - Add optional 2x 8255A port read/write logging @@ -83,18 +88,18 @@ void sdk86_state::io_map(address_map &map) /* Input ports */ static INPUT_PORTS_START( sdk86 ) PORT_START("X0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 EB/AX") PORT_CODE(KEYCODE_0) PORT_CHAR('0') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 ER/BX") PORT_CODE(KEYCODE_1) PORT_CHAR('1') - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 GO/CX") PORT_CODE(KEYCODE_2) PORT_CHAR('2') - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 ST/DX") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 IB/SP") PORT_CODE(KEYCODE_4) PORT_CHAR('4') - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 OB/BP") PORT_CODE(KEYCODE_5) PORT_CHAR('5') - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 MV/SI") PORT_CODE(KEYCODE_6) PORT_CHAR('6') - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 EW/DI") PORT_CODE(KEYCODE_7) PORT_CHAR('7') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 EB/AX") PORT_CODE(KEYCODE_0) PORT_CHAR('0') // examine/modify bytes + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 ER/BX") PORT_CODE(KEYCODE_1) PORT_CHAR('1') // examine/modify register + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 GO/CX") PORT_CODE(KEYCODE_2) PORT_CHAR('2') // go + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 ST/DX") PORT_CODE(KEYCODE_3) PORT_CHAR('3') // step + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 IB/SP") PORT_CODE(KEYCODE_4) PORT_CHAR('4') // read a byte from port + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 OB/BP") PORT_CODE(KEYCODE_5) PORT_CHAR('5') // output byte to port + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6 MV/SI") PORT_CODE(KEYCODE_6) PORT_CHAR('6') // copy memory block + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7 EW/DI") PORT_CODE(KEYCODE_7) PORT_CHAR('7') // examine/modify words PORT_START("X1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 IW/CS") PORT_CODE(KEYCODE_8) PORT_CHAR('8') - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 OW/DS") PORT_CODE(KEYCODE_9) PORT_CHAR('9') + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 IW/CS") PORT_CODE(KEYCODE_8) PORT_CHAR('8') // read a word from port + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 OW/DS") PORT_CODE(KEYCODE_9) PORT_CHAR('9') // output a word to port PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A SS") PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B ES") PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C IP") PORT_CODE(KEYCODE_C) PORT_CHAR('C') @@ -103,17 +108,17 @@ static INPUT_PORTS_START( sdk86 ) PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_START("X2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CODE(KEYCODE_X) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CODE(KEYCODE_UP) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_EQUALS) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_COLON) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("REG") PORT_CODE(KEYCODE_R) + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP) PORT_CODE(KEYCODE_ENTER) PORT_CHAR('X') // end current command + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(",") PORT_CODE(KEYCODE_COMMA) PORT_CODE(KEYCODE_UP) PORT_CHAR('^') // enter data and increment address + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('M') // subtract one number from another + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('P') // add two numbers + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_COLON) PORT_CHAR('S') // separator between segment and offset + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("REG") PORT_CODE(KEYCODE_R) PORT_CHAR('R') // registers PORT_BIT(0xC0, IP_ACTIVE_LOW, IPT_UNUSED) PORT_START("X3") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("INTR") PORT_CODE(KEYCODE_ESC) PORT_CHANGED_MEMBER(DEVICE_SELF, sdk86_state, nmi_button, 0) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Systm Reset") PORT_CODE(KEYCODE_F3) PORT_CHANGED_MEMBER(DEVICE_SELF, sdk86_state, reset_button, 0) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("INTR") PORT_CODE(KEYCODE_ESC) PORT_CHANGED_MEMBER(DEVICE_SELF, sdk86_state, nmi_button, 0) PORT_CHAR('I') + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Systm Reset") PORT_CODE(KEYCODE_F3) PORT_CHANGED_MEMBER(DEVICE_SELF, sdk86_state, reset_button, 0) PORT_CHAR('N') INPUT_PORTS_END INPUT_CHANGED_MEMBER(sdk86_state::nmi_button) @@ -186,7 +191,8 @@ void sdk86_state::sdk86(machine_config &config) m_uart->dtr_handler().set("rs232", FUNC(rs232_port_device::write_dtr)); m_uart->rts_handler().set(m_uart, FUNC(i8251_device::write_cts)); - rs232_port_device &rs232(RS232_PORT(config, "rs232", default_rs232_devices, "terminal")); + // it's meant to interface with an intellec unit, and you need floppy disks & drives for that + rs232_port_device &rs232(RS232_PORT(config, "rs232", default_rs232_devices, nullptr)); rs232.rxd_handler().set(m_uart, FUNC(i8251_device::write_rxd)); rs232.dsr_handler().set(m_uart, FUNC(i8251_device::write_dsr)); rs232.set_option_device_input_defaults("terminal", DEVICE_INPUT_DEFAULTS_NAME(terminal)); diff --git a/src/mame/drivers/tandy2k.cpp b/src/mame/drivers/tandy2k.cpp index 3cac1126519..6785eb42d67 100644 --- a/src/mame/drivers/tandy2k.cpp +++ b/src/mame/drivers/tandy2k.cpp @@ -157,10 +157,7 @@ void tandy2k_state::enable_w(uint8_t data) m_pit->write_gate2(BIT(data, 4)); // FDC reset - if (!BIT(data, 5)) - { - m_fdc->soft_reset(); - } + m_fdc->reset_w(!BIT(data, 5)); // timer 0 enable m_maincpu->tmrin0_w(BIT(data, 6)); diff --git a/src/mame/drivers/ti99_8.cpp b/src/mame/drivers/ti99_8.cpp index 2484f6d622c..1e0ed7c1c9c 100644 --- a/src/mame/drivers/ti99_8.cpp +++ b/src/mame/drivers/ti99_8.cpp @@ -5,7 +5,7 @@ The MESS TI-99/8 emulation driver The TI-99/8 was the envisaged successor to the TI-99/4A but never passed - its prototype state. Only a few dozens of consoles were built. The ROMs + its prototype state. Only a few dozen consoles were built. The ROMs were not even finalized, so the few available consoles have different operating system versions and capabilities. @@ -15,7 +15,7 @@ Name: "Texas Instruments Computer TI-99/8" (no "Home") - Inofficial nickname: "Armadillo" + Unofficial nickname: "Armadillo" CPU: Single-CPU system using a TMS9995, but as a variant named MP9537. This variant does not offer on-chip RAM or decrementer. @@ -81,7 +81,7 @@ Modes: - Compatibility mode (TI-99/4A mode): Memory-mapped devices are placed at the same location as found in the TI-99/4A, thereby - providing a good downward compatibility. + providing good downward compatibility. The console starts up in compatibility mode. - Native mode (Armadillo mode): Devices are located at positions above 0xF000 that allow for a contiguous usage of memory. @@ -94,7 +94,7 @@ From the 32 bits, 24 bits define the physical address, so this allows for a maximum of 16 MiB of mapped-addressable memory. - See more about the mapper in the file mapper8.c. + See more about the mapper in the file 998board.cpp Availability of ROMs and documentation diff --git a/src/mame/drivers/ut88.cpp b/src/mame/drivers/ut88.cpp index 64f4e46fe4d..a7d19ec4ccd 100644 --- a/src/mame/drivers/ut88.cpp +++ b/src/mame/drivers/ut88.cpp @@ -129,7 +129,7 @@ static INPUT_PORTS_START( ut88 ) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('~') + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('^') PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("<>") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('_') PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) @@ -177,7 +177,7 @@ static INPUT_PORTS_START( ut88mini ) PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_START("LINE2") - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Backspace") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR('V') INPUT_PORTS_END const gfx_layout charlayout = diff --git a/src/mame/drivers/x1.cpp b/src/mame/drivers/x1.cpp index f67266cda94..e91e0262742 100644 --- a/src/mame/drivers/x1.cpp +++ b/src/mame/drivers/x1.cpp @@ -1871,11 +1871,11 @@ INPUT_PORTS_START( x1 ) PORT_BIT(0x00000004,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("KANA") PORT_CODE(KEYCODE_RCONTROL) PORT_TOGGLE PORT_BIT(0x00000008,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("CAPS") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_BIT(0x00000010,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("GRAPH") PORT_CODE(KEYCODE_LALT) - // TODO: add other keys (ROLL UP, ROLL DOWN, HELP, COPY, XFER) INPUT_PORTS_END INPUT_PORTS_START( x1turbo ) PORT_INCLUDE( x1 ) + // X1TURBO TODO: add other keys (ROLL UP, ROLL DOWN, HELP, COPY, XFER) PORT_START("X1TURBO_DSW") PORT_DIPNAME( 0x01, 0x01, "Interlace mode" ) diff --git a/src/mame/includes/apollo.h b/src/mame/includes/apollo.h index a645dc31a72..367a926baa5 100644 --- a/src/mame/includes/apollo.h +++ b/src/mame/includes/apollo.h @@ -438,7 +438,7 @@ public: protected: required_device<screen_device> m_screen; - apollo_graphics_15i(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, device_type type); + apollo_graphics_15i(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); // device-level overrides virtual void device_start() override; @@ -544,8 +544,8 @@ protected: uint32_t m_color_lookup_table[16]; - lut_fifo *m_lut_fifo; - bt458 *m_bt458; + std::unique_ptr<lut_fifo> m_lut_fifo; + std::unique_ptr<bt458> m_bt458; }; diff --git a/src/mame/includes/champbas.h b/src/mame/includes/champbas.h index 917c80d9ab7..70d82340623 100644 --- a/src/mame/includes/champbas.h +++ b/src/mame/includes/champbas.h @@ -112,6 +112,7 @@ public: void exctsccr(machine_config &config); void exctsccrb(machine_config &config); + void exctscc2(machine_config &config); protected: TIMER_DEVICE_CALLBACK_MEMBER(exctsccr_sound_irq); @@ -129,6 +130,7 @@ protected: void exctsccrb_map(address_map &map); void exctsccr_sound_map(address_map &map); void exctsccr_sound_io_map(address_map &map); + void exctscc2_sound_io_map(address_map &map); private: required_device<cpu_device> m_audiocpu; diff --git a/src/mame/includes/pc1512.h b/src/mame/includes/pc1512.h index 036f64c8f7c..61522356432 100644 --- a/src/mame/includes/pc1512.h +++ b/src/mame/includes/pc1512.h @@ -75,7 +75,6 @@ public: m_nden(1), m_dint(0), m_ddrq(0), - m_dreset(1), m_fdc_dsr(0), m_neop(0), m_ack_int_enable(1), @@ -178,7 +177,6 @@ public: int m_nden; int m_dint; int m_ddrq; - int m_dreset; uint8_t m_fdc_dsr; int m_neop; diff --git a/src/mame/includes/prof80.h b/src/mame/includes/prof80.h index 272e3070746..08d89ec8f30 100644 --- a/src/mame/includes/prof80.h +++ b/src/mame/includes/prof80.h @@ -86,7 +86,6 @@ private: DECLARE_WRITE_LINE_MEMBER(inuse_w); DECLARE_WRITE_LINE_MEMBER(motor_w); DECLARE_WRITE_LINE_MEMBER(select_w); - DECLARE_WRITE_LINE_MEMBER(resf_w); DECLARE_WRITE_LINE_MEMBER(mini_w); DECLARE_WRITE_LINE_MEMBER(mstop_w); diff --git a/src/mame/layout/model1io2.lay b/src/mame/layout/model1io2.lay index 785b3b4540e..493a8de92fb 100644 --- a/src/mame/layout/model1io2.lay +++ b/src/mame/layout/model1io2.lay @@ -21,29 +21,22 @@ license:CC0 </element> <view name="Default"> - <!-- workaround for MAME selecting a 2-screen view by default --> - <screen tag="ioboard:screen"><bounds left="0" top="0" right="1" bottom="1" /></screen> - - <screen tag="screen"> - <bounds left="0" top="0" right="4" bottom="3" /> - </screen> - </view> - - <view name="Diagnostic"> - <element ref="background"> - <bounds x="0" y="0" width="496" height="419" /> - </element> + <collection name="Diagnostics" visible="no"> + <element ref="background"> + <bounds x="0" y="0" width="512" height="419" /> + </element> + <screen tag="ioboard:screen"> + <bounds left="8" top="392" right="129" bottom="411" /> + </screen> + <element name="led_comm_err" ref="led_red"> + <bounds x="141" y="399" width="5" height="5" /> + </element> + <element ref="text_comm_err"> + <bounds x="145" y="398" width="40" height="7" /> + </element> + </collection> <screen tag="screen"> - <bounds left="0" top="0" right="496" bottom="384" /> - </screen> - <screen tag="ioboard:screen"> - <bounds left="8" top="392" right="129" bottom="411" /> + <bounds left="0" top="0" right="512" bottom="384" /> </screen> - <element name="led_comm_err" ref="led_red"> - <bounds x="141" y="399" width="5" height="5" /> - </element> - <element ref="text_comm_err"> - <bounds x="145" y="398" width="40" height="7" /> - </element> </view> </mamelayout> diff --git a/src/mame/layout/sdk86.lay b/src/mame/layout/sdk86.lay index ed3a73006db..9ee46f9e113 100644 --- a/src/mame/layout/sdk86.lay +++ b/src/mame/layout/sdk86.lay @@ -30,16 +30,4 @@ copyright-holders:Robbbert </group> </view> - <view name="LED Displays with Terminal"> - <bounds left="0" top="0" right="362" bottom="340.5" /> - - <screen index="0"> - <bounds left="0" top="69" right="362" bottom="340.5" /> - </screen> - - <group ref="leds"> - <bounds left="10" top="10" right="352" bottom="59" /> - </group> - </view> - </mamelayout> diff --git a/src/mame/machine/psxcd.cpp b/src/mame/machine/psxcd.cpp index b7271d751b0..ddbcf2e267b 100644 --- a/src/mame/machine/psxcd.cpp +++ b/src/mame/machine/psxcd.cpp @@ -146,12 +146,12 @@ void psxcd_device::device_stop() for (int i = 0; i < MAX_PSXCD_TIMERS; i++) { if(m_timerinuse[i] && m_timers[i]->ptr()) - global_free((command_result *)m_timers[i]->ptr()); + delete (command_result *)m_timers[i]->ptr(); } while(res_queue) { command_result *res = res_queue->next; - global_free(res_queue); + delete res_queue; res_queue = res; } } @@ -164,7 +164,7 @@ void psxcd_device::device_reset() for (int i = 0; i < MAX_PSXCD_TIMERS; i++) { if(m_timerinuse[i] && m_timers[i]->ptr()) - global_free((command_result *)m_timers[i]->ptr()); + delete (command_result *)m_timers[i]->ptr(); m_timers[i]->adjust(attotime::never, 0, attotime::never); m_timerinuse[i] = false; } @@ -175,7 +175,7 @@ void psxcd_device::device_reset() while(res_queue) { command_result *res = res_queue->next; - global_free(res_queue); + delete res_queue; res_queue = res; } @@ -363,7 +363,7 @@ void psxcd_device::write(offs_t offset, uint8_t data) m_int1 = nullptr; res_queue = res->next; - global_free(res); + delete res; m_regs.sr &= ~0x20; rdp = 0; if(res_queue) @@ -867,7 +867,7 @@ void psxcd_device::cmd_complete(command_result *res) psxcd_device::command_result *psxcd_device::prepare_result(uint8_t res, uint8_t *data, int sz, uint8_t errcode) { - auto cr=global_alloc(command_result); + auto cr=new command_result; cr->res=res; if (sz) @@ -1072,7 +1072,7 @@ void psxcd_device::play_sector() if ((mode&mode_report) && !(sector & 15)) // slow the int rate { - auto res=global_alloc(command_result); + auto res=new command_result; uint8_t track = cdrom_get_track(m_cdrom_handle, sector) + 1; res->res=intr_dataready; diff --git a/src/mame/mame.lst b/src/mame/mame.lst index cd3c9f8aad5..0e2622bc035 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -14807,9 +14807,11 @@ suprpokrb // (c) 1986 Grayhound Electronics rp200 @source:generalplus_gpl_unknown.cpp +unkunsp + +@source:generalplus_gpl162xx_lcdtype.cpp pcp8718 pcp8728 -unkunsp bkid218 @source:generalplus_gpl16250_mobigo.cpp diff --git a/src/mame/mess.flt b/src/mame/mess.flt index bcb47f7233f..c0552dbdd3a 100644 --- a/src/mame/mess.flt +++ b/src/mame/mess.flt @@ -333,6 +333,7 @@ gb.cpp gba.cpp gem_rp.cpp generalplus_gpl_unknown.cpp +generalplus_gpl162xx_lcdtype.cpp generalplus_gpl16250_mobigo.cpp generalplus_gpl16250_nand.cpp generalplus_gpl16250_rom.cpp @@ -523,6 +524,7 @@ m79152pc.cpp mac.cpp mac128.cpp macpci.cpp +macquadra700.cpp magiceyes_pollux_vr3520f.cpp magnum.cpp mattelchess.cpp diff --git a/src/mame/video/apollo.cpp b/src/mame/video/apollo.cpp index 84183400c2a..a1b4c667fbf 100644 --- a/src/mame/video/apollo.cpp +++ b/src/mame/video/apollo.cpp @@ -1725,25 +1725,18 @@ void apollo_graphics_15i::device_add_mconfig(machine_config &config) DEFINE_DEVICE_TYPE(APOLLO_GRAPHICS, apollo_graphics_15i, "apollo_graphics_15i", "Apollo Screen") apollo_graphics_15i::apollo_graphics_15i(const machine_config &mconfig,const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, APOLLO_GRAPHICS, tag, owner, clock), - m_screen(*this, VIDEO_SCREEN_TAG), - m_lut_fifo(nullptr), - m_bt458(nullptr) + apollo_graphics_15i(mconfig, APOLLO_GRAPHICS, tag, owner, clock) { } -apollo_graphics_15i::apollo_graphics_15i(const machine_config &mconfig,const char *tag, device_t *owner, uint32_t clock, device_type type) : +apollo_graphics_15i::apollo_graphics_15i(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, type, tag, owner, clock), - m_screen(*this, VIDEO_SCREEN_TAG), - m_lut_fifo(nullptr), - m_bt458(nullptr) + m_screen(*this, VIDEO_SCREEN_TAG) { } apollo_graphics_15i::~apollo_graphics_15i() { - if (m_lut_fifo) global_free(m_lut_fifo); - if (m_bt458) global_free(m_bt458); } //------------------------------------------------- @@ -1798,8 +1791,8 @@ void apollo_graphics_15i::device_start() memset(m_color_lookup_table, 0, sizeof(m_color_lookup_table)); - m_lut_fifo = nullptr; - m_bt458 = nullptr; + m_lut_fifo.reset(); + m_bt458.reset(); } //------------------------------------------------- @@ -1852,12 +1845,9 @@ void apollo_graphics_15i::device_reset() m_buffer_width = 1024; m_buffer_height = 1024; - if (m_lut_fifo) global_free(m_lut_fifo); - if (m_bt458) global_free(m_bt458); + m_lut_fifo = std::make_unique<lut_fifo>(); - m_lut_fifo = global_alloc(lut_fifo); - - m_bt458 = global_alloc(bt458(machine())); + m_bt458 = std::make_unique<bt458>(machine()); m_bt458->start(); m_bt458->reset(); } @@ -1899,7 +1889,7 @@ void apollo_graphics_19i::device_add_mconfig(machine_config &config) DEFINE_DEVICE_TYPE(APOLLO_MONO19I, apollo_graphics_19i, "apollo_graphics_19i", "Apollo 19\" Monochrome Screen") apollo_graphics_19i::apollo_graphics_19i(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - apollo_graphics_15i(mconfig, tag, owner, clock, APOLLO_MONO19I) + apollo_graphics_15i(mconfig, APOLLO_MONO19I, tag, owner, clock) { } diff --git a/src/osd/modules/debugger/debugimgui.cpp b/src/osd/modules/debugger/debugimgui.cpp index 296b148c5db..da3e58d4bcf 100644 --- a/src/osd/modules/debugger/debugimgui.cpp +++ b/src/osd/modules/debugger/debugimgui.cpp @@ -225,11 +225,7 @@ static void view_list_remove(debug_area* item) static debug_area *dview_alloc(running_machine &machine, debug_view_type type) { - debug_area *dv; - - dv = global_alloc(debug_area(machine, type)); - - return dv; + return new debug_area(machine, type); } static inline void map_attr_to_fg_bg(unsigned char attr, rgb_t *fg, rgb_t *bg) @@ -1406,7 +1402,7 @@ void debug_imgui::update() if(to_delete != nullptr) { view_list_remove(to_delete); - global_free(to_delete); + delete to_delete; } ImGui::PopStyleColor(12); diff --git a/src/osd/modules/debugger/win/consolewininfo.cpp b/src/osd/modules/debugger/win/consolewininfo.cpp index e6ad4c0986f..5589a48018a 100644 --- a/src/osd/modules/debugger/win/consolewininfo.cpp +++ b/src/osd/modules/debugger/win/consolewininfo.cpp @@ -30,10 +30,10 @@ consolewin_info::consolewin_info(debugger_windows_interface &debugger) : goto cleanup; // create the views - m_views[1].reset(global_alloc(debugview_info(debugger, *this, window(), DVT_STATE))); + m_views[1].reset(new debugview_info(debugger, *this, window(), DVT_STATE)); if (!m_views[1]->is_valid()) goto cleanup; - m_views[2].reset(global_alloc(debugview_info(debugger, *this, window(), DVT_CONSOLE))); + m_views[2].reset(new debugview_info(debugger, *this, window(), DVT_CONSOLE)); if (!m_views[2]->is_valid()) goto cleanup; diff --git a/src/osd/modules/debugger/win/disasmbasewininfo.cpp b/src/osd/modules/debugger/win/disasmbasewininfo.cpp index 800443b47c1..f68a7652c77 100644 --- a/src/osd/modules/debugger/win/disasmbasewininfo.cpp +++ b/src/osd/modules/debugger/win/disasmbasewininfo.cpp @@ -26,7 +26,7 @@ disasmbasewin_info::disasmbasewin_info(debugger_windows_interface &debugger, boo if (!window()) return; - m_views[0].reset(global_alloc(disasmview_info(debugger, *this, window()))); + m_views[0].reset(new disasmview_info(debugger, *this, window())); if ((m_views[0] == nullptr) || !m_views[0]->is_valid()) { m_views[0].reset(); diff --git a/src/osd/modules/debugger/win/logwininfo.cpp b/src/osd/modules/debugger/win/logwininfo.cpp index 6d2cd59b554..88b6022aa9a 100644 --- a/src/osd/modules/debugger/win/logwininfo.cpp +++ b/src/osd/modules/debugger/win/logwininfo.cpp @@ -19,7 +19,7 @@ logwin_info::logwin_info(debugger_windows_interface &debugger) : if (!window()) return; - m_views[0].reset(global_alloc(logview_info(debugger, *this, window()))); + m_views[0].reset(new logview_info(debugger, *this, window())); if ((m_views[0] == nullptr) || !m_views[0]->is_valid()) { m_views[0].reset(); diff --git a/src/osd/modules/debugger/win/memorywininfo.cpp b/src/osd/modules/debugger/win/memorywininfo.cpp index 93151cc018d..18f28252f12 100644 --- a/src/osd/modules/debugger/win/memorywininfo.cpp +++ b/src/osd/modules/debugger/win/memorywininfo.cpp @@ -23,7 +23,7 @@ memorywin_info::memorywin_info(debugger_windows_interface &debugger) : if (!window()) return; - m_views[0].reset(global_alloc(memoryview_info(debugger, *this, window()))); + m_views[0].reset(new memoryview_info(debugger, *this, window())); if ((m_views[0] == nullptr) || !m_views[0]->is_valid()) { m_views[0].reset(); diff --git a/src/osd/modules/debugger/win/pointswininfo.cpp b/src/osd/modules/debugger/win/pointswininfo.cpp index 24a8f865e6f..eb2ca1875e2 100644 --- a/src/osd/modules/debugger/win/pointswininfo.cpp +++ b/src/osd/modules/debugger/win/pointswininfo.cpp @@ -20,7 +20,7 @@ pointswin_info::pointswin_info(debugger_windows_interface &debugger) : if (!window()) return; - m_views[0].reset(global_alloc(debugview_info(debugger, *this, window(), DVT_BREAK_POINTS))); + m_views[0].reset(new debugview_info(debugger, *this, window(), DVT_BREAK_POINTS)); if ((m_views[0] == nullptr) || !m_views[0]->is_valid()) { m_views[0].reset(); @@ -96,7 +96,7 @@ bool pointswin_info::handle_command(WPARAM wparam, LPARAM lparam) { case ID_SHOW_BREAKPOINTS: m_views[0].reset(); - m_views[0].reset(global_alloc(debugview_info(debugger(), *this, window(), DVT_BREAK_POINTS))); + m_views[0].reset(new debugview_info(debugger(), *this, window(), DVT_BREAK_POINTS)); if (!m_views[0]->is_valid()) m_views[0].reset(); win_set_window_text_utf8(window(), "All Breakpoints"); @@ -105,7 +105,7 @@ bool pointswin_info::handle_command(WPARAM wparam, LPARAM lparam) case ID_SHOW_WATCHPOINTS: m_views[0].reset(); - m_views[0].reset(global_alloc(debugview_info(debugger(), *this, window(), DVT_WATCH_POINTS))); + m_views[0].reset(new debugview_info(debugger(), *this, window(), DVT_WATCH_POINTS)); if (!m_views[0]->is_valid()) m_views[0].reset(); win_set_window_text_utf8(window(), "All Watchpoints"); diff --git a/src/osd/modules/lib/osdobj_common.cpp b/src/osd/modules/lib/osdobj_common.cpp index 25d4b979e87..a04952bcdbc 100644 --- a/src/osd/modules/lib/osdobj_common.cpp +++ b/src/osd/modules/lib/osdobj_common.cpp @@ -290,42 +290,42 @@ void osd_common_t::register_options() int num; std::vector<const char *> dnames; - m_mod_man.get_module_names(OSD_MONITOR_PROVIDER, 20, &num, names); + m_mod_man.get_module_names(OSD_MONITOR_PROVIDER, 20, num, names); for (int i = 0; i < num; i++) dnames.push_back(names[i]); update_option(OSD_MONITOR_PROVIDER, dnames); - m_mod_man.get_module_names(OSD_FONT_PROVIDER, 20, &num, names); + m_mod_man.get_module_names(OSD_FONT_PROVIDER, 20, num, names); dnames.clear(); for (int i = 0; i < num; i++) dnames.push_back(names[i]); update_option(OSD_FONT_PROVIDER, dnames); - m_mod_man.get_module_names(OSD_KEYBOARDINPUT_PROVIDER, 20, &num, names); + m_mod_man.get_module_names(OSD_KEYBOARDINPUT_PROVIDER, 20, num, names); dnames.clear(); for (int i = 0; i < num; i++) dnames.push_back(names[i]); update_option(OSD_KEYBOARDINPUT_PROVIDER, dnames); - m_mod_man.get_module_names(OSD_MOUSEINPUT_PROVIDER, 20, &num, names); + m_mod_man.get_module_names(OSD_MOUSEINPUT_PROVIDER, 20, num, names); dnames.clear(); for (int i = 0; i < num; i++) dnames.push_back(names[i]); update_option(OSD_MOUSEINPUT_PROVIDER, dnames); - m_mod_man.get_module_names(OSD_LIGHTGUNINPUT_PROVIDER, 20, &num, names); + m_mod_man.get_module_names(OSD_LIGHTGUNINPUT_PROVIDER, 20, num, names); dnames.clear(); for (int i = 0; i < num; i++) dnames.push_back(names[i]); update_option(OSD_LIGHTGUNINPUT_PROVIDER, dnames); - m_mod_man.get_module_names(OSD_JOYSTICKINPUT_PROVIDER, 20, &num, names); + m_mod_man.get_module_names(OSD_JOYSTICKINPUT_PROVIDER, 20, num, names); dnames.clear(); for (int i = 0; i < num; i++) dnames.push_back(names[i]); update_option(OSD_JOYSTICKINPUT_PROVIDER, dnames); - m_mod_man.get_module_names(OSD_SOUND_PROVIDER, 20, &num, names); + m_mod_man.get_module_names(OSD_SOUND_PROVIDER, 20, num, names); dnames.clear(); for (int i = 0; i < num; i++) dnames.push_back(names[i]); @@ -333,7 +333,7 @@ void osd_common_t::register_options() #if 0 // Register midi options and update options - m_mod_man.get_module_names(OSD_MIDI_PROVIDER, 20, &num, names); + m_mod_man.get_module_names(OSD_MIDI_PROVIDER, 20, num, names); dnames.clear(); for (int i = 0; i < num; i++) dnames.push_back(names[i]); @@ -341,13 +341,13 @@ void osd_common_t::register_options() #endif // Register debugger options and update options - m_mod_man.get_module_names(OSD_DEBUG_PROVIDER, 20, &num, names); + m_mod_man.get_module_names(OSD_DEBUG_PROVIDER, 20, num, names); dnames.clear(); for (int i = 0; i < num; i++) dnames.push_back(names[i]); update_option(OSD_DEBUG_PROVIDER, dnames); - m_mod_man.get_module_names(OSD_OUTPUT_PROVIDER, 20, &num, names); + m_mod_man.get_module_names(OSD_OUTPUT_PROVIDER, 20, num, names); dnames.clear(); for (int i = 0; i < num; i++) dnames.push_back(names[i]); diff --git a/src/osd/modules/lib/osdobj_common.h b/src/osd/modules/lib/osdobj_common.h index 9fb1b1eef6b..2df6a91b827 100644 --- a/src/osd/modules/lib/osdobj_common.h +++ b/src/osd/modules/lib/osdobj_common.h @@ -216,7 +216,7 @@ public: virtual osd_font::ptr font_alloc() override { return m_font_module->font_alloc(); } virtual bool get_font_families(std::string const &font_path, std::vector<std::pair<std::string, std::string> > &result) override { return m_font_module->get_font_families(font_path, result); } - virtual osd_midi_device *create_midi_device() override { return m_midi->create_midi_device(); } + virtual std::unique_ptr<osd_midi_device> create_midi_device() override { return m_midi->create_midi_device(); } // FIXME: everything below seems to be osd specific and not part of // this INTERFACE but part of the osd IMPLEMENTATION @@ -311,10 +311,10 @@ private: // this template function creates a stub which constructs a debugger -template<class _DeviceClass> +template<class DeviceClass> debug_module *osd_debugger_creator() { - return global_alloc(_DeviceClass()); + return new DeviceClass(); } #endif // MAME_OSD_LIB_OSDOBJ_COMMON_H diff --git a/src/osd/modules/midi/midi_module.h b/src/osd/modules/midi/midi_module.h index 6c50cdd3edc..8e64800622e 100644 --- a/src/osd/modules/midi/midi_module.h +++ b/src/osd/modules/midi/midi_module.h @@ -4,13 +4,17 @@ * midi_module.h * */ +#ifndef MAME_OSD_MODULES_MIDI_MIDI_MODULE_H +#define MAME_OSD_MODULES_MIDI_MIDI_MODULE_H -#ifndef MIDI_MODULE_H_ -#define MIDI_MODULE_H_ +#pragma once #include "osdepend.h" #include "modules/osdmodule.h" +#include <memory> + + //============================================================ // CONSTANTS //============================================================ @@ -23,10 +27,9 @@ public: virtual ~midi_module() { } // specific routines - virtual osd_midi_device *create_midi_device() = 0; + virtual std::unique_ptr<osd_midi_device> create_midi_device() = 0; // FIXME: should return a list of strings ... - virtual void list_midi_devices(void) = 0; + virtual void list_midi_devices() = 0; }; - -#endif /* MIDI_MODULE_H_ */ +#endif // MAME_OSD_MODULES_MIDI_MIDI_MODULE_H diff --git a/src/osd/modules/midi/none.cpp b/src/osd/modules/midi/none.cpp index 822de79bd08..25f83b45fbe 100644 --- a/src/osd/modules/midi/none.cpp +++ b/src/osd/modules/midi/none.cpp @@ -17,8 +17,7 @@ class none_module : public osd_module, public midi_module { public: - none_module() - : osd_module(OSD_MIDI_PROVIDER, "pm"), midi_module() + none_module() : osd_module(OSD_MIDI_PROVIDER, "pm"), midi_module() { } virtual ~none_module() { } @@ -26,7 +25,7 @@ public: virtual int init(const osd_options &options) override; virtual void exit() override; - virtual osd_midi_device *create_midi_device() override; + virtual std::unique_ptr<osd_midi_device> create_midi_device() override; virtual void list_midi_devices() override; }; @@ -43,9 +42,9 @@ public: virtual void write(uint8_t data) override; }; -osd_midi_device *none_module::create_midi_device() +std::unique_ptr<osd_midi_device> none_module::create_midi_device() { - return global_alloc(osd_midi_device_none()); + return std::make_unique<osd_midi_device_none>(); } diff --git a/src/osd/modules/midi/portmidi.cpp b/src/osd/modules/midi/portmidi.cpp index 64f71ca6689..9deca98ea2d 100644 --- a/src/osd/modules/midi/portmidi.cpp +++ b/src/osd/modules/midi/portmidi.cpp @@ -29,7 +29,7 @@ public: virtual int init(const osd_options &options)override; virtual void exit()override; - virtual osd_midi_device *create_midi_device() override; + virtual std::unique_ptr<osd_midi_device> create_midi_device() override; virtual void list_midi_devices() override; }; @@ -60,9 +60,9 @@ private: bool rx_sysex; }; -osd_midi_device *pm_module::create_midi_device() +std::unique_ptr<osd_midi_device> pm_module::create_midi_device() { - return global_alloc(osd_midi_device_pm()); + return std::make_unique<osd_midi_device_pm>(); } diff --git a/src/osd/modules/netdev/pcap.cpp b/src/osd/modules/netdev/pcap.cpp index 799cff9ec0e..2ae32df0f3b 100644 --- a/src/osd/modules/netdev/pcap.cpp +++ b/src/osd/modules/netdev/pcap.cpp @@ -250,7 +250,7 @@ netdev_pcap::~netdev_pcap() static CREATE_NETDEV(create_pcap) { - auto *dev = global_alloc(netdev_pcap(ifname, ifdev, rate)); + auto *dev = new netdev_pcap(ifname, ifdev, rate); return dynamic_cast<osd_netdev *>(dev); } diff --git a/src/osd/modules/netdev/taptun.cpp b/src/osd/modules/netdev/taptun.cpp index 1b549f5b3b2..baa45da0d5d 100644 --- a/src/osd/modules/netdev/taptun.cpp +++ b/src/osd/modules/netdev/taptun.cpp @@ -337,7 +337,7 @@ int netdev_tap::recv_dev(uint8_t **buf) static CREATE_NETDEV(create_tap) { - auto *dev = global_alloc(netdev_tap(ifname, ifdev, rate)); + auto *dev = new netdev_tap(ifname, ifdev, rate); return dynamic_cast<osd_netdev *>(dev); } diff --git a/src/osd/modules/osdmodule.cpp b/src/osd/modules/osdmodule.cpp index 75adc5c75bb..fec18ac5335 100644 --- a/src/osd/modules/osdmodule.cpp +++ b/src/osd/modules/osdmodule.cpp @@ -12,36 +12,23 @@ osd_module_manager::osd_module_manager() { - for (int i=0; i<MAX_MODULES; i++) - { - m_modules[i] = nullptr; - m_selected[i] = nullptr; - } } + osd_module_manager::~osd_module_manager() { - for (int i = 0; m_modules[i] != nullptr; i++) - { - global_free(m_modules[i]); - } } void osd_module_manager::register_module(const module_type &mod_type) { - auto const slot = std::find(std::begin(m_modules), std::end(m_modules), nullptr); - if (std::end(m_modules) == slot) - throw emu_fatalerror("osd_module_manager::register_module: Module registration beyond MAX_MODULES!"); - - osd_module *module = mod_type(); + std::unique_ptr<osd_module> module = mod_type(); if (module->probe()) { osd_printf_verbose("===> registered module %s %s\n", module->name(), module->type()); - *slot = module; + m_modules.emplace_back(std::move(module)); } else { osd_printf_verbose("===> not supported %s %s\n", module->name(), module->type()); - global_free(module); } } @@ -54,7 +41,7 @@ osd_module *osd_module_manager::get_module_generic(const char *type, const char { int const i = get_module_index(type, name); if (i >= 0) - return m_modules[i]; + return m_modules[i].get(); else return nullptr; } @@ -64,54 +51,43 @@ osd_module *osd_module_manager::select_module(const char *type, const char *name osd_module *m = get_module_generic(type, name); // FIXME: check if already exists! - int i; - for (i = 0; m_selected[i] != nullptr; i++) - ; - m_selected[i] = m; + if (m) + m_selected.emplace_back(*m); return m; } void osd_module_manager::init(const osd_options &options) { - for (int i = 0; m_selected[i] != nullptr; i++) - { - m_selected[i]->init(options); - } + for (osd_module &m : m_selected) + m.init(options); } void osd_module_manager::exit() { // Find count - int cnt; - for (cnt = 0; m_selected[cnt] != nullptr; cnt++) - ; - for (int i = cnt - 1; i >= 0; i--) + while (!m_selected.empty()) { - m_selected[i]->exit(); - m_selected[i] = nullptr; + m_selected.back().get().exit(); + m_selected.pop_back(); } } int osd_module_manager::get_module_index(const char *type, const char *name) const { - for (int i = 0; m_modules[i] != nullptr; i++) + for (int i = 0; m_modules.size() > i; i++) { - if (strcmp(m_modules[i]->type(), type) == 0 && ((name[0] == 0) || (strcmp(name, m_modules[i]->name())==0))) + if ((m_modules[i]->type() == type) && (!name[0] || (m_modules[i]->name() == name))) return i; } return -1; } -void osd_module_manager::get_module_names(const char *type, const int max, int *num, const char *names[]) const +void osd_module_manager::get_module_names(const char *type, const int max, int &num, const char *names[]) const { - *num = 0; - for (int i = 0; m_modules[i] != nullptr; i++) + num = 0; + for (int i = 0; (m_modules.size() > i) && (max > num); i++) { - if ((strcmp(m_modules[i]->type(), type) == 0) && (*num < max)) - { - names[*num] = m_modules[i]->name(); - *num = *num + 1; - } - + if (m_modules[i]->type() == type) + names[num++] = m_modules[i]->name().c_str(); } } diff --git a/src/osd/modules/osdmodule.h b/src/osd/modules/osdmodule.h index 95178b27f70..cd72ad2c480 100644 --- a/src/osd/modules/osdmodule.h +++ b/src/osd/modules/osdmodule.h @@ -7,62 +7,63 @@ OSD module management *******************************************************************c********/ - -//#pragma once - #ifndef MAME_OSD_MODULES_OSDMODULE_H #define MAME_OSD_MODULES_OSDMODULE_H +#pragma once + #include "osdcore.h" #include "osdepend.h" +#include <functional> +#include <memory> +#include <string> +#include <vector> + + //============================================================ // TYPE DEFINITIONS //============================================================ class osd_options; -class osd_module; // ======================> osd_module class osd_module { public: - - osd_module(const char *type, const char *name) - : m_name(name), m_type(type) - {} virtual ~osd_module() { } - const char * name() const { return m_name.c_str(); } - const char * type() const { return m_type.c_str(); } + std::string const &name() const { return m_name; } + std::string const &type() const { return m_type; } virtual bool probe() { return true; } virtual int init(const osd_options &options) = 0; virtual void exit() { } +protected: + osd_module(const char *type, const char *name) : m_name(name), m_type(type) { } + osd_module(osd_module const &) = delete; + private: - std::string m_name; - std::string m_type; + std::string const m_name; + std::string const m_type; }; // a module_type is simply a pointer to its alloc function -typedef osd_module *(*module_type)(); +typedef std::unique_ptr<osd_module> (*module_type)(); // this template function creates a stub which constructs a module -template<class ModuleClass> -osd_module *module_creator() +template <class ModuleClass> +std::unique_ptr<osd_module> module_creator() { - return global_alloc(ModuleClass()); + return std::unique_ptr<osd_module>(new ModuleClass); } class osd_module_manager { public: - - static const int MAX_MODULES = 64; - osd_module_manager(); ~osd_module_manager(); @@ -79,7 +80,7 @@ public: osd_module *select_module(const char *type, const char *name = ""); - void get_module_names(const char *type, const int max, int *num, const char *names[]) const; + void get_module_names(const char *type, const int max, int &num, const char *names[]) const; void init(const osd_options &options); @@ -88,8 +89,8 @@ public: private: int get_module_index(const char *type, const char *name) const; - osd_module *m_modules[MAX_MODULES]; - osd_module *m_selected[MAX_MODULES]; + std::vector<std::unique_ptr<osd_module> > m_modules; + std::vector<std::reference_wrapper<osd_module> > m_selected; }; #define MODULE_DEFINITION(mod_id, mod_class) \ diff --git a/src/osd/modules/output/win32_output.cpp b/src/osd/modules/output/win32_output.cpp index f01c46b735d..98731b32164 100644 --- a/src/osd/modules/output/win32_output.cpp +++ b/src/osd/modules/output/win32_output.cpp @@ -162,7 +162,7 @@ void output_win32::exit() { registered_client *temp = m_clientlist; m_clientlist = temp->next; - global_free(temp); + delete temp; } // broadcast a shutdown message @@ -266,7 +266,7 @@ LRESULT output_win32::register_client(HWND hwnd, LPARAM id) } // add us to the end - *client = global_alloc(registered_client); + *client = new registered_client; (*client)->next = nullptr; (*client)->id = id; (*client)->hwnd = hwnd; @@ -293,7 +293,7 @@ LRESULT output_win32::unregister_client(HWND hwnd, LPARAM id) { registered_client *temp = *client; *client = (*client)->next; - global_free(temp); + delete temp; found = true; break; } diff --git a/src/osd/modules/render/bgfx/chain.cpp b/src/osd/modules/render/bgfx/chain.cpp index 297d7686837..0efea9b6622 100644 --- a/src/osd/modules/render/bgfx/chain.cpp +++ b/src/osd/modules/render/bgfx/chain.cpp @@ -81,7 +81,7 @@ void bgfx_chain::process(chain_manager::screen_prim &prim, int view, int screen, screen_device_iterator screen_iterator(window.machine().root_device()); screen_device* screen_device = screen_iterator.byindex(screen); - uint16_t screen_count(window.target()->current_view().screen_count()); + uint16_t screen_count(window.target()->current_view().visible_screen_count()); uint16_t screen_width = prim.m_quad_width; uint16_t screen_height = prim.m_quad_height; uint32_t rotation_type = diff --git a/src/osd/modules/render/d3d/d3dhlsl.cpp b/src/osd/modules/render/d3d/d3dhlsl.cpp index b1bbb8a758e..e19f8882232 100644 --- a/src/osd/modules/render/d3d/d3dhlsl.cpp +++ b/src/osd/modules/render/d3d/d3dhlsl.cpp @@ -223,7 +223,7 @@ shaders::~shaders() if (options != nullptr) { - global_free(options); + delete options; options = nullptr; } } @@ -499,7 +499,7 @@ bool shaders::init(d3d_base *d3dintf, running_machine *machine, renderer_d3d9 *r snap_width = winoptions.d3d_snap_width(); snap_height = winoptions.d3d_snap_height(); - this->options = (hlsl_options*)global_alloc_clear<hlsl_options>(); + this->options = make_unique_clear<hlsl_options>().release(); this->options->params_init = false; // copy last options if initialized @@ -2431,7 +2431,7 @@ void uniform::update() } case CU_SCREEN_COUNT: { - int screen_count = win->target()->current_view().screen_count(); + int screen_count = win->target()->current_view().visible_screen_count(); m_shader->set_int("ScreenCount", screen_count); break; } diff --git a/src/osd/modules/render/draw13.cpp b/src/osd/modules/render/draw13.cpp index 96b04efc3d9..af7c8559ca0 100644 --- a/src/osd/modules/render/draw13.cpp +++ b/src/osd/modules/render/draw13.cpp @@ -335,7 +335,7 @@ int renderer_sdl2::RendererSupportsFormat(Uint32 format, Uint32 access, const ch void renderer_sdl2::add_list(copy_info_t **head, const copy_info_t *element, Uint32 bm) { - copy_info_t *newci = global_alloc(copy_info_t); + copy_info_t *newci = new copy_info_t; *newci = *element; newci->bm_mask = bm; @@ -917,7 +917,7 @@ void renderer_sdl2::exit() (int) bi->perf); copy_info_t *freeme = bi; bi = bi->next; - global_free(freeme); + delete freeme; } s_blit_info[i] = nullptr; } @@ -942,7 +942,7 @@ texture_info * renderer_sdl2::texture_update(const render_primitive &prim) // if we didn't find one, create a new texture if (texture == nullptr && prim.texture.base != nullptr) { - texture = global_alloc(texture_info(this, prim.texture, setup, prim.flags)); + texture = new texture_info(this, prim.texture, setup, prim.flags); /* add us to the texture list */ m_texlist.prepend(*texture); } diff --git a/src/osd/modules/render/draw13.h b/src/osd/modules/render/draw13.h index 26a6bb565bf..21126e8d76a 100644 --- a/src/osd/modules/render/draw13.h +++ b/src/osd/modules/render/draw13.h @@ -8,10 +8,10 @@ // //============================================================ -#pragma once +#ifndef MAME_OSD_MODULES_RENDER_DRAW13_H +#define MAME_OSD_MODULES_RENDER_DRAW13_H -#ifndef __DRAW20__ -#define __DRAW20__ +#pragma once // OSD headers #ifndef OSD_WINDOWS @@ -210,4 +210,4 @@ private: static const copy_info_t s_blit_info_default[]; }; -#endif // __DRAW20__ +#endif // MAME_OSD_MODULES_RENDER_DRAW13_H diff --git a/src/osd/modules/render/drawd3d.cpp b/src/osd/modules/render/drawd3d.cpp index 74a60eb955a..40f69235348 100644 --- a/src/osd/modules/render/drawd3d.cpp +++ b/src/osd/modules/render/drawd3d.cpp @@ -118,7 +118,7 @@ static inline uint32_t ycc_to_rgb(uint8_t y, uint8_t cb, uint8_t cr) // drawd3d_init //============================================================ -static d3d_base * d3dintf; // FIX ME +static d3d_base *d3dintf = nullptr; // FIX ME //============================================================ @@ -202,14 +202,15 @@ render_primitive_list *renderer_d3d9::get_primitives() bool renderer_d3d9::init(running_machine &machine) { - d3dintf = global_alloc(d3d_base); + d3dintf = new d3d_base; d3dintf->d3d9_dll = osd::dynamic_module::open({ "d3d9.dll" }); d3d9_create_fn d3d9_create_ptr = d3dintf->d3d9_dll->bind<d3d9_create_fn>("Direct3DCreate9"); if (d3d9_create_ptr == nullptr) { - global_free(d3dintf); + delete d3dintf; + d3dintf = nullptr; osd_printf_verbose("Direct3D: Unable to find Direct3D 9 runtime library\n"); return true; } @@ -217,7 +218,8 @@ bool renderer_d3d9::init(running_machine &machine) d3dintf->d3dobj = (*d3d9_create_ptr)(D3D_SDK_VERSION); if (d3dintf->d3dobj == nullptr) { - global_free(d3dintf); + delete d3dintf; + d3dintf = nullptr; osd_printf_verbose("Direct3D: Unable to initialize Direct3D 9\n"); return true; } @@ -462,7 +464,7 @@ void d3d_texture_manager::create_resources() void d3d_texture_manager::delete_resources() { // is part of m_texlist and will be free'd there - //global_free(m_default_texture); + //delete m_default_texture; m_default_texture = nullptr; // free all textures @@ -505,7 +507,7 @@ renderer_d3d9::renderer_d3d9(std::shared_ptr<osd_window> window) : osd_renderer(window, FLAG_NONE), m_adapter(0), m_width(0), m_height(0), m_refresh(0), m_create_error_count(0), m_device(nullptr), m_gamma_supported(0), m_pixformat(), m_vertexbuf(nullptr), m_lockedbuf(nullptr), m_numverts(0), m_vectorbatch(nullptr), m_batchindex(0), m_numpolys(0), m_toggle(false), m_screen_format(), m_last_texture(nullptr), m_last_texture_flags(0), m_last_blendenable(0), m_last_blendop(0), m_last_blendsrc(0), m_last_blenddst(0), m_last_filter(0), - m_last_wrap(), m_last_modmode(0), m_shaders(nullptr), m_texture_manager(nullptr) + m_last_wrap(), m_last_modmode(0), m_shaders(nullptr), m_texture_manager() { } @@ -811,7 +813,7 @@ int renderer_d3d9::device_create(HWND hwnd) return 1; } - m_texture_manager = global_alloc(d3d_texture_manager(this)); + m_texture_manager = std::make_unique<d3d_texture_manager>(this); // try for XRGB first m_screen_format = D3DFMT_X8R8G8B8; @@ -871,7 +873,7 @@ int renderer_d3d9::device_create_resources() // create shaders only once if (m_shaders == nullptr) { - m_shaders = (shaders*)global_alloc_clear<shaders>(); + m_shaders = new shaders; } if (m_shaders->init(d3dintf, &win->machine(), this)) @@ -962,7 +964,7 @@ renderer_d3d9::~renderer_d3d9() //if (m_shaders != nullptr) //{ // // delete the HLSL interface - // global_free(m_shaders); + // delete m_shaders; // m_shaders = nullptr; //} } @@ -972,7 +974,7 @@ void renderer_d3d9::exit() if (d3dintf != nullptr) { d3dintf->d3dobj->Release(); - global_free(d3dintf); + delete d3dintf; d3dintf = nullptr; } } @@ -984,11 +986,7 @@ void renderer_d3d9::device_delete() // we do not delete the HLSL interface here - if (m_texture_manager != nullptr) - { - global_free(m_texture_manager); - m_texture_manager = nullptr; - } + m_texture_manager.reset(); // free the device itself if (m_device != nullptr) diff --git a/src/osd/modules/render/drawd3d.h b/src/osd/modules/render/drawd3d.h index 03527d7374e..2fa4a30873c 100644 --- a/src/osd/modules/render/drawd3d.h +++ b/src/osd/modules/render/drawd3d.h @@ -5,11 +5,11 @@ // drawd3d.h - Win32 Direct3D header // //============================================================ +#ifndef MAME_OSD_MODULES_RENDER_DRAWD3D_H +#define MAME_OSD_MODULES_RENDER_DRAWD3D_H #pragma once -#ifndef __WIN_DRAWD3D__ -#define __WIN_DRAWD3D__ #ifdef OSD_WINDOWS @@ -127,7 +127,7 @@ public: uint32_t get_last_texture_flags() const { return m_last_texture_flags; } - d3d_texture_manager * get_texture_manager() const { return m_texture_manager; } + d3d_texture_manager * get_texture_manager() const { return m_texture_manager.get(); } texture_info * get_default_texture(); shaders * get_shaders() const { return m_shaders; } @@ -171,9 +171,9 @@ private: shaders * m_shaders; // HLSL interface - d3d_texture_manager * m_texture_manager; // texture manager + std::unique_ptr<d3d_texture_manager> m_texture_manager; // texture manager }; #endif // OSD_WINDOWS -#endif // __WIN_DRAWD3D__ +#endif // MAME_OSD_MODULES_RENDER_DRAWD3D_H diff --git a/src/osd/modules/render/drawgdi.cpp b/src/osd/modules/render/drawgdi.cpp index bd0e6425b6e..32dac94c24a 100644 --- a/src/osd/modules/render/drawgdi.cpp +++ b/src/osd/modules/render/drawgdi.cpp @@ -16,9 +16,6 @@ renderer_gdi::~renderer_gdi() { - // free the bitmap memory - if (m_bmdata != nullptr) - global_free_array(m_bmdata); } //============================================================ @@ -83,13 +80,13 @@ int renderer_gdi::draw(const int update) if (pitch * height * 4 > m_bmsize) { m_bmsize = pitch * height * 4 * 2; - global_free_array(m_bmdata); - m_bmdata = global_alloc_array(uint8_t, m_bmsize); + m_bmdata.reset(); + m_bmdata = std::make_unique<uint8_t []>(m_bmsize); } // draw the primitives to the bitmap win->m_primlist->acquire_lock(); - software_renderer<uint32_t, 0,0,0, 16,8,0>::draw_primitives(*win->m_primlist, m_bmdata, width, height, pitch); + software_renderer<uint32_t, 0,0,0, 16,8,0>::draw_primitives(*win->m_primlist, m_bmdata.get(), width, height, pitch); win->m_primlist->release_lock(); // fill in bitmap-specific info @@ -97,8 +94,9 @@ int renderer_gdi::draw(const int update) m_bminfo.bmiHeader.biHeight = -height; // blit to the screen - StretchDIBits(win->m_dc, 0, 0, width, height, - 0, 0, width, height, - m_bmdata, &m_bminfo, DIB_RGB_COLORS, SRCCOPY); + StretchDIBits( + win->m_dc, 0, 0, width, height, + 0, 0, width, height, + m_bmdata.get(), &m_bminfo, DIB_RGB_COLORS, SRCCOPY); return 0; } diff --git a/src/osd/modules/render/drawgdi.h b/src/osd/modules/render/drawgdi.h index 49d05c18daa..7984998f4bc 100644 --- a/src/osd/modules/render/drawgdi.h +++ b/src/osd/modules/render/drawgdi.h @@ -5,11 +5,11 @@ // drawgdi.h - Win32 GDI drawing // //============================================================ +#ifndef MAME_OSD_MODULES_RENDER_DRAWGDI_H +#define MAME_OSD_MODULES_RENDER_DRAWGDI_H #pragma once -#ifndef __DRAWGDI__ -#define __DRAWGDI__ // standard windows headers #include <windows.h> @@ -47,9 +47,9 @@ public: virtual void toggle_fsfx() override {}; private: - BITMAPINFO m_bminfo; - uint8_t * m_bmdata; - size_t m_bmsize; + BITMAPINFO m_bminfo; + std::unique_ptr<uint8_t []> m_bmdata; + size_t m_bmsize; }; -#endif // __DRAWGDI__ +#endif // MAME_OSD_MODULES_RENDER_DRAWGDI_H diff --git a/src/osd/modules/render/drawogl.cpp b/src/osd/modules/render/drawogl.cpp index ae030224e74..6d3eae1e8ad 100644 --- a/src/osd/modules/render/drawogl.cpp +++ b/src/osd/modules/render/drawogl.cpp @@ -307,7 +307,7 @@ renderer_ogl::~renderer_ogl() // free the memory in the window destroy_all_textures(); - global_free(m_gl_context); + delete m_gl_context; m_gl_context = nullptr; } @@ -366,7 +366,7 @@ static void loadgl_functions(osd_gl_context *context) //============================================================ #ifdef USE_DISPATCH_GL -osd_gl_dispatch *gl_dispatch; +osd_gl_dispatch *gl_dispatch = nullptr; #endif void renderer_ogl::load_gl_lib(running_machine &machine) @@ -394,7 +394,7 @@ void renderer_ogl::load_gl_lib(running_machine &machine) #endif #endif #ifdef USE_DISPATCH_GL - gl_dispatch = global_alloc(osd_gl_dispatch); + gl_dispatch = new osd_gl_dispatch; #endif s_dll_loaded = true; } @@ -566,12 +566,12 @@ int renderer_ogl::create() // create renderer #if defined(OSD_WINDOWS) - m_gl_context = global_alloc(win_gl_context(std::static_pointer_cast<win_window_info>(win)->platform_window())); + m_gl_context = new win_gl_context(std::static_pointer_cast<win_window_info>(win)->platform_window()); #elif defined(OSD_MAC) // TODO -// m_gl_context = global_alloc(mac_gl_context(std::static_pointer_cast<mac_window_info>(win)->platform_window())); +// m_gl_context = new mac_gl_context(std::static_pointer_cast<mac_window_info>(win)->platform_window()); #else - m_gl_context = global_alloc(sdl_gl_context(std::static_pointer_cast<sdl_window_info>(win)->platform_window())); + m_gl_context = new sdl_gl_context(std::static_pointer_cast<sdl_window_info>(win)->platform_window()); #endif if (m_gl_context->LastErrorMsg() != nullptr) { @@ -696,7 +696,7 @@ void renderer_ogl::destroy_all_textures() texture->data=nullptr; texture->data_own=false; } - global_free(texture); + delete texture; } i++; } @@ -1907,7 +1907,7 @@ ogl_texture_info *renderer_ogl::texture_create(const render_texinfo *texsource, ogl_texture_info *texture; // allocate a new texture - texture = global_alloc(ogl_texture_info); + texture = new ogl_texture_info; // fill in the core data texture->hash = texture_compute_hash(texsource, flags); @@ -1979,7 +1979,7 @@ ogl_texture_info *renderer_ogl::texture_create(const render_texinfo *texsource, { if ( texture_shader_create(texsource, texture, flags) ) { - global_free(texture); + delete texture; return nullptr; } } diff --git a/src/osd/modules/render/drawogl.h b/src/osd/modules/render/drawogl.h index 525ba0c3ffa..891c5cec814 100644 --- a/src/osd/modules/render/drawogl.h +++ b/src/osd/modules/render/drawogl.h @@ -7,12 +7,11 @@ // SDLMAME by Olivier Galibert and R. Belmont // //============================================================ +#ifndef MAME_OSD_MODULES_RENDER_DRAWOGL_H +#define MAME_OSD_MODULES_RENDER_DRAWOGL_H #pragma once -#ifndef __DRAWOGL__ -#define __DRAWOGL__ - // OSD headers #ifndef OSD_WINDOWS #ifdef OSD_MAC @@ -239,4 +238,4 @@ private: static bool s_dll_loaded; }; -#endif // __DRAWOGL__ +#endif // MAME_OSD_MODULES_RENDER_DRAWOGL_H diff --git a/src/osd/modules/render/drawsdl.cpp b/src/osd/modules/render/drawsdl.cpp index 76dc1375e5b..1797c5be597 100644 --- a/src/osd/modules/render/drawsdl.cpp +++ b/src/osd/modules/render/drawsdl.cpp @@ -111,11 +111,7 @@ void renderer_sdl1::setup_texture(const osd_dim &size) // Determine preferred pixelformat and set up yuv if necessary SDL_GetCurrentDisplayMode(win->monitor()->oshandle(), &mode); - if (m_yuv_bitmap) - { - global_free_array(m_yuv_bitmap); - m_yuv_bitmap = nullptr; - } + m_yuv_bitmap.reset(); fmt = (sdl_sm->pixel_format ? sdl_sm->pixel_format : mode.format); @@ -134,7 +130,7 @@ void renderer_sdl1::setup_texture(const osd_dim &size) m_hw_scale_width = (m_hw_scale_width + 1) & ~1; } if (sdl_sm->is_yuv) - m_yuv_bitmap = global_alloc_array(uint16_t, m_hw_scale_width * m_hw_scale_height); + m_yuv_bitmap = std::make_unique<uint16_t []>(m_hw_scale_width * m_hw_scale_height); int w = m_hw_scale_width * sdl_sm->mult_w; int h = m_hw_scale_height * sdl_sm->mult_h; @@ -257,16 +253,6 @@ renderer_sdl1::~renderer_sdl1() { destroy_all_textures(); - if (m_yuv_lookup != nullptr) - { - global_free_array(m_yuv_lookup); - m_yuv_lookup = nullptr; - } - if (m_yuv_bitmap != nullptr) - { - global_free_array(m_yuv_bitmap); - m_yuv_bitmap = nullptr; - } SDL_DestroyRenderer(m_sdl_renderer); } @@ -448,8 +434,8 @@ int renderer_sdl1::draw(int update) { assert (m_yuv_bitmap != nullptr); assert (surfptr != nullptr); - software_renderer<uint16_t, 3,3,3, 10,5,0>::draw_primitives(*win->m_primlist, m_yuv_bitmap, mamewidth, mameheight, mamewidth); - sm->yuv_blit((uint16_t *)m_yuv_bitmap, surfptr, pitch, m_yuv_lookup, mamewidth, mameheight); + software_renderer<uint16_t, 3,3,3, 10,5,0>::draw_primitives(*win->m_primlist, m_yuv_bitmap.get(), mamewidth, mameheight, mamewidth); + sm->yuv_blit(m_yuv_bitmap.get(), surfptr, pitch, m_yuv_lookup.get(), mamewidth, mameheight); } win->m_primlist->release_lock(); @@ -525,12 +511,11 @@ void renderer_sdl1::yuv_lookup_set(unsigned int pen, unsigned char red, void renderer_sdl1::yuv_init() { - unsigned char r,g,b; - if (m_yuv_lookup == nullptr) - m_yuv_lookup = global_alloc_array(uint32_t, 65536); - for (r = 0; r < 32; r++) - for (g = 0; g < 32; g++) - for (b = 0; b < 32; b++) + if (!m_yuv_lookup) + m_yuv_lookup = std::make_unique<uint32_t []>(65536); + for (unsigned char r = 0; r < 32; r++) + for (unsigned char g = 0; g < 32; g++) + for (unsigned char b = 0; b < 32; b++) { int idx = (r << 10) | (g << 5) | b; yuv_lookup_set(idx, diff --git a/src/osd/modules/render/drawsdl.h b/src/osd/modules/render/drawsdl.h index 6c0b51c0663..bc8246a632d 100644 --- a/src/osd/modules/render/drawsdl.h +++ b/src/osd/modules/render/drawsdl.h @@ -10,10 +10,10 @@ // //============================================================ -#pragma once +#ifndef MAME_OSD_MODULES_RENDER_DRAWSDL_H +#define MAME_OSD_MODULES_RENDER_DRAWSDL_H -#ifndef __DRAWSDL1__ -#define __DRAWSDL1__ +#pragma once #include <SDL2/SDL.h> @@ -26,8 +26,8 @@ public: : osd_renderer(w, FLAG_NEEDS_OPENGL | extra_flags) , m_sdl_renderer(nullptr) , m_texture_id(nullptr) - , m_yuv_lookup(nullptr) - , m_yuv_bitmap(nullptr) + , m_yuv_lookup() + , m_yuv_bitmap() //, m_hw_scale_width(0) //, m_hw_scale_height(0) , m_last_hofs(0) @@ -61,8 +61,8 @@ private: SDL_Texture *m_texture_id; // YUV overlay - uint32_t *m_yuv_lookup; - uint16_t *m_yuv_bitmap; + std::unique_ptr<uint32_t []> m_yuv_lookup; + std::unique_ptr<uint16_t []> m_yuv_bitmap; // if we leave scaling to SDL and the underlying driver, this // is the render_target_width/height to use @@ -85,4 +85,4 @@ struct sdl_scale_mode void (*yuv_blit)(const uint16_t *bitmap, uint8_t *ptr, const int pitch, const uint32_t *lookup, const int width, const int height); }; -#endif // __DRAWSDL1__ +#endif // MAME_OSD_MODULES_RENDER_DRAWSDL_H diff --git a/src/osd/osdepend.h b/src/osd/osdepend.h index f2c4e36c0e5..ad7b52049a6 100644 --- a/src/osd/osdepend.h +++ b/src/osd/osdepend.h @@ -91,7 +91,7 @@ public: virtual bool execute_command(const char *command) = 0; // midi interface - virtual osd_midi_device *create_midi_device() = 0; + virtual std::unique_ptr<osd_midi_device> create_midi_device() = 0; protected: virtual ~osd_interface() { } diff --git a/src/osd/sdl/window.cpp b/src/osd/sdl/window.cpp index 70886d76a73..9f07ce7cd49 100644 --- a/src/osd/sdl/window.cpp +++ b/src/osd/sdl/window.cpp @@ -1137,12 +1137,11 @@ sdl_window_info::sdl_window_info( m_prescale = video_config.prescale; m_windowed_dim = osd_dim(config->width, config->height); - m_original_mode = global_alloc(SDL_DM_Wrapper); + m_original_mode = std::make_unique<SDL_DM_Wrapper>(); } sdl_window_info::~sdl_window_info() { - global_free(m_original_mode); } diff --git a/src/osd/sdl/window.h b/src/osd/sdl/window.h index d6010e91ed2..bfe32e6e8a0 100644 --- a/src/osd/sdl/window.h +++ b/src/osd/sdl/window.h @@ -8,8 +8,8 @@ // //============================================================ -#ifndef __SDLWINDOW__ -#define __SDLWINDOW__ +#ifndef MAME_OSD_SDL_WINDOW_H +#define MAME_OSD_SDL_WINDOW_H #include "osdsdl.h" #include "video.h" @@ -87,7 +87,7 @@ private: render_target * m_target; // Original display_mode - SDL_DM_Wrapper *m_original_mode; + std::unique_ptr<SDL_DM_Wrapper> m_original_mode; int m_extra_flags; @@ -152,4 +152,4 @@ int drawsdl2_init(running_machine &machine, osd_draw_callbacks *callbacks); int drawbgfx_init(running_machine &machine, osd_draw_callbacks *callbacks); -#endif /* __SDLWINDOW__ */ +#endif // MAME_OSD_SDL_WINDOW_H diff --git a/src/tools/imgtool/modules/hp85_tape.cpp b/src/tools/imgtool/modules/hp85_tape.cpp index dada87e290a..fbdef06a7cb 100644 --- a/src/tools/imgtool/modules/hp85_tape.cpp +++ b/src/tools/imgtool/modules/hp85_tape.cpp @@ -866,7 +866,7 @@ namespace { tape_image_85& get_tape_image(tape_state_t& ts) { if (ts.img == nullptr) { - ts.img = global_alloc(tape_image_85); + ts.img = new tape_image_85; } return *(ts.img); @@ -916,7 +916,7 @@ namespace { delete state.stream; // Free tape_image - global_free(&tape_image); + delete &tape_image; } imgtoolerr_t hp85_tape_begin_enum (imgtool::directory &enumeration, const char *path) diff --git a/src/tools/imgtool/modules/hp9845_tape.cpp b/src/tools/imgtool/modules/hp9845_tape.cpp index d3416deaefd..e9abc99789c 100644 --- a/src/tools/imgtool/modules/hp9845_tape.cpp +++ b/src/tools/imgtool/modules/hp9845_tape.cpp @@ -985,7 +985,7 @@ static tape_state_t& get_tape_state(imgtool::image &img) static tape_image_t& get_tape_image(tape_state_t& ts) { if (ts.img == nullptr) { - ts.img = global_alloc(tape_image_t); + ts.img = new tape_image_t; } return *(ts.img); @@ -1034,7 +1034,7 @@ static void hp9845_tape_close(imgtool::image &image) delete state.stream; // Free tape_image - global_free(&tape_image); + delete &tape_image; } static imgtoolerr_t hp9845_tape_begin_enum (imgtool::directory &enumeration, const char *path) |