diff --git a/hash/gbcolor.xml b/hash/gbcolor.xml
index 6a3a39e00de..53c5d33127b 100644
--- a/hash/gbcolor.xml
+++ b/hash/gbcolor.xml
@@ -27151,7 +27151,7 @@ license:CC0
- Shi Qi Shi Dai - Jing Ling Wang Dan Sheng (China)
+ Shíqì Shídài - Jīnglíng Wang Dànshēng (China)
20??
GOWIN
diff --git a/hash/megaduck.xml b/hash/megaduck.xml
index b38f2bcf262..2810e8702a8 100644
--- a/hash/megaduck.xml
+++ b/hash/megaduck.xml
@@ -12,8 +12,9 @@ license:CC0
-
-
+
+
+
@@ -25,8 +26,9 @@ license:CC0
-
-
+
+
+
@@ -38,8 +40,8 @@ license:CC0
-
-
+
+
@@ -51,8 +53,9 @@ license:CC0
-
-
+
+
+
@@ -64,8 +67,9 @@ license:CC0
-
-
+
+
+
@@ -75,12 +79,14 @@ license:CC0
1993
Commin
-
-
+
+
+
+
Bomb Disposer
1993
@@ -88,8 +94,8 @@ license:CC0
-
-
+
+
@@ -101,8 +107,8 @@ license:CC0
-
-
+
+
@@ -114,8 +120,9 @@ license:CC0
-
-
+
+
+
@@ -127,8 +134,9 @@ license:CC0
-
-
+
+
+
@@ -141,8 +149,9 @@ license:CC0
-
-
+
+
+
@@ -154,8 +163,8 @@ license:CC0
-
-
+
+
@@ -167,8 +176,9 @@ license:CC0
-
-
+
+
+
@@ -180,8 +190,9 @@ license:CC0
-
-
+
+
+
@@ -193,8 +204,8 @@ license:CC0
-
-
+
+
@@ -206,8 +217,8 @@ license:CC0
-
-
+
+
@@ -219,8 +230,9 @@ license:CC0
-
-
+
+
+
@@ -232,8 +244,9 @@ license:CC0
-
-
+
+
+
@@ -245,8 +258,9 @@ license:CC0
-
-
+
+
+
@@ -258,8 +272,8 @@ license:CC0
-
-
+
+
@@ -271,8 +285,9 @@ license:CC0
-
-
+
+
+
@@ -284,8 +299,8 @@ license:CC0
-
-
+
+
@@ -297,8 +312,8 @@ license:CC0
-
-
+
+
@@ -310,8 +325,9 @@ license:CC0
-
-
+
+
+
@@ -323,8 +339,9 @@ license:CC0
-
-
+
+
+
diff --git a/src/devices/bus/generic/slot.h b/src/devices/bus/generic/slot.h
index da1e7e21988..c6f506a03bf 100644
--- a/src/devices/bus/generic/slot.h
+++ b/src/devices/bus/generic/slot.h
@@ -52,6 +52,38 @@ public:
}
}
+ // TODO: find a better home for this helper
+ template
+ static T map_non_power_of_two(T count, U &&map)
+ {
+ if (T(0) >= count)
+ return T(0);
+
+ T const max(count - 1);
+ T mask(max);
+ for (unsigned i = 1; (sizeof(T) * 8) > i; i <<= 1)
+ mask = T(std::make_unsigned_t(mask) | (std::make_unsigned_t(mask) >> i));
+ int bits(0);
+ while (BIT(mask, bits))
+ ++bits;
+
+ for (T entry = T(0); mask >= entry; ++entry)
+ {
+ T mapped(entry);
+ int b(bits - 1);
+ while (max < mapped)
+ {
+ while (BIT(max, b))
+ --b;
+ assert(0 <= b);
+ mapped = T(std::make_unsigned_t(mapped) & ~(std::make_unsigned_t(1) << b--));
+ }
+ map(entry, mapped);
+ }
+
+ return mask;
+ }
+
// construction/destruction
virtual ~device_generic_cart_interface();
diff --git a/src/devices/bus/vboy/rom.cpp b/src/devices/bus/vboy/rom.cpp
index 14fac38ca1f..434741458b0 100644
--- a/src/devices/bus/vboy/rom.cpp
+++ b/src/devices/bus/vboy/rom.cpp
@@ -63,7 +63,7 @@ image_init_result vboy_flat_rom_device::load()
0,
0,
rom_base(),
- [this, rom = reinterpret_cast(romregion->base())] (offs_t begin, offs_t end, offs_t mirror, offs_t src)
+ [this, rom = &romregion->as_u32()] (offs_t begin, offs_t end, offs_t mirror, offs_t src)
{
LOG(
"Install ROM 0x%08X-0x%08X at 0x%08X-0x%08X mirror %08X\n",
diff --git a/src/devices/bus/vboy/slot.cpp b/src/devices/bus/vboy/slot.cpp
index 1fe0c1c651e..0c6df96ca61 100644
--- a/src/devices/bus/vboy/slot.cpp
+++ b/src/devices/bus/vboy/slot.cpp
@@ -27,6 +27,7 @@
DEFINE_DEVICE_TYPE(VBOY_CART_SLOT, vboy_cart_slot_device, "vboy_cart_slot", "Nintendo Virtual Boy Cartridge Slot")
+
//**************************************************************************
// vboy_cart_slot_device
//**************************************************************************
@@ -129,22 +130,22 @@ std::string vboy_cart_slot_device::get_default_card_software(get_default_card_so
software_part const *const part(!image_name.empty() ? find_software_item(image_name, true) : nullptr);
if (part)
{
- //printf("[%s] Found software part for image name '%s'\n", tag(), image_name.c_str());
+ osd_printf_verbose("[%s] Found software part for image name '%s'\n", tag(), image_name);
for (rom_entry const &entry : part->romdata())
{
if (ROMENTRY_ISREGION(entry) && (entry.name() == "sram"))
{
- //printf("[%s] Found 'sram' data area, enabling cartridge backup RAM\n", tag());
+ osd_printf_verbose("[%s] Found 'sram' data area, enabling cartridge backup RAM\n", tag());
return "flatrom_sram";
}
}
}
else
{
- //printf("[%s] No software part found for image name '%s'\n", tag(), image_name.c_str());
+ osd_printf_verbose("[%s] No software part found for image name '%s'\n", tag(), image_name);
}
- //printf("[%s] Assuming plain ROM cartridge\n", tag());
+ osd_printf_verbose("[%s] Assuming plain ROM cartridge\n", tag());
return "flatrom";
}
diff --git a/src/devices/bus/vboy/slot.h b/src/devices/bus/vboy/slot.h
index 650c3380636..b628db8af0d 100644
--- a/src/devices/bus/vboy/slot.h
+++ b/src/devices/bus/vboy/slot.h
@@ -64,6 +64,10 @@
#include "imagedev/cartrom.h"
+#include
+#include
+#include
+
//**************************************************************************
// FORWARD DECLARATIONS
@@ -140,13 +144,13 @@ public:
protected:
device_vboy_cart_interface(machine_config const &mconfig, device_t &device);
- bool has_slot() const { return nullptr != m_slot; }
- address_space *exp_space() { return m_slot ? m_slot->m_exp_space.target() : nullptr; }
- address_space *chip_space() { return m_slot ? m_slot->m_chip_space.target() : nullptr; }
- address_space *rom_space() { return m_slot ? m_slot->m_rom_space.target() : nullptr; }
- offs_t exp_base() { return m_slot ? m_slot->m_exp_base : 0U; }
- offs_t chip_base() { return m_slot ? m_slot->m_chip_base : 0U; }
- offs_t rom_base() { return m_slot ? m_slot->m_rom_base : 0U; }
+ bool has_slot() const noexcept { return nullptr != m_slot; }
+ address_space *exp_space() noexcept { return m_slot ? m_slot->m_exp_space.target() : nullptr; }
+ address_space *chip_space() noexcept { return m_slot ? m_slot->m_chip_space.target() : nullptr; }
+ address_space *rom_space() noexcept { return m_slot ? m_slot->m_rom_space.target() : nullptr; }
+ offs_t exp_base() noexcept { return m_slot ? m_slot->m_exp_base : 0U; }
+ offs_t chip_base() noexcept { return m_slot ? m_slot->m_chip_base : 0U; }
+ offs_t rom_base() noexcept { return m_slot ? m_slot->m_rom_base : 0U; }
void battery_load(void *buffer, int length, int fill) { assert(m_slot); m_slot->battery_load(buffer, length, fill); }
void battery_load(void *buffer, int length, void *def_buffer) { assert(m_slot); m_slot->battery_load(buffer, length, def_buffer); }
diff --git a/src/devices/sound/pokey.cpp b/src/devices/sound/pokey.cpp
index 7a67605e4fe..11bf0bc3158 100644
--- a/src/devices/sound/pokey.cpp
+++ b/src/devices/sound/pokey.cpp
@@ -189,23 +189,23 @@ DEFINE_DEVICE_TYPE(POKEY, pokey_device, "pokey", "Atari C012294 POKEY")
// pokey_device - constructor
//-------------------------------------------------
-pokey_device::pokey_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, POKEY, tag, owner, clock),
- device_sound_interface(mconfig, *this),
- device_execute_interface(mconfig, *this),
- device_state_interface(mconfig, *this),
- m_icount(0),
- m_stream(nullptr),
- m_pot_r_cb(*this),
- m_allpot_r_cb(*this),
- m_serin_r_cb(*this),
- m_serout_w_cb(*this),
- m_keyboard_r(*this),
- m_irq_f(*this),
- m_output_type(LEGACY_LINEAR),
- m_serout_ready_timer(nullptr),
- m_serout_complete_timer(nullptr),
- m_serin_ready_timer(nullptr)
+pokey_device::pokey_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ device_t(mconfig, POKEY, tag, owner, clock),
+ device_sound_interface(mconfig, *this),
+ device_execute_interface(mconfig, *this),
+ device_state_interface(mconfig, *this),
+ m_icount(0),
+ m_stream(nullptr),
+ m_pot_r_cb(*this),
+ m_allpot_r_cb(*this),
+ m_serin_r_cb(*this),
+ m_serout_w_cb(*this),
+ m_keyboard_r(*this),
+ m_irq_f(*this),
+ m_output_type(LEGACY_LINEAR),
+ m_serout_ready_timer(nullptr),
+ m_serout_complete_timer(nullptr),
+ m_serin_ready_timer(nullptr)
{
}
@@ -217,12 +217,9 @@ void pokey_device::device_start()
{
//int sample_rate = clock();
- /* Setup channels */
- for (int i=0; im_IRQEN & m_INTMask)
+ if (host.m_IRQEN & m_INTMask)
{
/* Exposed state has changed: This should only be updated after a resync ... */
- m_parent->machine().scheduler().synchronize(timer_expired_delegate(FUNC(pokey_device::sync_set_irqst), m_parent), m_INTMask);
+ host.machine().scheduler().synchronize(timer_expired_delegate(FUNC(pokey_device::sync_set_irqst), &host), m_INTMask);
}
}
}
- inline int check_borrow()
+ int check_borrow()
{
if (m_borrow_cnt > 0)
{
@@ -254,7 +254,7 @@ private:
void vol_init();
inline void process_channel(int ch);
- void pokey_potgo(void);
+ void pokey_potgo();
char *audc2str(int val);
char *audctl2str(int val);
diff --git a/src/mame/nintendo/gb.cpp b/src/mame/nintendo/gb.cpp
index db59aef5d5f..85c06e5f8bc 100644
--- a/src/mame/nintendo/gb.cpp
+++ b/src/mame/nintendo/gb.cpp
@@ -892,7 +892,7 @@ uint8_t gbc_state::gbc_io2_r(offs_t offset)
Map megaduck video related area on to regular Game Boy video area
Different locations of the video registers:
- Register Game Boy MegaDuck
+ Register Game Boy Mega Duck
LCDC FF40 FF10 (See different bit order below)
STAT FF41 FF11
SCY FF42 FF12
@@ -912,7 +912,7 @@ uint8_t gbc_state::gbc_io2_r(offs_t offset)
Different LCDC register
- Game Boy MegaDuck
+ Game Boy Mega Duck
0 6 - BG & Window Display : 0 - Off, 1 - On
1 0 - OBJ Display: 0 - Off, 1 - On
2 1 - OBJ Size: 0 - 8x8, 1 - 8x16
diff --git a/src/mame/sega/turbo.h b/src/mame/sega/turbo.h
index 38f4fa36137..808411aa0a3 100644
--- a/src/mame/sega/turbo.h
+++ b/src/mame/sega/turbo.h
@@ -36,6 +36,7 @@ public:
, m_videoram(*this, "videoram")
, m_sprite_position(*this, "spritepos")
, m_samples(*this, "samples")
+ , m_discrete(*this, "discrete")
, m_gfxdecode(*this, "gfxdecode")
, m_screen(*this, "screen")
, m_digits(*this, "digit%u", 0U)
@@ -57,6 +58,7 @@ protected:
required_shared_ptr m_sprite_position;
required_device m_samples;
+ optional_device m_discrete;
required_device m_gfxdecode;
required_device m_screen;
diff --git a/src/mame/sega/turbo_a.cpp b/src/mame/sega/turbo_a.cpp
index 54a3f31212d..db99ba87673 100644
--- a/src/mame/sega/turbo_a.cpp
+++ b/src/mame/sega/turbo_a.cpp
@@ -41,22 +41,21 @@ void turbo_state::update_samples()
TIMER_CALLBACK_MEMBER(turbo_state::update_sound_a)
{
- discrete_device *discrete = machine.device("discrete");
int data = param;
// missing short crash sample, but I've never seen it triggered
- discrete->write(0, !(data & 0x01));
- discrete->write(1, (data >> 1) & 1);
- discrete->write(2, (data >> 2) & 1);
- discrete->write(3, (data >> 3) & 1);
- discrete->write(4, (data >> 4) & 1);
- discrete->write(5, !(data & 0x20));
- discrete->write(6, !(data & 0x40));
+ m_discrete->write(0, BIT(~data, 0));
+ m_discrete->write(1, BIT( data, 1));
+ m_discrete->write(2, BIT( data, 2));
+ m_discrete->write(3, BIT( data, 3));
+ m_discrete->write(4, BIT( data, 4));
+ m_discrete->write(5, BIT(~data, 5));
+ m_discrete->write(6, BIT(~data, 6));
-if (!((data >> 1) & 1)) osd_printf_debug("/TRIG1\n");
-if (!((data >> 2) & 1)) osd_printf_debug("/TRIG2\n");
-if (!((data >> 3) & 1)) osd_printf_debug("/TRIG3\n");
-if (!((data >> 4) & 1)) osd_printf_debug("/TRIG4\n");
+ if (!BIT(data, 1)) osd_printf_debug("/TRIG1\n");
+ if (!BIT(data, 2)) osd_printf_debug("/TRIG2\n");
+ if (!BIT(data, 3)) osd_printf_debug("/TRIG3\n");
+ if (!BIT(data, 4)) osd_printf_debug("/TRIG4\n");
// osel = (osel & 6) | ((data >> 5) & 1);
// update_samples(samples);