diff --git a/src/devices/bus/gameboy/cartbase.ipp b/src/devices/bus/gameboy/cartbase.ipp
index 39bde1c857f..eb10795591e 100644
--- a/src/devices/bus/gameboy/cartbase.ipp
+++ b/src/devices/bus/gameboy/cartbase.ipp
@@ -77,7 +77,6 @@ void flat_ram_device_base::install_ram()
nvrambytes,
0x1fff,
0,
- 0,
0xa000,
[this, nvrambase] (offs_t begin, offs_t end, offs_t mirror, offs_t src)
{
@@ -111,7 +110,6 @@ void flat_ram_device_base::install_ram()
rambytes,
0x1fff,
0,
- 0,
0xa000,
[this, rambase] (offs_t begin, offs_t end, offs_t mirror, offs_t src)
{
@@ -131,7 +129,6 @@ void flat_ram_device_base::install_ram()
rambytes,
nvrambytes - 1,
0,
- 0,
0xa000 | nvrambytes,
[this, rambase, highmirror = 0x1fff & ~(nvrambytes | (nvrambytes - 1))] (offs_t begin, offs_t end, offs_t mirror, offs_t src)
{
@@ -353,7 +350,6 @@ void mbc_ram_device_base::install_ram(
nvrambytes ? nvrambytes : rambytes,
PAGE_RAM_SIZE - 1,
0,
- 0,
0xa000,
[this, rospace, rwspace, base = nvrambase ? nvrambase : rambase] (offs_t begin, offs_t end, offs_t mirror, offs_t src)
{
diff --git a/src/devices/bus/gameboy/mbc6.cpp b/src/devices/bus/gameboy/mbc6.cpp
index 66551678200..322619dd9d6 100644
--- a/src/devices/bus/gameboy/mbc6.cpp
+++ b/src/devices/bus/gameboy/mbc6.cpp
@@ -479,7 +479,6 @@ void mbc6_device::install_ram()
nvrambytes ? nvrambytes : rambytes,
PAGE_RAM_SIZE - 1,
0,
- 0,
0xa000,
[this, base = nvrambase ? nvrambase : rambase] (offs_t begin, offs_t end, offs_t mirror, offs_t src)
{
diff --git a/src/devices/bus/gameboy/rom.cpp b/src/devices/bus/gameboy/rom.cpp
index c3dfeeb68bb..e2bb928524f 100644
--- a/src/devices/bus/gameboy/rom.cpp
+++ b/src/devices/bus/gameboy/rom.cpp
@@ -330,7 +330,6 @@ public:
bytes,
0x7fff,
0,
- 0,
0x0000,
[this, base = &romregion->as_u8()] (offs_t begin, offs_t end, offs_t mirror, offs_t src)
{
diff --git a/src/devices/bus/generic/slot.h b/src/devices/bus/generic/slot.h
index 9fde07ddd83..2e2a99a50b5 100644
--- a/src/devices/bus/generic/slot.h
+++ b/src/devices/bus/generic/slot.h
@@ -63,6 +63,33 @@ public:
}
}
+ // TODO: find a better home for this helper
+ template
+ static void install_non_power_of_two(
+ offs_t length,
+ offs_t decode_limit,
+ offs_t decode_offset,
+ offs_t base,
+ T &&install)
+ {
+ offs_t decode_mask(length - 1);
+ for (unsigned i = 31 - count_leading_zeros_32(decode_mask); 0U < i; --i)
+ {
+ if (!BIT(decode_mask, i - 1))
+ {
+ decode_mask &= ~((offs_t(1) << i) - 1);
+ break;
+ }
+ }
+ install_non_power_of_two(
+ length,
+ decode_limit,
+ decode_mask,
+ decode_offset,
+ base,
+ std::forward(install));
+ }
+
// TODO: find a better home for this helper
template
static T map_non_power_of_two(T count, U &&map)
@@ -72,7 +99,7 @@ public:
T const max(count - 1);
T mask(max);
- for (unsigned i = 1; (sizeof(T) * 8) > i; i <<= 1)
+ for (unsigned i = 1U; (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))
diff --git a/src/devices/bus/vboy/rom.cpp b/src/devices/bus/vboy/rom.cpp
index 65724108b41..20ba18ff62a 100644
--- a/src/devices/bus/vboy/rom.cpp
+++ b/src/devices/bus/vboy/rom.cpp
@@ -62,7 +62,6 @@ std::error_condition vboy_flat_rom_device::load()
romregion->bytes() >> 2,
0x00ff'ffff >> 2,
0,
- 0,
rom_base(),
[this, rom = &romregion->as_u32()] (offs_t begin, offs_t end, offs_t mirror, offs_t src)
{
@@ -118,7 +117,6 @@ std::error_condition vboy_flat_rom_sram_device::load()
sramregion->bytes() >> 1,
0x00ff'ffff >> 2,
0,
- 0,
chip_base(),
[this, sramregion] (offs_t begin, offs_t end, offs_t mirror, offs_t src)
{
@@ -151,7 +149,6 @@ std::error_condition vboy_flat_rom_sram_device::load()
sramregion->bytes() >> 2,
0x00ff'ffff >> 2,
0,
- 0,
chip_base(),
[this, sramregion] (offs_t begin, offs_t end, offs_t mirror, offs_t src)
{