From 42391bbb6be913c407933ad064eb31fe63afbcb8 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Mon, 29 Aug 2022 11:25:58 +1000 Subject: [PATCH] Work around older versions of libc++, tidy up some recent changes. --- src/devices/cpu/mn1610/mn1610d.cpp | 9 +++++++-- src/devices/sound/pokey.cpp | 16 ++++++++-------- src/mame/apple/mactoolbox.h | 10 ++++++++++ src/mame/sega/deniam.cpp | 6 ++---- src/mame/taito/chaknpop.cpp | 2 +- 5 files changed, 28 insertions(+), 15 deletions(-) diff --git a/src/devices/cpu/mn1610/mn1610d.cpp b/src/devices/cpu/mn1610/mn1610d.cpp index f04b40f1378..83e87669c84 100644 --- a/src/devices/cpu/mn1610/mn1610d.cpp +++ b/src/devices/cpu/mn1610/mn1610d.cpp @@ -14,6 +14,8 @@ #include "mn1610d.h" +namespace { + char const *const reg[] = { "r0", "r1", "r2", "r3", "r4", "sp", "str", "ic" }; enum operand_type : unsigned @@ -54,7 +56,7 @@ struct instruction u32 flags; }; -static const struct instruction mn1610_table[] = +const struct instruction mn1610_table[] = { // memory { 0xc700, 0xc700, "b", { EA } }, // 11mm m111 nnnn nnnn @@ -109,7 +111,7 @@ static const struct instruction mn1610_table[] = }; // opcodes are sorted in descending order of number of bits in mask to ensure correct decoding -static const struct instruction mn1613_table[] = +const struct instruction mn1613_table[] = { { 0x1707, 0xffff, "popm", { } }, // 0001 0111 0000 0111 { 0x170f, 0xffff, "pshm", { } }, // 0001 0111 0000 1111 @@ -195,6 +197,9 @@ static const struct instruction mn1613_table[] = { 0x1f00, 0xff00, "neg", { Rs, C, SK } }, // 0001 1111 kkkk cddd }; +} // anonymous namespace + + std::optional mn1610_disassembler::operand(unsigned t, u16 pc, u16 data) { char const *const ee[] = { nullptr, "re", "se", "ce" }; diff --git a/src/devices/sound/pokey.cpp b/src/devices/sound/pokey.cpp index 11bf0bc3158..fbe88a924cc 100644 --- a/src/devices/sound/pokey.cpp +++ b/src/devices/sound/pokey.cpp @@ -1196,16 +1196,16 @@ void pokey_device::poly_init_9_17(uint32_t *poly, int size) { LOG_RAND(("rand %d\n", size)); - int mask = (1 << size) - 1; + const uint32_t mask = util::make_bitmask(size); uint32_t lfsr = mask; if (size == 17) { - for (int i = 0; i < mask; i++) + for (uint32_t i = 0; i < mask; i++) { - /* calculate next bit @ 7 */ - int in8 = ((lfsr >> 8) & 1) ^ ((lfsr >> 13) & 1); - int in = (lfsr & 1); + // calculate next bit @ 7 + const uint32_t in8 = BIT(lfsr, 8) ^ BIT(lfsr, 13); + const uint32_t in = BIT(lfsr, 0); lfsr = lfsr >> 1; lfsr = (lfsr & 0xff7f) | (in8 << 7); lfsr = (in << 16) | lfsr; @@ -1216,10 +1216,10 @@ void pokey_device::poly_init_9_17(uint32_t *poly, int size) } else // size == 9 { - for (int i = 0; i < mask; i++) + for (uint32_t i = 0; i < mask; i++) { - /* calculate next bit */ - int in = ((lfsr >> 0) & 1) ^ ((lfsr >> 5) & 1); + // calculate next bit + const uint32_t in = BIT(lfsr, 0) ^ BIT(lfsr, 5); lfsr = lfsr >> 1; lfsr = (in << 8) | lfsr; *poly = lfsr; diff --git a/src/mame/apple/mactoolbox.h b/src/mame/apple/mactoolbox.h index 51a7f4955cc..6f16ac60ce7 100644 --- a/src/mame/apple/mactoolbox.h +++ b/src/mame/apple/mactoolbox.h @@ -6,6 +6,16 @@ #pragma once + +// older versions of libc++ are missing deduction guides that the things using this require +// FIXME: find a better place to put this +#if defined(_LIBCPP_VERSION) && (_LIBCPP_VERSION < 10000) +namespace std { inline namespace __1 { +template function( R(*)(ArgTypes...) ) -> function; +} } +#endif + + extern offs_t mac68k_dasm_override(std::ostream &stream, offs_t pc, const util::disasm_interface::data_buffer &opcodes, const util::disasm_interface::data_buffer ¶ms); #endif // MAME_APPLE_MACTOOLBOX_H diff --git a/src/mame/sega/deniam.cpp b/src/mame/sega/deniam.cpp index 73527138f34..81b596e929c 100644 --- a/src/mame/sega/deniam.cpp +++ b/src/mame/sega/deniam.cpp @@ -113,7 +113,7 @@ private: required_shared_ptr m_textram; required_shared_ptr m_spriteram; - required_memory_region m_spritegfx; + required_region_ptr m_spritegfx; // video-related tilemap_t *m_fg_tilemap = nullptr; @@ -353,8 +353,6 @@ void deniamc_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, co { for (int offs = m_spriteram.bytes() / 2 - 8; offs >= 0; offs -= 8) { - u8 *rom = m_spritegfx->base(); - int sx = (m_spriteram[offs + 1] & 0x01ff) + 16 * 8 - 1; if (sx >= 512) sx -= 512; const int starty = m_spriteram[offs + 0] & 0xff; @@ -376,7 +374,7 @@ void deniamc_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, co } const int start = m_spriteram[offs + 3] + ((m_spriteram[offs + 4] & 0x1f00) << 8); - rom += 2 * start; + const u8 *rom = &m_spritegfx[2 * start]; for (int y = starty + 1; y <= endy; y++) { diff --git a/src/mame/taito/chaknpop.cpp b/src/mame/taito/chaknpop.cpp index eac17698208..add343b225e 100644 --- a/src/mame/taito/chaknpop.cpp +++ b/src/mame/taito/chaknpop.cpp @@ -390,7 +390,7 @@ void chaknpop_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprec } - m_gfxdecode->gfx(0)->transpen(bitmap, cliprect, + m_gfxdecode->gfx(0)->transpen(bitmap, cliprect, tile, color, flipx, flipy,