diff --git a/3rdparty/softfloat/fpu_constant.h b/3rdparty/softfloat/fpu_constant.h index 3ac8862ba0c..fdd9719eb99 100644 --- a/3rdparty/softfloat/fpu_constant.h +++ b/3rdparty/softfloat/fpu_constant.h @@ -37,11 +37,11 @@ these four paragraphs for those parts of this code that are retained. // 128-bit PI fraction #ifdef BETTER_THAN_PENTIUM -#define FLOAT_PI_HI (U64(0xc90fdaa22168c234)) -#define FLOAT_PI_LO (U64(0xc4c6628b80dc1cd1)) +#define FLOAT_PI_HI (0xc90fdaa22168c234U) +#define FLOAT_PI_LO (0xc4c6628b80dc1cd1U) #else -#define FLOAT_PI_HI (U64(0xc90fdaa22168c234)) -#define FLOAT_PI_LO (U64(0xC000000000000000)) +#define FLOAT_PI_HI (0xc90fdaa22168c234U) +#define FLOAT_PI_LO (0xC000000000000000U) #endif #define FLOATX80_PI2_EXP (0x3FFF) @@ -55,11 +55,11 @@ these four paragraphs for those parts of this code that are retained. // 128-bit 3PI/4 fraction #ifdef BETTER_THAN_PENTIUM -#define FLOAT_3PI4_HI (U64(0x96cbe3f9990e91a7)) -#define FLOAT_3PI4_LO (U64(0x9394c9e8a0a5159c)) +#define FLOAT_3PI4_HI (0x96cbe3f9990e91a7U) +#define FLOAT_3PI4_LO (0x9394c9e8a0a5159cU) #else -#define FLOAT_3PI4_HI (U64(0x96cbe3f9990e91a7)) -#define FLOAT_3PI4_LO (U64(0x9000000000000000)) +#define FLOAT_3PI4_HI (0x96cbe3f9990e91a7U) +#define FLOAT_3PI4_LO (0x9000000000000000U) #endif ////////////////////////////// @@ -70,11 +70,11 @@ these four paragraphs for those parts of this code that are retained. // 128-bit 1/LN2 fraction #ifdef BETTER_THAN_PENTIUM -#define FLOAT_LN2INV_HI (U64(0xb8aa3b295c17f0bb)) -#define FLOAT_LN2INV_LO (U64(0xbe87fed0691d3e89)) +#define FLOAT_LN2INV_HI (0xb8aa3b295c17f0bbU) +#define FLOAT_LN2INV_LO (0xbe87fed0691d3e89U) #else -#define FLOAT_LN2INV_HI (U64(0xb8aa3b295c17f0bb)) -#define FLOAT_LN2INV_LO (U64(0xC000000000000000)) +#define FLOAT_LN2INV_HI (0xb8aa3b295c17f0bbU) +#define FLOAT_LN2INV_LO (0xC000000000000000U) #endif #endif diff --git a/3rdparty/softfloat/fsincos.c b/3rdparty/softfloat/fsincos.c index 742c07f2b3b..a57b9ccbf87 100644 --- a/3rdparty/softfloat/fsincos.c +++ b/3rdparty/softfloat/fsincos.c @@ -31,8 +31,8 @@ these four paragraphs for those parts of this code that are retained. //#include "softfloat-specialize" #include "fpu_constant.h" -static const floatx80 floatx80_one = packFloatx80(0, 0x3fff, U64(0x8000000000000000)); -static const floatx80 floatx80_default_nan = packFloatx80(0, 0xffff, U64(0xffffffffffffffff)); +static const floatx80 floatx80_one = packFloatx80(0, 0x3fff, 0x8000000000000000U); +static const floatx80 floatx80_default_nan = packFloatx80(0, 0xffff, 0xffffffffffffffffU); #define packFloat2x128m(zHi, zLo) {(zHi), (zLo)} #define PACK_FLOAT_128(hi,lo) packFloat2x128m(LIT64(hi),LIT64(lo)) @@ -83,7 +83,7 @@ INLINE floatx80 propagateFloatx80NaNOneArg(floatx80 a) if (floatx80_is_signaling_nan(a)) float_raise(float_flag_invalid); - a.low |= U64(0xC000000000000000); + a.low |= 0xC000000000000000U; return a; } @@ -322,7 +322,7 @@ int sf_fsincos(floatx80 a, floatx80 *sin_a, floatx80 *cos_a) // float_raise(float_flag_denormal); /* handle pseudo denormals */ - if (! (aSig0 & U64(0x8000000000000000))) + if (! (aSig0 & 0x8000000000000000U)) { float_raise(float_flag_inexact); if (sin_a) @@ -435,7 +435,7 @@ int floatx80_ftan(floatx80 &a) if (aSig0 == 0) return 0; // float_raise(float_flag_denormal); /* handle pseudo denormals */ - if (! (aSig0 & U64(0x8000000000000000))) + if (! (aSig0 & 0x8000000000000000U)) { float_raise(float_flag_inexact | float_flag_underflow); return 0; @@ -616,7 +616,7 @@ floatx80 floatx80_scale(floatx80 a, floatx80 b) } if (aSig && (aExp == 0)) float_raise(float_flag_denormal); if (bSign) return packFloatx80(aSign, 0, 0); - return packFloatx80(aSign, 0x7FFF, U64(0x8000000000000000)); + return packFloatx80(aSign, 0x7FFF, 0x8000000000000000U); } if (aExp == 0) { if (aSig == 0) return a; diff --git a/3rdparty/softfloat/fyl2x.c b/3rdparty/softfloat/fyl2x.c index d7c5baa3e70..44c3e7610bc 100644 --- a/3rdparty/softfloat/fyl2x.c +++ b/3rdparty/softfloat/fyl2x.c @@ -32,10 +32,10 @@ these four paragraphs for those parts of this code that are retained. //#include "softfloat-specialize" #include "fpu_constant.h" -static const floatx80 floatx80_log10_2 = packFloatx80(0, 0x3ffd, U64(0x9a209a84fbcff798)); -static const floatx80 floatx80_ln_2 = packFloatx80(0, 0x3ffe, U64(0xb17217f7d1cf79ac)); -static const floatx80 floatx80_one = packFloatx80(0, 0x3fff, U64(0x8000000000000000)); -static const floatx80 floatx80_default_nan = packFloatx80(0, 0xffff, U64(0xffffffffffffffff)); +static const floatx80 floatx80_log10_2 = packFloatx80(0, 0x3ffd, 0x9a209a84fbcff798U); +static const floatx80 floatx80_ln_2 = packFloatx80(0, 0x3ffe, 0xb17217f7d1cf79acU); +static const floatx80 floatx80_one = packFloatx80(0, 0x3fff, 0x8000000000000000U); +static const floatx80 floatx80_default_nan = packFloatx80(0, 0xffff, 0xffffffffffffffffU); #define packFloat_128(zHi, zLo) {(zHi), (zLo)} #define PACK_FLOAT_128(hi,lo) packFloat_128(LIT64(hi),LIT64(lo)) @@ -87,7 +87,7 @@ INLINE floatx80 propagateFloatx80NaNOneArg(floatx80 a) if (floatx80_is_signaling_nan(a)) float_raise(float_flag_invalid); - a.low |= U64(0xC000000000000000); + a.low |= 0xC000000000000000U; return a; } @@ -130,8 +130,8 @@ static floatx80 propagateFloatx80NaN(floatx80 a, floatx80 b) int aIsSignalingNaN = floatx80_is_signaling_nan(a); int bIsNaN = floatx80_is_nan(b); int bIsSignalingNaN = floatx80_is_signaling_nan(b); - a.low |= U64(0xC000000000000000); - b.low |= U64(0xC000000000000000); + a.low |= 0xC000000000000000U; + b.low |= 0xC000000000000000U; if (aIsSignalingNaN | bIsSignalingNaN) float_raise(float_flag_invalid); if (aIsSignalingNaN) { if (bIsSignalingNaN) goto returnLargerSignificand; @@ -150,14 +150,14 @@ static floatx80 propagateFloatx80NaN(floatx80 a, floatx80 b) } static const float128 float128_one = - packFloat_128(U64(0x3fff000000000000), U64(0x0000000000000000)); + packFloat_128(0x3fff000000000000U, 0x0000000000000000U); static const float128 float128_two = - packFloat_128(U64(0x4000000000000000), U64(0x0000000000000000)); + packFloat_128(0x4000000000000000U, 0x0000000000000000U); static const float128 float128_ln2inv2 = - packFloat_128(U64(0x400071547652b82f), U64(0xe1777d0ffda0d23a)); + packFloat_128(0x400071547652b82fU, 0xe1777d0ffda0d23aU); -#define SQRT2_HALF_SIG U64(0xb504f333f9de6484) +#define SQRT2_HALF_SIG 0xb504f333f9de6484U extern float128 OddPoly(float128 x, float128 *arr, unsigned n); @@ -279,7 +279,7 @@ invalid: if (bSig == 0) goto invalid; float_raise(float_flag_denormal); } - return packFloatx80(bSign, 0x7FFF, U64(0x8000000000000000)); + return packFloatx80(bSign, 0x7FFF, 0x8000000000000000U); } } if (bExp == 0x7FFF) @@ -289,16 +289,16 @@ invalid: if (aSig && (aExp == 0)) float_raise(float_flag_denormal); if (aExp < 0x3FFF) { - return packFloatx80(zSign, 0x7FFF, U64(0x8000000000000000)); + return packFloatx80(zSign, 0x7FFF, 0x8000000000000000U); } if (aExp == 0x3FFF && ((uint64_t) (aSig<<1) == 0)) goto invalid; - return packFloatx80(bSign, 0x7FFF, U64(0x8000000000000000)); + return packFloatx80(bSign, 0x7FFF, 0x8000000000000000U); } if (aExp == 0) { if (aSig == 0) { if ((bExp | bSig) == 0) goto invalid; float_raise(float_flag_divbyzero); - return packFloatx80(zSign, 0x7FFF, U64(0x8000000000000000)); + return packFloatx80(zSign, 0x7FFF, 0x8000000000000000U); } if (aSign) goto invalid; float_raise(float_flag_denormal); @@ -393,7 +393,7 @@ invalid: if (bSig == 0) goto invalid; float_raise(float_flag_denormal); } - return packFloatx80(bSign, 0x7FFF, U64(0x8000000000000000)); + return packFloatx80(bSign, 0x7FFF, 0x8000000000000000U); } } if (bExp == 0x7FFF) @@ -406,7 +406,7 @@ invalid: float_raise(float_flag_denormal); } - return packFloatx80(zSign, 0x7FFF, U64(0x8000000000000000)); + return packFloatx80(zSign, 0x7FFF, 0x8000000000000000U); } if (aExp == 0) { if (aSig == 0) { diff --git a/src/devices/bus/isa/isa.h b/src/devices/bus/isa/isa.h index d4f67b55f74..25e6bb281ce 100644 --- a/src/devices/bus/isa/isa.h +++ b/src/devices/bus/isa/isa.h @@ -216,7 +216,7 @@ public: } void install_device(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler); - template void install_device(offs_t addrstart, offs_t addrend, T &device, void (T::*map)(class address_map &map), int bits = 8, uint64_t unitmask = U64(0xffffffffffffffff)) + template void install_device(offs_t addrstart, offs_t addrend, T &device, void (T::*map)(class address_map &map), int bits = 8, uint64_t unitmask = 0xffffffffffffffffU) { m_iospace->install_device(addrstart, addrend, device, map, bits, unitmask); } diff --git a/src/devices/bus/msx_cart/yamaha.cpp b/src/devices/bus/msx_cart/yamaha.cpp index b5841580917..f3f2bfb3815 100644 --- a/src/devices/bus/msx_cart/yamaha.cpp +++ b/src/devices/bus/msx_cart/yamaha.cpp @@ -164,7 +164,7 @@ READ8_MEMBER(msx_cart_sfg::read_cart) if (offset < 0x8000) { - return m_region_sfg->u8(offset & m_rom_mask); + return m_region_sfg->as_u8(offset & m_rom_mask); } return 0xff; diff --git a/src/devices/bus/neogeo/slot.h b/src/devices/bus/neogeo/slot.h index a2413d81589..e11fa0fe066 100644 --- a/src/devices/bus/neogeo/slot.h +++ b/src/devices/bus/neogeo/slot.h @@ -108,7 +108,7 @@ public: void rom_alloc(uint32_t size) { m_rom.resize(size/sizeof(uint16_t)); } uint16_t* get_rom_base() { return &m_rom[0]; } uint32_t get_rom_size() { return m_rom.size() * sizeof(uint16_t); } - uint16_t* get_region_rom_base() { if (m_region_rom.found()) return &m_region_rom->u16(0); return nullptr; } + uint16_t* get_region_rom_base() { if (m_region_rom.found()) return &m_region_rom->as_u16(0); return nullptr; } uint32_t get_region_rom_size() { if (m_region_rom.found()) return m_region_rom->bytes(); return 0; } void fixed_alloc(uint32_t size) { m_fixed.resize(size); } diff --git a/src/devices/bus/snes/sa1.cpp b/src/devices/bus/snes/sa1.cpp index 3608aa9bd8d..86363038992 100644 --- a/src/devices/bus/snes/sa1.cpp +++ b/src/devices/bus/snes/sa1.cpp @@ -765,7 +765,7 @@ void sns_sa1_device::write_regs(address_space &space, uint32_t offset, uint8_t d case 2: //sigma (accumulative multiplication) case 3: uint64_t acum = (int16_t)m_math_a * (int16_t)m_math_b; - uint64_t mask = U64(0xffffffffff); + uint64_t mask = 0xffffffffffU; m_math_res += acum; m_math_overflow = (m_math_res > mask) ? 0x80 : 0; m_math_res &= mask; diff --git a/src/devices/bus/svi3x8/expander/sv603.cpp b/src/devices/bus/svi3x8/expander/sv603.cpp index 1adc323377e..ba69250becd 100644 --- a/src/devices/bus/svi3x8/expander/sv603.cpp +++ b/src/devices/bus/svi3x8/expander/sv603.cpp @@ -117,7 +117,7 @@ READ8_MEMBER( sv603_device::mreq_r ) if (offset >= 0x8000 && offset < 0xa000) { m_expander->ramdis_w(0); - return m_bios->u8(offset & 0x1fff); + return m_bios->as_u8(offset & 0x1fff); } return 0xff; diff --git a/src/devices/bus/svi3x8/slot/sv806.cpp b/src/devices/bus/svi3x8/slot/sv806.cpp index b45da2f7abb..ec16d84c656 100644 --- a/src/devices/bus/svi3x8/slot/sv806.cpp +++ b/src/devices/bus/svi3x8/slot/sv806.cpp @@ -98,7 +98,7 @@ MC6845_UPDATE_ROW( sv806_device::crtc_update_row ) for (int i = 0; i < x_count; i++) { - uint8_t data = m_gfx->u8((m_ram[(ma + i) & 0x7ff] << 4) | ra); + uint8_t data = m_gfx->as_u8((m_ram[(ma + i) & 0x7ff] << 4) | ra); if (i == cursor_x) data = 0xff; diff --git a/src/devices/cpu/arm7/arm7drc.hxx b/src/devices/cpu/arm7/arm7drc.hxx index 2dc32cd68c2..7df82e359ab 100644 --- a/src/devices/cpu/arm7/arm7drc.hxx +++ b/src/devices/cpu/arm7/arm7drc.hxx @@ -1362,7 +1362,7 @@ void arm7_cpu_device::saturate_qbit_overflow(drcuml_block *block) UML_DCMP(block, uml::I0, 0x000000007fffffffL); UML_MOVc(block, uml::COND_G, uml::I1, Q_MASK); UML_MOVc(block, uml::COND_G, uml::I0, 0x7fffffff); - UML_DCMP(block, uml::I0, U64(0xffffffff80000000)); + UML_DCMP(block, uml::I0, 0xffffffff80000000ULL); UML_MOVc(block, uml::COND_L, uml::I1, Q_MASK); UML_MOVc(block, uml::COND_L, uml::I0, 0x80000000); UML_OR(block, DRC_CPSR, DRC_CPSR, uml::I1); diff --git a/src/devices/cpu/drcbex64.cpp b/src/devices/cpu/drcbex64.cpp index 3c136fff783..27404d0f066 100644 --- a/src/devices/cpu/drcbex64.cpp +++ b/src/devices/cpu/drcbex64.cpp @@ -273,7 +273,7 @@ inline x86_memref drcbe_x64::MABS(const void *ptr) drcbe_x64::opcode_generate_func drcbe_x64::s_opcode_table[OP_MAX]; // size-to-mask table -//static const uint64_t size_to_mask[] = { 0, 0xff, 0xffff, 0, 0xffffffff, 0, 0, 0, U64(0xffffffffffffffff) }; +//static const uint64_t size_to_mask[] = { 0, 0xff, 0xffff, 0, 0xffffffff, 0, 0, 0, 0xffffffffffffffffU }; // register mapping tables static const uint8_t int_register_map[REG_I_COUNT] = @@ -642,7 +642,7 @@ drcbe_x64::drcbe_x64(drcuml_state &drcuml, device_t &device, drc_cache &cache, u m_absmask32 = (uint32_t *)(((uintptr_t)m_absmask32 + 15) & ~15); m_absmask32[0] = m_absmask32[1] = m_absmask32[2] = m_absmask32[3] = 0x7fffffff; m_absmask64 = (uint64_t *)&m_absmask32[4]; - m_absmask64[0] = m_absmask64[1] = U64(0x7fffffffffffffff); + m_absmask64[0] = m_absmask64[1] = 0x7fffffffffffffffU; // get pointers to C functions we need to call m_near.debug_cpu_instruction_hook = (x86code *)debugger_instruction_hook; @@ -1975,7 +1975,7 @@ void drcbe_x64::emit_and_r64_p64(x86code *&dst, uint8_t reg, const be_parameter { if (param.is_immediate()) { - if (inst.flags() != 0 || param.immediate() != U64(0xffffffffffffffff)) + if (inst.flags() != 0 || param.immediate() != 0xffffffffffffffffU) { if (short_immediate(param.immediate())) emit_and_r64_imm(dst, reg, param.immediate()); // and reg,param @@ -2002,7 +2002,7 @@ void drcbe_x64::emit_and_m64_p64(x86code *&dst, x86_memref memref, const be_para { if (param.is_immediate()) { - if (inst.flags() != 0 || param.immediate() != U64(0xffffffffffffffff)) + if (inst.flags() != 0 || param.immediate() != 0xffffffffffffffffU) { if (short_immediate(param.immediate())) emit_and_m64_imm(dst, memref, param.immediate()); // and [mem],param @@ -2132,7 +2132,7 @@ void drcbe_x64::emit_xor_r64_p64(x86code *&dst, uint8_t reg, const be_parameter { if (inst.flags() != 0 || param.immediate() != 0) { - if (param.immediate() == U64(0xffffffffffffffff)) + if (param.immediate() == 0xffffffffffffffffU) emit_not_r64(dst, reg); // not reg else if (short_immediate(param.immediate())) emit_xor_r64_imm(dst, reg, param.immediate()); // xor reg,param @@ -2161,7 +2161,7 @@ void drcbe_x64::emit_xor_m64_p64(x86code *&dst, x86_memref memref, const be_para { if (inst.flags() != 0 || param.immediate() != 0) { - if (param.immediate() == U64(0xffffffffffffffff)) + if (param.immediate() == 0xffffffffffffffffU) emit_not_m64(dst, memref); // not [mem] else if (short_immediate(param.immediate())) emit_xor_m64_imm(dst, memref, param.immediate()); // xor [mem],param diff --git a/src/devices/cpu/drcbex86.cpp b/src/devices/cpu/drcbex86.cpp index 5f7bf220ef2..d4435ef9514 100644 --- a/src/devices/cpu/drcbex86.cpp +++ b/src/devices/cpu/drcbex86.cpp @@ -148,7 +148,7 @@ const uint32_t PTYPE_MF = PTYPE_M | PTYPE_F; drcbe_x86::opcode_generate_func drcbe_x86::s_opcode_table[OP_MAX]; // size-to-mask table -//static const uint64_t size_to_mask[] = { 0, 0xff, 0xffff, 0, 0xffffffff, 0, 0, 0, U64(0xffffffffffffffff) }; +//static const uint64_t size_to_mask[] = { 0, 0xff, 0xffff, 0, 0xffffffff, 0, 0, 0, 0xffffffffffffffffU }; // register mapping tables static const uint8_t int_register_map[REG_I_COUNT] = @@ -5243,7 +5243,7 @@ void drcbe_x86::op_and(x86code *&dst, const instruction &inst) } // AND with immediate 0xffffffff00000000 - else if (src2p.is_immediate_value(U64(0xffffffff00000000)) && inst.flags() == 0) + else if (src2p.is_immediate_value(0xffffffff00000000U) && inst.flags() == 0) { if (src1p != dstp) { diff --git a/src/devices/cpu/dsp16/dsp16.cpp b/src/devices/cpu/dsp16/dsp16.cpp index 6cefa03836c..f6d597e741d 100644 --- a/src/devices/cpu/dsp16/dsp16.cpp +++ b/src/devices/cpu/dsp16/dsp16.cpp @@ -108,8 +108,8 @@ void dsp16_device::device_start() state_add(DSP16_X, "X", m_x); state_add(DSP16_Y, "Y", m_y); state_add(DSP16_P, "P", m_p); - state_add(DSP16_A0, "A0", m_a0).mask(U64(0xfffffffff)); - state_add(DSP16_A1, "A1", m_a1).mask(U64(0xfffffffff)); + state_add(DSP16_A0, "A0", m_a0).mask(0xfffffffffU); + state_add(DSP16_A1, "A1", m_a1).mask(0xfffffffffU); state_add(DSP16_AUC, "AUC", m_auc).formatstr("%8s"); state_add(DSP16_PSW, "PSW", m_psw).formatstr("%16s"); state_add(DSP16_C0, "C0", m_c0); diff --git a/src/devices/cpu/dsp16/dsp16ops.hxx b/src/devices/cpu/dsp16/dsp16ops.hxx index 6893819f754..ab54a577fef 100644 --- a/src/devices/cpu/dsp16/dsp16ops.hxx +++ b/src/devices/cpu/dsp16/dsp16ops.hxx @@ -67,10 +67,10 @@ void dsp16_device::writeRegister(void* reg, const uint16_t &value) else if (reg == &m_psw) { // Writes to the a0 & a1 guard bits too - m_a0 &= U64(0x0ffffffff); - m_a0 |= U64(m_psw & 0x000f) << 32; - m_a1 &= U64(0x0ffffffff); - m_a1 |= U64(m_psw & 0x01e0) << 27; + m_a0 &= 0x0ffffffffU; + m_a0 |= u64(m_psw & 0x000fU) << 32; + m_a1 &= 0x0ffffffffU; + m_a1 |= u64(m_psw & 0x01e0U) << 27; m_psw = value; } else if (reg == &m_i) @@ -293,12 +293,12 @@ void dsp16_device::executeF1Field(const uint8_t& F1, const uint8_t& D, const uin { // aS-y int64_t aS = *sourceReg; - if (aS & U64(0x800000000)) - aS |= U64(0xfffffff000000000); + if (aS & 0x800000000U) + aS |= 0xfffffff000000000U; int64_t y = (m_y & 0xffff0000) >> 16; if (y & 0x8000) - y |= U64(0xffffffffffff0000); + y |= 0xffffffffffff0000U; result = aS-y; justATest = true; @@ -314,12 +314,12 @@ void dsp16_device::executeF1Field(const uint8_t& F1, const uint8_t& D, const uin { // Ad = aS+y int64_t aS = *sourceReg; - if (aS & U64(0x800000000)) - aS |= U64(0xfffffff000000000); + if (aS & 0x800000000U) + aS |= 0xfffffff000000000U; int64_t y = (m_y & 0xffff0000) >> 16; if (y & 0x8000) - y |= U64(0xffffffffffff0000); + y |= 0xffffffffffff0000U; result = aS+y; break; @@ -334,12 +334,12 @@ void dsp16_device::executeF1Field(const uint8_t& F1, const uint8_t& D, const uin { // Ad = aS-y int64_t aS = *sourceReg; - if (aS & U64(0x800000000)) - aS |= U64(0xfffffff000000000); + if (aS & 0x800000000U) + aS |= 0xfffffff000000000U; int64_t y = (m_y & 0xffff0000) >> 16; if (y & 0x8000) - y |= U64(0xffffffffffff0000); + y |= 0xffffffffffff0000U; result = aS-y; break; @@ -348,13 +348,13 @@ void dsp16_device::executeF1Field(const uint8_t& F1, const uint8_t& D, const uin // CPU Flags (page 3-4) // LMI (logical minus) - if (result & U64(0x800000000)) + if (result & 0x800000000U) m_psw |= 0x8000; else m_psw &= (~0x8000); // LEQ (logical equal) - if (result == U64(0x000000000)) + if (result == 0x000000000U) m_psw |= 0x4000; else m_psw &= (~0x4000); @@ -363,15 +363,15 @@ void dsp16_device::executeF1Field(const uint8_t& F1, const uint8_t& D, const uin // TODO // LMV (mathematical overflow) - if ((result & U64(0xf00000000)) != U64(0xf00000000) && - (result & U64(0xf00000000)) != U64(0x000000000)) + if ((result & 0xf00000000U) != 0xf00000000U && + (result & 0xf00000000U) != 0x000000000U) m_psw |= 0x1000; else m_psw &= (~0x1000); // If it was a real operation, make sure the data goes where it should if (!justATest) - *destinationReg = (uint64_t)result & U64(0x0000000fffffffff); + *destinationReg = (uint64_t)result & 0x0000000fffffffffU; } @@ -471,11 +471,11 @@ void dsp16_device::execute_one(const uint16_t& op, uint8_t& cycles, uint8_t& pcA uint16_t aRegValue = 0x0000; if (op & 0xc000) { - aRegValue = (m_a0 & U64(0x0ffff0000)) >> 16; + aRegValue = (m_a0 & 0x0ffff0000U) >> 16; } else { - aRegValue = (m_a1 & U64(0x0ffff0000)) >> 16; + aRegValue = (m_a1 & 0x0ffff0000U) >> 16; } data_write(*destinationReg, aRegValue); executeYFieldPost(Y); @@ -614,7 +614,7 @@ void dsp16_device::execute_one(const uint16_t& op, uint8_t& cycles, uint8_t& pcA } uint16_t sourceAddress = *(registerFromYFieldUpper(Y)); int64_t sourceValueSigned = (int16_t)data_read(sourceAddress); - *destinationReg = sourceValueSigned & U64(0xffffffffff); + *destinationReg = sourceValueSigned & 0xffffffffffU; executeYFieldPost(Y); cycles = 1; pcAdvance = 1; @@ -771,7 +771,7 @@ void dsp16_device::execute_one(const uint16_t& op, uint8_t& cycles, uint8_t& pcA const uint8_t S = (op & 0x1000) >> 12; void* destinationReg = registerFromRTable(R); uint64_t* sourceReg = (S) ? &m_a1 : &m_a0; - uint16_t sourceValue = (*sourceReg & U64(0x0ffff0000)) >> 16; + uint16_t sourceValue = (*sourceReg & 0x0ffff0000U) >> 16; writeRegister(destinationReg, sourceValue); cycles = 2; pcAdvance = 1; @@ -791,10 +791,10 @@ void dsp16_device::execute_one(const uint16_t& op, uint8_t& cycles, uint8_t& pcA default: break; } void* sourceReg = registerFromRTable(R); - *destinationReg &= U64(0x00000ffff); + *destinationReg &= 0x00000ffffU; *destinationReg |= (*(uint16_t*)sourceReg) << 16; // TODO: Fix for all registers if (*(uint16_t*)sourceReg & 0x8000) - *destinationReg |= U64(0xf00000000); + *destinationReg |= 0xf00000000U; // TODO: Special function encoding cycles = 2; pcAdvance = 1; diff --git a/src/devices/cpu/dsp56k/dsp56k.cpp b/src/devices/cpu/dsp56k/dsp56k.cpp index 1442aa8254d..5c24d5431bc 100644 --- a/src/devices/cpu/dsp56k/dsp56k.cpp +++ b/src/devices/cpu/dsp56k/dsp56k.cpp @@ -293,8 +293,8 @@ void dsp56k_device::device_start() state_add(DSP56K_X, "X", m_dsp56k_core.ALU.x.d).mask(0xffffffff).formatstr("%9s"); state_add(DSP56K_Y, "Y", m_dsp56k_core.ALU.y.d).mask(0xffffffff).formatstr("%9s"); - state_add(DSP56K_A, "A", m_dsp56k_core.ALU.a.q).mask((uint64_t)U64(0xffffffffffffffff)).formatstr("%12s"); /* could benefit from a better mask? */ - state_add(DSP56K_B, "B", m_dsp56k_core.ALU.b.q).mask((uint64_t)U64(0xffffffffffffffff)).formatstr("%12s"); /* could benefit from a better mask? */ + state_add(DSP56K_A, "A", m_dsp56k_core.ALU.a.q).mask(u64(0xffffffffffffffffU)).formatstr("%12s"); /* could benefit from a better mask? */ + state_add(DSP56K_B, "B", m_dsp56k_core.ALU.b.q).mask(u64(0xffffffffffffffffU)).formatstr("%12s"); /* could benefit from a better mask? */ state_add(DSP56K_R0, "R0", m_dsp56k_core.AGU.r0).formatstr("%04X"); state_add(DSP56K_R1, "R1", m_dsp56k_core.AGU.r1).formatstr("%04X"); diff --git a/src/devices/cpu/dsp56k/dsp56ops.hxx b/src/devices/cpu/dsp56k/dsp56ops.hxx index 0395e08d337..0c898e7c674 100644 --- a/src/devices/cpu/dsp56k/dsp56ops.hxx +++ b/src/devices/cpu/dsp56k/dsp56ops.hxx @@ -344,7 +344,7 @@ static void execute_one(dsp56k_core* cpustate) int parallelType = -1; uint16_t op_byte = 0x0000; typed_pointer d_register = {nullptr, DT_BYTE}; - uint64_t prev_accum_value = U64(0x0000000000000000); + uint64_t prev_accum_value = 0x0000000000000000U; /* Note: it's important that NPDM comes before RtRDM here */ /* No Parallel Data Move : 0100 1010 .... .... : A-131 */ @@ -1142,8 +1142,8 @@ static size_t dsp56k_op_addsub_2(dsp56k_core* cpustate, const uint16_t op_byte, } /* Sign-extend word for proper add/sub op */ - if ((S.data_type == DT_WORD) && useVal & U64(0x0000000080000000)) - useVal |= U64(0x000000ff00000000); + if ((S.data_type == DT_WORD) && (useVal & 0x0000000080000000U)) + useVal |= 0x000000ff00000000U; /* Operate*/ if (op_type == OP_ADD) @@ -1157,8 +1157,8 @@ static size_t dsp56k_op_addsub_2(dsp56k_core* cpustate, const uint16_t op_byte, /* S L E U N Z V C */ /* * * * * * * * * */ /* TODO S, L, E, U, V, C */ - if (*((uint64_t*)D.addr) & U64(0x0000008000000000)) DSP56K_N_SET(); else DSP56K_N_CLEAR(); - if (*((uint64_t*)D.addr) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); + if (*((uint64_t*)D.addr) & 0x0000008000000000U) DSP56K_N_SET(); else DSP56K_N_CLEAR(); + if (*((uint64_t*)D.addr) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); cycles += 2; /* TODO: + mv oscillator cycles */ return 1; @@ -1188,16 +1188,16 @@ static size_t dsp56k_op_mac_1(dsp56k_core* cpustate, const uint16_t op_byte, typ /* Sign extend D into a temp variable */ opD = (*((uint64_t*)D)); - if (opD & U64(0x0000008000000000)) - opD |= U64(0xffffff0000000000); + if (opD & 0x0000008000000000U) + opD |= 0xffffff0000000000U; else - opD &= U64(0x000000ffffffffff); + opD &= 0x000000ffffffffffU; /* Accumulate */ opD += result; /* And out the bits that don't live in the register */ - opD &= U64(0x000000ffffffffff); + opD &= 0x000000ffffffffffU; (*((uint64_t*)D)) = (uint64_t)opD; @@ -1208,8 +1208,8 @@ static size_t dsp56k_op_mac_1(dsp56k_core* cpustate, const uint16_t op_byte, typ /* S L E U N Z V C */ /* * * * * * * * - */ /* TODO: S, L, E, V */ - if ( *((uint64_t*)D) & U64(0x0000008000000000)) DSP56K_N_SET(); else DSP56K_N_CLEAR(); - if ((*((uint64_t*)D) & U64(0x000000ffffffffff)) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); + if ( *((uint64_t*)D) & 0x0000008000000000U) DSP56K_N_SET(); else DSP56K_N_CLEAR(); + if ((*((uint64_t*)D) & 0x000000ffffffffffU) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); cycles += 2; /* TODO: +mv oscillator cycles */ return 1; @@ -1253,7 +1253,7 @@ static size_t dsp56k_op_mpy_1(dsp56k_core* cpustate, const uint16_t op_byte, typ result = (s1 * s2) << 1; /* And out the bits that don't live in the register */ - (*((uint64_t*)D)) = result & U64(0x000000ffffffffff); + (*((uint64_t*)D)) = result & 0x000000ffffffffffU; /* For the parallel move */ d_register->addr = D; @@ -1262,8 +1262,8 @@ static size_t dsp56k_op_mpy_1(dsp56k_core* cpustate, const uint16_t op_byte, typ /* S L E U N Z V C */ /* * * * * * * * - */ /* TODO: S, L, E, V */ - if ( *((uint64_t*)D) & U64(0x0000008000000000)) DSP56K_N_SET(); else DSP56K_N_CLEAR(); - if ((*((uint64_t*)D) & U64(0x000000ffffffffff)) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); + if ( *((uint64_t*)D) & 0x0000008000000000U) DSP56K_N_SET(); else DSP56K_N_CLEAR(); + if ((*((uint64_t*)D) & 0x000000ffffffffffU) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); cycles += 2; /* TODO: +mv oscillator cycles */ return 1; @@ -1306,7 +1306,7 @@ static size_t dsp56k_op_clr(dsp56k_core* cpustate, const uint16_t op_byte, typed { typed_pointer D = {nullptr, DT_LONG_WORD}; typed_pointer clear = {nullptr, DT_LONG_WORD}; - uint64_t clear_val = U64(0x0000000000000000); + uint64_t clear_val = 0x0000000000000000U; decode_F_table(cpustate, BITS(op_byte,0x0008), &D); @@ -1351,8 +1351,8 @@ static size_t dsp56k_op_add(dsp56k_core* cpustate, const uint16_t op_byte, typed } /* Sign-extend word for proper add/sub op */ - if ((S.data_type == DT_WORD) && addVal & U64(0x0000000080000000)) - addVal |= U64(0x000000ff00000000); + if ((S.data_type == DT_WORD) && (addVal & 0x0000000080000000U)) + addVal |= 0x000000ff00000000U; /* Operate*/ *((uint64_t*)D.addr) += addVal; @@ -1363,8 +1363,8 @@ static size_t dsp56k_op_add(dsp56k_core* cpustate, const uint16_t op_byte, typed /* S L E U N Z V C */ /* * * * * * * * * */ /* TODO S, L, E, U, V, C */ - if (*((uint64_t*)D.addr) & U64(0x0000008000000000)) DSP56K_N_SET(); else DSP56K_N_CLEAR(); - if (*((uint64_t*)D.addr) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); + if (*((uint64_t*)D.addr) & 0x0000008000000000U) DSP56K_N_SET(); else DSP56K_N_CLEAR(); + if (*((uint64_t*)D.addr) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); cycles += 2; /* TODO: + mv oscillator cycles */ return 1; @@ -1418,10 +1418,10 @@ static size_t dsp56k_op_rnd(dsp56k_core* cpustate, const uint16_t op_byte, typed *p_accum = *((uint64_t*)D.addr); /* WARNING : ROUNDING NOT FULLY IMPLEMENTED YET! */ - if ((*((uint64_t*)D.addr) & U64(0x000000000000ffff)) >= 0x8000) - *((uint64_t*)D.addr) += U64(0x0000000000010000); + if ((*((uint64_t*)D.addr) & 0x000000000000ffffU) >= 0x8000) + *((uint64_t*)D.addr) += 0x0000000000010000U; - *((uint64_t*)D.addr) = *((uint64_t*)D.addr) & U64(0x000000ffffff0000); + *((uint64_t*)D.addr) = *((uint64_t*)D.addr) & 0x000000ffffff0000U; d_register->addr = D.addr; d_register->data_type = D.data_type; @@ -1429,8 +1429,8 @@ static size_t dsp56k_op_rnd(dsp56k_core* cpustate, const uint16_t op_byte, typed /* S L E U N Z V C */ /* * * * * * * * - */ /* TODO: S, L, E, U, V */ - if ((*((uint64_t*)D.addr)) & U64(0x0000008000000000)) DSP56K_N_SET(); else DSP56K_N_CLEAR(); - if ((*((uint64_t*)D.addr)) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); + if ((*((uint64_t*)D.addr)) & 0x0000008000000000U) DSP56K_N_SET(); else DSP56K_N_CLEAR(); + if ((*((uint64_t*)D.addr)) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); cycles += 2; /* TODO: + mv oscillator clock cycles */ return 1; @@ -1451,8 +1451,8 @@ static size_t dsp56k_op_tst(dsp56k_core* cpustate, const uint16_t op_byte, typed /* S L E U N Z V C */ /* 0 * * * * * 0 0 */ /* TODO: S, L, E, U */ - if ((*((uint64_t*)D.addr)) & U64(0x0000008000000000)) DSP56K_N_SET(); else DSP56K_N_CLEAR(); - if ((*((uint64_t*)D.addr)) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); + if ((*((uint64_t*)D.addr)) & 0x0000008000000000U) DSP56K_N_SET(); else DSP56K_N_CLEAR(); + if ((*((uint64_t*)D.addr)) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); DSP56K_V_CLEAR(); DSP56K_C_CLEAR(); @@ -1470,7 +1470,7 @@ static size_t dsp56k_op_inc(dsp56k_core* cpustate, const uint16_t op_byte, typed *p_accum = *((uint64_t*)D.addr); /* Make sure the destination is a real 40-bit value */ - *((uint64_t*)D.addr) &= U64(0x000000ffffffffff); + *((uint64_t*)D.addr) &= 0x000000ffffffffffU; /* Increment */ *((uint64_t*)D.addr) = *((uint64_t*)D.addr) + 1; @@ -1481,10 +1481,10 @@ static size_t dsp56k_op_inc(dsp56k_core* cpustate, const uint16_t op_byte, typed /* S L E U N Z V C */ /* * * * * * * * * */ /* TODO: S, L, E, U */ - if ( *((uint64_t*)D.addr) & U64(0x0000008000000000)) DSP56K_N_SET(); else DSP56K_N_CLEAR(); - if ((*((uint64_t*)D.addr) & U64(0x000000ffffff0000)) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); - if ((*((uint64_t*)D.addr) & U64(0xffffff0000000000)) != 0) DSP56K_V_SET(); else DSP56K_V_CLEAR(); - if ((*((uint64_t*)D.addr) & U64(0xffffff0000000000)) != 0) DSP56K_C_SET(); else DSP56K_C_CLEAR(); + if ( *((uint64_t*)D.addr) & 0x0000008000000000U) DSP56K_N_SET(); else DSP56K_N_CLEAR(); + if ((*((uint64_t*)D.addr) & 0x000000ffffff0000U) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); + if ((*((uint64_t*)D.addr) & 0xffffff0000000000U) != 0) DSP56K_V_SET(); else DSP56K_V_CLEAR(); + if ((*((uint64_t*)D.addr) & 0xffffff0000000000U) != 0) DSP56K_C_SET(); else DSP56K_C_CLEAR(); cycles += 2; /* TODO: +mv oscillator cycles */ return 1; @@ -1502,12 +1502,12 @@ static size_t dsp56k_op_inc24(dsp56k_core* cpustate, const uint16_t op_byte, typ *p_accum = *((uint64_t*)D.addr); /* TODO: I wonder if workBits24 should be signed? */ - workBits24 = ((*((uint64_t*)D.addr)) & U64(0x000000ffffff0000)) >> 16; + workBits24 = ((*((uint64_t*)D.addr)) & 0x000000ffffff0000U) >> 16; workBits24++; //workBits24 &= 0x00ffffff; /* Solves -x issues - TODO: huh? */ /* Set the D bits with the dec result */ - *((uint64_t*)D.addr) &= U64(0x000000000000ffff); + *((uint64_t*)D.addr) &= 0x000000000000ffffU; *((uint64_t*)D.addr) |= (((uint64_t)(workBits24)) << 16); d_register->addr = D.addr; @@ -1516,8 +1516,8 @@ static size_t dsp56k_op_inc24(dsp56k_core* cpustate, const uint16_t op_byte, typ /* S L E U N Z V C */ /* * * * * * ? * * */ /* TODO: S, L, E, U */ - if ( *((uint64_t*)D.addr) & U64(0x0000008000000000)) DSP56K_N_SET(); else DSP56K_N_CLEAR(); - if ((*((uint64_t*)D.addr) & U64(0x000000ffffff0000)) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); + if ( *((uint64_t*)D.addr) & 0x0000008000000000U) DSP56K_N_SET(); else DSP56K_N_CLEAR(); + if ((*((uint64_t*)D.addr) & 0x000000ffffff0000U) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); if ((workBits24 & 0xff000000) != 0) DSP56K_V_SET(); else DSP56K_V_CLEAR(); if ((workBits24 & 0xff000000) != 0) DSP56K_C_SET(); else DSP56K_C_CLEAR(); @@ -1545,8 +1545,8 @@ static size_t dsp56k_op_or(dsp56k_core* cpustate, const uint16_t op_byte, typed_ /* S L E U N Z V C */ /* * * - - ? ? 0 - */ /* TODO: S, L */ - if ( *((uint64_t*)D.addr) & U64(0x0000000080000000)) DSP56K_N_SET(); else DSP56K_N_CLEAR(); - if ((*((uint64_t*)D.addr) & U64(0x00000000ffff0000)) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); + if ( *((uint64_t*)D.addr) & 0x0000000080000000U) DSP56K_N_SET(); else DSP56K_N_CLEAR(); + if ((*((uint64_t*)D.addr) & 0x00000000ffff0000U) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); DSP56K_V_CLEAR(); cycles += 2; /* TODO: + mv oscillator cycles */ @@ -1564,10 +1564,10 @@ static size_t dsp56k_op_asr(dsp56k_core* cpustate, const uint16_t op_byte, typed *((uint64_t*)D.addr) = (*((uint64_t*)D.addr)) >> 1; /* Make sure the MSB is maintained */ - if (*p_accum & U64(0x0000008000000000)) - *((uint64_t*)D.addr) |= U64(0x0000008000000000); + if (*p_accum & 0x0000008000000000U) + *((uint64_t*)D.addr) |= 0x0000008000000000U; else - *((uint64_t*)D.addr) &= (~U64(0x0000008000000000)); + *((uint64_t*)D.addr) &= (~u64(0x0000008000000000U)); /* For the parallel move */ d_register->addr = D.addr; @@ -1576,10 +1576,10 @@ static size_t dsp56k_op_asr(dsp56k_core* cpustate, const uint16_t op_byte, typed /* S L E U N Z V C */ /* * * * * * * 0 ? */ /* TODO: S, L, E, U */ - if (*((uint64_t*)D.addr) & U64(0x0000008000000000)) DSP56K_N_SET(); else DSP56K_N_CLEAR(); - if (*((uint64_t*)D.addr) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); + if (*((uint64_t*)D.addr) & 0x0000008000000000U) DSP56K_N_SET(); else DSP56K_N_CLEAR(); + if (*((uint64_t*)D.addr) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); DSP56K_V_CLEAR(); - if (*p_accum & U64(0x0000000000000001)) DSP56K_C_SET(); else DSP56K_C_CLEAR(); + if (*p_accum & 0x0000000000000001U) DSP56K_C_SET(); else DSP56K_C_CLEAR(); cycles += 2; /* TODO: + mv oscillator cycles */ return 1; @@ -1617,9 +1617,9 @@ static size_t dsp56k_op_lsr(dsp56k_core* cpustate, const uint16_t op_byte, typed /* * * - - ? ? 0 ? */ /* TODO: S, L */ DSP56K_N_CLEAR(); - if (((PAIR64*)D.addr)->w.h == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); + if (((PAIR64*)D.addr)->w.h == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); DSP56K_V_CLEAR(); - if (*p_accum & U64(0x0000000000010000)) DSP56K_C_SET(); else DSP56K_C_CLEAR(); + if (*p_accum & 0x0000000000010000U) DSP56K_C_SET(); else DSP56K_C_CLEAR(); cycles += 2; /* TODO: + mv oscillator cycles */ return 1; @@ -1674,12 +1674,12 @@ static size_t dsp56k_op_sub(dsp56k_core* cpustate, const uint16_t op_byte, typed } /* Sign-extend word for proper sub op */ - if ((S.data_type == DT_WORD) && useVal & U64(0x0000000080000000)) - useVal |= U64(0x000000ff00000000); + if ((S.data_type == DT_WORD) && useVal & 0x0000000080000000U) + useVal |= 0x000000ff00000000U; /* Make sure they're both real 40-bit values */ - useVal &= U64(0x000000ffffffffff); - *((uint64_t*)D.addr) &= U64(0x000000ffffffffff); + useVal &= 0x000000ffffffffffU; + *((uint64_t*)D.addr) &= 0x000000ffffffffffU; /* Operate*/ *((uint64_t*)D.addr) -= useVal; @@ -1690,10 +1690,10 @@ static size_t dsp56k_op_sub(dsp56k_core* cpustate, const uint16_t op_byte, typed /* S L E U N Z V C */ /* * * * * * * * * */ /* TODO S, L, E, U */ - if ( *((uint64_t*)D.addr) & U64(0x0000008000000000)) DSP56K_N_SET(); else DSP56K_N_CLEAR(); - if ( *((uint64_t*)D.addr) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); - if ((*((uint64_t*)D.addr) & U64(0xffffff0000000000)) != 0) DSP56K_V_SET(); else DSP56K_V_CLEAR(); - if ((*((uint64_t*)D.addr) & U64(0xffffff0000000000)) != 0) DSP56K_C_SET(); else DSP56K_C_CLEAR(); + if ( *((uint64_t*)D.addr) & 0x0000008000000000U) DSP56K_N_SET(); else DSP56K_N_CLEAR(); + if ( *((uint64_t*)D.addr) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); + if ((*((uint64_t*)D.addr) & 0xffffff0000000000U) != 0) DSP56K_V_SET(); else DSP56K_V_CLEAR(); + if ((*((uint64_t*)D.addr) & 0xffffff0000000000U) != 0) DSP56K_C_SET(); else DSP56K_C_CLEAR(); cycles += 2; /* TODO: + mv oscillator cycles */ return 1; @@ -1737,12 +1737,12 @@ static size_t dsp56k_op_cmp(dsp56k_core* cpustate, const uint16_t op_byte, typed } /* Sign-extend word for proper subtraction op */ - if ((S.data_type == DT_WORD) && cmpVal & U64(0x0000000080000000)) - cmpVal |= U64(0x000000ff00000000); + if ((S.data_type == DT_WORD) && cmpVal & 0x0000000080000000U) + cmpVal |= 0x000000ff00000000U; /* Make sure they're both real 40-bit values */ - cmpVal &= U64(0x000000ffffffffff); - *((uint64_t*)D.addr) &= U64(0x000000ffffffffff); + cmpVal &= 0x000000ffffffffffU; + *((uint64_t*)D.addr) &= 0x000000ffffffffffU; /* Operate */ result = *((uint64_t*)D.addr) - cmpVal; @@ -1753,10 +1753,10 @@ static size_t dsp56k_op_cmp(dsp56k_core* cpustate, const uint16_t op_byte, typed /* S L E U N Z V C */ /* * * * * * * * * */ /* TODO: S, L, E, U */ - if ( result & U64(0x0000008000000000)) DSP56K_N_SET(); else DSP56K_N_CLEAR(); + if ( result & 0x0000008000000000U) DSP56K_N_SET(); else DSP56K_N_CLEAR(); if ( result == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); - if ((result & U64(0xffffff0000000000)) != 0) DSP56K_V_SET(); else DSP56K_V_CLEAR(); - if ((result & U64(0xffffff0000000000)) != 0) DSP56K_C_SET(); else DSP56K_C_CLEAR(); + if ((result & 0xffffff0000000000U) != 0) DSP56K_V_SET(); else DSP56K_V_CLEAR(); + if ((result & 0xffffff0000000000U) != 0) DSP56K_C_SET(); else DSP56K_C_CLEAR(); cycles += 2; /* TODO: + mv oscillator clock cycles */ @@ -1788,8 +1788,8 @@ static size_t dsp56k_op_not(dsp56k_core* cpustate, const uint16_t op_byte, typed /* S L E U N Z V C */ /* * * - - ? ? 0 - */ /* TODO: S?, L */ - if ( *((uint64_t*)D.addr) & U64(0x0000000080000000)) DSP56K_N_SET(); else DSP56K_N_CLEAR(); - if ((*((uint64_t*)D.addr) & U64(0x00000000ffff0000)) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); + if ( *((uint64_t*)D.addr) & 0x0000000080000000U) DSP56K_N_SET(); else DSP56K_N_CLEAR(); + if ((*((uint64_t*)D.addr) & 0x00000000ffff0000U) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); DSP56K_V_CLEAR(); cycles += 2; /* TODO: + mv oscillator cycles */ @@ -1816,12 +1816,12 @@ static size_t dsp56k_op_dec24(dsp56k_core* cpustate, const uint16_t op_byte, typ *p_accum = *((uint64_t*)D.addr); /* TODO: I wonder if workBits24 should be signed? */ - workBits24 = ((*((uint64_t*)D.addr)) & U64(0x000000ffffff0000)) >> 16; + workBits24 = ((*((uint64_t*)D.addr)) & 0x000000ffffff0000U) >> 16; workBits24--; workBits24 &= 0x00ffffff; /* Solves -x issues */ /* Set the D bits with the dec result */ - *((uint64_t*)D.addr) &= U64(0x000000000000ffff); + *((uint64_t*)D.addr) &= 0x000000000000ffffU; *((uint64_t*)D.addr) |= (((uint64_t)(workBits24)) << 16); d_register->addr = D.addr; @@ -1830,8 +1830,8 @@ static size_t dsp56k_op_dec24(dsp56k_core* cpustate, const uint16_t op_byte, typ /* S L E U N Z V C */ /* * * * * * ? * * */ /* TODO: S, L, E, U, V, C */ - if ( *((uint64_t*)D.addr) & U64(0x0000008000000000)) DSP56K_N_SET(); else DSP56K_N_CLEAR(); - if ((*((uint64_t*)D.addr) & U64(0x000000ffffff0000)) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); + if ( *((uint64_t*)D.addr) & 0x0000008000000000U) DSP56K_N_SET(); else DSP56K_N_CLEAR(); + if ((*((uint64_t*)D.addr) & 0x000000ffffff0000U) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); cycles += 2; /* TODO: + mv oscillator clock cycles */ return 1; @@ -1857,8 +1857,8 @@ static size_t dsp56k_op_and(dsp56k_core* cpustate, const uint16_t op_byte, typed /* S L E U N Z V C */ /* * * - - ? ? 0 - */ /* TODO: S, L */ - if ( *((uint64_t*)D.addr) & U64(0x0000000080000000)) DSP56K_N_SET(); else DSP56K_N_CLEAR(); - if ((*((uint64_t*)D.addr) & U64(0x00000000ffff0000)) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); + if ( *((uint64_t*)D.addr) & 0x0000000080000000U) DSP56K_N_SET(); else DSP56K_N_CLEAR(); + if ((*((uint64_t*)D.addr) & 0x00000000ffff0000U) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); DSP56K_V_CLEAR(); cycles += 2; /* TODO: + mv oscillator cycles */ @@ -1877,28 +1877,28 @@ static size_t dsp56k_op_abs(dsp56k_core* cpustate, const uint16_t op_byte, typed /* Sign extend D into a temp variable */ opD = *p_accum; - if (opD & U64(0x0000008000000000)) - opD |= U64(0xffffff0000000000); + if (opD & 0x0000008000000000U) + opD |= 0xffffff0000000000U; else - opD &= U64(0x000000ffffffffff); + opD &= 0x000000ffffffffffU; /* Take the absolute value and clean up */ opD = (opD < 0) ? -opD : opD; - opD &= U64(0x000000ffffffffff); + opD &= 0x000000ffffffffffU; /* Reassign */ *((uint64_t*)D.addr) = opD; /* Special overflow case */ - if ((*p_accum) == U64(0x0000008000000000)) - *((uint64_t*)D.addr) = U64(0x0000007fffffffff); + if ((*p_accum) == 0x0000008000000000U) + *((uint64_t*)D.addr) = 0x0000007fffffffffU; /* S L E U N Z V C */ /* * * * * * * * - */ /* TODO: S, L, E, U */ - if ( *((uint64_t*)D.addr) & U64(0x0000008000000000)) DSP56K_N_SET(); else DSP56K_N_CLEAR(); - if ((*((uint64_t*)D.addr) & U64(0x000000ffffffffff)) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); - if ((*p_accum) == U64(0x0000008000000000)) DSP56K_V_SET(); else DSP56K_V_CLEAR(); + if ( *((uint64_t*)D.addr) & 0x0000008000000000U) DSP56K_N_SET(); else DSP56K_N_CLEAR(); + if ((*((uint64_t*)D.addr) & 0x000000ffffffffffU) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); + if ((*p_accum) == 0x0000008000000000U) DSP56K_V_SET(); else DSP56K_V_CLEAR(); cycles += 2; /* TODO: + mv oscillator clock cycles */ return 1; @@ -1944,14 +1944,14 @@ static size_t dsp56k_op_cmpm(dsp56k_core* cpustate, const uint16_t op_byte, type if (S.addr == &A || S.addr == &B) { absS = *((uint64_t*)S.addr); - if (absS & U64(0x0000008000000000)) - absS |= U64(0xffffff8000000000); + if (absS & 0x0000008000000000U) + absS |= 0xffffff8000000000U; } else { absS = (*((uint16_t*)S.addr)) << 16; - if (absS & U64(0x0000000080000000)) - absS |= U64(0xffffffff80000000); + if (absS & 0x0000000080000000U) + absS |= 0xffffffff80000000U; } absS = (absS < 0) ? -absS : absS; @@ -1959,14 +1959,14 @@ static size_t dsp56k_op_cmpm(dsp56k_core* cpustate, const uint16_t op_byte, type if (D.addr == &A || D.addr == &B) { absD = *((uint64_t*)D.addr); - if (absD & U64(0x0000008000000000)) - absD |= U64(0xffffff8000000000); + if (absD & 0x0000008000000000U) + absD |= 0xffffff8000000000U; } else { absD = (*((uint16_t*)D.addr)) << 16; - if (absS & U64(0x0000000080000000)) - absS |= U64(0xffffffff80000000); + if (absS & 0x0000000080000000U) + absS |= 0xffffffff80000000U; } absD = (absD < 0) ? -absD : absD; @@ -1979,10 +1979,10 @@ static size_t dsp56k_op_cmpm(dsp56k_core* cpustate, const uint16_t op_byte, type /* S L E U N Z V C */ /* * * * * * * * * */ /* TODO: S, L, E, U */ - if ( (absResult) & U64(0x0000008000000000)) DSP56K_N_SET(); else DSP56K_N_CLEAR(); - if (((absResult) & U64(0x000000ffffffffff)) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); - if ( (absResult & U64(0xffffff0000000000)) != 0) DSP56K_V_SET(); else DSP56K_V_CLEAR(); - if ( (absResult & U64(0xffffff0000000000)) != 0) DSP56K_C_SET(); else DSP56K_C_CLEAR(); + if ( (absResult) & 0x0000008000000000U) DSP56K_N_SET(); else DSP56K_N_CLEAR(); + if (((absResult) & 0x000000ffffffffffU) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); + if ( (absResult & 0xffffff0000000000U) != 0) DSP56K_V_SET(); else DSP56K_V_CLEAR(); + if ( (absResult & 0xffffff0000000000U) != 0) DSP56K_C_SET(); else DSP56K_C_CLEAR(); cycles += 2; /* TODO: +mv oscillator cycles */ return 1; @@ -2016,13 +2016,13 @@ static size_t dsp56k_op_mpy(dsp56k_core* cpustate, const uint16_t op_byte, typed if (k) result *= -1; - (*((uint64_t*)D)) = result & U64(0x000000ffffffffff); + (*((uint64_t*)D)) = result & 0x000000ffffffffffU; /* S L E U N Z V C */ /* * * * * * * * - */ /* TODO: S, L, E, V */ - if ( *((uint64_t*)D) & U64(0x0000008000000000)) DSP56K_N_SET(); else DSP56K_N_CLEAR(); - if ((*((uint64_t*)D) & U64(0x000000ffffffffff)) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); + if ( *((uint64_t*)D) & 0x0000008000000000U) DSP56K_N_SET(); else DSP56K_N_CLEAR(); + if ((*((uint64_t*)D) & 0x000000ffffffffffU) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); cycles += 2; /* TODO: +mv oscillator cycles */ return 1; @@ -2063,10 +2063,10 @@ static size_t dsp56k_op_mac(dsp56k_core* cpustate, const uint16_t op_byte, typed /* Sign extend D into a temp variable */ opD = (*((uint64_t*)D)); - if (opD & U64(0x0000008000000000)) - opD |= U64(0xffffff0000000000); + if (opD & 0x0000008000000000U) + opD |= 0xffffff0000000000U; else - opD &= U64(0x000000ffffffffff); + opD &= 0x000000ffffffffffU; /* Negate if necessary */ if (k) @@ -2076,7 +2076,7 @@ static size_t dsp56k_op_mac(dsp56k_core* cpustate, const uint16_t op_byte, typed opD += result; /* And out the bits that don't live in the register */ - opD &= U64(0x000000ffffffffff); + opD &= 0x000000ffffffffffU; (*((uint64_t*)D)) = (uint64_t)opD; @@ -2087,8 +2087,8 @@ static size_t dsp56k_op_mac(dsp56k_core* cpustate, const uint16_t op_byte, typed /* S L E U N Z V C */ /* * * * * * * * - */ /* TODO: S, L, E, V */ - if ( *((uint64_t*)D) & U64(0x0000008000000000)) DSP56K_N_SET(); else DSP56K_N_CLEAR(); - if ((*((uint64_t*)D) & U64(0x000000ffffffffff)) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); + if ( *((uint64_t*)D) & 0x0000008000000000U) DSP56K_N_SET(); else DSP56K_N_CLEAR(); + if ((*((uint64_t*)D) & 0x000000ffffffffffU) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); cycles += 2; /* TODO: +mv oscillator cycles */ return 1; @@ -2121,10 +2121,10 @@ static size_t dsp56k_op_macr(dsp56k_core* cpustate, const uint16_t op_byte, type /* Sign extend D into a temp variable */ opD = (*((uint64_t*)D)); - if (opD & U64(0x0000008000000000)) - opD |= U64(0xffffff0000000000); + if (opD & 0x0000008000000000U) + opD |= 0xffffff0000000000U; else - opD &= U64(0x000000ffffffffff); + opD &= 0x000000ffffffffffU; /* Negate if necessary */ if (k) @@ -2135,13 +2135,13 @@ static size_t dsp56k_op_macr(dsp56k_core* cpustate, const uint16_t op_byte, type /* Round the result */ /* WARNING : ROUNDING NOT FULLY IMPLEMENTED YET! */ - if ((opD & U64(0x000000000000ffff)) >= 0x8000) - opD += U64(0x0000000000010000); + if ((opD & 0x000000000000ffffU) >= 0x8000) + opD += 0x0000000000010000U; - opD &= U64(0x000000ffffff0000); + opD &= 0x000000ffffff0000U; /* And out the bits that don't live in the register */ - opD &= U64(0x000000ffffffffff); + opD &= 0x000000ffffffffffU; /* Store the result */ (*((uint64_t*)D)) = (uint64_t)opD; @@ -2153,8 +2153,8 @@ static size_t dsp56k_op_macr(dsp56k_core* cpustate, const uint16_t op_byte, type /* S L E U N Z V C */ /* * * * * * * * - */ /* TODO: S, L, E, V */ - if ( *((uint64_t*)D) & U64(0x0000008000000000)) DSP56K_N_SET(); else DSP56K_N_CLEAR(); - if ((*((uint64_t*)D) & U64(0x000000ffffffffff)) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); + if ( *((uint64_t*)D) & 0x0000008000000000U) DSP56K_N_SET(); else DSP56K_N_CLEAR(); + if ((*((uint64_t*)D) & 0x000000ffffffffffU) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); cycles += 2; /* TODO: +mv oscillator cycles */ return 1; @@ -2215,7 +2215,7 @@ static size_t dsp56k_op_asl4(dsp56k_core* cpustate, const uint16_t op, uint8_t* p_accum = *((uint64_t*)D.addr); *((uint64_t*)D.addr) = (*((uint64_t*)D.addr)) << 4; - *((uint64_t*)D.addr) = (*((uint64_t*)D.addr)) & U64(0x000000ffffffffff); + *((uint64_t*)D.addr) = (*((uint64_t*)D.addr)) & 0x000000ffffffffffU; /* S L E U N Z V C */ /* - ? * * * * ? ? */ @@ -2223,10 +2223,10 @@ static size_t dsp56k_op_asl4(dsp56k_core* cpustate, const uint16_t op, uint8_t* /* V - Set if an arithmetic overflow occurs in the 40 bit result. Also set if bit 35 through 39 are not the same. */ /* C - Set if bit 36 of source operand is set. Cleared otherwise. */ - if (*((uint64_t*)D.addr) & U64(0x0000008000000000)) DSP56K_N_SET(); else DSP56K_N_CLEAR(); - if (*((uint64_t*)D.addr) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); - if ( (*((uint64_t*)D.addr) & U64(0x000000ff00000000)) != (p_accum & U64(0x000000ff00000000)) ) DSP56K_V_SET(); else DSP56K_V_CLEAR(); - if (p_accum & U64(0x0000001000000000)) DSP56K_C_SET(); else DSP56K_C_CLEAR(); + if (*((uint64_t*)D.addr) & 0x0000008000000000U) DSP56K_N_SET(); else DSP56K_N_CLEAR(); + if (*((uint64_t*)D.addr) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); + if ( (*((uint64_t*)D.addr) & 0x000000ff00000000U) != (p_accum & 0x000000ff00000000U) ) DSP56K_V_SET(); else DSP56K_V_CLEAR(); + if (p_accum & 0x0000001000000000U) DSP56K_C_SET(); else DSP56K_C_CLEAR(); cycles += 2; return 1; @@ -2242,22 +2242,22 @@ static size_t dsp56k_op_asr4(dsp56k_core* cpustate, const uint16_t op, uint8_t* p_accum = *((uint64_t*)D.addr); *((uint64_t*)D.addr) = (*((uint64_t*)D.addr)) >> 4; - *((uint64_t*)D.addr) = (*((uint64_t*)D.addr)) & U64(0x000000ffffffffff); + *((uint64_t*)D.addr) = (*((uint64_t*)D.addr)) & 0x000000ffffffffffU; /* The top 4 bits become the old bit 39 */ - if (p_accum & U64(0x0000008000000000)) - *((uint64_t*)D.addr) |= U64(0x000000f000000000); + if (p_accum & 0x0000008000000000U) + *((uint64_t*)D.addr) |= 0x000000f000000000U; else - *((uint64_t*)D.addr) &= (~U64(0x000000f000000000)); + *((uint64_t*)D.addr) &= (~u64(0x000000f000000000U)); /* S L E U N Z V C */ /* - * * * * * 0 ? */ /* TODO: E, U */ /* C - Set if bit 3 of source operand is set. Cleared otherwise. */ - if (*((uint64_t*)D.addr) & U64(0x0000008000000000)) DSP56K_N_SET(); else DSP56K_N_CLEAR(); - if (*((uint64_t*)D.addr) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); + if (*((uint64_t*)D.addr) & 0x0000008000000000U) DSP56K_N_SET(); else DSP56K_N_CLEAR(); + if (*((uint64_t*)D.addr) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); DSP56K_V_CLEAR(); - if (p_accum & U64(0x0000000000000008)) DSP56K_C_SET(); else DSP56K_C_CLEAR(); + if (p_accum & 0x0000000000000008U) DSP56K_C_SET(); else DSP56K_C_CLEAR(); cycles += 2; return 1; @@ -2275,18 +2275,18 @@ static size_t dsp56k_op_asr16(dsp56k_core* cpustate, const uint16_t op, uint8_t* *((uint64_t*)D.addr) = *((uint64_t*)D.addr) >> 16; - if(backupVal & U64(0x0000008000000000)) - *((uint64_t*)D.addr) |= U64(0x000000ffff000000); + if (backupVal & 0x0000008000000000U) + *((uint64_t*)D.addr) |= 0x000000ffff000000U; else - *((uint64_t*)D.addr) &= U64(0x0000000000ffffff); + *((uint64_t*)D.addr) &= 0x0000000000ffffffU; /* S L E U N Z V C */ /* - * * * * * 0 ? */ /* TODO: E, U */ - if (*((uint64_t*)D.addr) & U64(0x0000008000000000)) DSP56K_N_SET(); else DSP56K_N_CLEAR(); - if (*((uint64_t*)D.addr) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); + if (*((uint64_t*)D.addr) & 0x0000008000000000U) DSP56K_N_SET(); else DSP56K_N_CLEAR(); + if (*((uint64_t*)D.addr) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); DSP56K_V_CLEAR(); - if (backupVal & U64(0x0000000000008000)) DSP56K_C_SET(); else DSP56K_C_CLEAR(); + if (backupVal & 0x0000000000008000U) DSP56K_C_SET(); else DSP56K_C_CLEAR(); cycles += 2; return 1; @@ -2774,8 +2774,8 @@ static size_t dsp56k_op_dmac(dsp56k_core* cpustate, const uint16_t op, uint8_t* /* S L E U N Z V C */ /* - * * * * * * - */ /* TODO: L, E, U, V */ - if ( *((uint64_t*)D) & U64(0x0000008000000000)) DSP56K_N_SET(); else DSP56K_N_CLEAR(); - if ((*((uint64_t*)D) & U64(0x000000ffffffffff)) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); + if ( *((uint64_t*)D) & 0x0000008000000000U) DSP56K_N_SET(); else DSP56K_N_CLEAR(); + if ((*((uint64_t*)D) & 0x000000ffffffffffU) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); cycles += 2; return 1; @@ -2982,16 +2982,16 @@ static size_t dsp56k_op_imac(dsp56k_core* cpustate, const uint16_t op, uint8_t* /* Sign extend D into a temp variable */ opD = (*((uint64_t*)D)); - if (opD & U64(0x0000008000000000)) - opD |= U64(0xffffff0000000000); + if (opD & 0x0000008000000000U) + opD |= 0xffffff0000000000U; else - opD &= U64(0x000000ffffffffff); + opD &= 0x000000ffffffffffU; /* Accumulate */ opD += result; /* And out the bits that don't live in the register */ - opD &= U64(0x000000ffffffffff); + opD &= 0x000000ffffffffffU; (*((uint64_t*)D)) = (uint64_t)opD; @@ -2999,8 +2999,8 @@ static size_t dsp56k_op_imac(dsp56k_core* cpustate, const uint16_t op, uint8_t* /* - * ? ? * ? ? - */ /* TODO: L */ /* U,E - Will not be set correctly by this instruction*/ - if ( *((uint64_t*)D) & U64(0x0000008000000000)) DSP56K_N_SET(); else DSP56K_N_CLEAR(); - if ((*((uint64_t*)D) & U64(0x000000ffffff0000)) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); + if ( *((uint64_t*)D) & 0x0000008000000000U) DSP56K_N_SET(); else DSP56K_N_CLEAR(); + if ((*((uint64_t*)D) & 0x000000ffffff0000U) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); DSP56K_V_CLEAR(); cycles += 2; @@ -3231,13 +3231,13 @@ static size_t dsp56k_op_macsuuu(dsp56k_core* cpustate, const uint16_t op, uint8_ (*((uint64_t*)D)) += result; /* And out the bits that don't live in the register */ - (*((uint64_t*)D)) &= U64(0x000000ffffffffff); + (*((uint64_t*)D)) &= 0x000000ffffffffffU; /* S L E U N Z V C */ /* - * * * * * * - */ /* TODO: L, E, U, V */ - if ( *((uint64_t*)D) & U64(0x0000008000000000)) DSP56K_N_SET(); else DSP56K_N_CLEAR(); - if ((*((uint64_t*)D) & U64(0x000000ffffffffff)) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); + if ( *((uint64_t*)D) & 0x0000008000000000U) DSP56K_N_SET(); else DSP56K_N_CLEAR(); + if ((*((uint64_t*)D) & 0x000000ffffffffffU) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); cycles += 2; return 1; @@ -3702,13 +3702,13 @@ static size_t dsp56k_op_mpysuuu(dsp56k_core* cpustate, const uint16_t op, uint8_ (*((uint64_t*)D)) = result; /* And out the bits that don't live in the register */ - (*((uint64_t*)D)) &= U64(0x000000ffffffffff); + (*((uint64_t*)D)) &= 0x000000ffffffffffU; /* S L E U N Z V C */ /* - * * * * * * - */ /* TODO: L, E, U, V */ - if ( *((uint64_t*)D) & U64(0x0000008000000000)) DSP56K_N_SET(); else DSP56K_N_CLEAR(); - if ((*((uint64_t*)D) & U64(0x000000ffffffffff)) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); + if ( *((uint64_t*)D) & 0x0000008000000000U) DSP56K_N_SET(); else DSP56K_N_CLEAR(); + if ((*((uint64_t*)D) & 0x000000ffffffffffU) == 0) DSP56K_Z_SET(); else DSP56K_Z_CLEAR(); cycles += 2; return 1; @@ -4828,7 +4828,7 @@ static void SetDestinationValue(typed_pointer source, typed_pointer dest) case DT_BYTE: *((uint8_t*)dest.addr) = (*((uint8_t*) source.addr)) & 0xff; break; case DT_WORD: *((uint8_t*)dest.addr) = (*((uint16_t*)source.addr)) & 0x00ff; break; case DT_DOUBLE_WORD: *((uint8_t*)dest.addr) = (*((uint32_t*)source.addr)) & 0x000000ff; break; - case DT_LONG_WORD: *((uint8_t*)dest.addr) = (*((uint64_t*)source.addr)) & U64(0x00000000000000ff); break; + case DT_LONG_WORD: *((uint8_t*)dest.addr) = (*((uint64_t*)source.addr)) & 0x00000000000000ffU; break; } break ; @@ -4839,7 +4839,7 @@ static void SetDestinationValue(typed_pointer source, typed_pointer dest) case DT_BYTE: *((uint16_t*)dest.addr) = (*((uint8_t*) source.addr)) & 0xff; break; case DT_WORD: *((uint16_t*)dest.addr) = (*((uint16_t*)source.addr)) & 0xffff; break; case DT_DOUBLE_WORD: *((uint16_t*)dest.addr) = (*((uint32_t*)source.addr)) & 0x0000ffff; break; - case DT_LONG_WORD: *((uint16_t*)dest.addr) = (*((uint64_t*)source.addr)) & U64(0x000000000000ffff); break; /* TODO: Shift limiter action! A-147 */ + case DT_LONG_WORD: *((uint16_t*)dest.addr) = (*((uint64_t*)source.addr)) & 0x000000000000ffffU; break; /* TODO: Shift limiter action! A-147 */ } break ; @@ -4850,7 +4850,7 @@ static void SetDestinationValue(typed_pointer source, typed_pointer dest) case DT_BYTE: *((uint32_t*)dest.addr) = (*((uint8_t*) source.addr)) & 0xff; break; case DT_WORD: *((uint32_t*)dest.addr) = (*((uint16_t*)source.addr)) & 0xffff; break; case DT_DOUBLE_WORD: *((uint32_t*)dest.addr) = (*((uint32_t*)source.addr)) & 0xffffffff; break; - case DT_LONG_WORD: *((uint32_t*)dest.addr) = (*((uint64_t*)source.addr)) & U64(0x00000000ffffffff); break; + case DT_LONG_WORD: *((uint32_t*)dest.addr) = (*((uint64_t*)source.addr)) & 0x00000000ffffffffU; break; } break ; @@ -4861,12 +4861,12 @@ static void SetDestinationValue(typed_pointer source, typed_pointer dest) case DT_BYTE: *((uint64_t*)dest.addr) = (*((uint8_t*)source.addr)) & 0xff; break; case DT_WORD: destinationValue = (*((uint16_t*)source.addr)) << 16; - if (destinationValue & U64(0x0000000080000000)) - destinationValue |= U64(0x000000ff00000000); + if (destinationValue & 0x0000000080000000U) + destinationValue |= 0x000000ff00000000U; *((uint64_t*)dest.addr) = (uint64_t)destinationValue; break; /* Forget not, yon shift register */ case DT_DOUBLE_WORD: *((uint64_t*)dest.addr) = (*((uint32_t*)source.addr)) & 0xffffffff; break; - case DT_LONG_WORD: *((uint64_t*)dest.addr) = (*((uint64_t*)source.addr)) & U64(0x000000ffffffffff); break; + case DT_LONG_WORD: *((uint64_t*)dest.addr) = (*((uint64_t*)source.addr)) & 0x000000ffffffffffU; break; } break ; } @@ -4883,7 +4883,7 @@ static void SetDataMemoryValue(dsp56k_core* cpustate, typed_pointer source, uint /* !!! Is this universal ??? */ /* !!! Forget not, yon shift-limiter !!! */ - case DT_LONG_WORD: cpustate->data->write_word(destinationAddr, (uint16_t)( ((*((uint64_t*)source.addr)) & U64(0x00000000ffff0000)) >> 16) ) ; break ; + case DT_LONG_WORD: cpustate->data->write_word(destinationAddr, (uint16_t)( ((*((uint64_t*)source.addr)) & 0x00000000ffff0000U) >> 16) ) ; break ; } } @@ -4898,6 +4898,6 @@ static void SetProgramMemoryValue(dsp56k_core* cpustate, typed_pointer source, u /* !!! Is this universal ??? */ /* !!! Forget not, yon shift-limiter !!! */ - case DT_LONG_WORD: cpustate->program->write_word(destinationAddr, (uint16_t)( ((*((uint64_t*)source.addr)) & U64(0x00000000ffff0000)) >> 16) ) ; break ; + case DT_LONG_WORD: cpustate->program->write_word(destinationAddr, (uint16_t)( ((*((uint64_t*)source.addr)) & 0x00000000ffff0000U) >> 16) ) ; break ; } } diff --git a/src/devices/cpu/e132xs/e132xs.cpp b/src/devices/cpu/e132xs/e132xs.cpp index 0fea0efe55b..6f26c9daa8d 100644 --- a/src/devices/cpu/e132xs/e132xs.cpp +++ b/src/devices/cpu/e132xs/e132xs.cpp @@ -2858,7 +2858,7 @@ void hyperstone_device::hyperstone_sardi(struct hyperstone_device::regs_decode * int i; for( i = 0; i < N_VALUE; i++ ) { - val |= (U64(0x8000000000000000) >> i); + val |= (0x8000000000000000U >> i); } } @@ -2908,7 +2908,7 @@ void hyperstone_device::hyperstone_sard(struct hyperstone_device::regs_decode *d int i; for( i = 0; i < n; i++ ) { - val |= (U64(0x8000000000000000) >> i); + val |= (0x8000000000000000U >> i); } } @@ -2965,7 +2965,7 @@ void hyperstone_device::hyperstone_shldi(struct hyperstone_device::regs_decode * low_order = DREGF; val = concat_64(high_order, low_order); - SET_C( (N_VALUE)?(((val<<(N_VALUE-1))&U64(0x8000000000000000))?1:0):0); + SET_C( (N_VALUE)?(((val<<(N_VALUE-1))&0x8000000000000000U)?1:0):0); mask = ((((uint64_t)1) << (32 - N_VALUE)) - 1) ^ 0xffffffff; tmp = high_order << N_VALUE; @@ -3009,7 +3009,7 @@ void hyperstone_device::hyperstone_shld(struct hyperstone_device::regs_decode *d mask = ((((uint64_t)1) << (32 - n)) - 1) ^ 0xffffffff; val = concat_64(high_order, low_order); - SET_C( (n)?(((val<<(n-1))&U64(0x8000000000000000))?1:0):0); + SET_C( (n)?(((val<<(n-1))&0x8000000000000000U)?1:0):0); tmp = high_order << n; if( ((high_order & mask) && (!(tmp & 0x80000000))) || diff --git a/src/devices/cpu/es5510/es5510.cpp b/src/devices/cpu/es5510/es5510.cpp index 6191369a6a3..9d44de1acd7 100644 --- a/src/devices/cpu/es5510/es5510.cpp +++ b/src/devices/cpu/es5510/es5510.cpp @@ -16,8 +16,8 @@ static const int32_t MIN_24 = -(1 << 23); static const int32_t MAX_24 = (1 << 23) - 1; -static const int64_t MIN_48 = -(S64(1) << 47); -static const int64_t MAX_48 = (S64(1) << 47) - 1; +static const int64_t MIN_48 = -(s64(1) << 47); +static const int64_t MAX_48 = (s64(1) << 47) - 1; #define SIGN_BIT_24 (0x00800000) #define GET_SIGN_BIT_24(x) ((x) & SIGN_BIT_24) @@ -27,8 +27,8 @@ static const int64_t MAX_48 = (S64(1) << 47) - 1; static inline int32_t SX(int32_t x) { return IS_NEGATIVE(x) ? x | 0xff000000 : x & 0x00ffffff; } static inline int32_t SC(int32_t x) { return x & 0x00ffffff; } -static inline int64_t SX64(int64_t x) { return (x & S64(0x0000800000000000)) ? x | S64(0xffff000000000000) : x & S64(0x0000ffffffffffff); } -//static inline int64_t SC64(int64_t x) { return x & S64(0x0000ffffffffffff); } +static inline int64_t SX64(int64_t x) { return (x & s64(0x0000800000000000U)) ? x | s64(0xffff000000000000U) : x & s64(0x0000ffffffffffffU); } +//static inline int64_t SC64(int64_t x) { return x & s64(0x0000ffffffffffffU); } #define VERBOSE 0 #define VERBOSE_EXEC 0 @@ -422,12 +422,12 @@ WRITE8_MEMBER(es5510_device::host_w) break; /* 0x03 to 0x08 INSTR Register */ - case 0x03: instr_latch = ((instr_latch&U64(0x00ffffffffff)) | ((int64_t)data&0xff)<<40); LOG(("%s",string_format("ES5510: Host Write INSTR latch[5] = %02x -> %012I64x\n", data, instr_latch).c_str())); break; - case 0x04: instr_latch = ((instr_latch&U64(0xff00ffffffff)) | ((int64_t)data&0xff)<<32); LOG(("%s",string_format("ES5510: Host Write INSTR latch[4] = %02x -> %012I64x\n", data, instr_latch).c_str())); break; - case 0x05: instr_latch = ((instr_latch&U64(0xffff00ffffff)) | ((int64_t)data&0xff)<<24); LOG(("%s",string_format("ES5510: Host Write INSTR latch[3] = %02x -> %012I64x\n", data, instr_latch).c_str())); break; - case 0x06: instr_latch = ((instr_latch&U64(0xffffff00ffff)) | ((int64_t)data&0xff)<<16); LOG(("%s",string_format("ES5510: Host Write INSTR latch[2] = %02x -> %012I64x\n", data, instr_latch).c_str())); break; - case 0x07: instr_latch = ((instr_latch&U64(0xffffffff00ff)) | ((int64_t)data&0xff)<< 8); LOG(("%s",string_format("ES5510: Host Write INSTR latch[1] = %02x -> %012I64x\n", data, instr_latch).c_str())); break; - case 0x08: instr_latch = ((instr_latch&U64(0xffffffffff00)) | ((int64_t)data&0xff)<< 0); LOG(("%s",string_format("ES5510: Host Write INSTR latch[0] = %02x -> %012I64x\n", data, instr_latch).c_str())); break; + case 0x03: instr_latch = ((instr_latch&0x00ffffffffffU) | ((int64_t)data&0xff)<<40); LOG(("%s",string_format("ES5510: Host Write INSTR latch[5] = %02x -> %012I64x\n", data, instr_latch).c_str())); break; + case 0x04: instr_latch = ((instr_latch&0xff00ffffffffU) | ((int64_t)data&0xff)<<32); LOG(("%s",string_format("ES5510: Host Write INSTR latch[4] = %02x -> %012I64x\n", data, instr_latch).c_str())); break; + case 0x05: instr_latch = ((instr_latch&0xffff00ffffffU) | ((int64_t)data&0xff)<<24); LOG(("%s",string_format("ES5510: Host Write INSTR latch[3] = %02x -> %012I64x\n", data, instr_latch).c_str())); break; + case 0x06: instr_latch = ((instr_latch&0xffffff00ffffU) | ((int64_t)data&0xff)<<16); LOG(("%s",string_format("ES5510: Host Write INSTR latch[2] = %02x -> %012I64x\n", data, instr_latch).c_str())); break; + case 0x07: instr_latch = ((instr_latch&0xffffffff00ffU) | ((int64_t)data&0xff)<< 8); LOG(("%s",string_format("ES5510: Host Write INSTR latch[1] = %02x -> %012I64x\n", data, instr_latch).c_str())); break; + case 0x08: instr_latch = ((instr_latch&0xffffffffff00U) | ((int64_t)data&0xff)<< 0); LOG(("%s",string_format("ES5510: Host Write INSTR latch[0] = %02x -> %012I64x\n", data, instr_latch).c_str())); break; /* 0x09 to 0x0b DIL Register (r/o) */ @@ -477,7 +477,7 @@ WRITE8_MEMBER(es5510_device::host_w) break; case 0x80: /* Read select - GPR + INSTR */ - LOG(("%s",string_format("ES5510: Host Read INSTR+GPR %02x (%s): %012I64x %06x (%d)\n", data, REGNAME(data & 0xff), instr[data] & U64(0xffffffffffff), gpr[data] & 0xffffff, gpr[data]).c_str())); + LOG(("%s",string_format("ES5510: Host Read INSTR+GPR %02x (%s): %012I64x %06x (%d)\n", data, REGNAME(data & 0xff), instr[data] & 0xffffffffffffU, gpr[data] & 0xffffff, gpr[data]).c_str())); /* Check if an INSTR address is selected */ if (data < 0xa0) { @@ -498,10 +498,10 @@ WRITE8_MEMBER(es5510_device::host_w) case 0xc0: /* Write select - INSTR */ #if VERBOSE DESCRIBE_INSTR(buf, instr_latch, gpr[data], nullptr, nullptr, nullptr, nullptr); - LOG(("%s",string_format("ES5510: Host Write INSTR %02x %012I64x: %s\n", data, instr_latch&U64(0xffffffffffff), buf).c_str())); + LOG(("%s",string_format("ES5510: Host Write INSTR %02x %012I64x: %s\n", data, instr_latch&0xffffffffffffU, buf).c_str())); #endif if (data < 0xa0) { - instr[data] = instr_latch&U64(0xffffffffffff); + instr[data] = instr_latch&0xffffffffffffU; } break; @@ -802,7 +802,7 @@ void es5510_device::execute_run() { } #endif machl = mulacc.result; - int32_t tmp = mac_overflow ? (machl < 0 ? MIN_24 : MAX_24) : (mulacc.result & U64(0x0000ffffff000000)) >> 24; + int32_t tmp = mac_overflow ? (machl < 0 ? MIN_24 : MAX_24) : (mulacc.result & 0x0000ffffff000000U) >> 24; if (mulacc.dst & SRC_DST_REG) { write_reg(mulacc.cReg, tmp); } @@ -1052,7 +1052,7 @@ void es5510_device::write_reg(uint8_t reg, int32_t value) #if VERBOSE_EXEC old = machl; #endif - int64_t masked = machl & (S64(0x00ffffff) << 24); + int64_t masked = machl & (s64(0x00ffffffU) << 24); int64_t shifted = (int64_t)(value & 0x00ffffff) << 0; machl = SX64(masked | shifted); #if VERBOSE_EXEC @@ -1064,7 +1064,7 @@ void es5510_device::write_reg(uint8_t reg, int32_t value) #if VERBOSE_EXEC old = machl; #endif - int64_t masked = machl & (S64(0x00ffffff) << 0); + int64_t masked = machl & (s64(0x00ffffffU) << 0); int64_t shifted = (int64_t)(value & 0x00ffffff) << 24; machl = SX64(masked | shifted); mac_overflow = false; diff --git a/src/devices/cpu/h8/h8.cpp b/src/devices/cpu/h8/h8.cpp index fe25c24d61f..d7b3abf1bb1 100644 --- a/src/devices/cpu/h8/h8.cpp +++ b/src/devices/cpu/h8/h8.cpp @@ -799,7 +799,7 @@ uint32_t h8_device::do_add32(uint32_t v1, uint32_t v2) CCR |= F_N; if(~(v1^v2) & (v1^res) & 0x80000000) CCR |= F_V; - if(res & U64(0x100000000)) + if(res & 0x100000000U) CCR |= F_C; return res; } @@ -891,7 +891,7 @@ uint32_t h8_device::do_sub32(uint32_t v1, uint32_t v2) CCR |= F_N; if((v1^v2) & (v1^res) & 0x80000000) CCR |= F_V; - if(res & U64(0x100000000)) + if(res & 0x100000000U) CCR |= F_C; return res; } diff --git a/src/devices/cpu/i386/pentops.hxx b/src/devices/cpu/i386/pentops.hxx index 00b706bd5f2..42d3958cd0a 100644 --- a/src/devices/cpu/i386/pentops.hxx +++ b/src/devices/cpu/i386/pentops.hxx @@ -4417,36 +4417,36 @@ void i386_device::sse_predicate_compare_double(uint8_t imm8, XMM_REG d, XMM_REG switch (imm8 & 7) { case 0: - d.q[0]=d.f64[0] == s.f64[0] ? U64(0xffffffffffffffff) : 0; - d.q[1]=d.f64[1] == s.f64[1] ? U64(0xffffffffffffffff) : 0; + d.q[0]=d.f64[0] == s.f64[0] ? 0xffffffffffffffffU : 0; + d.q[1]=d.f64[1] == s.f64[1] ? 0xffffffffffffffffU : 0; break; case 1: - d.q[0]=d.f64[0] < s.f64[0] ? U64(0xffffffffffffffff) : 0; - d.q[1]=d.f64[1] < s.f64[1] ? U64(0xffffffffffffffff) : 0; + d.q[0]=d.f64[0] < s.f64[0] ? 0xffffffffffffffffU : 0; + d.q[1]=d.f64[1] < s.f64[1] ? 0xffffffffffffffffU : 0; break; case 2: - d.q[0]=d.f64[0] <= s.f64[0] ? U64(0xffffffffffffffff) : 0; - d.q[1]=d.f64[1] <= s.f64[1] ? U64(0xffffffffffffffff) : 0; + d.q[0]=d.f64[0] <= s.f64[0] ? 0xffffffffffffffffU : 0; + d.q[1]=d.f64[1] <= s.f64[1] ? 0xffffffffffffffffU : 0; break; case 3: - d.q[0]=sse_isdoubleunordered(d.f64[0], s.f64[0]) ? U64(0xffffffffffffffff) : 0; - d.q[1]=sse_isdoubleunordered(d.f64[1], s.f64[1]) ? U64(0xffffffffffffffff) : 0; + d.q[0]=sse_isdoubleunordered(d.f64[0], s.f64[0]) ? 0xffffffffffffffffU : 0; + d.q[1]=sse_isdoubleunordered(d.f64[1], s.f64[1]) ? 0xffffffffffffffffU : 0; break; case 4: - d.q[0]=d.f64[0] != s.f64[0] ? U64(0xffffffffffffffff) : 0; - d.q[1]=d.f64[1] != s.f64[1] ? U64(0xffffffffffffffff) : 0; + d.q[0]=d.f64[0] != s.f64[0] ? 0xffffffffffffffffU : 0; + d.q[1]=d.f64[1] != s.f64[1] ? 0xffffffffffffffffU : 0; break; case 5: - d.q[0]=d.f64[0] < s.f64[0] ? 0 : U64(0xffffffffffffffff); - d.q[1]=d.f64[1] < s.f64[1] ? 0 : U64(0xffffffffffffffff); + d.q[0]=d.f64[0] < s.f64[0] ? 0 : 0xffffffffffffffffU; + d.q[1]=d.f64[1] < s.f64[1] ? 0 : 0xffffffffffffffffU; break; case 6: - d.q[0]=d.f64[0] <= s.f64[0] ? 0 : U64(0xffffffffffffffff); - d.q[1]=d.f64[1] <= s.f64[1] ? 0 : U64(0xffffffffffffffff); + d.q[0]=d.f64[0] <= s.f64[0] ? 0 : 0xffffffffffffffffU; + d.q[1]=d.f64[1] <= s.f64[1] ? 0 : 0xffffffffffffffffU; break; case 7: - d.q[0]=sse_isdoubleordered(d.f64[0], s.f64[0]) ? U64(0xffffffffffffffff) : 0; - d.q[1]=sse_isdoubleordered(d.f64[1], s.f64[1]) ? U64(0xffffffffffffffff) : 0; + d.q[0]=sse_isdoubleordered(d.f64[0], s.f64[0]) ? 0xffffffffffffffffU : 0; + d.q[1]=sse_isdoubleordered(d.f64[1], s.f64[1]) ? 0xffffffffffffffffU : 0; break; } } @@ -4487,28 +4487,28 @@ void i386_device::sse_predicate_compare_double_scalar(uint8_t imm8, XMM_REG d, X switch (imm8 & 7) { case 0: - d.q[0]=d.f64[0] == s.f64[0] ? U64(0xffffffffffffffff) : 0; + d.q[0]=d.f64[0] == s.f64[0] ? 0xffffffffffffffffU : 0; break; case 1: - d.q[0]=d.f64[0] < s.f64[0] ? U64(0xffffffffffffffff) : 0; + d.q[0]=d.f64[0] < s.f64[0] ? 0xffffffffffffffffU : 0; break; case 2: - d.q[0]=d.f64[0] <= s.f64[0] ? U64(0xffffffffffffffff) : 0; + d.q[0]=d.f64[0] <= s.f64[0] ? 0xffffffffffffffffU : 0; break; case 3: - d.q[0]=sse_isdoubleunordered(d.f64[0], s.f64[0]) ? U64(0xffffffffffffffff) : 0; + d.q[0]=sse_isdoubleunordered(d.f64[0], s.f64[0]) ? 0xffffffffffffffffU : 0; break; case 4: - d.q[0]=d.f64[0] != s.f64[0] ? U64(0xffffffffffffffff) : 0; + d.q[0]=d.f64[0] != s.f64[0] ? 0xffffffffffffffffU : 0; break; case 5: - d.q[0]=d.f64[0] < s.f64[0] ? 0 : U64(0xffffffffffffffff); + d.q[0]=d.f64[0] < s.f64[0] ? 0 : 0xffffffffffffffffU; break; case 6: - d.q[0]=d.f64[0] <= s.f64[0] ? 0 : U64(0xffffffffffffffff); + d.q[0]=d.f64[0] <= s.f64[0] ? 0 : 0xffffffffffffffffU; break; case 7: - d.q[0]=sse_isdoubleordered(d.f64[0], s.f64[0]) ? U64(0xffffffffffffffff) : 0; + d.q[0]=sse_isdoubleordered(d.f64[0], s.f64[0]) ? 0xffffffffffffffffU : 0; break; } } diff --git a/src/devices/cpu/i386/x87ops.hxx b/src/devices/cpu/i386/x87ops.hxx index 010a4d2bea3..c2f36e3cfd2 100644 --- a/src/devices/cpu/i386/x87ops.hxx +++ b/src/devices/cpu/i386/x87ops.hxx @@ -91,11 +91,11 @@ * *************************************/ -static const floatx80 fx80_zero = { 0x0000, U64(0x0000000000000000) }; -static const floatx80 fx80_one = { 0x3fff, U64(0x8000000000000000) }; +static const floatx80 fx80_zero = { 0x0000, 0x0000000000000000U }; +static const floatx80 fx80_one = { 0x3fff, 0x8000000000000000U }; -static const floatx80 fx80_ninf = { 0xffff, U64(0x8000000000000000) }; -static const floatx80 fx80_inan = { 0xffff, U64(0xc000000000000000) }; +static const floatx80 fx80_ninf = { 0xffff, 0x8000000000000000U }; +static const floatx80 fx80_inan = { 0xffff, 0xc000000000000000U }; /* Maps x87 round modes to SoftFloat round modes */ static const int x87_to_sf_rc[4] = @@ -141,7 +141,7 @@ static inline int floatx80_is_inf(floatx80 fx) static inline int floatx80_is_denormal(floatx80 fx) { return (((fx.high & 0x7fff) == 0) && - ((fx.low & U64(0x8000000000000000)) == 0) && + ((fx.low & 0x8000000000000000U) == 0) && ((fx.low << 1) != 0)); } @@ -3104,21 +3104,21 @@ void i386_device::x87_fistp_m64int(uint8_t modrm) if (X87_IS_ST_EMPTY(0)) { x87_set_stack_underflow(); - m64int = U64(0x8000000000000000); + m64int = 0x8000000000000000U; } else { floatx80 fx80 = floatx80_round_to_int(ST(0)); - floatx80 lowerLim = int64_to_floatx80(U64(0x8000000000000000)); - floatx80 upperLim = int64_to_floatx80(U64(0x7fffffffffffffff)); + floatx80 lowerLim = int64_to_floatx80(0x8000000000000000U); + floatx80 upperLim = int64_to_floatx80(0x7fffffffffffffffU); m_x87_sw &= ~X87_SW_C1; if (!floatx80_lt(fx80, lowerLim) && floatx80_le(fx80, upperLim)) m64int = floatx80_to_int64(fx80); else - m64int = U64(0x8000000000000000); + m64int = 0x8000000000000000U; } uint32_t ea = GetEA(modrm, 1); @@ -3210,9 +3210,9 @@ void i386_device::x87_fldl2t(uint8_t modrm) value.high = 0x4000; if (X87_RC == X87_CW_RC_UP) - value.low = U64(0xd49a784bcd1b8aff); + value.low = 0xd49a784bcd1b8affU; else - value.low = U64(0xd49a784bcd1b8afe); + value.low = 0xd49a784bcd1b8afeU; m_x87_sw &= ~X87_SW_C1; } @@ -3243,9 +3243,9 @@ void i386_device::x87_fldl2e(uint8_t modrm) value.high = 0x3fff; if (rc == X87_CW_RC_UP || rc == X87_CW_RC_NEAREST) - value.low = U64(0xb8aa3b295c17f0bc); + value.low = 0xb8aa3b295c17f0bcU; else - value.low = U64(0xb8aa3b295c17f0bb); + value.low = 0xb8aa3b295c17f0bbU; m_x87_sw &= ~X87_SW_C1; } @@ -3276,9 +3276,9 @@ void i386_device::x87_fldpi(uint8_t modrm) value.high = 0x4000; if (rc == X87_CW_RC_UP || rc == X87_CW_RC_NEAREST) - value.low = U64(0xc90fdaa22168c235); + value.low = 0xc90fdaa22168c235U; else - value.low = U64(0xc90fdaa22168c234); + value.low = 0xc90fdaa22168c234U; m_x87_sw &= ~X87_SW_C1; } @@ -3309,9 +3309,9 @@ void i386_device::x87_fldlg2(uint8_t modrm) value.high = 0x3ffd; if (rc == X87_CW_RC_UP || rc == X87_CW_RC_NEAREST) - value.low = U64(0x9a209a84fbcff799); + value.low = 0x9a209a84fbcff799U; else - value.low = U64(0x9a209a84fbcff798); + value.low = 0x9a209a84fbcff798U; m_x87_sw &= ~X87_SW_C1; } @@ -3342,9 +3342,9 @@ void i386_device::x87_fldln2(uint8_t modrm) value.high = 0x3ffe; if (rc == X87_CW_RC_UP || rc == X87_CW_RC_NEAREST) - value.low = U64(0xb17217f7d1cf79ac); + value.low = 0xb17217f7d1cf79acU; else - value.low = U64(0xb17217f7d1cf79ab); + value.low = 0xb17217f7d1cf79abU; m_x87_sw &= ~X87_SW_C1; } diff --git a/src/devices/cpu/m68000/m68kcpu.h b/src/devices/cpu/m68000/m68kcpu.h index d9ad9656bf2..2d3d7c27fb0 100644 --- a/src/devices/cpu/m68000/m68kcpu.h +++ b/src/devices/cpu/m68000/m68kcpu.h @@ -153,7 +153,7 @@ class m68000_base_device; #define GET_MSB_16(A) ((A) & 0x8000) #define GET_MSB_17(A) ((A) & 0x10000) #define GET_MSB_32(A) ((A) & 0x80000000) -#define GET_MSB_33(A) ((A) & U64(0x100000000)) +#define GET_MSB_33(A) ((A) & 0x100000000U) /* Isolate nibbles */ #define LOW_NIBBLE(A) ((A) & 0x0f) @@ -168,8 +168,8 @@ class m68000_base_device; #define MASK_OUT_BELOW_16(A) ((A) & ~0xffff) /* No need to mask if we are 32 bit */ -#define MASK_OUT_ABOVE_32(A) ((A) & U64(0xffffffff)) -#define MASK_OUT_BELOW_32(A) ((A) & ~U64(0xffffffff)) +#define MASK_OUT_ABOVE_32(A) ((A) & u64(0xffffffffU)) +#define MASK_OUT_BELOW_32(A) ((A) & ~u64(0xffffffffU)) /* Shift & Rotate Macros. */ #define LSL(A, C) ((A) << (C)) diff --git a/src/devices/cpu/m68000/m68kfpu.hxx b/src/devices/cpu/m68000/m68kfpu.hxx index 9c11acd5fb8..e53f4ad899d 100644 --- a/src/devices/cpu/m68000/m68kfpu.hxx +++ b/src/devices/cpu/m68000/m68kfpu.hxx @@ -10,9 +10,9 @@ #define FPES_OE 0x00002000 #define FPAE_IOP 0x00000080 -#define DOUBLE_INFINITY U64(0x7ff0000000000000) -#define DOUBLE_EXPONENT U64(0x7ff0000000000000) -#define DOUBLE_MANTISSA U64(0x000fffffffffffff) +#define DOUBLE_INFINITY 0x7ff0000000000000U +#define DOUBLE_EXPONENT 0x7ff0000000000000U +#define DOUBLE_MANTISSA 0x000fffffffffffffU extern flag floatx80_is_nan( floatx80 a ); @@ -1239,27 +1239,27 @@ static void fpgen_rm_reg(m68000_base_device *m68k, uint16_t w2) { case 0x0: // Pi source.high = 0x4000; - source.low = U64(0xc90fdaa22168c235); + source.low = 0xc90fdaa22168c235U; break; case 0xb: // log10(2) source.high = 0x3ffd; - source.low = U64(0x9a209a84fbcff798); + source.low = 0x9a209a84fbcff798U; break; case 0xc: // e source.high = 0x4000; - source.low = U64(0xadf85458a2bb4a9b); + source.low = 0xadf85458a2bb4a9bU; break; case 0xd: // log2(e) source.high = 0x3fff; - source.low = U64(0xb8aa3b295c17f0bc); + source.low = 0xb8aa3b295c17f0bcU; break; case 0xe: // log10(e) source.high = 0x3ffd; - source.low = U64(0xde5bd8a937287195); + source.low = 0xde5bd8a937287195U; break; case 0xf: // 0.0 @@ -1268,12 +1268,12 @@ static void fpgen_rm_reg(m68000_base_device *m68k, uint16_t w2) case 0x30: // ln(2) source.high = 0x3ffe; - source.low = U64(0xb17217f7d1cf79ac); + source.low = 0xb17217f7d1cf79acU; break; case 0x31: // ln(10) source.high = 0x4000; - source.low = U64(0x935d8dddaaa8ac17); + source.low = 0x935d8dddaaa8ac17U; break; case 0x32: // 1 (or 100? manuals are unclear, but 1 would make more sense) @@ -1298,47 +1298,47 @@ static void fpgen_rm_reg(m68000_base_device *m68k, uint16_t w2) case 0x37: // 1.0e16 - can't get the right precision from int32_t so go "direct" with constants from h/w source.high = 0x4034; - source.low = U64(0x8e1bc9bf04000000); + source.low = 0x8e1bc9bf04000000U; break; case 0x38: // 1.0e32 source.high = 0x4069; - source.low = U64(0x9dc5ada82b70b59e); + source.low = 0x9dc5ada82b70b59eU; break; case 0x39: // 1.0e64 source.high = 0x40d3; - source.low = U64(0xc2781f49ffcfa6d5); + source.low = 0xc2781f49ffcfa6d5U; break; case 0x3a: // 1.0e128 source.high = 0x41a8; - source.low = U64(0x93ba47c980e98ce0); + source.low = 0x93ba47c980e98ce0U; break; case 0x3b: // 1.0e256 source.high = 0x4351; - source.low = U64(0xaa7eebfb9df9de8e); + source.low = 0xaa7eebfb9df9de8eU; break; case 0x3c: // 1.0e512 source.high = 0x46a3; - source.low = U64(0xe319a0aea60e91c7); + source.low = 0xe319a0aea60e91c7U; break; case 0x3d: // 1.0e1024 source.high = 0x4d48; - source.low = U64(0xc976758681750c17); + source.low = 0xc976758681750c17U; break; case 0x3e: // 1.0e2048 source.high = 0x5a92; - source.low = U64(0x9e8b3b5dc53d5de5); + source.low = 0x9e8b3b5dc53d5de5U; break; case 0x3f: // 1.0e4096 source.high = 0x7525; - source.low = U64(0xc46052028a20979b); + source.low = 0xc46052028a20979bU; break; default: @@ -2002,7 +2002,7 @@ static void do_frestore_null(m68000_base_device *m68k) for (i = 0; i < 8; i++) { REG_FP(m68k)[i].high = 0x7fff; - REG_FP(m68k)[i].low = U64(0xffffffffffffffff); + REG_FP(m68k)[i].low = 0xffffffffffffffffU; } // Mac IIci at 408458e6 wants an FSAVE of a just-restored nullptr frame to also be nullptr diff --git a/src/devices/cpu/mips/mips3.cpp b/src/devices/cpu/mips/mips3.cpp index c5ba79f2440..940e22d1892 100644 --- a/src/devices/cpu/mips/mips3.cpp +++ b/src/devices/cpu/mips/mips3.cpp @@ -2983,7 +2983,7 @@ void mips3_device::ldl_be(uint32_t op) { offs_t offs = SIMMVAL + RSVAL32; int shift = 8 * (offs & 7); - uint64_t mask = U64(0xffffffffffffffff) << shift; + uint64_t mask = 0xffffffffffffffffU << shift; uint64_t temp; if (RDOUBLE_MASKED(offs & ~7, &temp, mask >> shift) && RTREG) @@ -2994,7 +2994,7 @@ void mips3_device::ldr_be(uint32_t op) { offs_t offs = SIMMVAL + RSVAL32; int shift = 8 * (~offs & 7); - uint64_t mask = U64(0xffffffffffffffff) >> shift; + uint64_t mask = 0xffffffffffffffffU >> shift; uint64_t temp; if (RDOUBLE_MASKED(offs & ~7, &temp, mask << shift) && RTREG) @@ -3021,7 +3021,7 @@ void mips3_device::sdl_be(uint32_t op) { offs_t offs = SIMMVAL + RSVAL32; int shift = 8 * (offs & 7); - uint64_t mask = U64(0xffffffffffffffff) >> shift; + uint64_t mask = 0xffffffffffffffffU >> shift; WDOUBLE_MASKED(offs & ~7, RTVAL64 >> shift, mask); } @@ -3029,7 +3029,7 @@ void mips3_device::sdr_be(uint32_t op) { offs_t offs = SIMMVAL + RSVAL32; int shift = 8 * (~offs & 7); - uint64_t mask = U64(0xffffffffffffffff) << shift; + uint64_t mask = 0xffffffffffffffffU << shift; WDOUBLE_MASKED(offs & ~7, RTVAL64 << shift, mask); } @@ -3061,7 +3061,7 @@ void mips3_device::ldl_le(uint32_t op) { offs_t offs = SIMMVAL + RSVAL32; int shift = 8 * (~offs & 7); - uint64_t mask = U64(0xffffffffffffffff) << shift; + uint64_t mask = 0xffffffffffffffffU << shift; uint64_t temp; if (RDOUBLE_MASKED(offs & ~7, &temp, mask >> shift) && RTREG) @@ -3072,7 +3072,7 @@ void mips3_device::ldr_le(uint32_t op) { offs_t offs = SIMMVAL + RSVAL32; int shift = 8 * (offs & 7); - uint64_t mask = U64(0xffffffffffffffff) >> shift; + uint64_t mask = 0xffffffffffffffffU >> shift; uint64_t temp; if (RDOUBLE_MASKED(offs & ~7, &temp, mask << shift) && RTREG) @@ -3099,7 +3099,7 @@ void mips3_device::sdl_le(uint32_t op) { offs_t offs = SIMMVAL + RSVAL32; int shift = 8 * (~offs & 7); - uint64_t mask = U64(0xffffffffffffffff) >> shift; + uint64_t mask = 0xffffffffffffffffU >> shift; WDOUBLE_MASKED(offs & ~7, RTVAL64 >> shift, mask); } @@ -3107,6 +3107,6 @@ void mips3_device::sdr_le(uint32_t op) { offs_t offs = SIMMVAL + RSVAL32; int shift = 8 * (offs & 7); - uint64_t mask = U64(0xffffffffffffffff) << shift; + uint64_t mask = 0xffffffffffffffffU << shift; WDOUBLE_MASKED(offs & ~7, RTVAL64 << shift, mask); } diff --git a/src/devices/cpu/mips/mips3com.cpp b/src/devices/cpu/mips/mips3com.cpp index 3410843c3e1..f01f27925fe 100644 --- a/src/devices/cpu/mips/mips3com.cpp +++ b/src/devices/cpu/mips/mips3com.cpp @@ -389,7 +389,7 @@ void mips3_device::tlb_write_common(int tlbindex) /* fill in the new TLB entry from the COP0 registers */ entry->page_mask = m_core->cpr[0][COP0_PageMask]; - entry->entry_hi = m_core->cpr[0][COP0_EntryHi] & ~(entry->page_mask & U64(0x0000000001ffe000)); + entry->entry_hi = m_core->cpr[0][COP0_EntryHi] & ~(entry->page_mask & u64(0x0000000001ffe000U)); entry->entry_lo[0] = m_core->cpr[0][COP0_EntryLo0]; entry->entry_lo[1] = m_core->cpr[0][COP0_EntryLo1]; diff --git a/src/devices/cpu/mips/mips3drc.cpp b/src/devices/cpu/mips/mips3drc.cpp index ad1d824e81b..9be286efda4 100644 --- a/src/devices/cpu/mips/mips3drc.cpp +++ b/src/devices/cpu/mips/mips3drc.cpp @@ -2946,7 +2946,7 @@ bool mips3_device::generate_cop1_fr0(drcuml_block *block, compiler_state *compil generate_get_cop1_reg64(block, compiler, desc, FSREG, F0); // dmov F0, UML_FDNEG(block, F1, F0); // fdneg F1,F0 UML_DCMP(block, F0, 0); // cmp F0,0.0 - UML_DMOVc(block, COND_E, F1, U64(0x8000000000000000)); // dmov F1,-0.0,e + UML_DMOVc(block, COND_E, F1, 0x8000000000000000U); // dmov F1,-0.0,e generate_set_cop1_reg64(block, compiler, desc, FDREG, F1); // dmov ,F1 } return true; diff --git a/src/devices/cpu/powerpc/ppccom.cpp b/src/devices/cpu/powerpc/ppccom.cpp index 4d21c59ee0b..026f382eabb 100644 --- a/src/devices/cpu/powerpc/ppccom.cpp +++ b/src/devices/cpu/powerpc/ppccom.cpp @@ -26,9 +26,9 @@ CONSTANTS ***************************************************************************/ -#define DOUBLE_SIGN (U64(0x8000000000000000)) -#define DOUBLE_EXP (U64(0x7ff0000000000000)) -#define DOUBLE_FRAC (U64(0x000fffffffffffff)) +#define DOUBLE_SIGN (0x8000000000000000U) +#define DOUBLE_EXP (0x7ff0000000000000U) +#define DOUBLE_FRAC (0x000fffffffffffffU) #define DOUBLE_ZERO (0) @@ -473,8 +473,8 @@ static inline int is_qnan_double(double x) { uint64_t xi = *(uint64_t*)&x; return( ((xi & DOUBLE_EXP) == DOUBLE_EXP) && - ((xi & U64(0x0007fffffffffff)) == U64(0x000000000000000)) && - ((xi & U64(0x000800000000000)) == U64(0x000800000000000)) ); + ((xi & 0x0007fffffffffffU) == 0x000000000000000U) && + ((xi & 0x000800000000000U) == 0x000800000000000U) ); } @@ -489,7 +489,7 @@ static inline int is_snan_double(double x) uint64_t xi = *(uint64_t*)&x; return( ((xi & DOUBLE_EXP) == DOUBLE_EXP) && ((xi & DOUBLE_FRAC) != DOUBLE_ZERO) && - ((xi & U64(0x0008000000000000)) == DOUBLE_ZERO) ); + ((xi & 0x0008000000000000U) == DOUBLE_ZERO) ); } #endif @@ -1010,11 +1010,11 @@ void ppc_device::state_import(const device_state_entry &entry) break; case PPC_TBL: - set_timebase((get_timebase() & ~U64(0x00ffffff00000000)) | m_debugger_temp); + set_timebase((get_timebase() & ~u64(0x00ffffff00000000U)) | m_debugger_temp); break; case PPC_TBH: - set_timebase((get_timebase() & ~U64(0x00000000ffffffff)) | ((uint64_t)(m_debugger_temp & 0x00ffffff) << 32)); + set_timebase((get_timebase() & ~u64(0x00000000ffffffffU)) | ((uint64_t)(m_debugger_temp & 0x00ffffff) << 32)); break; case PPC_DEC: @@ -1763,10 +1763,10 @@ void ppc_device::ppccom_execute_mtspr() /* timebase */ case SPR603_TBL_W: - set_timebase((get_timebase() & ~U64(0xffffffff00000000)) | m_core->param1); + set_timebase((get_timebase() & ~u64(0xffffffff00000000U)) | m_core->param1); return; case SPR603_TBU_W: - set_timebase((get_timebase() & ~U64(0x00000000ffffffff)) | ((uint64_t)m_core->param1 << 32)); + set_timebase((get_timebase() & ~u64(0x00000000ffffffffU)) | ((uint64_t)m_core->param1 << 32)); return; } } @@ -1822,10 +1822,10 @@ void ppc_device::ppccom_execute_mtspr() /* timebase */ case SPR4XX_TBLO: - set_timebase((get_timebase() & ~U64(0x00ffffff00000000)) | m_core->param1); + set_timebase((get_timebase() & ~u64(0x00ffffff00000000U)) | m_core->param1); return; case SPR4XX_TBHI: - set_timebase((get_timebase() & ~U64(0x00000000ffffffff)) | ((uint64_t)(m_core->param1 & 0x00ffffff) << 32)); + set_timebase((get_timebase() & ~u64(0x00000000ffffffffU)) | ((uint64_t)(m_core->param1 & 0x00ffffff) << 32)); return; } } diff --git a/src/devices/cpu/powerpc/ppcdrc.cpp b/src/devices/cpu/powerpc/ppcdrc.cpp index d03109867c4..9210d4f5447 100644 --- a/src/devices/cpu/powerpc/ppcdrc.cpp +++ b/src/devices/cpu/powerpc/ppcdrc.cpp @@ -1127,7 +1127,7 @@ void ppc_device::static_generate_memory_accessor(int mode, int size, int iswrite { UML_DLOAD(block, I3, fastbase, I0, SIZE_QWORD, SCALE_x1); // dload i3,fastbase,i0,qword_x1 UML_DAND(block, I1, I1, I2); // dand i1,i1,i2 - UML_DXOR(block, I2, I2, U64(0xffffffffffffffff)); // dxor i2,i2,0xfffffffffffffffff + UML_DXOR(block, I2, I2, 0xffffffffffffffffU); // dxor i2,i2,0xfffffffffffffffff UML_DAND(block, I3, I3, I2); // dand i3,i3,i2 UML_DOR(block, I1, I1, I3); // dor i1,i1,i3 } @@ -1209,29 +1209,29 @@ void ppc_device::static_generate_memory_accessor(int mode, int size, int iswrite { if (iswrite) { - UML_MOV(block, mem(&m_core->tempaddr), I0); // mov [tempaddr],i0 - UML_MOV(block, mem(&m_core->tempdata.w.l), I1); // mov [tempdata],i1 + UML_MOV(block, mem(&m_core->tempaddr), I0); // mov [tempaddr],i0 + UML_MOV(block, mem(&m_core->tempdata.w.l), I1); // mov [tempdata],i1 UML_SUB(block, I0, I0, 1); // sub i0,i0,1 UML_SHR(block, I1, I1, 8); // shr i1,i1,8 - UML_MOV(block, I2, 0x00ff); // mov i2,0x00ff - UML_CALLH(block, *masked); // callh masked - UML_ADD(block, I0, mem(&m_core->tempaddr), 1); // add i0,[tempaddr],1 - UML_SHL(block, I1, mem(&m_core->tempdata.w.l), 8); // shl i1,[tempdata],8 - UML_MOV(block, I2, 0xff00); // mov i2,0xff00 - UML_CALLH(block, *masked); // callh masked + UML_MOV(block, I2, 0x00ff); // mov i2,0x00ff + UML_CALLH(block, *masked); // callh masked + UML_ADD(block, I0, mem(&m_core->tempaddr), 1); // add i0,[tempaddr],1 + UML_SHL(block, I1, mem(&m_core->tempdata.w.l), 8); // shl i1,[tempdata],8 + UML_MOV(block, I2, 0xff00); // mov i2,0xff00 + UML_CALLH(block, *masked); // callh masked } else { - UML_MOV(block, mem(&m_core->tempaddr), I0); // mov [tempaddr],i0 + UML_MOV(block, mem(&m_core->tempaddr), I0); // mov [tempaddr],i0 UML_SUB(block, I0, I0, 1); // sub i0,i0,1 - UML_MOV(block, I2, 0x00ff); // mov i2,0x00ff - UML_CALLH(block, *masked); // callh masked - UML_SHL(block, mem(&m_core->tempdata.w.l), I0, 8); // shl [tempdata],i0,8 - UML_ADD(block, I0, mem(&m_core->tempaddr), 1); // add i0,[tempaddr],1 - UML_MOV(block, I2, 0xff00); // mov i2,0xff00 - UML_CALLH(block, *masked); // callh masked + UML_MOV(block, I2, 0x00ff); // mov i2,0x00ff + UML_CALLH(block, *masked); // callh masked + UML_SHL(block, mem(&m_core->tempdata.w.l), I0, 8); // shl [tempdata],i0,8 + UML_ADD(block, I0, mem(&m_core->tempaddr), 1); // add i0,[tempaddr],1 + UML_MOV(block, I2, 0xff00); // mov i2,0xff00 + UML_CALLH(block, *masked); // callh masked UML_SHR(block, I0, I0, 8); // shr i0,i0,8 - UML_OR(block, I0, I0, mem(&m_core->tempdata.w.l)); // or i0,i0,[tempdata] + UML_OR(block, I0, I0, mem(&m_core->tempdata.w.l)); // or i0,i0,[tempdata] } } else if (size == 4) @@ -1239,108 +1239,108 @@ void ppc_device::static_generate_memory_accessor(int mode, int size, int iswrite int offs2, offs3; if (iswrite) { - UML_MOV(block, mem(&m_core->tempaddr), I0); // mov [tempaddr],i0 - UML_MOV(block, mem(&m_core->tempdata.w.l), I1); // mov [tempdata],i1 - UML_TEST(block, I0, 2); // test i0,i0,2 - UML_JMPc(block, COND_NZ, offs2 = label++); // jnz offs2 + UML_MOV(block, mem(&m_core->tempaddr), I0); // mov [tempaddr],i0 + UML_MOV(block, mem(&m_core->tempdata.w.l), I1); // mov [tempdata],i1 + UML_TEST(block, I0, 2); // test i0,i0,2 + UML_JMPc(block, COND_NZ, offs2 = label++); // jnz offs2 UML_SUB(block, I0, I0, 1); // sub i0,i0,1 UML_SHR(block, I1, I1, 8); // shr i1,i1,8 - UML_MOV(block, I2, 0x00ffffff); // mov i2,0x00ffffff - UML_CALLH(block, *masked); // callh masked - UML_ADD(block, I0, mem(&m_core->tempaddr), 3); // add i0,[tempaddr],3 - UML_SHL(block, I1, mem(&m_core->tempdata.w.l), 24); // shl i1,[tempdata],24 - UML_MOV(block, I2, 0xff000000); // mov i2,0xff000000 - UML_CALLH(block, *masked); // callh masked - UML_RET(block); // ret - UML_LABEL(block, offs2); // offs2: - UML_TEST(block, I0, 1); // test i0,i0,1 - UML_JMPc(block, COND_NZ, offs3 = label++); // jnz offs3 + UML_MOV(block, I2, 0x00ffffff); // mov i2,0x00ffffff + UML_CALLH(block, *masked); // callh masked + UML_ADD(block, I0, mem(&m_core->tempaddr), 3); // add i0,[tempaddr],3 + UML_SHL(block, I1, mem(&m_core->tempdata.w.l), 24); // shl i1,[tempdata],24 + UML_MOV(block, I2, 0xff000000); // mov i2,0xff000000 + UML_CALLH(block, *masked); // callh masked + UML_RET(block); // ret + UML_LABEL(block, offs2); // offs2: + UML_TEST(block, I0, 1); // test i0,i0,1 + UML_JMPc(block, COND_NZ, offs3 = label++); // jnz offs3 UML_SUB(block, I0, I0, 2); // sub i0,i0,2 UML_SHR(block, I1, I1, 16); // shr i1,i1,16 - UML_MOV(block, I2, 0x0000ffff); // mov i2,0x0000ffff - UML_CALLH(block, *masked); // callh masked - UML_ADD(block, I0, mem(&m_core->tempaddr), 2); // add i0,[tempaddr],2 - UML_SHL(block, I1, mem(&m_core->tempdata.w.l), 16); // shl i1,[tempdata],16 - UML_MOV(block, I2, 0xffff0000); // mov i2,0xffff0000 - UML_CALLH(block, *masked); // callh masked - UML_RET(block); // ret - UML_LABEL(block, offs3); // offs3: + UML_MOV(block, I2, 0x0000ffff); // mov i2,0x0000ffff + UML_CALLH(block, *masked); // callh masked + UML_ADD(block, I0, mem(&m_core->tempaddr), 2); // add i0,[tempaddr],2 + UML_SHL(block, I1, mem(&m_core->tempdata.w.l), 16); // shl i1,[tempdata],16 + UML_MOV(block, I2, 0xffff0000); // mov i2,0xffff0000 + UML_CALLH(block, *masked); // callh masked + UML_RET(block); // ret + UML_LABEL(block, offs3); // offs3: UML_SUB(block, I0, I0, 3); // sub i0,i0,3 UML_SHR(block, I1, I1, 24); // shr i1,i1,24 - UML_MOV(block, I2, 0x000000ff); // mov i2,0x000000ff - UML_CALLH(block, *masked); // callh masked - UML_ADD(block, I0, mem(&m_core->tempaddr), 1); // add i0,[tempaddr],1 - UML_SHL(block, I1, mem(&m_core->tempdata.w.l), 8); // shl i1,[tempdata],8 - UML_MOV(block, I2, 0xffffff00); // mov i2,0xffffff00 - UML_CALLH(block, *masked); // callh masked + UML_MOV(block, I2, 0x000000ff); // mov i2,0x000000ff + UML_CALLH(block, *masked); // callh masked + UML_ADD(block, I0, mem(&m_core->tempaddr), 1); // add i0,[tempaddr],1 + UML_SHL(block, I1, mem(&m_core->tempdata.w.l), 8); // shl i1,[tempdata],8 + UML_MOV(block, I2, 0xffffff00); // mov i2,0xffffff00 + UML_CALLH(block, *masked); // callh masked } else { - UML_MOV(block, mem(&m_core->tempaddr), I0); // mov [tempaddr],i0 - UML_TEST(block, I0, 2); // test i0,i0,2 - UML_JMPc(block, COND_NZ, offs2 = label++); // jnz offs2 + UML_MOV(block, mem(&m_core->tempaddr), I0); // mov [tempaddr],i0 + UML_TEST(block, I0, 2); // test i0,i0,2 + UML_JMPc(block, COND_NZ, offs2 = label++); // jnz offs2 UML_SUB(block, I0, I0, 1); // sub i0,i0,1 - UML_MOV(block, I2, 0x00ffffff); // mov i2,0x00ffffff - UML_CALLH(block, *masked); // callh masked - UML_SHL(block, mem(&m_core->tempdata.w.l), I0, 8); // shl [tempdata],i0,8 - UML_ADD(block, I0, mem(&m_core->tempaddr), 3); // add i0,[tempaddr],3 - UML_MOV(block, I2, 0xff000000); // mov i2,0xff000000 - UML_CALLH(block, *masked); // callh masked + UML_MOV(block, I2, 0x00ffffff); // mov i2,0x00ffffff + UML_CALLH(block, *masked); // callh masked + UML_SHL(block, mem(&m_core->tempdata.w.l), I0, 8); // shl [tempdata],i0,8 + UML_ADD(block, I0, mem(&m_core->tempaddr), 3); // add i0,[tempaddr],3 + UML_MOV(block, I2, 0xff000000); // mov i2,0xff000000 + UML_CALLH(block, *masked); // callh masked UML_SHR(block, I0, I0, 24); // shr i0,i0,24 - UML_OR(block, I0, I0, mem(&m_core->tempdata.w.l)); // or i0,i0,[tempdata] - UML_RET(block); // ret - UML_LABEL(block, offs2); // offs2: - UML_TEST(block, I0, 1); // test i0,i0,1 - UML_JMPc(block, COND_NZ, offs3 = label++); // jnz offs3 + UML_OR(block, I0, I0, mem(&m_core->tempdata.w.l)); // or i0,i0,[tempdata] + UML_RET(block); // ret + UML_LABEL(block, offs2); // offs2: + UML_TEST(block, I0, 1); // test i0,i0,1 + UML_JMPc(block, COND_NZ, offs3 = label++); // jnz offs3 UML_SUB(block, I0, I0, 2); // sub i0,i0,2 - UML_MOV(block, I2, 0x0000ffff); // mov i2,0x0000ffff - UML_CALLH(block, *masked); // callh masked - UML_SHL(block, mem(&m_core->tempdata.w.l), I0, 16); // shl [tempdata],i0,16 - UML_ADD(block, I0, mem(&m_core->tempaddr), 2); // add i0,[tempaddr],2 - UML_MOV(block, I2, 0xffff0000); // mov i2,0xffff0000 - UML_CALLH(block, *masked); // callh masked + UML_MOV(block, I2, 0x0000ffff); // mov i2,0x0000ffff + UML_CALLH(block, *masked); // callh masked + UML_SHL(block, mem(&m_core->tempdata.w.l), I0, 16); // shl [tempdata],i0,16 + UML_ADD(block, I0, mem(&m_core->tempaddr), 2); // add i0,[tempaddr],2 + UML_MOV(block, I2, 0xffff0000); // mov i2,0xffff0000 + UML_CALLH(block, *masked); // callh masked UML_SHR(block, I0, I0, 16); // shr i0,i0,16 - UML_OR(block, I0, I0, mem(&m_core->tempdata.w.l)); // or i0,i0,[tempdata] - UML_RET(block); // ret - UML_LABEL(block, offs3); // offs3: + UML_OR(block, I0, I0, mem(&m_core->tempdata.w.l)); // or i0,i0,[tempdata] + UML_RET(block); // ret + UML_LABEL(block, offs3); // offs3: UML_SUB(block, I0, I0, 3); // sub i0,i0,3 - UML_MOV(block, I2, 0x000000ff); // mov i2,0x000000ff - UML_CALLH(block, *masked); // callh masked - UML_SHL(block, mem(&m_core->tempdata.w.l), I0, 24); // shl [tempdata],i0,24 - UML_ADD(block, I0, mem(&m_core->tempaddr), 1); // add i0,[tempaddr],1 - UML_MOV(block, I2, 0xffffff00); // mov i2,0xffffff00 - UML_CALLH(block, *masked); // callh masked + UML_MOV(block, I2, 0x000000ff); // mov i2,0x000000ff + UML_CALLH(block, *masked); // callh masked + UML_SHL(block, mem(&m_core->tempdata.w.l), I0, 24); // shl [tempdata],i0,24 + UML_ADD(block, I0, mem(&m_core->tempaddr), 1); // add i0,[tempaddr],1 + UML_MOV(block, I2, 0xffffff00); // mov i2,0xffffff00 + UML_CALLH(block, *masked); // callh masked UML_SHR(block, I0, I0, 8); // shr i0,i0,8 - UML_OR(block, I0, I0, mem(&m_core->tempdata.w.l)); // or i0,i0,[tempdata] + UML_OR(block, I0, I0, mem(&m_core->tempdata.w.l)); // or i0,i0,[tempdata] } } else if (size == 8) { if (iswrite) { - UML_MOV(block, mem(&m_core->tempaddr), I0); // mov [tempaddr],i0 - UML_DMOV(block, mem(&m_core->tempdata.d), I1); // dmov [tempdata],i1 - UML_DSHR(block, I1, I1, 32); // dshr i1,i1,32 - UML_AND(block, I0, I0, ~7); // and i0,i0,~7 - UML_DMOV(block, I2, U64(0x00000000ffffffff)); // dmov i2,0x00000000ffffffff - UML_CALLH(block, *masked); // callh masked - UML_ADD(block, I0, mem(&m_core->tempaddr), 4); // add i0,[tempaddr],4 - UML_DSHL(block, I1, mem(&m_core->tempdata.d), 32); // dshl i1,[tempdata],32 - UML_DMOV(block, I2, U64(0xffffffff00000000)); // dmov i2,0xffffffff00000000 - UML_CALLH(block, *masked); // callh masked + UML_MOV(block, mem(&m_core->tempaddr), I0); // mov [tempaddr],i0 + UML_DMOV(block, mem(&m_core->tempdata.d), I1); // dmov [tempdata],i1 + UML_DSHR(block, I1, I1, 32); // dshr i1,i1,32 + UML_AND(block, I0, I0, ~7); // and i0,i0,~7 + UML_DMOV(block, I2, 0x00000000ffffffffU); // dmov i2,0x00000000ffffffff + UML_CALLH(block, *masked); // callh masked + UML_ADD(block, I0, mem(&m_core->tempaddr), 4); // add i0,[tempaddr],4 + UML_DSHL(block, I1, mem(&m_core->tempdata.d), 32); // dshl i1,[tempdata],32 + UML_DMOV(block, I2, 0xffffffff00000000U); // dmov i2,0xffffffff00000000 + UML_CALLH(block, *masked); // callh masked } else { - UML_MOV(block, mem(&m_core->tempaddr), I0); // mov [tempaddr],i0 - UML_DMOV(block, I2, U64(0x00000000ffffffff)); // mov i2,0x00000000ffffffff - UML_AND(block, I0, I0, ~7); // and i0,i0,~7 - UML_CALLH(block, *masked); // callh masked - UML_DSHL(block, mem(&m_core->tempdata.d), I0, 32); // dshl [tempdata],i0,32 - UML_ADD(block, I0, mem(&m_core->tempaddr), 4); // add i0,[tempaddr],4 - UML_DMOV(block, I2, U64(0xffffffff00000000)); // dmov i2,0xffffffff00000000 - UML_CALLH(block, *masked); // callh masked - UML_DSHR(block, I0, I0, 32); // dshr i0,i0,32 - UML_DOR(block, I0, I0, mem(&m_core->tempdata.d)); // dor i0,i0,[tempdata] + UML_MOV(block, mem(&m_core->tempaddr), I0); // mov [tempaddr],i0 + UML_DMOV(block, I2, 0x00000000ffffffffU); // mov i2,0x00000000ffffffff + UML_AND(block, I0, I0, ~7); // and i0,i0,~7 + UML_CALLH(block, *masked); // callh masked + UML_DSHL(block, mem(&m_core->tempdata.d), I0, 32); // dshl [tempdata],i0,32 + UML_ADD(block, I0, mem(&m_core->tempaddr), 4); // add i0,[tempaddr],4 + UML_DMOV(block, I2, 0xffffffff00000000U); // dmov i2,0xffffffff00000000 + UML_CALLH(block, *masked); // callh masked + UML_DSHR(block, I0, I0, 32); // dshr i0,i0,32 + UML_DOR(block, I0, I0, mem(&m_core->tempdata.d)); // dor i0,i0,[tempdata] } } UML_RET(block); // ret diff --git a/src/devices/cpu/psx/gte.h b/src/devices/cpu/psx/gte.h index 9402c302035..d6da63e1f5e 100644 --- a/src/devices/cpu/psx/gte.h +++ b/src/devices/cpu/psx/gte.h @@ -43,8 +43,8 @@ protected: public: int44( int64_t value ) : m_value( value ), - m_positive_overflow( value > S64( 0x7ffffffffff ) ), - m_negative_overflow( value < S64( -0x80000000000 ) ) + m_positive_overflow( value > 0x7ffffffffff ), + m_negative_overflow( value < -0x80000000000 ) { } diff --git a/src/devices/cpu/rsp/rspcp2d.cpp b/src/devices/cpu/rsp/rspcp2d.cpp index 017d180626e..4354838ae6b 100644 --- a/src/devices/cpu/rsp/rspcp2d.cpp +++ b/src/devices/cpu/rsp/rspcp2d.cpp @@ -1363,7 +1363,7 @@ void rsp_cop2_drc::vmulf() if (s1 == -32768 && s2 == -32768) { // overflow - ACCUM(i) = S64(0x0000800080000000); + ACCUM(i) = s64(0x0000800080000000U); m_vres[i] = 0x7fff; } else diff --git a/src/devices/cpu/scudsp/scudsp.cpp b/src/devices/cpu/scudsp/scudsp.cpp index 24880437d21..89173a7a60d 100644 --- a/src/devices/cpu/scudsp/scudsp.cpp +++ b/src/devices/cpu/scudsp/scudsp.cpp @@ -139,9 +139,9 @@ uint32_t scudsp_cpu_device::scudsp_get_source_mem_reg_value( uint32_t mode ) switch( mode ) { case 0x9: - return (uint32_t)((m_alu & U64(0x00000000ffffffff)) >> 0); + return u32((m_alu & 0x00000000ffffffffU) >> 0); case 0xA: - return (uint32_t)((m_alu & U64(0x0000ffffffff0000)) >> 16); + return u32((m_alu & 0x0000ffffffff0000U) >> 16); } } return 0; @@ -436,17 +436,17 @@ void scudsp_cpu_device::scudsp_operation(uint32_t opcode) i3 = m_acl.si + m_pl.si; m_alu = (uint64_t)(uint32_t)i3; //SET_Z(i3 == 0); - SET_Z( (i3 & S64(0xffffffffffff)) == 0 ); + SET_Z( (i3 & s64(0xffffffffffffU)) == 0 ); //SET_S(i3 < 0); - SET_S( i3 & S64(0x1000000000000)); - SET_C(i3 & S64(0x100000000)); + SET_S( i3 & s64(0x1000000000000U)); + SET_C(i3 & s64(0x100000000U)); SET_V(((i3) ^ (m_acl.si)) & ((i3) ^ (m_pl.si)) & 0x80000000); break; case 0x5: /* SUB */ i3 = m_acl.si - m_pl.si; m_alu = (uint64_t)(uint32_t)i3; SET_Z(i3 == 0); - SET_C(i3 & S64(0x100000000)); + SET_C(i3 & s64(0x100000000U)); SET_S(i3 < 0); SET_V(((m_pl.si) ^ (m_acl.si)) & ((m_pl.si) ^ (i3)) & 0x80000000); break; @@ -454,10 +454,10 @@ void scudsp_cpu_device::scudsp_operation(uint32_t opcode) i1 = concat_64((int32_t)m_ph.si,m_pl.si); i2 = concat_64((int32_t)m_ach.si,m_acl.si); m_alu = i1 + i2; - SET_Z((m_alu & S64(0xffffffffffff)) == 0); - SET_S((m_alu & S64(0x800000000000)) > 0); - SET_C((m_alu) & S64(0x1000000000000)); - SET_V(((m_alu) ^ (i1)) & ((m_alu) ^ (i2)) & S64(0x800000000000)); + SET_Z((m_alu & s64(0xffffffffffffU)) == 0); + SET_S((m_alu & s64(0x800000000000U)) > 0); + SET_C((m_alu) & s64(0x1000000000000U)); + SET_V(((m_alu) ^ (i1)) & ((m_alu) ^ (i2)) & s64(0x800000000000U)); break; case 0x7: /* ??? */ /* Unrecognized opcode */ @@ -523,8 +523,8 @@ void scudsp_cpu_device::scudsp_operation(uint32_t opcode) case 0x1: /* NOP ? */ break; case 0x2: /* MOV MUL,P */ - m_ph.ui = (uint16_t)((m_mul & U64(0x0000ffff00000000)) >> 32); - m_pl.ui = (uint32_t)((m_mul & U64(0x00000000ffffffff)) >> 0); + m_ph.ui = u16((m_mul & 0x0000ffff00000000U) >> 32); + m_pl.ui = u32((m_mul & 0x00000000ffffffffU) >> 0); break; case 0x3: /* MOV [s],P */ dsp_mem = (opcode & 0x700000) >> 20; @@ -560,8 +560,8 @@ void scudsp_cpu_device::scudsp_operation(uint32_t opcode) m_ach.ui = 0; break; case 0x2: /* MOV ALU,A */ - m_ach.ui = (uint16_t)((m_alu & U64(0x0000ffff00000000)) >> 32); - m_acl.ui = (uint32_t)((m_alu & U64(0x00000000ffffffff)) >> 0); + m_ach.ui = u16((m_alu & 0x0000ffff00000000U) >> 32); + m_acl.ui = u32((m_alu & 0x00000000ffffffffU) >> 0); break; case 0x3: /* MOV [s], A */ dsp_mem = (opcode & 0x1C000 ) >> 14; diff --git a/src/devices/cpu/sh4/sh4.cpp b/src/devices/cpu/sh4/sh4.cpp index 831804260a8..773dc9ae566 100644 --- a/src/devices/cpu/sh4/sh4.cpp +++ b/src/devices/cpu/sh4/sh4.cpp @@ -76,12 +76,12 @@ static ADDRESS_MAP_START( sh4_internal_map, AS_PROGRAM, 64, sh4_base_device ) AM_RANGE(0x1E000000, 0x1E000FFF) AM_RAM AM_MIRROR(0x01FFF000) AM_RANGE(0xE0000000, 0xE000003F) AM_RAM AM_MIRROR(0x03FFFFC0) // todo: store queues should be write only on DC's SH4, executing PREFM shouldn't cause an actual memory read access! AM_RANGE(0xF6000000, 0xF7FFFFFF) AM_READWRITE(sh4_tlb_r,sh4_tlb_w) - AM_RANGE(0xFE000000, 0xFFFFFFFF) AM_READWRITE32(sh4_internal_r, sh4_internal_w, U64(0xffffffffffffffff)) + AM_RANGE(0xFE000000, 0xFFFFFFFF) AM_READWRITE32(sh4_internal_r, sh4_internal_w, 0xffffffffffffffffU) ADDRESS_MAP_END static ADDRESS_MAP_START( sh3_internal_map, AS_PROGRAM, 64, sh3_base_device ) - AM_RANGE(SH3_LOWER_REGBASE, SH3_LOWER_REGEND) AM_READWRITE32(sh3_internal_r, sh3_internal_w, U64(0xffffffffffffffff)) - AM_RANGE(SH3_UPPER_REGBASE, SH3_UPPER_REGEND) AM_READWRITE32(sh3_internal_high_r, sh3_internal_high_w, U64(0xffffffffffffffff)) + AM_RANGE(SH3_LOWER_REGBASE, SH3_LOWER_REGEND) AM_READWRITE32(sh3_internal_r, sh3_internal_w, 0xffffffffffffffffU) + AM_RANGE(SH3_UPPER_REGBASE, SH3_UPPER_REGEND) AM_READWRITE32(sh3_internal_high_r, sh3_internal_high_w, 0xffffffffffffffffU) ADDRESS_MAP_END diff --git a/src/devices/cpu/sharc/sharcdrc.cpp b/src/devices/cpu/sharc/sharcdrc.cpp index 75c0647da9f..5eaacd58b54 100644 --- a/src/devices/cpu/sharc/sharcdrc.cpp +++ b/src/devices/cpu/sharc/sharcdrc.cpp @@ -2292,7 +2292,7 @@ bool adsp21062_device::generate_opcode(drcuml_block *block, compiler_state *comp switch (subop) { case 0x00: // NOP / idle |000|00000| - if (opcode & U64(0x008000000000)) + if (opcode & 0x008000000000U) { // IDLE UML_MOV(block, mem(&m_core->idle), 1); @@ -3060,7 +3060,7 @@ bool adsp21062_device::generate_opcode(drcuml_block *block, compiler_state *comp case 0x16: // I register modify / bit-reverse |000|10110| { - if (opcode & U64(0x008000000000)) // bit reverse + if (opcode & 0x008000000000U) // bit reverse { return false; } @@ -3087,28 +3087,28 @@ bool adsp21062_device::generate_opcode(drcuml_block *block, compiler_state *comp case 0x17: // push|pop stacks / flush cache |000|10111| { - if (opcode & U64(0x008000000000)) + if (opcode & 0x008000000000U) { fatalerror("sharcdrc: push/pop stacks: push loop not implemented\n"); } - if (opcode & U64(0x004000000000)) + if (opcode & 0x004000000000U) { fatalerror("sharcdrc: push/pop stacks: pop loop not implemented\n"); } - if (opcode & U64(0x002000000000)) + if (opcode & 0x002000000000U) { UML_CALLH(block, *m_push_status); } - if (opcode & U64(0x001000000000)) + if (opcode & 0x001000000000U) { UML_CALLH(block, *m_pop_status); } - if (opcode & U64(0x000800000000)) + if (opcode & 0x000800000000U) { UML_MOV(block, I0, PCSTK); UML_CALLH(block, *m_push_pc); } - if (opcode & U64(0x000400000000)) + if (opcode & 0x000400000000U) { UML_CALLH(block, *m_pop_pc); } @@ -3295,7 +3295,7 @@ bool adsp21062_device::generate_opcode(drcuml_block *block, compiler_state *comp case 3: { - if (opcode & U64(0x100000000000)) // compute / ureg <-> ureg |011|1| + if (opcode & 0x100000000000U) // compute / ureg <-> ureg |011|1| { int src_ureg = (opcode >> 36) & 0xff; int dst_ureg = (opcode >> 23) & 0xff; @@ -3420,7 +3420,7 @@ bool adsp21062_device::generate_opcode(drcuml_block *block, compiler_state *comp case 4: { - if (opcode & U64(0x100000000000)) // immediate data -> DM|PM |100|1| + if (opcode & 0x100000000000U) // immediate data -> DM|PM |100|1| { int i = (opcode >> 41) & 0x7; int m = (opcode >> 38) & 0x7; @@ -3722,22 +3722,22 @@ void adsp21062_device::generate_compute(drcuml_block *block, compiler_state *com switch (ai) { case 0x00: // MR0F - UML_DAND(block, MRF, MRF, U64(0xffffffff00000000)); + UML_DAND(block, MRF, MRF, 0xffffffff00000000U); UML_AND(block, I0, REG(rn), 0xffffffff); UML_DOR(block, MRF, MRF, I0); break; case 0x01: // MR1F - UML_DAND(block, MRF, MRF, U64(0x00000000ffffffff)); + UML_DAND(block, MRF, MRF, 0x00000000ffffffffU); UML_DSHL(block, I0, REG(rn), 32); UML_DOR(block, MRF, MRF, I0); break; case 0x04: // MR0B - UML_DAND(block, MRB, MRB, U64(0xffffffff00000000)); + UML_DAND(block, MRB, MRB, 0xffffffff00000000U); UML_AND(block, I0, REG(rn), 0xffffffff); UML_DOR(block, MRB, MRB, I0); break; case 0x05: // MR1B - UML_DAND(block, MRB, MRB, U64(0x00000000ffffffff)); + UML_DAND(block, MRB, MRB, 0x00000000ffffffffU); UML_DSHL(block, I0, REG(rn), 32); UML_DOR(block, MRB, MRB, I0); break; diff --git a/src/devices/cpu/sharc/sharcdsm.cpp b/src/devices/cpu/sharc/sharcdsm.cpp index 1d99ab16f31..192a9fa9bfc 100644 --- a/src/devices/cpu/sharc/sharcdsm.cpp +++ b/src/devices/cpu/sharc/sharcdsm.cpp @@ -646,7 +646,7 @@ static uint32_t dasm_direct_jump(uint32_t pc, uint64_t opcode) uint32_t flags = 0; get_if_condition(cond); - if (opcode & U64(0x8000000000)) + if (opcode & 0x8000000000U) { print("CALL"); flags = DASMFLAG_STEP_OVER; @@ -656,7 +656,7 @@ static uint32_t dasm_direct_jump(uint32_t pc, uint64_t opcode) print("JUMP"); } - if (opcode & U64(0x10000000000)) /* PC-relative branch */ + if (opcode & 0x10000000000U) /* PC-relative branch */ { print(" (0x%08X)", pc + SIGN_EXTEND24(addr)); } @@ -699,7 +699,7 @@ static uint32_t dasm_indirect_jump_compute(uint32_t pc, uint64_t opcode) print("JUMP"); } - if (opcode & U64(0x10000000000)) /* PC-relative branch */ + if (opcode & 0x10000000000U) /* PC-relative branch */ { print(" (0x%08X)", pc + SIGN_EXTEND6(reladdr)); } @@ -744,7 +744,7 @@ static uint32_t dasm_indirect_jump_compute_dregdm(uint32_t pc, uint64_t opcode) get_if_condition(cond); print("JUMP"); - if (opcode & U64(0x200000000000)) /* PC-relative branch */ + if (opcode & 0x200000000000U) /* PC-relative branch */ { print(" (0x%08X)", pc + SIGN_EXTEND6(reladdr)); } @@ -780,7 +780,7 @@ static uint32_t dasm_rts_compute(uint32_t pc, uint64_t opcode) get_if_condition(cond); - if (opcode & U64(0x10000000000)) + if (opcode & 0x10000000000U) { print("RTI"); } @@ -817,7 +817,7 @@ static uint32_t dasm_do_until_counter(uint32_t pc, uint64_t opcode) int ureg = (opcode >> 32) & 0xff; uint32_t addr = opcode & 0xffffff; - if (opcode & U64(0x10000000000)) /* Loop counter from universal register */ + if (opcode & 0x10000000000U) /* Loop counter from universal register */ { print("LCNTR = %s, ", GET_UREG(ureg)); print("DO (0x%08X)", pc + SIGN_EXTEND24(addr)); @@ -950,7 +950,7 @@ static uint32_t dasm_ireg_modify(uint32_t pc, uint64_t opcode) int i = (opcode >> 32) & 0x7; uint32_t data = opcode & 0xffffffff; - if (opcode & U64(0x8000000000)) /* with bit-reverse */ + if (opcode & 0x8000000000U) /* with bit-reverse */ { if (g) { @@ -1043,7 +1043,7 @@ static uint32_t dasm_misc(uint32_t pc, uint64_t opcode) static uint32_t dasm_idlenop(uint32_t pc, uint64_t opcode) { - if (opcode & U64(0x8000000000)) + if (opcode & 0x8000000000U) { print("IDLE"); } @@ -1058,7 +1058,7 @@ static uint32_t dasm_idlenop(uint32_t pc, uint64_t opcode) static uint32_t dasm_cjump_rframe(uint32_t pc, uint64_t opcode) { /* TODO */ - if (opcode & U64(0x10000000000)) /* RFRAME */ + if (opcode & 0x10000000000U) /* RFRAME */ { print("TODO: RFRAME"); } diff --git a/src/devices/cpu/sharc/sharcfe.cpp b/src/devices/cpu/sharc/sharcfe.cpp index 194dabcea8c..dc060ac733d 100644 --- a/src/devices/cpu/sharc/sharcfe.cpp +++ b/src/devices/cpu/sharc/sharcfe.cpp @@ -227,7 +227,7 @@ bool sharc_frontend::describe(opcode_desc &desc, const opcode_desc *prev) switch (subop) { case 0x00: // NOP / idle |000|00000| - if (opcode & U64(0x008000000000)) + if (opcode & 0x008000000000U) { // IDLE desc.flags |= OPFLAG_END_SEQUENCE; @@ -608,7 +608,7 @@ bool sharc_frontend::describe(opcode_desc &desc, const opcode_desc *prev) case 0x16: // I register modify / bit-reverse |000|10110| { - if (opcode & U64(0x008000000000)) // bit reverse + if (opcode & 0x008000000000U) // bit reverse { fatalerror("sharc_frontend::describe: bit reverse unimplemented"); } @@ -737,7 +737,7 @@ bool sharc_frontend::describe(opcode_desc &desc, const opcode_desc *prev) if (!describe_compute(desc, opcode)) return false; - if (opcode & U64(0x100000000000)) // compute / ureg <-> ureg |011|1| + if (opcode & 0x100000000000U) // compute / ureg <-> ureg |011|1| { int src_ureg = (opcode >> 36) & 0xff; int dst_ureg = (opcode >> 23) & 0xff; @@ -798,7 +798,7 @@ bool sharc_frontend::describe(opcode_desc &desc, const opcode_desc *prev) case 4: { - if (opcode & U64(0x100000000000)) // immediate data -> DM|PM |100|1| + if (opcode & 0x100000000000U) // immediate data -> DM|PM |100|1| { int i = (opcode >> 41) & 0x7; int m = (opcode >> 38) & 0x7; diff --git a/src/devices/cpu/sharc/sharcops.hxx b/src/devices/cpu/sharc/sharcops.hxx index e3140f00352..4454bf0cf69 100644 --- a/src/devices/cpu/sharc/sharcops.hxx +++ b/src/devices/cpu/sharc/sharcops.hxx @@ -440,8 +440,8 @@ void adsp21062_device::SET_UREG(int ureg, uint32_t data) case 0xd: switch(reg) { - case 0xc: m_core->px &= U64(0xffffffffffff0000); m_core->px |= (data & 0xffff); break; /* PX1 */ - case 0xd: m_core->px &= U64(0x000000000000ffff); m_core->px |= (uint64_t)data << 16; break; /* PX2 */ + case 0xc: m_core->px &= 0xffffffffffff0000U; m_core->px |= (data & 0xffff); break; /* PX1 */ + case 0xd: m_core->px &= 0x000000000000ffffU; m_core->px |= (uint64_t)data << 16; break; /* PX2 */ default: fatalerror("SHARC: SET_UREG: unknown register %08X at %08X\n", ureg, m_core->pc); } break; @@ -2668,29 +2668,29 @@ void adsp21062_device::sharcop_bit_reverse() /* push/pop stacks / flush cache */ void adsp21062_device::sharcop_push_pop_stacks() { - if (m_core->opcode & U64(0x008000000000)) + if (m_core->opcode & 0x008000000000U) { fatalerror("sharcop_push_pop_stacks: push loop not implemented\n"); } - if (m_core->opcode & U64(0x004000000000)) + if (m_core->opcode & 0x004000000000U) { fatalerror("sharcop_push_pop_stacks: pop loop not implemented\n"); } - if (m_core->opcode & U64(0x002000000000)) + if (m_core->opcode & 0x002000000000U) { //fatalerror("sharcop_push_pop_stacks: push sts not implemented\n"); PUSH_STATUS_STACK(); } - if (m_core->opcode & U64(0x001000000000)) + if (m_core->opcode & 0x001000000000U) { //fatalerror("sharcop_push_pop_stacks: pop sts not implemented\n"); POP_STATUS_STACK(); } - if (m_core->opcode & U64(0x000800000000)) + if (m_core->opcode & 0x000800000000U) { PUSH_PC(m_core->pcstk); } - if (m_core->opcode & U64(0x000400000000)) + if (m_core->opcode & 0x000400000000U) { POP_PC(); } diff --git a/src/devices/cpu/tms32031/32031ops.hxx b/src/devices/cpu/tms32031/32031ops.hxx index 476c5082a3e..a99d3d0295e 100644 --- a/src/devices/cpu/tms32031/32031ops.hxx +++ b/src/devices/cpu/tms32031/32031ops.hxx @@ -574,14 +574,14 @@ void tms3203x_device::addf(tmsreg &dst, tmsreg &src1, tmsreg &src2) } // if the mantissa is >= 2.0 or < -2.0, normalize - else if (man >= int64_t(U64(0x100000000)) || man < int64_t(U64(0xffffffff00000000))) + else if (man >= int64_t(0x100000000U) || man < int64_t(0xffffffff00000000U)) { man >>= 1; exp++; } // if the mantissa is < 1.0 and > -1.0, normalize - else if (man < int64_t(U64(0x80000000)) && man >= int64_t(U64(0xffffffff80000000))) + else if (man < int64_t(0x80000000U) && man >= int64_t(0xffffffff80000000U)) { if (man > 0) { @@ -687,14 +687,14 @@ void tms3203x_device::subf(tmsreg &dst, tmsreg &src1, tmsreg &src2) } // if the mantissa is >= 2.0 or < -2.0, normalize - else if (man >= int64_t(U64(0x100000000)) || man < int64_t(U64(0xffffffff00000000))) + else if (man >= int64_t(0x100000000U) || man < int64_t(0xffffffff00000000U)) { man >>= 1; exp++; } // if the mantissa is < 1.0 and > -1.0, normalize - else if (man < int64_t(U64(0x80000000)) && man >= int64_t(U64(0xffffffff80000000))) + else if (man < int64_t(0x80000000U) && man >= int64_t(0xffffffff80000000U)) { if (man > 0) { @@ -778,11 +778,11 @@ void tms3203x_device::mpyf(tmsreg &dst, tmsreg &src1, tmsreg &src2) } // if the mantissa is >= 2.0 or <= -2.0, normalize - else if (man >= int64_t(U64(0x100000000))) + else if (man >= int64_t(0x100000000U)) { man >>= 1; exp++; - if (man >= int64_t(U64(0x100000000))) + if (man >= int64_t(0x100000000U)) { man >>= 1; exp++; @@ -790,7 +790,7 @@ void tms3203x_device::mpyf(tmsreg &dst, tmsreg &src1, tmsreg &src2) } // if the mantissa is >= 2.0 or <= -2.0, normalize - else if (man < int64_t(U64(0xffffffff00000000))) + else if (man < int64_t(0xffffffff00000000U)) { man >>= 1; exp++; diff --git a/src/devices/cpu/tms32082/dis_pp.cpp b/src/devices/cpu/tms32082/dis_pp.cpp index b32b681df3a..bdd6dfc9c97 100644 --- a/src/devices/cpu/tms32082/dis_pp.cpp +++ b/src/devices/cpu/tms32082/dis_pp.cpp @@ -435,10 +435,10 @@ static offs_t tms32082_disasm_pp(std::ostream &stream, offs_t pc, const uint8_t case 0xe: case 0xf: { - if ((op & U64(0xfaa8100000000000)) == U64(0x8800000000000000)) + if ((op & 0xfaa8100000000000U) == 0x8800000000000000U) { int operation = (op >> 39) & 0x1f; - uint64_t parallel_xfer = (op & U64(0x0000007fffffffff)); + uint64_t parallel_xfer = (op & 0x0000007fffffffffU); switch (operation) { @@ -462,7 +462,7 @@ static offs_t tms32082_disasm_pp(std::ostream &stream, offs_t pc, const uint8_t case 0: case 1: // Base set ALU (5-bit immediate) { - uint64_t parallel_xfer = (op & U64(0x0000007fffffffff)); + uint64_t parallel_xfer = (op & 0x0000007fffffffffU); int dst = (op >> 48) & 7; int src1 = (op >> 45) & 7; @@ -541,7 +541,7 @@ static offs_t tms32082_disasm_pp(std::ostream &stream, offs_t pc, const uint8_t case 2: // Base set ALU (reg src2) { - uint64_t parallel_xfer = (op & U64(0x0000007fffffffff)); + uint64_t parallel_xfer = (op & 0x0000007fffffffffU); int dst = (op >> 48) & 7; int src1 = (op >> 45) & 7; diff --git a/src/devices/cpu/tms57002/tms57002.cpp b/src/devices/cpu/tms57002/tms57002.cpp index eafa912206c..761bf1e082b 100644 --- a/src/devices/cpu/tms57002/tms57002.cpp +++ b/src/devices/cpu/tms57002/tms57002.cpp @@ -821,7 +821,7 @@ void tms57002_device::device_start() state_add(TMS57002_ST1, "ST1", st1); state_add(TMS57002_RPTC, "RPTC", rptc); state_add(TMS57002_AACC, "AACC", aacc); - state_add(TMS57002_MACC, "MACC", macc).mask(U64(0xfffffffffffff)); + state_add(TMS57002_MACC, "MACC", macc).mask(0xfffffffffffffU); state_add(TMS57002_BA0, "BA0", ba0); state_add(TMS57002_BA1, "BA1", ba1); state_add(TMS57002_CREG, "CREG", creg); diff --git a/src/devices/cpu/uml.cpp b/src/devices/cpu/uml.cpp index 5b4822cb379..3e14b713c34 100644 --- a/src/devices/cpu/uml.cpp +++ b/src/devices/cpu/uml.cpp @@ -414,8 +414,8 @@ void uml::instruction::simplify() if (m_flags != 0) return; - static const uint64_t instsizemask[] = { 0, 0, 0, 0, 0xffffffff, 0, 0, 0, U64(0xffffffffffffffff) }; - static const uint64_t paramsizemask[] = { 0xff, 0xffff, 0xffffffff, U64(0xffffffffffffffff) }; + static const uint64_t instsizemask[] = { 0, 0, 0, 0, 0xffffffff, 0, 0, 0, 0xffffffffffffffffU }; + static const uint64_t paramsizemask[] = { 0xff, 0xffff, 0xffffffff, 0xffffffffffffffffU }; // loop until we've simplified all we can opcode_t origop; @@ -491,7 +491,7 @@ void uml::instruction::simplify() m_opcode = OP_ROL; m_numparams = 3; } - else if (m_param[2].is_immediate() && m_param[3].is_immediate_value((U64(0xffffffffffffffff) << m_param[2].immediate()) & instsizemask[m_size])) + else if (m_param[2].is_immediate() && m_param[3].is_immediate_value((0xffffffffffffffffU << m_param[2].immediate()) & instsizemask[m_size])) { m_opcode = OP_SHL; m_numparams = 3; diff --git a/src/devices/machine/intelfsh.cpp b/src/devices/machine/intelfsh.cpp index 88e3cdddec8..fcc24af7904 100644 --- a/src/devices/machine/intelfsh.cpp +++ b/src/devices/machine/intelfsh.cpp @@ -480,12 +480,12 @@ void intelfsh_device::nvram_default() if (m_bits == 8) { for (offs_t offs = 0; offs < bytes; offs++) - m_data[offs] = m_region->u8(offs); + m_data[offs] = m_region->as_u8(offs); } else { for (offs_t offs = 0; offs < bytes; offs += 2) { - uint16_t v = m_region->u16(offs / 2); + uint16_t v = m_region->as_u16(offs / 2); m_data[offs] = v >> 8; m_data[offs+1] = v; } diff --git a/src/devices/machine/pci.cpp b/src/devices/machine/pci.cpp index c10a58306a8..dd8e767f5a8 100644 --- a/src/devices/machine/pci.cpp +++ b/src/devices/machine/pci.cpp @@ -150,7 +150,7 @@ WRITE32_MEMBER(pci_device::address_base_w) if(bank_reg_infos[offset].hi) bank_infos[bid].adr = (bank_infos[bid].adr & 0xffffffff) | (uint64_t(data) << 32); else { - bank_infos[bid].adr = (bank_infos[bid].adr & U64(0xffffffff00000000)) | data; + bank_infos[bid].adr = (bank_infos[bid].adr & 0xffffffff00000000U) | data; } remap_cb(); } diff --git a/src/devices/sound/rf5c400.cpp b/src/devices/sound/rf5c400.cpp index c6bfe8797d2..2399acdcd04 100644 --- a/src/devices/sound/rf5c400.cpp +++ b/src/devices/sound/rf5c400.cpp @@ -202,7 +202,7 @@ void rf5c400_device::sound_stream_update(sound_stream &stream, stream_sample_t * if ( (pos>>16) > m_rom.length() || (pos>>16) > end) { pos -= loop<<16; - pos &= U64(0xFFFFFF0000); + pos &= 0xFFFFFF0000U; } } diff --git a/src/devices/video/epic12.cpp b/src/devices/video/epic12.cpp index dab2e84a748..bcf4e04ab18 100644 --- a/src/devices/video/epic12.cpp +++ b/src/devices/video/epic12.cpp @@ -944,7 +944,7 @@ void epic12_device::install_handlers(int addr1, int addr2) write = write32_delegate(FUNC(epic12_device::blitter_w), this); } - space.install_readwrite_handler(addr1, addr2, read , write, U64(0xffffffffffffffff)); + space.install_readwrite_handler(addr1, addr2, read , write, 0xffffffffffffffffU); } READ64_MEMBER( epic12_device::fpga_r ) diff --git a/src/devices/video/gb_lcd.cpp b/src/devices/video/gb_lcd.cpp index 3cf9ef945a1..6be32fc7588 100644 --- a/src/devices/video/gb_lcd.cpp +++ b/src/devices/video/gb_lcd.cpp @@ -867,8 +867,8 @@ LOG(("scrollx_to_apply: %u\n", m_line.scrollx_to_apply)); else { // Interleave bits from plane0 and plane1 - m_line.shift_register = (((((m_line.plane0 * U64(0x0101010101010101)) & U64(0x8040201008040201)) * U64(0x0102040810204081)) >> 49) & 0x5555) - | (((((m_line.plane1 * U64(0x0101010101010101)) & U64(0x8040201008040201)) * U64(0x0102040810204081)) >> 48) & 0xAAAA); + m_line.shift_register = (((((m_line.plane0 * 0x0101010101010101U) & 0x8040201008040201U) * 0x0102040810204081U) >> 49) & 0x5555) + | (((((m_line.plane1 * 0x0101010101010101U) & 0x8040201008040201U) * 0x0102040810204081U) >> 48) & 0xAAAA); } if (m_line.pixels_drawn < 8) { diff --git a/src/devices/video/stvvdp2.cpp b/src/devices/video/stvvdp2.cpp index 617252c0ee4..6e78b89bef3 100644 --- a/src/devices/video/stvvdp2.cpp +++ b/src/devices/video/stvvdp2.cpp @@ -3752,8 +3752,8 @@ void saturn_state::stv_vdp2_draw_basic_tilemap(bitmap_rgb32 &bitmap, const recta } } - scalex = (int32_t)((int64_t)S64(0x100000000) / (int64_t)stv2_current_tilemap.incx); - scaley = (int32_t)((int64_t)S64(0x100000000) / (int64_t)stv2_current_tilemap.incy); + scalex = s32(s64(0x100000000U) / s64(stv2_current_tilemap.incx)); + scaley = s32(s64(0x100000000U) / s64(stv2_current_tilemap.incy)); tilesizex = scalex * 8; tilesizey = scaley * 8; drawypos = drawxpos = 0; diff --git a/src/devices/video/vooddefs.h b/src/devices/video/vooddefs.h index 0840f80eaf4..095f29f972c 100644 --- a/src/devices/video/vooddefs.h +++ b/src/devices/video/vooddefs.h @@ -149,7 +149,7 @@ static inline int32_t fast_reciplog(int64_t value, int32_t *log2) } /* if we've spilled out of 32 bits, push it down under 32 */ - if (value & U64(0xffff00000000)) + if (value & 0xffff00000000U) { temp = (uint32_t)(value >> 16); exp -= 16; @@ -250,7 +250,7 @@ static inline int64_t float_to_int64(uint32_t data, int fixedbits) if (exponent < 64) result <<= exponent; else - result = U64(0x7fffffffffffffff); + result = 0x7fffffffffffffffU; } if (data & 0x80000000) result = -result; @@ -1846,9 +1846,9 @@ do if (FBZMODE_STIPPLE_PATTERN(FBZMODE) == 0) \ { \ vd->reg[stipple].u = (vd->reg[stipple].u << 1) | (vd->reg[stipple].u >> 31);\ - if ((vd->reg[stipple].u & 0x80000000) == 0) \ + if ((vd->reg[stipple].u & 0x80000000) == 0) \ { \ - vd->stats.total_stippled++; \ + vd->stats.total_stippled++; \ goto skipdrawdepth; \ } \ } \ @@ -1857,21 +1857,21 @@ do else \ { \ int stipple_index = (((YY) & 3) << 3) | (~(XX) & 7); \ - if (((vd->reg[stipple].u >> stipple_index) & 1) == 0) \ + if (((vd->reg[stipple].u >> stipple_index) & 1) == 0) \ { \ - vd->stats.total_stippled++; \ + vd->stats.total_stippled++; \ goto skipdrawdepth; \ } \ } \ } \ \ /* compute "floating point" W value (used for depth and fog) */ \ - if ((ITERW) & U64(0xffff00000000)) \ + if ((ITERW) & 0xffff00000000U) \ wfloat = 0x0000; \ else \ { \ - uint32_t temp = (uint32_t)(ITERW); \ - if (!(temp & 0xffff0000)) \ + uint32_t temp = (uint32_t)(ITERW); \ + if (!(temp & 0xffff0000)) \ wfloat = 0xffff; \ else \ { \ @@ -1879,7 +1879,7 @@ do wfloat = ((exp << 12) | ((~temp >> (19 - exp)) & 0xfff)) + 1; \ } \ } \ - fogdepth = wfloat; \ + fogdepth = wfloat; \ /* add the bias for fog selection*/ \ if (FBZMODE_ENABLE_DEPTH_BIAS(FBZMODE)) \ { \ @@ -1900,8 +1900,8 @@ do depthval = 0x0000; \ else \ { \ - uint32_t temp = (ITERZ << 4); \ - if (!(temp & 0xffff0000)) \ + uint32_t temp = (ITERZ << 4); \ + if (!(temp & 0xffff0000)) \ depthval = 0xffff; \ else \ { \ @@ -1909,7 +1909,7 @@ do depthval = ((exp << 12) | ((~temp >> (19 - exp)) & 0xfff)) + 1; \ } \ } \ - } \ + } \ /* add the bias */ \ biasdepth = depthval; \ if (FBZMODE_ENABLE_DEPTH_BIAS(FBZMODE)) \ diff --git a/src/emu/addrmap.cpp b/src/emu/addrmap.cpp index 9996f803e7e..97579fc126a 100644 --- a/src/emu/addrmap.cpp +++ b/src/emu/addrmap.cpp @@ -79,7 +79,7 @@ address_map_entry &address_map_entry::mask(offs_t _mask) // retrieve a submap from a device //------------------------------------------------- -address_map_entry &address_map_entry::set_submap(const char *tag, address_map_delegate func, int bits, uint64_t mask) +address_map_entry &address_map_entry::set_submap(const char *tag, address_map_delegate func, int bits, u64 mask) { if(!bits) bits = m_map.m_databits; @@ -103,7 +103,7 @@ address_map_entry &address_map_entry::set_submap(const char *tag, address_map_de // 8-bit read/write handlers //------------------------------------------------- -address_map_entry &address_map_entry::set_handler(read8_delegate func, uint64_t unitmask) +address_map_entry &address_map_entry::set_handler(read8_delegate func, u64 unitmask) { assert(!func.isnull()); assert(unitmask_is_appropriate(8, unitmask, func.name())); @@ -116,7 +116,7 @@ address_map_entry &address_map_entry::set_handler(read8_delegate func, uint64_t } -address_map_entry &address_map_entry::set_handler(write8_delegate func, uint64_t unitmask) +address_map_entry &address_map_entry::set_handler(write8_delegate func, u64 unitmask) { assert(!func.isnull()); assert(unitmask_is_appropriate(8, unitmask, func.name())); @@ -129,7 +129,7 @@ address_map_entry &address_map_entry::set_handler(write8_delegate func, uint64_t } -address_map_entry &address_map_entry::set_handler(read8_delegate rfunc, write8_delegate wfunc, uint64_t unitmask) +address_map_entry &address_map_entry::set_handler(read8_delegate rfunc, write8_delegate wfunc, u64 unitmask) { set_handler(rfunc, unitmask); set_handler(wfunc, unitmask); @@ -142,7 +142,7 @@ address_map_entry &address_map_entry::set_handler(read8_delegate rfunc, write8_d // 16-bit read/write handlers //------------------------------------------------- -address_map_entry &address_map_entry::set_handler(read16_delegate func, uint64_t unitmask) +address_map_entry &address_map_entry::set_handler(read16_delegate func, u64 unitmask) { assert(!func.isnull()); assert(unitmask_is_appropriate(16, unitmask, func.name())); @@ -155,7 +155,7 @@ address_map_entry &address_map_entry::set_handler(read16_delegate func, uint64_t } -address_map_entry &address_map_entry::set_handler(write16_delegate func, uint64_t unitmask) +address_map_entry &address_map_entry::set_handler(write16_delegate func, u64 unitmask) { assert(!func.isnull()); assert(unitmask_is_appropriate(16, unitmask, func.name())); @@ -168,7 +168,7 @@ address_map_entry &address_map_entry::set_handler(write16_delegate func, uint64_ } -address_map_entry &address_map_entry::set_handler(read16_delegate rfunc, write16_delegate wfunc, uint64_t unitmask) +address_map_entry &address_map_entry::set_handler(read16_delegate rfunc, write16_delegate wfunc, u64 unitmask) { set_handler(rfunc, unitmask); set_handler(wfunc, unitmask); @@ -181,7 +181,7 @@ address_map_entry &address_map_entry::set_handler(read16_delegate rfunc, write16 // 32-bit read/write handlers //------------------------------------------------- -address_map_entry &address_map_entry::set_handler(read32_delegate func, uint64_t unitmask) +address_map_entry &address_map_entry::set_handler(read32_delegate func, u64 unitmask) { assert(!func.isnull()); assert(unitmask_is_appropriate(32, unitmask, func.name())); @@ -194,7 +194,7 @@ address_map_entry &address_map_entry::set_handler(read32_delegate func, uint64_t } -address_map_entry &address_map_entry::set_handler(write32_delegate func, uint64_t unitmask) +address_map_entry &address_map_entry::set_handler(write32_delegate func, u64 unitmask) { assert(!func.isnull()); assert(unitmask_is_appropriate(32, unitmask, func.name())); @@ -207,7 +207,7 @@ address_map_entry &address_map_entry::set_handler(write32_delegate func, uint64_ } -address_map_entry &address_map_entry::set_handler(read32_delegate rfunc, write32_delegate wfunc, uint64_t unitmask) +address_map_entry &address_map_entry::set_handler(read32_delegate rfunc, write32_delegate wfunc, u64 unitmask) { set_handler(rfunc, unitmask); set_handler(wfunc, unitmask); @@ -220,7 +220,7 @@ address_map_entry &address_map_entry::set_handler(read32_delegate rfunc, write32 // 64-bit read/write handlers //------------------------------------------------- -address_map_entry &address_map_entry::set_handler(read64_delegate func, uint64_t unitmask) +address_map_entry &address_map_entry::set_handler(read64_delegate func, u64 unitmask) { assert(!func.isnull()); assert(unitmask_is_appropriate(64, unitmask, func.name())); @@ -233,7 +233,7 @@ address_map_entry &address_map_entry::set_handler(read64_delegate func, uint64_t } -address_map_entry &address_map_entry::set_handler(write64_delegate func, uint64_t unitmask) +address_map_entry &address_map_entry::set_handler(write64_delegate func, u64 unitmask) { assert(!func.isnull()); assert(unitmask_is_appropriate(64, unitmask, func.name())); @@ -246,7 +246,7 @@ address_map_entry &address_map_entry::set_handler(write64_delegate func, uint64_ } -address_map_entry &address_map_entry::set_handler(read64_delegate rfunc, write64_delegate wfunc, uint64_t unitmask) +address_map_entry &address_map_entry::set_handler(read64_delegate rfunc, write64_delegate wfunc, u64 unitmask) { set_handler(rfunc, unitmask); set_handler(wfunc, unitmask); @@ -274,7 +274,7 @@ address_map_entry &address_map_entry::set_handler(setoffset_delegate func) // provided unitmask is valid and expected //------------------------------------------------- -bool address_map_entry::unitmask_is_appropriate(uint8_t width, uint64_t unitmask, const char *string) +bool address_map_entry::unitmask_is_appropriate(u8 width, u64 unitmask, const char *string) { // if no mask, this must match the default width of the map if (unitmask == 0) @@ -289,12 +289,12 @@ bool address_map_entry::unitmask_is_appropriate(uint8_t width, uint64_t unitmask throw emu_fatalerror("Handler %s is a %d-bit handler and is too wide to be used in a %d-bit address map", string, width, m_map.m_databits); // the mask must represent whole units of width - uint32_t basemask = (width == 8) ? 0xff : (width == 16) ? 0xffff : 0xffffffff; - uint64_t singlemask = basemask; + u32 basemask = (width == 8) ? 0xff : (width == 16) ? 0xffff : 0xffffffff; + u64 singlemask = basemask; while (singlemask != 0) { if ((unitmask & singlemask) != 0 && (unitmask & singlemask) != singlemask) - throw emu_fatalerror("Handler %s specified a mask of %08X%08X; needs to be in even chunks of %X", string, (uint32_t)(unitmask >> 32), (uint32_t)unitmask, basemask); + throw emu_fatalerror("Handler %s specified a mask of %08X%08X; needs to be in even chunks of %X", string, (u32)(unitmask >> 32), (u32)unitmask, basemask); singlemask <<= width; } return true; @@ -373,7 +373,7 @@ address_map::address_map(device_t &device, address_map_entry *entry) // address_map - constructor dynamic device mapping case //---------------------------------------------------------- -address_map::address_map(const address_space &space, offs_t start, offs_t end, int bits, uint64_t unitmask, device_t &device, address_map_delegate submap_delegate) +address_map::address_map(const address_space &space, offs_t start, offs_t end, int bits, u64 unitmask, device_t &device, address_map_delegate submap_delegate) : m_spacenum(space.spacenum()), m_device(&device), m_databits(space.data_width()), @@ -399,7 +399,7 @@ address_map::~address_map() // values //------------------------------------------------- -void address_map::configure(address_spacenum spacenum, uint8_t databits) +void address_map::configure(address_spacenum spacenum, u8 databits) { assert(m_spacenum == spacenum); if (m_databits == 0xff) @@ -471,14 +471,14 @@ void address_map::uplift_submaps(running_machine &machine, device_t &owner, endi offs_t mirror_address_mask = (databytes - 1) & ~(entry_bytes - 1); - uint64_t entry_mask = (2ULL << (entry_bits-1)) - 1; + u64 entry_mask = (2ULL << (entry_bits-1)) - 1; int slot_offset[8]; int slot_count = 0; int max_slot_count = m_databits / entry_bits; int slot_xor_mask = endian == ENDIANNESS_LITTLE ? 0 : max_slot_count - 1; - uint64_t global_mask = entry->m_read.m_mask; + u64 global_mask = entry->m_read.m_mask; // zero means all if (!global_mask) global_mask = ~global_mask; @@ -547,10 +547,10 @@ void address_map::uplift_submaps(running_machine &machine, device_t &owner, endi if (mdata.m_bits == 0 && entry_bits != m_databits) mdata.m_bits = entry_bits; - uint64_t mask = 0; + u64 mask = 0; if (mdata.m_bits != m_databits) { - uint64_t unitmask = mdata.m_mask ? mdata.m_mask : entry_mask; + u64 unitmask = mdata.m_mask ? mdata.m_mask : entry_mask; for (int slot = start_slot; slot <= end_slot; slot++) mask |= unitmask << slot_offset[slot]; } @@ -602,8 +602,8 @@ void address_map::map_validity_check(validity_checker &valid, address_spacenum s // loop over entries and look for errors for (address_map_entry &entry : m_entrylist) { - uint32_t bytestart = spaceconfig.addr2byte(entry.m_addrstart); - uint32_t byteend = spaceconfig.addr2byte_end(entry.m_addrend); + u32 bytestart = spaceconfig.addr2byte(entry.m_addrstart); + u32 byteend = spaceconfig.addr2byte_end(entry.m_addrend); // look for overlapping entries if (!detected_overlap) diff --git a/src/emu/addrmap.h b/src/emu/addrmap.h index 4dde0005a13..ac6736c6b51 100644 --- a/src/emu/addrmap.h +++ b/src/emu/addrmap.h @@ -58,11 +58,11 @@ public: m_name(nullptr), m_tag(nullptr) { } - map_handler_type m_type; // type of the handler - uint8_t m_bits; // width of the handler in bits, or 0 for default - uint64_t m_mask; // mask for which lanes apply - const char * m_name; // name of the handler - const char * m_tag; // tag for I/O ports and banks + map_handler_type m_type; // type of the handler + u8 m_bits; // width of the handler in bits, or 0 for default + u64 m_mask; // mask for which lanes apply + const char * m_name; // name of the handler + const char * m_tag; // tag for I/O ports and banks }; @@ -120,7 +120,7 @@ public: address_map_entry &set_write_type(map_handler_type _type) { m_write.m_type = _type; return *this; } // submap referencing - address_map_entry &set_submap(const char *tag, address_map_delegate func, int bits, uint64_t mask); + address_map_entry &set_submap(const char *tag, address_map_delegate func, int bits, u64 mask); // public state address_map_entry * m_next; // pointer to the next entry @@ -162,28 +162,28 @@ public: offs_t m_bytemask; // byte-adjusted mask bits // handler setters for 8-bit functions - address_map_entry &set_handler(read8_delegate func, uint64_t mask = 0); - address_map_entry &set_handler(write8_delegate func, uint64_t mask = 0); - address_map_entry &set_handler(read8_delegate rfunc, write8_delegate wfunc, uint64_t mask = 0); + address_map_entry &set_handler(read8_delegate func, u64 mask = 0); + address_map_entry &set_handler(write8_delegate func, u64 mask = 0); + address_map_entry &set_handler(read8_delegate rfunc, write8_delegate wfunc, u64 mask = 0); // handler setters for 16-bit functions - address_map_entry &set_handler(read16_delegate func, uint64_t mask = 0); - address_map_entry &set_handler(write16_delegate func, uint64_t mask = 0); - address_map_entry &set_handler(read16_delegate rfunc, write16_delegate wfunc, uint64_t mask = 0); + address_map_entry &set_handler(read16_delegate func, u64 mask = 0); + address_map_entry &set_handler(write16_delegate func, u64 mask = 0); + address_map_entry &set_handler(read16_delegate rfunc, write16_delegate wfunc, u64 mask = 0); // handler setters for 32-bit functions - address_map_entry &set_handler(read32_delegate func, uint64_t mask = 0); - address_map_entry &set_handler(write32_delegate func, uint64_t mask = 0); - address_map_entry &set_handler(read32_delegate rfunc, write32_delegate wfunc, uint64_t mask = 0); + address_map_entry &set_handler(read32_delegate func, u64 mask = 0); + address_map_entry &set_handler(write32_delegate func, u64 mask = 0); + address_map_entry &set_handler(read32_delegate rfunc, write32_delegate wfunc, u64 mask = 0); // handler setters for 64-bit functions - address_map_entry &set_handler(read64_delegate func, uint64_t mask = 0); - address_map_entry &set_handler(write64_delegate func, uint64_t mask = 0); - address_map_entry &set_handler(read64_delegate rfunc, write64_delegate wfunc, uint64_t mask = 0); + address_map_entry &set_handler(read64_delegate func, u64 mask = 0); + address_map_entry &set_handler(write64_delegate func, u64 mask = 0); + address_map_entry &set_handler(read64_delegate rfunc, write64_delegate wfunc, u64 mask = 0); private: // helper functions - bool unitmask_is_appropriate(uint8_t width, uint64_t unitmask, const char *string); + bool unitmask_is_appropriate(u8 width, u64 unitmask, const char *string); }; // ======================> address_map @@ -195,28 +195,28 @@ public: // construction/destruction address_map(device_t &device, address_spacenum spacenum); address_map(device_t &device, address_map_entry *entry); - address_map(const address_space &space, offs_t start, offs_t end, int bits, uint64_t unitmask, device_t &device, address_map_delegate submap_delegate); + address_map(const address_space &space, offs_t start, offs_t end, int bits, u64 unitmask, device_t &device, address_map_delegate submap_delegate); ~address_map(); // configuration - void configure(address_spacenum _spacenum, uint8_t _databits); + void configure(address_spacenum _spacenum, u8 _databits); // setters void global_mask(offs_t mask); void unmap_value_low() { m_unmapval = 0; } void unmap_value_high() { m_unmapval = ~0; } - void unmap_value(uint8_t value) { m_unmapval = value; } + void unmap_value(u8 value) { m_unmapval = value; } // add a new entry of the given type address_map_entry &range(offs_t start, offs_t end); // public data - address_spacenum m_spacenum; // space number of the map - device_t * m_device; // associated device - uint8_t m_databits; // data bits represented by the map - uint8_t m_unmapval; // unmapped memory value - offs_t m_globalmask; // global mask - simple_list m_entrylist; // list of entries + address_spacenum m_spacenum; // space number of the map + device_t * m_device; // associated device + u8 m_databits; // data bits represented by the map + u8 m_unmapval; // unmapped memory value + offs_t m_globalmask; // global mask + simple_list m_entrylist; // list of entries void uplift_submaps(running_machine &machine, device_t &owner, endianness_t endian); void map_validity_check(validity_checker &valid, address_spacenum spacenum) const; diff --git a/src/emu/attotime.cpp b/src/emu/attotime.cpp index 6df7487dfc7..e756aa9653d 100644 --- a/src/emu/attotime.cpp +++ b/src/emu/attotime.cpp @@ -29,7 +29,7 @@ const attotime attotime::never(ATTOTIME_MAX_SECONDS, 0); // constant //------------------------------------------------- -attotime &attotime::operator*=(uint32_t factor) +attotime &attotime::operator*=(u32 factor) { // if one of the items is attotime::never, return attotime::never if (m_seconds >= ATTOTIME_MAX_SECONDS) @@ -40,17 +40,17 @@ attotime &attotime::operator*=(uint32_t factor) return *this = zero; // split attoseconds into upper and lower halves which fit into 32 bits - uint32_t attolo; - uint32_t attohi = divu_64x32_rem(m_attoseconds, ATTOSECONDS_PER_SECOND_SQRT, &attolo); + u32 attolo; + u32 attohi = divu_64x32_rem(m_attoseconds, ATTOSECONDS_PER_SECOND_SQRT, &attolo); // scale the lower half, then split into high/low parts - uint64_t temp = mulu_32x32(attolo, factor); - uint32_t reslo; + u64 temp = mulu_32x32(attolo, factor); + u32 reslo; temp = divu_64x32_rem(temp, ATTOSECONDS_PER_SECOND_SQRT, &reslo); // scale the upper half, then split into high/low parts temp += mulu_32x32(attohi, factor); - uint32_t reshi; + u32 reshi; temp = divu_64x32_rem(temp, ATTOSECONDS_PER_SECOND_SQRT, &reshi); // scale the seconds @@ -69,7 +69,7 @@ attotime &attotime::operator*=(uint32_t factor) // operator/= - divide an attotime by a constant //------------------------------------------------- -attotime &attotime::operator/=(uint32_t factor) +attotime &attotime::operator/=(u32 factor) { // if one of the items is attotime::never, return attotime::never if (m_seconds >= ATTOTIME_MAX_SECONDS) @@ -80,20 +80,20 @@ attotime &attotime::operator/=(uint32_t factor) return *this; // split attoseconds into upper and lower halves which fit into 32 bits - uint32_t attolo; - uint32_t attohi = divu_64x32_rem(m_attoseconds, ATTOSECONDS_PER_SECOND_SQRT, &attolo); + u32 attolo; + u32 attohi = divu_64x32_rem(m_attoseconds, ATTOSECONDS_PER_SECOND_SQRT, &attolo); // divide the seconds and get the remainder - uint32_t remainder; + u32 remainder; m_seconds = divu_64x32_rem(m_seconds, factor, &remainder); // combine the upper half of attoseconds with the remainder and divide that - uint64_t temp = (int64_t)attohi + mulu_32x32(remainder, ATTOSECONDS_PER_SECOND_SQRT); - uint32_t reshi = divu_64x32_rem(temp, factor, &remainder); + u64 temp = s64(attohi) + mulu_32x32(remainder, ATTOSECONDS_PER_SECOND_SQRT); + u32 reshi = divu_64x32_rem(temp, factor, &remainder); // combine the lower half of attoseconds with the remainder and divide that temp = attolo + mulu_32x32(remainder, ATTOSECONDS_PER_SECOND_SQRT); - uint32_t reslo = divu_64x32_rem(temp, factor, &remainder); + u32 reslo = divu_64x32_rem(temp, factor, &remainder); // round based on the remainder m_attoseconds = (attoseconds_t)reslo + mulu_32x32(reshi, ATTOSECONDS_PER_SECOND_SQRT); @@ -129,7 +129,7 @@ const char *attotime::as_string(int precision) const // case 2: we want 9 or fewer digits of precision else if (precision <= 9) { - uint32_t upper = m_attoseconds / ATTOSECONDS_PER_SECOND_SQRT; + u32 upper = m_attoseconds / ATTOSECONDS_PER_SECOND_SQRT; int temp = precision; while (temp < 9) { @@ -142,8 +142,8 @@ const char *attotime::as_string(int precision) const // case 3: more than 9 digits of precision else { - uint32_t lower; - uint32_t upper = divu_64x32_rem(m_attoseconds, ATTOSECONDS_PER_SECOND_SQRT, &lower); + u32 lower; + u32 upper = divu_64x32_rem(m_attoseconds, ATTOSECONDS_PER_SECOND_SQRT, &lower); int temp = precision; while (temp < 18) { diff --git a/src/emu/attotime.h b/src/emu/attotime.h index c99a1d953df..02c19465037 100644 --- a/src/emu/attotime.h +++ b/src/emu/attotime.h @@ -44,8 +44,8 @@ //************************************************************************** // core components of the attotime structure -typedef int64_t attoseconds_t; -typedef int32_t seconds_t; +typedef s64 attoseconds_t; +typedef s32 seconds_t; // core definitions const attoseconds_t ATTOSECONDS_PER_SECOND_SQRT = 1'000'000'000; @@ -110,7 +110,7 @@ public: // conversion to other forms constexpr double as_double() const { return double(m_seconds) + ATTOSECONDS_TO_DOUBLE(m_attoseconds); } constexpr attoseconds_t as_attoseconds() const; - uint64_t as_ticks(uint32_t frequency) const; + u64 as_ticks(u32 frequency) const; /** Convert to string using at @p precision */ const char *as_string(int precision = 9) const; @@ -120,23 +120,23 @@ public: constexpr seconds_t seconds() const { return m_seconds; } static attotime from_double(double _time); - static attotime from_ticks(uint64_t ticks, uint32_t frequency); + static attotime from_ticks(u64 ticks, u32 frequency); /** Create an attotime from a integer count of seconds @seconds */ - static constexpr attotime from_seconds(int32_t seconds) { return attotime(seconds, 0); } + static constexpr attotime from_seconds(s32 seconds) { return attotime(seconds, 0); } /** Create an attotime from a integer count of milliseconds @msec */ - static constexpr attotime from_msec(int64_t msec) { return attotime(msec / 1000, (msec % 1000) * (ATTOSECONDS_PER_SECOND / 1000)); } + static constexpr attotime from_msec(s64 msec) { return attotime(msec / 1000, (msec % 1000) * (ATTOSECONDS_PER_SECOND / 1000)); } /** Create an attotime from a integer count of microseconds @usec */ - static constexpr attotime from_usec(int64_t usec) { return attotime(usec / 1000000, (usec % 1000000) * (ATTOSECONDS_PER_SECOND / 1000000)); } + static constexpr attotime from_usec(s64 usec) { return attotime(usec / 1000000, (usec % 1000000) * (ATTOSECONDS_PER_SECOND / 1000000)); } /** Create an attotime from a integer count of nanoseconds @nsec */ - static constexpr attotime from_nsec(int64_t nsec) { return attotime(nsec / 1000000000, (nsec % 1000000000) * (ATTOSECONDS_PER_SECOND / 1000000000)); } + static constexpr attotime from_nsec(s64 nsec) { return attotime(nsec / 1000000000, (nsec % 1000000000) * (ATTOSECONDS_PER_SECOND / 1000000000)); } /** Create an attotime from at the given frequency @frequency */ static attotime from_hz(double frequency) { assert(frequency > 0); double d = 1 / frequency; return attotime(floor(d), modf(d, &d) * ATTOSECONDS_PER_SECOND); } // math attotime &operator+=(const attotime &right); attotime &operator-=(const attotime &right); - attotime &operator*=(uint32_t factor); - attotime &operator/=(uint32_t factor); + attotime &operator*=(u32 factor); + attotime &operator/=(u32 factor); // members seconds_t m_seconds; @@ -246,14 +246,14 @@ inline attotime &attotime::operator-=(const attotime &right) /** handle multiplication by an integral factor; defined in terms of the assignment operators */ -inline attotime operator*(const attotime &left, uint32_t factor) +inline attotime operator*(const attotime &left, u32 factor) { attotime result = left; result *= factor; return result; } -inline attotime operator*(uint32_t factor, const attotime &right) +inline attotime operator*(u32 factor, const attotime &right) { attotime result = right; result *= factor; @@ -261,7 +261,7 @@ inline attotime operator*(uint32_t factor, const attotime &right) } /** handle division by an integral factor; defined in terms of the assignment operators */ -inline attotime operator/(const attotime &left, uint32_t factor) +inline attotime operator/(const attotime &left, u32 factor) { attotime result = left; result /= factor; @@ -332,24 +332,24 @@ inline constexpr attoseconds_t attotime::as_attoseconds() const /** as_ticks - convert to ticks at @p frequency */ -inline uint64_t attotime::as_ticks(uint32_t frequency) const +inline u64 attotime::as_ticks(u32 frequency) const { - uint32_t fracticks = (attotime(0, m_attoseconds) * frequency).m_seconds; + u32 fracticks = (attotime(0, m_attoseconds) * frequency).m_seconds; return mulu_32x32(m_seconds, frequency) + fracticks; } /** Create an attotime from a tick count @ticks at the given frequency @frequency */ -inline attotime attotime::from_ticks(uint64_t ticks, uint32_t frequency) +inline attotime attotime::from_ticks(u64 ticks, u32 frequency) { attoseconds_t attos_per_tick = HZ_TO_ATTOSECONDS(frequency); if (ticks < frequency) return attotime(0, ticks * attos_per_tick); - uint32_t remainder; - int32_t secs = divu_64x32_rem(ticks, frequency, &remainder); - return attotime(secs, (uint64_t)remainder * attos_per_tick); + u32 remainder; + s32 secs = divu_64x32_rem(ticks, frequency, &remainder); + return attotime(secs, u64(remainder) * attos_per_tick); } /** Create an attotime from floating point count of seconds @p _time */ diff --git a/src/emu/bookkeeping.h b/src/emu/bookkeeping.h index 277501b5d2a..131ae6e8be4 100644 --- a/src/emu/bookkeeping.h +++ b/src/emu/bookkeeping.h @@ -8,20 +8,13 @@ *********************************************************************/ +#ifndef MAME_EMU_BOOKKEEPING_H +#define MAME_EMU_BOOKKEEPING_H + #pragma once -#ifndef __BOOKKEEPING_H__ -#define __BOOKKEEPING_H__ - -/*************************************************************************** - CONSTANTS -***************************************************************************/ - -/* total # of coin counters */ -#define COIN_COUNTERS 8 - //************************************************************************** // TYPE DEFINITIONS //************************************************************************** @@ -34,6 +27,9 @@ enum class config_type; class bookkeeping_manager { public: + // total # of coin counters + static constexpr size_t COIN_COUNTERS = 8; + // construction/destruction bookkeeping_manager(running_machine &machine); @@ -69,10 +65,10 @@ private: // internal state running_machine & m_machine; // reference to our machine - uint32_t m_dispensed_tickets; - uint32_t m_coin_count[COIN_COUNTERS]; - uint32_t m_coinlockedout[COIN_COUNTERS]; - uint32_t m_lastcoin[COIN_COUNTERS]; + u32 m_dispensed_tickets; + u32 m_coin_count[COIN_COUNTERS]; + u32 m_coinlockedout[COIN_COUNTERS]; + u32 m_lastcoin[COIN_COUNTERS]; }; -#endif /* __BOOKKEEPING_H__ */ +#endif /* MAME_EMU_BOOKKEEPING_H */ diff --git a/src/emu/crsshair.cpp b/src/emu/crsshair.cpp index 9c2f2dbd996..26d671ec479 100644 --- a/src/emu/crsshair.cpp +++ b/src/emu/crsshair.cpp @@ -29,7 +29,7 @@ ***************************************************************************/ /* raw bitmap */ -static const uint8_t crosshair_raw_top[] = +static const u8 crosshair_raw_top[] = { 0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00, 0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x00, @@ -206,8 +206,8 @@ void render_crosshair::create_bitmap() for (y = 0; y < CROSSHAIR_RAW_SIZE / 2; y++) { /* assume it is mirrored vertically */ - uint32_t *dest0 = &m_bitmap->pix32(y); - uint32_t *dest1 = &m_bitmap->pix32(CROSSHAIR_RAW_SIZE - 1 - y); + u32 *dest0 = &m_bitmap->pix32(y); + u32 *dest1 = &m_bitmap->pix32(CROSSHAIR_RAW_SIZE - 1 - y); /* extract to two rows simultaneously */ for (x = 0; x < CROSSHAIR_RAW_SIZE; x++) @@ -225,7 +225,7 @@ void render_crosshair::create_bitmap() // animate - update the crosshair state //------------------------------------------------- -void render_crosshair::animate(uint16_t auto_time) +void render_crosshair::animate(u16 auto_time) { // read all the port values if (m_used) @@ -263,7 +263,7 @@ void render_crosshair::animate(uint16_t auto_time) // draw - render the crosshair to the container //------------------------------------------------- -void render_crosshair::draw(render_container &container, uint8_t fade) +void render_crosshair::draw(render_container &container, u8 fade) { // add a quad assuming a 4:3 screen (this is not perfect) container.add_quad(m_x - 0.03f, m_y - 0.04f, m_x + 0.03f, m_y + 0.04f, @@ -414,7 +414,7 @@ void crosshair_manager::config_load(config_type cfg_type, xml_data_node *parentn mode = crosshairnode->get_attribute_int("mode", CROSSHAIR_VISIBILITY_DEFAULT); if (mode >= CROSSHAIR_VISIBILITY_OFF && mode <= CROSSHAIR_VISIBILITY_AUTO) { - crosshair.set_mode((uint8_t)mode); + crosshair.set_mode(u8(mode)); /* set visibility as specified by mode */ /* auto mode starts with visibility off */ crosshair.set_visible(mode == CROSSHAIR_VISIBILITY_ON); @@ -432,7 +432,7 @@ void crosshair_manager::config_load(config_type cfg_type, xml_data_node *parentn { auto_time = crosshairnode->get_attribute_int("val", CROSSHAIR_VISIBILITY_AUTOTIME_DEFAULT); if ((auto_time >= CROSSHAIR_VISIBILITY_AUTOTIME_MIN) && (auto_time <= CROSSHAIR_VISIBILITY_AUTOTIME_MAX)) - m_auto_time = (uint8_t)auto_time; + m_auto_time = u8(auto_time); } } diff --git a/src/emu/crsshair.h b/src/emu/crsshair.h index 609109d8b72..7981c249b98 100644 --- a/src/emu/crsshair.h +++ b/src/emu/crsshair.h @@ -7,10 +7,10 @@ Crosshair handling. ***************************************************************************/ -#pragma once +#ifndef MAME_EMU_CRSSHAIR_H +#define MAME_EMU_CRSSHAIR_H -#ifndef __CRSSHAIR_H__ -#define __CRSSHAIR_H__ +#pragma once /*************************************************************************** @@ -50,7 +50,7 @@ public: running_machine &machine() const { return m_machine; } int player() const { return m_player; } bool is_used() const { return m_used; } - uint8_t mode() const { return m_mode; } + u8 mode() const { return m_mode; } bool is_visible() const { return m_visible; } screen_device *screen() const { return m_screen; } float x() const { return m_x; } @@ -59,7 +59,7 @@ public: // setters void set_used(bool used) { m_used = used; } - void set_mode(uint8_t mode) { m_mode = mode; } + void set_mode(u8 mode) { m_mode = mode; } void set_visible(bool visible) { m_visible = visible; } void set_screen(screen_device *screen) { m_screen = screen; } //void setxy(float x, float y); @@ -67,8 +67,8 @@ public: void set_default_bitmap(); // updates - void animate(uint16_t auto_time); - void draw(render_container &container, uint8_t fade); + void animate(u16 auto_time); + void draw(render_container &container, u8 fade); private: // private helpers @@ -78,7 +78,7 @@ private: running_machine & m_machine; // reference to our machine int m_player; // player number bool m_used; // usage for this crosshair - uint8_t m_mode; // visibility mode for this crosshair + u8 m_mode; // visibility mode for this crosshair bool m_visible; // visibility for this crosshair std::unique_ptr m_bitmap; // bitmap for this crosshair render_texture * m_texture; // texture for this crosshair @@ -87,7 +87,7 @@ private: float m_y; // current Y position float m_last_x; // last X position float m_last_y; // last Y position - uint16_t m_time; // time since last movement + u16 m_time; // time since last movement std::string m_name; // name of png file }; @@ -109,8 +109,8 @@ public: // getters running_machine &machine() const { return m_machine; } render_crosshair &get_crosshair(int player) const { assert(player >= 0 && player < MAX_PLAYERS); assert(m_crosshair[player] != nullptr); return *m_crosshair[player]; } - uint16_t auto_time() const { return m_auto_time; } - void set_auto_time(uint16_t auto_time) { m_auto_time = auto_time; } + u16 auto_time() const { return m_auto_time; } + void set_auto_time(u16 auto_time) { m_auto_time = auto_time; } private: void exit(); @@ -124,9 +124,9 @@ private: bool m_usage; // true if any crosshairs are used std::unique_ptr m_crosshair[MAX_PLAYERS]; // per-player crosshair state - uint8_t m_fade; // color fading factor - uint8_t m_animation_counter; // animation frame index - uint16_t m_auto_time; // time in seconds to turn invisible + u8 m_fade; // color fading factor + u8 m_animation_counter; // animation frame index + u16 m_auto_time; // time in seconds to turn invisible }; -#endif /* __CRSSHAIR_H__ */ +#endif /* MAME_EMU_CRSSHAIR_H */ diff --git a/src/emu/debug/debugcmd.cpp b/src/emu/debug/debugcmd.cpp index 620f83985b5..b4d5197e702 100644 --- a/src/emu/debug/debugcmd.cpp +++ b/src/emu/debug/debugcmd.cpp @@ -49,15 +49,15 @@ bool debugger_commands::cheat_address_is_valid(address_space &space, offs_t addr the current cheat width, if signed -------------------------------------------------*/ -uint64_t debugger_commands::cheat_sign_extend(const cheat_system *cheatsys, uint64_t value) +u64 debugger_commands::cheat_sign_extend(const cheat_system *cheatsys, u64 value) { if (cheatsys->signed_cheat) { switch (cheatsys->width) { - case 1: value = (int8_t)value; break; - case 2: value = (int16_t)value; break; - case 4: value = (int32_t)value; break; + case 1: value = s8(value); break; + case 2: value = s16(value); break; + case 4: value = s32(value); break; } } return value; @@ -67,7 +67,7 @@ uint64_t debugger_commands::cheat_sign_extend(const cheat_system *cheatsys, uint cheat_byte_swap - swap a value -------------------------------------------------*/ -uint64_t debugger_commands::cheat_byte_swap(const cheat_system *cheatsys, uint64_t value) +u64 debugger_commands::cheat_byte_swap(const cheat_system *cheatsys, u64 value) { if (cheatsys->swapped_cheat) { @@ -75,8 +75,8 @@ uint64_t debugger_commands::cheat_byte_swap(const cheat_system *cheatsys, uint64 { case 2: value = ((value >> 8) & 0x00ff) | ((value << 8) & 0xff00); break; case 4: value = ((value >> 24) & 0x000000ff) | ((value >> 8) & 0x0000ff00) | ((value << 8) & 0x00ff0000) | ((value << 24) & 0xff000000); break; - case 8: value = ((value >> 56) & U64(0x00000000000000ff)) | ((value >> 40) & U64(0x000000000000ff00)) | ((value >> 24) & U64(0x0000000000ff0000)) | ((value >> 8) & U64(0x00000000ff000000)) | - ((value << 8) & U64(0x000000ff00000000)) | ((value << 24) & U64(0x0000ff0000000000)) | ((value << 40) & U64(0x00ff000000000000)) | ((value << 56) & U64(0xff00000000000000)); break; + case 8: value = ((value >> 56) & 0x00000000000000ffU) | ((value >> 40) & 0x000000000000ff00U) | ((value >> 24) & 0x0000000000ff0000U) | ((value >> 8) & 0x00000000ff000000U) | + ((value << 8) & 0x000000ff00000000U) | ((value << 24) & 0x0000ff0000000000U) | ((value << 40) & 0x00ff000000000000U) | ((value << 56) & 0xff00000000000000U); break; } } return value; @@ -88,7 +88,7 @@ uint64_t debugger_commands::cheat_byte_swap(const cheat_system *cheatsys, uint64 and swapping if necessary -------------------------------------------------*/ -uint64_t debugger_commands::cheat_read_extended(const cheat_system *cheatsys, address_space &space, offs_t address) +u64 debugger_commands::cheat_read_extended(const cheat_system *cheatsys, address_space &space, offs_t address) { return cheat_sign_extend(cheatsys, cheat_byte_swap(cheatsys, m_cpu.read_memory(space, address, cheatsys->width, true))); } @@ -111,7 +111,7 @@ debugger_commands::debugger_commands(running_machine& machine, debugger_cpu& cpu /* add all single-entry save state globals */ for (int itemnum = 0; itemnum < MAX_GLOBALS; itemnum++) { - uint32_t valsize, valcount; + u32 valsize, valcount; void *base; /* stop when we run out of items */ @@ -281,7 +281,7 @@ debugger_commands::debugger_commands(running_machine& machine, debugger_cpu& cpu execute_min - return the minimum of two values -------------------------------------------------*/ -uint64_t debugger_commands::execute_min(symbol_table &table, void *ref, int params, const uint64_t *param) +u64 debugger_commands::execute_min(symbol_table &table, void *ref, int params, const u64 *param) { return (param[0] < param[1]) ? param[0] : param[1]; } @@ -291,7 +291,7 @@ uint64_t debugger_commands::execute_min(symbol_table &table, void *ref, int para execute_max - return the maximum of two values -------------------------------------------------*/ -uint64_t debugger_commands::execute_max(symbol_table &table, void *ref, int params, const uint64_t *param) +u64 debugger_commands::execute_max(symbol_table &table, void *ref, int params, const u64 *param) { return (param[0] > param[1]) ? param[0] : param[1]; } @@ -301,7 +301,7 @@ uint64_t debugger_commands::execute_max(symbol_table &table, void *ref, int para execute_if - if (a) return b; else return c; -------------------------------------------------*/ -uint64_t debugger_commands::execute_if(symbol_table &table, void *ref, int params, const uint64_t *param) +u64 debugger_commands::execute_if(symbol_table &table, void *ref, int params, const u64 *param) { return param[0] ? param[1] : param[2]; } @@ -316,15 +316,15 @@ uint64_t debugger_commands::execute_if(symbol_table &table, void *ref, int param global_get - symbol table getter for globals -------------------------------------------------*/ -uint64_t debugger_commands::global_get(symbol_table &table, void *ref) +u64 debugger_commands::global_get(symbol_table &table, void *ref) { global_entry *global = (global_entry *)ref; switch (global->size) { - case 1: return *(uint8_t *)global->base; - case 2: return *(uint16_t *)global->base; - case 4: return *(uint32_t *)global->base; - case 8: return *(uint64_t *)global->base; + case 1: return *(u8 *)global->base; + case 2: return *(u16 *)global->base; + case 4: return *(u32 *)global->base; + case 8: return *(u64 *)global->base; } return ~0; } @@ -334,15 +334,15 @@ uint64_t debugger_commands::global_get(symbol_table &table, void *ref) global_set - symbol table setter for globals -------------------------------------------------*/ -void debugger_commands::global_set(symbol_table &table, void *ref, uint64_t value) +void debugger_commands::global_set(symbol_table &table, void *ref, u64 value) { global_entry *global = (global_entry *)ref; switch (global->size) { - case 1: *(uint8_t *)global->base = value; break; - case 2: *(uint16_t *)global->base = value; break; - case 4: *(uint32_t *)global->base = value; break; - case 8: *(uint64_t *)global->base = value; break; + case 1: *(u8 *)global->base = value; break; + case 2: *(u16 *)global->base = value; break; + case 4: *(u32 *)global->base = value; break; + case 8: *(u64 *)global->base = value; break; } } @@ -357,7 +357,7 @@ void debugger_commands::global_set(symbol_table &table, void *ref, uint64_t valu number parameter -------------------------------------------------*/ -bool debugger_commands::validate_number_parameter(const char *param, uint64_t *result) +bool debugger_commands::validate_number_parameter(const char *param, u64 *result) { /* nullptr parameter does nothing and returns no error */ if (param == nullptr) @@ -432,7 +432,7 @@ bool debugger_commands::validate_cpu_parameter(const char *param, device_t **res return true; /* then evaluate as an expression; on an error assume it was a tag */ - uint64_t cpunum; + u64 cpunum; try { parsed_expression expression(m_cpu.get_visible_symtable(), param, &cpunum); @@ -552,7 +552,7 @@ void debugger_commands::execute_help(int ref, int params, const char *param[]) void debugger_commands::execute_print(int ref, int params, const char *param[]) { /* validate the other parameters */ - uint64_t values[MAX_COMMAND_PARAMS]; + u64 values[MAX_COMMAND_PARAMS]; for (int i = 0; i < params; i++) if (!validate_number_parameter(param[i], &values[i])) return; @@ -568,7 +568,7 @@ void debugger_commands::execute_print(int ref, int params, const char *param[]) mini_printf - safe printf to a buffer -------------------------------------------------*/ -int debugger_commands::mini_printf(char *buffer, const char *format, int params, uint64_t *param) +int debugger_commands::mini_printf(char *buffer, const char *format, int params, u64 *param) { const char *f = format; char *p = buffer; @@ -624,11 +624,11 @@ int debugger_commands::mini_printf(char *buffer, const char *format, int params, m_console.printf("Not enough parameters for format!\n"); return 0; } - if ((uint32_t)(*param >> 32) != 0) - p += sprintf(p, zerofill ? "%0*X" : "%*X", (width <= 8) ? 1 : width - 8, (uint32_t)(*param >> 32)); + if (u32(*param >> 32) != 0) + p += sprintf(p, zerofill ? "%0*X" : "%*X", (width <= 8) ? 1 : width - 8, u32(*param >> 32)); else if (width > 8) p += sprintf(p, zerofill ? "%0*X" : "%*X", width - 8, 0); - p += sprintf(p, zerofill ? "%0*X" : "%*X", (width < 8) ? width : 8, (uint32_t)*param); + p += sprintf(p, zerofill ? "%0*X" : "%*X", (width < 8) ? width : 8, u32(*param)); param++; params--; break; @@ -640,7 +640,7 @@ int debugger_commands::mini_printf(char *buffer, const char *format, int params, m_console.printf("Not enough parameters for format!\n"); return 0; } - p += sprintf(p, zerofill ? "%0*d" : "%*d", width, (uint32_t)*param); + p += sprintf(p, zerofill ? "%0*d" : "%*d", width, u32(*param)); param++; params--; break; @@ -665,7 +665,7 @@ int debugger_commands::mini_printf(char *buffer, const char *format, int params, void debugger_commands::execute_printf(int ref, int params, const char *param[]) { /* validate the other parameters */ - uint64_t values[MAX_COMMAND_PARAMS]; + u64 values[MAX_COMMAND_PARAMS]; for (int i = 1; i < params; i++) if (!validate_number_parameter(param[i], &values[i])) return; @@ -684,7 +684,7 @@ void debugger_commands::execute_printf(int ref, int params, const char *param[]) void debugger_commands::execute_logerror(int ref, int params, const char *param[]) { /* validate the other parameters */ - uint64_t values[MAX_COMMAND_PARAMS]; + u64 values[MAX_COMMAND_PARAMS]; for (int i = 1; i < params; i++) if (!validate_number_parameter(param[i], &values[i])) return; @@ -703,7 +703,7 @@ void debugger_commands::execute_logerror(int ref, int params, const char *param[ void debugger_commands::execute_tracelog(int ref, int params, const char *param[]) { /* validate the other parameters */ - uint64_t values[MAX_COMMAND_PARAMS]; + u64 values[MAX_COMMAND_PARAMS]; for (int i = 1; i < params; i++) if (!validate_number_parameter(param[i], &values[i])) return; @@ -732,7 +732,7 @@ void debugger_commands::execute_quit(int ref, int params, const char *param[]) void debugger_commands::execute_do(int ref, int params, const char *param[]) { - uint64_t dummy; + u64 dummy; validate_number_parameter(param[0], &dummy); } @@ -744,7 +744,7 @@ void debugger_commands::execute_do(int ref, int params, const char *param[]) void debugger_commands::execute_step(int ref, int params, const char *param[]) { /* if we have a parameter, use it */ - uint64_t steps = 1; + u64 steps = 1; if (!validate_number_parameter(param[0], &steps)) return; @@ -759,7 +759,7 @@ void debugger_commands::execute_step(int ref, int params, const char *param[]) void debugger_commands::execute_over(int ref, int params, const char *param[]) { /* if we have a parameter, use it */ - uint64_t steps = 1; + u64 steps = 1; if (!validate_number_parameter(param[0], &steps)) return; @@ -783,7 +783,7 @@ void debugger_commands::execute_out(int ref, int params, const char *param[]) void debugger_commands::execute_go(int ref, int params, const char *param[]) { - uint64_t addr = ~0; + u64 addr = ~0; /* if we have a parameter, use it instead */ if (!validate_number_parameter(param[0], &addr)) @@ -810,7 +810,7 @@ void debugger_commands::execute_go_vblank(int ref, int params, const char *param void debugger_commands::execute_go_interrupt(int ref, int params, const char *param[]) { - uint64_t irqline = -1; + u64 irqline = -1; /* if we have a parameter, use it instead */ if (!validate_number_parameter(param[0], &irqline)) @@ -826,7 +826,7 @@ void debugger_commands::execute_go_interrupt(int ref, int params, const char *pa void debugger_commands::execute_go_time(int ref, int params, const char *param[]) { - uint64_t milliseconds = -1; + u64 milliseconds = -1; /* if we have a parameter, use it instead */ if (!validate_number_parameter(param[0], &milliseconds)) @@ -987,7 +987,7 @@ void debugger_commands::execute_observe(int ref, int params, const char *param[] void debugger_commands::execute_comment_add(int ref, int params, const char *param[]) { device_t *cpu; - uint64_t address; + u64 address; /* param 1 is the address for the comment */ if (!validate_number_parameter(param[0], &address)) @@ -1017,7 +1017,7 @@ void debugger_commands::execute_comment_add(int ref, int params, const char *par void debugger_commands::execute_comment_del(int ref, int params, const char *param[]) { device_t *cpu; - uint64_t address; + u64 address; /* param 1 can either be a command or the address for the comment */ if (!validate_number_parameter(param[0], &address)) @@ -1093,7 +1093,7 @@ void debugger_commands::execute_bpset(int ref, int params, const char *param[]) { device_t *cpu; const char *action = nullptr; - uint64_t address; + u64 address; int bpnum; /* CPU is implicit */ @@ -1126,7 +1126,7 @@ void debugger_commands::execute_bpset(int ref, int params, const char *param[]) void debugger_commands::execute_bpclear(int ref, int params, const char *param[]) { - uint64_t bpindex; + u64 bpindex; /* if 0 parameters, clear all */ if (params == 0) @@ -1146,9 +1146,9 @@ void debugger_commands::execute_bpclear(int ref, int params, const char *param[] if (device.debug()->breakpoint_clear(bpindex)) found = true; if (found) - m_console.printf("Breakpoint %X cleared\n", (uint32_t)bpindex); + m_console.printf("Breakpoint %X cleared\n", u32(bpindex)); else - m_console.printf("Invalid breakpoint number %X\n", (uint32_t)bpindex); + m_console.printf("Invalid breakpoint number %X\n", u32(bpindex)); } } @@ -1160,7 +1160,7 @@ void debugger_commands::execute_bpclear(int ref, int params, const char *param[] void debugger_commands::execute_bpdisenable(int ref, int params, const char *param[]) { - uint64_t bpindex; + u64 bpindex; /* if 0 parameters, clear all */ if (params == 0) @@ -1183,9 +1183,9 @@ void debugger_commands::execute_bpdisenable(int ref, int params, const char *par if (device.debug()->breakpoint_enable(bpindex, ref)) found = true; if (found) - m_console.printf("Breakpoint %X %s\n", (uint32_t)bpindex, ref ? "enabled" : "disabled"); + m_console.printf("Breakpoint %X %s\n", u32(bpindex), ref ? "enabled" : "disabled"); else - m_console.printf("Invalid breakpoint number %X\n", (uint32_t)bpindex); + m_console.printf("Invalid breakpoint number %X\n", u32(bpindex)); } } @@ -1233,7 +1233,7 @@ void debugger_commands::execute_wpset(int ref, int params, const char *param[]) { address_space *space; const char *action = nullptr; - uint64_t address, length; + u64 address, length; int type; int wpnum; @@ -1284,7 +1284,7 @@ void debugger_commands::execute_wpset(int ref, int params, const char *param[]) void debugger_commands::execute_wpclear(int ref, int params, const char *param[]) { - uint64_t wpindex; + u64 wpindex; /* if 0 parameters, clear all */ if (params == 0) @@ -1304,9 +1304,9 @@ void debugger_commands::execute_wpclear(int ref, int params, const char *param[] if (device.debug()->watchpoint_clear(wpindex)) found = true; if (found) - m_console.printf("Watchpoint %X cleared\n", (uint32_t)wpindex); + m_console.printf("Watchpoint %X cleared\n", u32(wpindex)); else - m_console.printf("Invalid watchpoint number %X\n", (uint32_t)wpindex); + m_console.printf("Invalid watchpoint number %X\n", u32(wpindex)); } } @@ -1318,7 +1318,7 @@ void debugger_commands::execute_wpclear(int ref, int params, const char *param[] void debugger_commands::execute_wpdisenable(int ref, int params, const char *param[]) { - uint64_t wpindex; + u64 wpindex; /* if 0 parameters, clear all */ if (params == 0) @@ -1341,9 +1341,9 @@ void debugger_commands::execute_wpdisenable(int ref, int params, const char *par if (device.debug()->watchpoint_enable(wpindex, ref)) found = true; if (found) - m_console.printf("Watchpoint %X %s\n", (uint32_t)wpindex, ref ? "enabled" : "disabled"); + m_console.printf("Watchpoint %X %s\n", u32(wpindex), ref ? "enabled" : "disabled"); else - m_console.printf("Invalid watchpoint number %X\n", (uint32_t)wpindex); + m_console.printf("Invalid watchpoint number %X\n", u32(wpindex)); } } @@ -1426,7 +1426,7 @@ void debugger_commands::execute_rpset(int ref, int params, const char *param[]) void debugger_commands::execute_rpclear(int ref, int params, const char *param[]) { - uint64_t rpindex; + u64 rpindex; /* if 0 parameters, clear all */ if (params == 0) @@ -1446,9 +1446,9 @@ void debugger_commands::execute_rpclear(int ref, int params, const char *param[] if (device.debug()->registerpoint_clear(rpindex)) found = true; if (found) - m_console.printf("Registerpoint %X cleared\n", (uint32_t)rpindex); + m_console.printf("Registerpoint %X cleared\n", u32(rpindex)); else - m_console.printf("Invalid registerpoint number %X\n", (uint32_t)rpindex); + m_console.printf("Invalid registerpoint number %X\n", u32(rpindex)); } } @@ -1460,7 +1460,7 @@ void debugger_commands::execute_rpclear(int ref, int params, const char *param[] void debugger_commands::execute_rpdisenable(int ref, int params, const char *param[]) { - uint64_t rpindex; + u64 rpindex; /* if 0 parameters, clear all */ if (params == 0) @@ -1483,9 +1483,9 @@ void debugger_commands::execute_rpdisenable(int ref, int params, const char *par if (device.debug()->registerpoint_enable(rpindex, ref)) found = true; if (found) - m_console.printf("Registerpoint %X %s\n", (uint32_t)rpindex, ref ? "enabled" : "disabled"); + m_console.printf("Registerpoint %X %s\n", u32(rpindex), ref ? "enabled" : "disabled"); else - m_console.printf("Invalid registerpoint number %X\n", (uint32_t)rpindex); + m_console.printf("Invalid registerpoint number %X\n", u32(rpindex)); } } @@ -1552,10 +1552,10 @@ void debugger_commands::execute_hotspot(int ref, int params, const char *param[] device_t *device = nullptr; if (!validate_cpu_parameter((params > 0) ? param[0] : nullptr, &device)) return; - uint64_t count = 64; + u64 count = 64; if (!validate_number_parameter(param[1], &count)) return; - uint64_t threshhold = 250; + u64 threshhold = 250; if (!validate_number_parameter(param[2], &threshhold)) return; @@ -1602,10 +1602,10 @@ void debugger_commands::execute_stateload(int ref, int params, const char *param void debugger_commands::execute_save(int ref, int params, const char *param[]) { - uint64_t offset, endoffset, length; + u64 offset, endoffset, length; address_space *space; FILE *f; - uint64_t i; + u64 i; /* validate parameters */ if (!validate_number_parameter(param[1], &offset)) @@ -1630,7 +1630,7 @@ void debugger_commands::execute_save(int ref, int params, const char *param[]) /* now write the data out */ for (i = offset; i <= endoffset; i++) { - uint8_t byte = m_cpu.read_byte(*space, i, true); + u8 byte = m_cpu.read_byte(*space, i, true); fwrite(&byte, 1, 1, f); } @@ -1646,10 +1646,10 @@ void debugger_commands::execute_save(int ref, int params, const char *param[]) void debugger_commands::execute_load(int ref, int params, const char *param[]) { - uint64_t offset, endoffset, length; + u64 offset, endoffset, length; address_space *space; FILE *f; - uint64_t i; + u64 i; /* validate parameters */ if (!validate_number_parameter(param[1], &offset)) @@ -1672,7 +1672,7 @@ void debugger_commands::execute_load(int ref, int params, const char *param[]) } /* now read the data in, ignore endoffset and load entire file if length has been set to zero (offset-1) */ - uint8_t byte; + u8 byte; for (i = offset; i <= endoffset || endoffset == offset - 1 ; i++) { fread(&byte, 1, 1, f); @@ -1697,23 +1697,23 @@ void debugger_commands::execute_load(int ref, int params, const char *param[]) void debugger_commands::execute_dump(int ref, int params, const char *param[]) { /* validate parameters */ - uint64_t offset; + u64 offset; if (!validate_number_parameter(param[1], &offset)) return; - uint64_t length; + u64 length; if (!validate_number_parameter(param[2], &length)) return; - uint64_t width = 0; + u64 width = 0; if (!validate_number_parameter(param[3], &width)) return; - uint64_t ascii = 1; + u64 ascii = 1; if (!validate_number_parameter(param[4], &ascii)) return; - uint64_t rowsize = 16; + u64 rowsize = 16; if (!validate_number_parameter(param[5], &rowsize)) return; @@ -1737,7 +1737,7 @@ void debugger_commands::execute_dump(int ref, int params, const char *param[]) return; } - uint64_t endoffset = space->address_to_byte(offset + length - 1) & space->bytemask(); + u64 endoffset = space->address_to_byte(offset + length - 1) & space->bytemask(); offset = space->address_to_byte(offset) & space->bytemask(); /* open the file */ @@ -1751,23 +1751,23 @@ void debugger_commands::execute_dump(int ref, int params, const char *param[]) /* now write the data out */ util::ovectorstream output; output.reserve(200); - for (uint64_t i = offset; i <= endoffset; i += rowsize) + for (u64 i = offset; i <= endoffset; i += rowsize) { output.clear(); output.rdbuf()->clear(); /* print the address */ - util::stream_format(output, "%0*X: ", space->logaddrchars(), (uint32_t)space->byte_to_address(i)); + util::stream_format(output, "%0*X: ", space->logaddrchars(), u32(space->byte_to_address(i))); /* print the bytes */ - for (uint64_t j = 0; j < rowsize; j += width) + for (u64 j = 0; j < rowsize; j += width) { if (i + j <= endoffset) { offs_t curaddr = i + j; if (space->device().memory().translate(space->spacenum(), TRANSLATE_READ_DEBUG, curaddr)) { - uint64_t value = m_cpu.read_memory(*space, i + j, width, true); + u64 value = m_cpu.read_memory(*space, i + j, width, true); util::stream_format(output, " %0*X", width * 2, value); } else @@ -1783,12 +1783,12 @@ void debugger_commands::execute_dump(int ref, int params, const char *param[]) if (ascii) { util::stream_format(output, " "); - for (uint64_t j = 0; j < rowsize && (i + j) <= endoffset; j++) + for (u64 j = 0; j < rowsize && (i + j) <= endoffset; j++) { offs_t curaddr = i + j; if (space->device().memory().translate(space->spacenum(), TRANSLATE_READ_DEBUG, curaddr)) { - uint8_t byte = m_cpu.read_byte(*space, i + j, true); + u8 byte = m_cpu.read_byte(*space, i + j, true); util::stream_format(output, "%c", (byte >= 32 && byte < 127) ? byte : '.'); } else @@ -1815,11 +1815,11 @@ void debugger_commands::execute_dump(int ref, int params, const char *param[]) void debugger_commands::execute_cheatinit(int ref, int params, const char *param[]) { - uint64_t offset, length = 0, real_length = 0; + u64 offset, length = 0, real_length = 0; address_space *space; - uint32_t active_cheat = 0; - uint64_t curaddr; - uint8_t i, region_count = 0; + u32 active_cheat = 0; + u64 curaddr; + u8 i, region_count = 0; cheat_region_map cheat_region[100]; @@ -1969,10 +1969,10 @@ void debugger_commands::execute_cheatinit(int ref, int params, const char *param void debugger_commands::execute_cheatnext(int ref, int params, const char *param[]) { address_space *space; - uint64_t cheatindex; - uint32_t active_cheat = 0; - uint8_t condition; - uint64_t comp_value = 0; + u64 cheatindex; + u32 active_cheat = 0; + u8 condition; + u64 comp_value = 0; enum { @@ -2038,9 +2038,9 @@ void debugger_commands::execute_cheatnext(int ref, int params, const char *param for (cheatindex = 0; cheatindex < m_cheat.cheatmap.size(); cheatindex += 1) if (m_cheat.cheatmap[cheatindex].state == 1) { - uint64_t cheat_value = cheat_read_extended(&m_cheat, *space, m_cheat.cheatmap[cheatindex].offset); - uint64_t comp_byte = (ref == 0) ? m_cheat.cheatmap[cheatindex].previous_value : m_cheat.cheatmap[cheatindex].first_value; - uint8_t disable_byte = false; + u64 cheat_value = cheat_read_extended(&m_cheat, *space, m_cheat.cheatmap[cheatindex].offset); + u64 comp_byte = (ref == 0) ? m_cheat.cheatmap[cheatindex].previous_value : m_cheat.cheatmap[cheatindex].first_value; + u8 disable_byte = false; switch (condition) { @@ -2065,30 +2065,30 @@ void debugger_commands::execute_cheatnext(int ref, int params, const char *param case CHEAT_DECREASE: if (m_cheat.signed_cheat) - disable_byte = ((int64_t)cheat_value >= (int64_t)comp_byte); + disable_byte = (s64(cheat_value) >= s64(comp_byte)); else - disable_byte = ((uint64_t)cheat_value >= (uint64_t)comp_byte); + disable_byte = (u64(cheat_value) >= u64(comp_byte)); break; case CHEAT_INCREASE: if (m_cheat.signed_cheat) - disable_byte = ((int64_t)cheat_value <= (int64_t)comp_byte); + disable_byte = (s64(cheat_value) <= s64(comp_byte)); else - disable_byte = ((uint64_t)cheat_value <= (uint64_t)comp_byte); + disable_byte = (u64(cheat_value) <= u64(comp_byte)); break; case CHEAT_DECREASE_OR_EQUAL: if (m_cheat.signed_cheat) - disable_byte = ((int64_t)cheat_value > (int64_t)comp_byte); + disable_byte = (s64(cheat_value) > s64(comp_byte)); else - disable_byte = ((uint64_t)cheat_value > (uint64_t)comp_byte); + disable_byte = (u64(cheat_value) > u64(comp_byte)); break; case CHEAT_INCREASE_OR_EQUAL: if (m_cheat.signed_cheat) - disable_byte = ((int64_t)cheat_value < (int64_t)comp_byte); + disable_byte = (s64(cheat_value) < s64(comp_byte)); else - disable_byte = ((uint64_t)cheat_value < (uint64_t)comp_byte); + disable_byte = (u64(cheat_value) < u64(comp_byte)); break; case CHEAT_DECREASEOF: @@ -2101,16 +2101,16 @@ void debugger_commands::execute_cheatnext(int ref, int params, const char *param case CHEAT_SMALLEROF: if (m_cheat.signed_cheat) - disable_byte = ((int64_t)cheat_value >= (int64_t)comp_value); + disable_byte = (s64(cheat_value) >= s64(comp_value)); else - disable_byte = ((uint64_t)cheat_value >= (uint64_t)comp_value); + disable_byte = (u64(cheat_value) >= u64(comp_value)); break; case CHEAT_GREATEROF: if (m_cheat.signed_cheat) - disable_byte = ((int64_t)cheat_value <= (int64_t)comp_value); + disable_byte = (s64(cheat_value) <= s64(comp_value)); else - disable_byte = ((uint64_t)cheat_value <= (uint64_t)comp_value); + disable_byte = (u64(cheat_value) <= u64(comp_value)); break; case CHEAT_CHANGEDBY: if (cheat_value > comp_byte) @@ -2148,9 +2148,9 @@ void debugger_commands::execute_cheatlist(int ref, int params, const char *param char spaceletter, sizeletter; address_space *space; device_t *cpu; - uint32_t active_cheat = 0; - uint64_t cheatindex; - uint64_t sizemask; + u32 active_cheat = 0; + u64 cheatindex; + u64 sizemask; FILE *f = nullptr; if (!validate_cpu_space_parameter(m_cheat.cpu, AS_PROGRAM, space)) @@ -2173,10 +2173,10 @@ void debugger_commands::execute_cheatlist(int ref, int params, const char *param switch (m_cheat.width) { default: - case 1: sizeletter = 'b'; sizemask = 0xff; break; - case 2: sizeletter = 'w'; sizemask = 0xffff; break; - case 4: sizeletter = 'd'; sizemask = 0xffffffff; break; - case 8: sizeletter = 'q'; sizemask = U64(0xffffffffffffffff); break; + case 1: sizeletter = 'b'; sizemask = 0xffU; break; + case 2: sizeletter = 'w'; sizemask = 0xffffU; break; + case 4: sizeletter = 'd'; sizemask = 0xffffffffU; break; + case 8: sizeletter = 'q'; sizemask = 0xffffffffffffffffU; break; } /* write the cheat list */ @@ -2185,7 +2185,7 @@ void debugger_commands::execute_cheatlist(int ref, int params, const char *param { if (m_cheat.cheatmap[cheatindex].state == 1) { - uint64_t value = cheat_byte_swap(&m_cheat, cheat_read_extended(&m_cheat, *space, m_cheat.cheatmap[cheatindex].offset)) & sizemask; + u64 value = cheat_byte_swap(&m_cheat, cheat_read_extended(&m_cheat, *space, m_cheat.cheatmap[cheatindex].offset)) & sizemask; offs_t address = space->byte_to_address(m_cheat.cheatmap[cheatindex].offset); if (params > 0) @@ -2226,8 +2226,8 @@ void debugger_commands::execute_cheatlist(int ref, int params, const char *param void debugger_commands::execute_cheatundo(int ref, int params, const char *param[]) { - uint64_t cheatindex; - uint32_t undo_count = 0; + u64 cheatindex; + u32 undo_count = 0; if (m_cheat.undo > 0) { @@ -2255,10 +2255,10 @@ void debugger_commands::execute_cheatundo(int ref, int params, const char *param void debugger_commands::execute_find(int ref, int params, const char *param[]) { - uint64_t offset, endoffset, length; + u64 offset, endoffset, length; address_space *space; - uint64_t data_to_find[256]; - uint8_t data_size[256]; + u64 data_to_find[256]; + u8 data_size[256]; int cur_data_size; int data_count = 0; int found = 0; @@ -2300,10 +2300,10 @@ void debugger_commands::execute_find(int ref, int params, const char *param[]) { /* check for a 'b','w','d',or 'q' prefix */ data_size[data_count] = cur_data_size; - if (tolower((uint8_t)pdata[0]) == 'b' && pdata[1] == '.') { data_size[data_count] = cur_data_size = 1; pdata += 2; } - if (tolower((uint8_t)pdata[0]) == 'w' && pdata[1] == '.') { data_size[data_count] = cur_data_size = 2; pdata += 2; } - if (tolower((uint8_t)pdata[0]) == 'd' && pdata[1] == '.') { data_size[data_count] = cur_data_size = 4; pdata += 2; } - if (tolower((uint8_t)pdata[0]) == 'q' && pdata[1] == '.') { data_size[data_count] = cur_data_size = 8; pdata += 2; } + if (tolower(u8(pdata[0])) == 'b' && pdata[1] == '.') { data_size[data_count] = cur_data_size = 1; pdata += 2; } + if (tolower(u8(pdata[0])) == 'w' && pdata[1] == '.') { data_size[data_count] = cur_data_size = 2; pdata += 2; } + if (tolower(u8(pdata[0])) == 'd' && pdata[1] == '.') { data_size[data_count] = cur_data_size = 4; pdata += 2; } + if (tolower(u8(pdata[0])) == 'q' && pdata[1] == '.') { data_size[data_count] = cur_data_size = 8; pdata += 2; } /* look for a wildcard */ if (!strcmp(pdata, "?")) @@ -2316,7 +2316,7 @@ void debugger_commands::execute_find(int ref, int params, const char *param[]) } /* now search */ - for (uint64_t i = offset; i <= endoffset; i += data_size[0]) + for (u64 i = offset; i <= endoffset; i += data_size[0]) { int suboffset = 0; int match = 1; @@ -2326,10 +2326,10 @@ void debugger_commands::execute_find(int ref, int params, const char *param[]) { switch (data_size[j]) { - case 1: match = ((uint8_t)m_cpu.read_byte(*space, i + suboffset, true) == (uint8_t)data_to_find[j]); break; - case 2: match = ((uint16_t)m_cpu.read_word(*space, i + suboffset, true) == (uint16_t)data_to_find[j]); break; - case 4: match = ((uint32_t)m_cpu.read_dword(*space, i + suboffset, true) == (uint32_t)data_to_find[j]); break; - case 8: match = ((uint64_t)m_cpu.read_qword(*space, i + suboffset, true) == (uint64_t)data_to_find[j]); break; + case 1: match = (u8(m_cpu.read_byte(*space, i + suboffset, true)) == u8(data_to_find[j])); break; + case 2: match = (u16(m_cpu.read_word(*space, i + suboffset, true)) == u16(data_to_find[j])); break; + case 4: match = (u32(m_cpu.read_dword(*space, i + suboffset, true)) == u32(data_to_find[j])); break; + case 8: match = (u64(m_cpu.read_qword(*space, i + suboffset, true)) == u64(data_to_find[j])); break; default: /* all other cases are wildcards */ break; } suboffset += data_size[j] & 0x0f; @@ -2339,7 +2339,7 @@ void debugger_commands::execute_find(int ref, int params, const char *param[]) if (match) { found++; - m_console.printf("Found at %0*X\n", space->addrchars(), (uint32_t)space->byte_to_address(i)); + m_console.printf("Found at %0*X\n", space->addrchars(), u32(space->byte_to_address(i))); } } @@ -2355,7 +2355,7 @@ void debugger_commands::execute_find(int ref, int params, const char *param[]) void debugger_commands::execute_dasm(int ref, int params, const char *param[]) { - uint64_t offset, length, bytes = 1; + u64 offset, length, bytes = 1; int minbytes, maxbytes, byteswidth; address_space *space, *decrypted_space; FILE *f; @@ -2402,7 +2402,7 @@ void debugger_commands::execute_dasm(int ref, int params, const char *param[]) /* now write the data out */ util::ovectorstream output; output.reserve(512); - for (uint64_t i = 0; i < length; ) + for (u64 i = 0; i < length; ) { int pcbyte = space->address_to_byte(offset + i) & space->bytemask(); char disasm[200]; @@ -2413,13 +2413,13 @@ void debugger_commands::execute_dasm(int ref, int params, const char *param[]) output.rdbuf()->clear(); /* print the address */ - stream_format(output, "%0*X: ", space->logaddrchars(), (uint32_t)space->byte_to_address(pcbyte)); + stream_format(output, "%0*X: ", space->logaddrchars(), u32(space->byte_to_address(pcbyte))); /* make sure we can translate the address */ tempaddr = pcbyte; if (space->device().memory().translate(space->spacenum(), TRANSLATE_FETCH_DEBUG, tempaddr)) { - uint8_t opbuf[64], argbuf[64]; + u8 opbuf[64], argbuf[64]; /* fetch the bytes up to the maximum */ for (numbytes = 0; numbytes < maxbytes; numbytes++) @@ -2573,7 +2573,7 @@ void debugger_commands::execute_history(int ref, int params, const char *param[] else decrypted_space = space; - uint64_t count = device_debug::HISTORY_SIZE; + u64 count = device_debug::HISTORY_SIZE; if (!validate_number_parameter(param[1], &count)) return; @@ -2597,7 +2597,7 @@ void debugger_commands::execute_history(int ref, int params, const char *param[] /* fetch the bytes up to the maximum */ offs_t pcbyte = space->address_to_byte(pc) & space->bytemask(); - uint8_t opbuf[64], argbuf[64]; + u8 opbuf[64], argbuf[64]; for (int numbytes = 0; numbytes < maxbytes; numbytes++) { opbuf[numbytes] = m_cpu.read_opcode(*decrypted_space, pcbyte + numbytes, 1); @@ -2619,7 +2619,7 @@ void debugger_commands::execute_history(int ref, int params, const char *param[] void debugger_commands::execute_trackpc(int ref, int params, const char *param[]) { // Gather the on/off switch (if present) - uint64_t turnOn = true; + u64 turnOn = true; if (!validate_number_parameter(param[0], &turnOn)) return; @@ -2629,7 +2629,7 @@ void debugger_commands::execute_trackpc(int ref, int params, const char *param[] return; // Should we clear the existing data? - uint64_t clear = false; + u64 clear = false; if (!validate_number_parameter(param[2], &clear)) return; @@ -2661,7 +2661,7 @@ void debugger_commands::execute_trackpc(int ref, int params, const char *param[] void debugger_commands::execute_trackmem(int ref, int params, const char *param[]) { // Gather the on/off switch (if present) - uint64_t turnOn = true; + u64 turnOn = true; if (!validate_number_parameter(param[0], &turnOn)) return; @@ -2671,7 +2671,7 @@ void debugger_commands::execute_trackmem(int ref, int params, const char *param[ return; // Should we clear the existing data? - uint64_t clear = false; + u64 clear = false; if (!validate_number_parameter(param[2], &clear)) return; @@ -2699,7 +2699,7 @@ void debugger_commands::execute_trackmem(int ref, int params, const char *param[ void debugger_commands::execute_pcatmem(int ref, int params, const char *param[]) { // Gather the required address parameter - uint64_t address; + u64 address; if (!validate_number_parameter(param[0], &address)) return; @@ -2715,7 +2715,7 @@ void debugger_commands::execute_pcatmem(int ref, int params, const char *param[] // Get the value of memory at the address const int native_data_width = space->data_width() / 8; - const uint64_t data = m_cpu.read_memory(*space, space->address_to_byte(address), native_data_width, true); + const u64 data = m_cpu.read_memory(*space, space->address_to_byte(address), native_data_width, true); // Recover the pc & print const address_spacenum space_num = (address_spacenum)ref; @@ -2791,7 +2791,7 @@ void debugger_commands::execute_map(int ref, int params, const char *param[]) { address_space *space; offs_t taddress; - uint64_t address; + u64 address; int intention; /* validate parameters */ @@ -2899,7 +2899,7 @@ void debugger_commands::execute_symlist(int ref, int params, const char **param) { const symbol_entry *entry = symtable->find(namelist[symnum]); assert(entry != nullptr); - uint64_t value = entry->value(); + u64 value = entry->value(); /* only display "register" type symbols */ m_console.printf("%s = %X", namelist[symnum], value); diff --git a/src/emu/debug/debugcmd.h b/src/emu/debug/debugcmd.h index b65b49b68ea..ac57622abd5 100644 --- a/src/emu/debug/debugcmd.h +++ b/src/emu/debug/debugcmd.h @@ -8,10 +8,10 @@ *********************************************************************/ -#pragma once +#ifndef MAME_EMU_DEBUG_DEBUGCMD_H +#define MAME_EMU_DEBUG_DEBUGCMD_H -#ifndef __DEBUGCMD_H__ -#define __DEBUGCMD_H__ +#pragma once #include "emu.h" #include "debugcpu.h" @@ -29,7 +29,7 @@ public: bool validate_boolean_parameter(const char *param, bool *result); /* validates a parameter as a numeric value */ - bool validate_number_parameter(const char *param, uint64_t *result); + bool validate_number_parameter(const char *param, u64 *result); /* validates a parameter as a cpu */ bool validate_cpu_parameter(const char *param, device_t **result); @@ -41,55 +41,55 @@ private: struct global_entry { void * base; - uint32_t size; + u32 size; }; struct cheat_map { - uint64_t offset; - uint64_t first_value; - uint64_t previous_value; - uint8_t state:1; - uint8_t undo:7; + u64 offset; + u64 first_value; + u64 previous_value; + u8 state:1; + u8 undo:7; }; // TODO [RH 31 May 2016]: Move this cheat stuff into its own class struct cheat_system { char cpu[2]; - uint8_t width; + u8 width; std::vector cheatmap; - uint8_t undo; - uint8_t signed_cheat; - uint8_t swapped_cheat; + u8 undo; + u8 signed_cheat; + u8 swapped_cheat; }; struct cheat_region_map { - uint64_t offset; - uint64_t endoffset; + u64 offset; + u64 endoffset; const char *share; - uint8_t disabled; + u8 disabled; }; bool debug_command_parameter_expression(const char *param, parsed_expression &result); bool debug_command_parameter_command(const char *param); bool cheat_address_is_valid(address_space &space, offs_t address); - uint64_t cheat_sign_extend(const cheat_system *cheatsys, uint64_t value); - uint64_t cheat_byte_swap(const cheat_system *cheatsys, uint64_t value); - uint64_t cheat_read_extended(const cheat_system *cheatsys, address_space &space, offs_t address); + u64 cheat_sign_extend(const cheat_system *cheatsys, u64 value); + u64 cheat_byte_swap(const cheat_system *cheatsys, u64 value); + u64 cheat_read_extended(const cheat_system *cheatsys, address_space &space, offs_t address); - uint64_t execute_min(symbol_table &table, void *ref, int params, const uint64_t *param); - uint64_t execute_max(symbol_table &table, void *ref, int params, const uint64_t *param); - uint64_t execute_if(symbol_table &table, void *ref, int params, const uint64_t *param); + u64 execute_min(symbol_table &table, void *ref, int params, const u64 *param); + u64 execute_max(symbol_table &table, void *ref, int params, const u64 *param); + u64 execute_if(symbol_table &table, void *ref, int params, const u64 *param); - uint64_t global_get(symbol_table &table, void *ref); - void global_set(symbol_table &table, void *ref, uint64_t value); + u64 global_get(symbol_table &table, void *ref); + void global_set(symbol_table &table, void *ref, u64 value); - int mini_printf(char *buffer, const char *format, int params, uint64_t *param); + int mini_printf(char *buffer, const char *format, int params, u64 *param); void execute_trace_internal(int ref, int params, const char *param[], bool trace_over); @@ -161,8 +161,8 @@ private: void execute_dumpkbd(int ref, int params, const char **param); running_machine& m_machine; - debugger_cpu& m_cpu; - debugger_console& m_console; + debugger_cpu& m_cpu; + debugger_console& m_console; global_entry *m_global_array; cheat_system m_cheat; @@ -170,4 +170,4 @@ private: static const size_t MAX_GLOBALS; }; -#endif +#endif // MAME_EMU_DEBUG_DEBUGCMD_H diff --git a/src/emu/debug/debugcon.cpp b/src/emu/debug/debugcon.cpp index b0a7e1dd2a4..8cd565cbfa1 100644 --- a/src/emu/debug/debugcon.cpp +++ b/src/emu/debug/debugcon.cpp @@ -165,12 +165,12 @@ CMDERR debugger_console::internal_execute_command(bool execute, int params, char return CMDERR_NONE; /* the first parameter has the command and the real first parameter; separate them */ - for (p = param[0]; *p && isspace((uint8_t)*p); p++) { } - for (command = p; *p && !isspace((uint8_t)*p); p++) { } + for (p = param[0]; *p && isspace(u8(*p)); p++) { } + for (command = p; *p && !isspace(u8(*p)); p++) { } if (*p != 0) { *p++ = 0; - for ( ; *p && isspace((uint8_t)*p); p++) { } + for ( ; *p && isspace(u8(*p)); p++) { } if (*p != 0) param[0] = p; else @@ -271,7 +271,7 @@ CMDERR debugger_console::internal_parse_command(const char *original_command, bo case '+': if (parendex == 0 && paramcount == 1 && p[1] == '+') isexpr = true; *p = c; break; case '=': if (parendex == 0 && paramcount == 1) isexpr = true; *p = c; break; case 0: foundend = true; break; - default: *p = tolower((uint8_t)c); break; + default: *p = tolower(u8(c)); break; } } } @@ -290,7 +290,7 @@ CMDERR debugger_console::internal_parse_command(const char *original_command, bo command_start = params[0]; /* allow for "do" commands */ - if (tolower((uint8_t)command_start[0] == 'd') && tolower((uint8_t)command_start[1] == 'o') && isspace((uint8_t)command_start[2])) + if (tolower(u8(command_start[0])) == 'd' && tolower(u8(command_start[1])) == 'o' && isspace(u8(command_start[2]))) { isexpr = true; command_start += 3; @@ -301,7 +301,7 @@ CMDERR debugger_console::internal_parse_command(const char *original_command, bo { try { - uint64_t expresult; + u64 expresult; parsed_expression expression(m_machine.debugger().cpu().get_visible_symtable(), command_start, &expresult); } catch (expression_error &err) @@ -368,7 +368,7 @@ CMDERR debugger_console::validate_command(const char *command) register_command - register a command handler -------------------------------------------------*/ -void debugger_console::register_command(const char *command, uint32_t flags, int ref, int minparams, int maxparams, std::function handler) +void debugger_console::register_command(const char *command, u32 flags, int ref, int minparams, int maxparams, std::function handler) { assert_always(m_machine.phase() == MACHINE_PHASE_INIT, "Can only call register_command() at init time!"); assert_always((m_machine.debug_flags & DEBUG_FLAG_ENABLED) != 0, "Cannot call register_command() when debugger is not running"); diff --git a/src/emu/debug/debugcon.h b/src/emu/debug/debugcon.h index 7a06c68c5f1..cd226c93866 100644 --- a/src/emu/debug/debugcon.h +++ b/src/emu/debug/debugcon.h @@ -67,7 +67,7 @@ ***************************************************************************/ /* CMDERR is an error code for command evaluation */ -typedef uint32_t CMDERR; +typedef u32 CMDERR; class debugger_console { @@ -77,7 +77,7 @@ public: /* command handling */ CMDERR execute_command(const char *command, bool echo); CMDERR validate_command(const char *command); - void register_command(const char *command, uint32_t flags, int ref, int minparams, int maxparams, std::function handler); + void register_command(const char *command, u32 flags, int ref, int minparams, int maxparams, std::function handler); /* console management */ void vprintf(util::format_argument_pack const &args); @@ -118,7 +118,7 @@ private: const char * params; const char * help; std::function handler; - uint32_t flags; + u32 flags; int ref; int minparams; int maxparams; diff --git a/src/emu/debug/debugcpu.cpp b/src/emu/debug/debugcpu.cpp index b8ef947b4f8..ba1b6d4f9a7 100644 --- a/src/emu/debug/debugcpu.cpp +++ b/src/emu/debug/debugcpu.cpp @@ -52,7 +52,7 @@ debugger_cpu::debugger_cpu(running_machine &machine) { screen_device *first_screen = m_machine.first_screen(); - m_tempvar = make_unique_clear(NUM_TEMP_VARIABLES); + m_tempvar = make_unique_clear(NUM_TEMP_VARIABLES); /* create a global symbol table */ m_symtable = std::make_unique(&m_machine); @@ -357,7 +357,7 @@ bool debugger_cpu::comment_load(bool is_inline) memory space -------------------------------------------------*/ -uint8_t debugger_cpu::read_byte(address_space &space, offs_t address, bool apply_translation) +u8 debugger_cpu::read_byte(address_space &space, offs_t address, bool apply_translation) { device_memory_interface &memory = space.device().memory(); @@ -369,8 +369,8 @@ uint8_t debugger_cpu::read_byte(address_space &space, offs_t address, bool apply space.set_debugger_access(true); /* translate if necessary; if not mapped, return 0xff */ - uint64_t custom; - uint8_t result; + u64 custom; + u8 result; if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_READ_DEBUG, address)) { result = 0xff; @@ -396,16 +396,16 @@ uint8_t debugger_cpu::read_byte(address_space &space, offs_t address, bool apply memory space -------------------------------------------------*/ -uint16_t debugger_cpu::read_word(address_space &space, offs_t address, bool apply_translation) +u16 debugger_cpu::read_word(address_space &space, offs_t address, bool apply_translation) { /* mask against the logical byte mask */ address &= space.logbytemask(); - uint16_t result; + u16 result; if (!WORD_ALIGNED(address)) { /* if this is misaligned read, or if there are no word readers, just read two bytes */ - uint8_t byte0 = read_byte(space, address + 0, apply_translation); - uint8_t byte1 = read_byte(space, address + 1, apply_translation); + u8 byte0 = read_byte(space, address + 0, apply_translation); + u8 byte1 = read_byte(space, address + 1, apply_translation); /* based on the endianness, the result is assembled differently */ if (space.endianness() == ENDIANNESS_LITTLE) @@ -422,7 +422,7 @@ uint16_t debugger_cpu::read_word(address_space &space, offs_t address, bool appl space.set_debugger_access(true); /* translate if necessary; if not mapped, return 0xffff */ - uint64_t custom; + u64 custom; if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_READ_DEBUG, address)) { result = 0xffff; @@ -450,16 +450,16 @@ uint16_t debugger_cpu::read_word(address_space &space, offs_t address, bool appl memory space -------------------------------------------------*/ -uint32_t debugger_cpu::read_dword(address_space &space, offs_t address, bool apply_translation) +u32 debugger_cpu::read_dword(address_space &space, offs_t address, bool apply_translation) { /* mask against the logical byte mask */ address &= space.logbytemask(); - uint32_t result; + u32 result; if (!DWORD_ALIGNED(address)) { /* if this is a misaligned read, or if there are no dword readers, just read two words */ - uint16_t word0 = read_word(space, address + 0, apply_translation); - uint16_t word1 = read_word(space, address + 2, apply_translation); + u16 word0 = read_word(space, address + 0, apply_translation); + u16 word1 = read_word(space, address + 2, apply_translation); /* based on the endianness, the result is assembled differently */ if (space.endianness() == ENDIANNESS_LITTLE) @@ -475,7 +475,7 @@ uint32_t debugger_cpu::read_dword(address_space &space, offs_t address, bool app m_debugger_access = true; space.set_debugger_access(true); - uint64_t custom; + u64 custom; if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_READ_DEBUG, address)) { /* translate if necessary; if not mapped, return 0xffffffff */ result = 0xffffffff; @@ -503,22 +503,22 @@ uint32_t debugger_cpu::read_dword(address_space &space, offs_t address, bool app memory space -------------------------------------------------*/ -uint64_t debugger_cpu::read_qword(address_space &space, offs_t address, bool apply_translation) +u64 debugger_cpu::read_qword(address_space &space, offs_t address, bool apply_translation) { /* mask against the logical byte mask */ address &= space.logbytemask(); - uint64_t result; + u64 result; if (!QWORD_ALIGNED(address)) { /* if this is a misaligned read, or if there are no qword readers, just read two dwords */ - uint32_t dword0 = read_dword(space, address + 0, apply_translation); - uint32_t dword1 = read_dword(space, address + 4, apply_translation); + u32 dword0 = read_dword(space, address + 0, apply_translation); + u32 dword1 = read_dword(space, address + 4, apply_translation); /* based on the endianness, the result is assembled differently */ if (space.endianness() == ENDIANNESS_LITTLE) - result = dword0 | ((uint64_t)dword1 << 32); + result = dword0 | (u64(dword1) << 32); else - result = dword1 | ((uint64_t)dword0 << 32); + result = dword1 | (u64(dword0) << 32); } else { /* otherwise, this proceeds like the byte case */ @@ -529,10 +529,10 @@ uint64_t debugger_cpu::read_qword(address_space &space, offs_t address, bool app space.set_debugger_access(true); /* translate if necessary; if not mapped, return 0xffffffffffffffff */ - uint64_t custom; + u64 custom; if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_READ_DEBUG, address)) { - result = ~(uint64_t)0; + result = ~u64(0); } else if (memory.read(space.spacenum(), address, 8, custom)) { /* if there is a custom read handler, and it returns true, use that value */ @@ -557,9 +557,9 @@ uint64_t debugger_cpu::read_qword(address_space &space, offs_t address, bool app from the specified memory space -------------------------------------------------*/ -uint64_t debugger_cpu::read_memory(address_space &space, offs_t address, int size, bool apply_translation) +u64 debugger_cpu::read_memory(address_space &space, offs_t address, int size, bool apply_translation) { - uint64_t result = ~(uint64_t)0 >> (64 - 8*size); + u64 result = ~u64(0) >> (64 - 8*size); switch (size) { case 1: result = read_byte(space, address, apply_translation); break; @@ -576,7 +576,7 @@ uint64_t debugger_cpu::read_memory(address_space &space, offs_t address, int siz memory space -------------------------------------------------*/ -void debugger_cpu::write_byte(address_space &space, offs_t address, uint8_t data, bool apply_translation) +void debugger_cpu::write_byte(address_space &space, offs_t address, u8 data, bool apply_translation) { device_memory_interface &memory = space.device().memory(); @@ -612,7 +612,7 @@ void debugger_cpu::write_byte(address_space &space, offs_t address, uint8_t data memory space -------------------------------------------------*/ -void debugger_cpu::write_word(address_space &space, offs_t address, uint16_t data, bool apply_translation) +void debugger_cpu::write_word(address_space &space, offs_t address, u16 data, bool apply_translation) { /* mask against the logical byte mask */ address &= space.logbytemask(); @@ -667,7 +667,7 @@ void debugger_cpu::write_word(address_space &space, offs_t address, uint16_t dat memory space -------------------------------------------------*/ -void debugger_cpu::write_dword(address_space &space, offs_t address, uint32_t data, bool apply_translation) +void debugger_cpu::write_dword(address_space &space, offs_t address, u32 data, bool apply_translation) { /* mask against the logical byte mask */ address &= space.logbytemask(); @@ -721,7 +721,7 @@ void debugger_cpu::write_dword(address_space &space, offs_t address, uint32_t da memory space -------------------------------------------------*/ -void debugger_cpu::write_qword(address_space &space, offs_t address, uint64_t data, bool apply_translation) +void debugger_cpu::write_qword(address_space &space, offs_t address, u64 data, bool apply_translation) { /* mask against the logical byte mask */ address &= space.logbytemask(); @@ -776,7 +776,7 @@ void debugger_cpu::write_qword(address_space &space, offs_t address, uint64_t da specified memory space -------------------------------------------------*/ -void debugger_cpu::write_memory(address_space &space, offs_t address, uint64_t data, int size, bool apply_translation) +void debugger_cpu::write_memory(address_space &space, offs_t address, u64 data, int size, bool apply_translation) { switch (size) { @@ -793,11 +793,11 @@ void debugger_cpu::write_memory(address_space &space, offs_t address, uint64_t d given offset from opcode space -------------------------------------------------*/ -uint64_t debugger_cpu::read_opcode(address_space &space, offs_t address, int size) +u64 debugger_cpu::read_opcode(address_space &space, offs_t address, int size) { device_memory_interface &memory = space.device().memory(); - uint64_t result = ~(uint64_t)0 & (~(uint64_t)0 >> (64 - 8*size)), result2; + u64 result = ~u64(0) & (~u64(0) >> (64 - 8*size)), result2; /* keep in logical range */ address &= space.logbytemask(); @@ -816,8 +816,8 @@ uint64_t debugger_cpu::read_opcode(address_space &space, offs_t address, int siz if (size > space.data_width() / 8) { int halfsize = size / 2; - uint64_t r0 = read_opcode(space, address + 0, halfsize); - uint64_t r1 = read_opcode(space, address + halfsize, halfsize); + u64 r0 = read_opcode(space, address + 0, halfsize); + u64 r1 = read_opcode(space, address + halfsize, halfsize); if (space.endianness() == ENDIANNESS_LITTLE) return r0 | (r1 << (8 * halfsize)); @@ -1005,7 +1005,7 @@ void debugger_cpu::process_source_file() /* strip whitespace */ int i = (int)strlen(buf); - while((i > 0) && (isspace((uint8_t)buf[i-1]))) + while((i > 0) && (isspace(u8(buf[i-1])))) buf[--i] = '\0'; /* execute the command */ @@ -1040,7 +1040,7 @@ device_t* debugger_cpu::expression_get_device(const char *tag) space -------------------------------------------------*/ -uint64_t debugger_cpu::expression_read_memory(void *param, const char *name, expression_space spacenum, uint32_t address, int size) +u64 debugger_cpu::expression_read_memory(void *param, const char *name, expression_space spacenum, u32 address, int size) { switch (spacenum) { @@ -1126,9 +1126,9 @@ uint64_t debugger_cpu::expression_read_memory(void *param, const char *name, exp directly from an opcode or RAM pointer -------------------------------------------------*/ -uint64_t debugger_cpu::expression_read_program_direct(address_space &space, int opcode, offs_t address, int size) +u64 debugger_cpu::expression_read_program_direct(address_space &space, int opcode, offs_t address, int size) { - uint8_t *base; + u8 *base; /* adjust the address into a byte address, but not if being called recursively */ if ((opcode & 2) == 0) @@ -1140,8 +1140,8 @@ uint64_t debugger_cpu::expression_read_program_direct(address_space &space, int int halfsize = size / 2; /* read each half, from lower address to upper address */ - uint64_t r0 = expression_read_program_direct(space, opcode | 2, address + 0, halfsize); - uint64_t r1 = expression_read_program_direct(space, opcode | 2, address + halfsize, halfsize); + u64 r0 = expression_read_program_direct(space, opcode | 2, address + 0, halfsize); + u64 r1 = expression_read_program_direct(space, opcode | 2, address + halfsize, halfsize); /* assemble based on the target endianness */ if (space.endianness() == ENDIANNESS_LITTLE) @@ -1157,7 +1157,7 @@ uint64_t debugger_cpu::expression_read_program_direct(address_space &space, int offs_t lowmask = space.data_width() / 8 - 1; /* get the base of memory, aligned to the address minus the lowbits */ - base = (uint8_t *)space.get_read_ptr(address & ~lowmask); + base = (u8 *)space.get_read_ptr(address & ~lowmask); /* if we have a valid base, return the appropriate byte */ if (base != nullptr) @@ -1178,10 +1178,10 @@ uint64_t debugger_cpu::expression_read_program_direct(address_space &space, int from a memory region -------------------------------------------------*/ -uint64_t debugger_cpu::expression_read_memory_region(const char *rgntag, offs_t address, int size) +u64 debugger_cpu::expression_read_memory_region(const char *rgntag, offs_t address, int size) { memory_region *region = m_machine.root_device().memregion(rgntag); - uint64_t result = ~(uint64_t)0 >> (64 - 8*size); + u64 result = ~u64(0) >> (64 - 8*size); /* make sure we get a valid base before proceeding */ if (region != nullptr) @@ -1190,7 +1190,7 @@ uint64_t debugger_cpu::expression_read_memory_region(const char *rgntag, offs_t if (size > 1) { int halfsize = size / 2; - uint64_t r0, r1; + u64 r0, r1; /* read each half, from lower address to upper address */ r0 = expression_read_memory_region(rgntag, address + 0, halfsize); @@ -1207,8 +1207,8 @@ uint64_t debugger_cpu::expression_read_memory_region(const char *rgntag, offs_t else if (address < region->bytes()) { /* lowmask specified which address bits are within the databus width */ - uint32_t lowmask = region->bytewidth() - 1; - uint8_t *base = region->base() + (address & ~lowmask); + u32 lowmask = region->bytewidth() - 1; + u8 *base = region->base() + (address & ~lowmask); /* if we have a valid base, return the appropriate byte */ if (region->endianness() == ENDIANNESS_LITTLE) @@ -1227,7 +1227,7 @@ uint64_t debugger_cpu::expression_read_memory_region(const char *rgntag, offs_t space -------------------------------------------------*/ -void debugger_cpu::expression_write_memory(void *param, const char *name, expression_space spacenum, uint32_t address, int size, uint64_t data) +void debugger_cpu::expression_write_memory(void *param, const char *name, expression_space spacenum, u32 address, int size, u64 data) { device_t *device = nullptr; device_memory_interface *memory; @@ -1299,7 +1299,7 @@ void debugger_cpu::expression_write_memory(void *param, const char *name, expres directly to an opcode or RAM pointer -------------------------------------------------*/ -void debugger_cpu::expression_write_program_direct(address_space &space, int opcode, offs_t address, int size, uint64_t data) +void debugger_cpu::expression_write_program_direct(address_space &space, int opcode, offs_t address, int size, u64 data) { /* adjust the address into a byte address, but not if being called recursively */ if ((opcode & 2) == 0) @@ -1311,8 +1311,8 @@ void debugger_cpu::expression_write_program_direct(address_space &space, int opc int halfsize = size / 2; /* break apart based on the target endianness */ - uint64_t halfmask = ~(uint64_t)0 >> (64 - 8 * halfsize); - uint64_t r0, r1; + u64 halfmask = ~u64(0) >> (64 - 8 * halfsize); + u64 r0, r1; if (space.endianness() == ENDIANNESS_LITTLE) { r0 = data & halfmask; @@ -1336,7 +1336,7 @@ void debugger_cpu::expression_write_program_direct(address_space &space, int opc offs_t lowmask = space.data_width() / 8 - 1; /* get the base of memory, aligned to the address minus the lowbits */ - uint8_t *base = (uint8_t *)space.get_read_ptr(address & ~lowmask); + u8 *base = (u8 *)space.get_read_ptr(address & ~lowmask); /* if we have a valid base, write the appropriate byte */ if (base != nullptr) @@ -1356,7 +1356,7 @@ void debugger_cpu::expression_write_program_direct(address_space &space, int opc from a memory region -------------------------------------------------*/ -void debugger_cpu::expression_write_memory_region(const char *rgntag, offs_t address, int size, uint64_t data) +void debugger_cpu::expression_write_memory_region(const char *rgntag, offs_t address, int size, u64 data) { memory_region *region = m_machine.root_device().memregion(rgntag); @@ -1369,8 +1369,8 @@ void debugger_cpu::expression_write_memory_region(const char *rgntag, offs_t add int halfsize = size / 2; /* break apart based on the target endianness */ - uint64_t halfmask = ~(uint64_t)0 >> (64 - 8 * halfsize); - uint64_t r0, r1; + u64 halfmask = ~u64(0) >> (64 - 8 * halfsize); + u64 r0, r1; if (region->endianness() == ENDIANNESS_LITTLE) { r0 = data & halfmask; @@ -1391,8 +1391,8 @@ void debugger_cpu::expression_write_memory_region(const char *rgntag, offs_t add else if (address < region->bytes()) { /* lowmask specified which address bits are within the databus width */ - uint32_t lowmask = region->bytewidth() - 1; - uint8_t *base = region->base() + (address & ~lowmask); + u32 lowmask = region->bytewidth() - 1; + u8 *base = region->base() + (address & ~lowmask); /* if we have a valid base, set the appropriate byte */ if (region->endianness() == ENDIANNESS_LITTLE) @@ -1491,7 +1491,7 @@ expression_error::error_code debugger_cpu::expression_validate(void *param, cons get_beamx - get beam horizontal position -------------------------------------------------*/ -uint64_t debugger_cpu::get_beamx(symbol_table &table, void *ref) +u64 debugger_cpu::get_beamx(symbol_table &table, void *ref) { screen_device *screen = reinterpret_cast(ref); return (screen != nullptr) ? screen->hpos() : 0; @@ -1502,7 +1502,7 @@ uint64_t debugger_cpu::get_beamx(symbol_table &table, void *ref) get_beamy - get beam vertical position -------------------------------------------------*/ -uint64_t debugger_cpu::get_beamy(symbol_table &table, void *ref) +u64 debugger_cpu::get_beamy(symbol_table &table, void *ref) { screen_device *screen = reinterpret_cast(ref); return (screen != nullptr) ? screen->vpos() : 0; @@ -1513,7 +1513,7 @@ uint64_t debugger_cpu::get_beamy(symbol_table &table, void *ref) get_frame - get current frame number -------------------------------------------------*/ -uint64_t debugger_cpu::get_frame(symbol_table &table, void *ref) +u64 debugger_cpu::get_frame(symbol_table &table, void *ref) { screen_device *screen = reinterpret_cast(ref); return (screen != nullptr) ? screen->frame_number() : 0; @@ -1525,7 +1525,7 @@ uint64_t debugger_cpu::get_frame(symbol_table &table, void *ref) 'cpunum' symbol -------------------------------------------------*/ -uint64_t debugger_cpu::get_cpunum(symbol_table &table, void *ref) +u64 debugger_cpu::get_cpunum(symbol_table &table, void *ref) { execute_interface_iterator iter(m_machine.root_device()); return iter.indexof(m_visiblecpu->execute()); @@ -1825,7 +1825,7 @@ void device_debug::instruction_hook(offs_t curpc) // are we tracking our recent pc visits? if (m_track_pc) { - const uint32_t crc = compute_opcode_crc32(curpc); + const u32 crc = compute_opcode_crc32(curpc); m_track_pc_set.insert(dasm_pc_tag(curpc, crc)); } @@ -1952,7 +1952,7 @@ void device_debug::instruction_hook(offs_t curpc) // memory read happens //------------------------------------------------- -void device_debug::memory_read_hook(address_space &space, offs_t address, uint64_t mem_mask) +void device_debug::memory_read_hook(address_space &space, offs_t address, u64 mem_mask) { // check watchpoints watchpoint_check(space, WATCHPOINT_READ, address, 0, mem_mask); @@ -1969,7 +1969,7 @@ void device_debug::memory_read_hook(address_space &space, offs_t address, uint64 // memory write happens //------------------------------------------------- -void device_debug::memory_write_hook(address_space &space, offs_t address, uint64_t data, uint64_t mem_mask) +void device_debug::memory_write_hook(address_space &space, offs_t address, u64 data, u64 mem_mask) { if (m_track_mem) { @@ -2134,7 +2134,7 @@ void device_debug::go_exception(int exception) // delay elapses //------------------------------------------------- -void device_debug::go_milliseconds(uint64_t milliseconds) +void device_debug::go_milliseconds(u64 milliseconds) { assert(m_exec != nullptr); @@ -2165,7 +2165,7 @@ void device_debug::halt_on_next_instruction_impl(util::format_argument_pack::iterator, bool> const inserted = m_comment_set.insert(newComment); if (!inserted.second) @@ -2553,7 +2553,7 @@ void device_debug::comment_add(offs_t addr, const char *comment, rgb_t color) bool device_debug::comment_remove(offs_t addr) { - const uint32_t crc = compute_opcode_crc32(addr); + const u32 crc = compute_opcode_crc32(addr); size_t const removed = m_comment_set.erase(dasm_comment(addr, crc, "", 0xffffffff)); if (removed != 0U) m_comment_change++; return removed != 0U; @@ -2566,7 +2566,7 @@ bool device_debug::comment_remove(offs_t addr) const char *device_debug::comment_text(offs_t addr) const { - const uint32_t crc = compute_opcode_crc32(addr); + const u32 crc = compute_opcode_crc32(addr); auto comment = m_comment_set.find(dasm_comment(addr, crc, "", 0)); if (comment == m_comment_set.end()) return nullptr; return comment->m_text.c_str(); @@ -2608,7 +2608,7 @@ bool device_debug::comment_import(xml_data_node const &cpunode, bool is_inline) offs_t address = datanode->get_attribute_int("address", 0); rgb_t color = datanode->get_attribute_int("color", 0); - uint32_t crc; + u32 crc; sscanf(datanode->get_attribute_string("crc", nullptr), "%08X", &crc); // add the new comment @@ -2626,7 +2626,7 @@ bool device_debug::comment_import(xml_data_node const &cpunode, bool is_inline) // the opcode bytes at the given address //------------------------------------------------- -uint32_t device_debug::compute_opcode_crc32(offs_t pc) const +u32 device_debug::compute_opcode_crc32(offs_t pc) const { // Basically the same thing as dasm_wrapped, but with some tiny savings assert(m_memory != nullptr); @@ -2637,7 +2637,7 @@ uint32_t device_debug::compute_opcode_crc32(offs_t pc) const offs_t pcbyte = space.address_to_byte(pc) & space.bytemask(); // fetch the bytes up to the maximum - uint8_t opbuf[64], argbuf[64]; + u8 opbuf[64], argbuf[64]; int maxbytes = (m_disasm != nullptr) ? m_disasm->max_opcode_bytes() : 1; for (int numbytes = 0; numbytes < maxbytes; numbytes++) { @@ -2645,7 +2645,7 @@ uint32_t device_debug::compute_opcode_crc32(offs_t pc) const argbuf[numbytes] = m_device.machine().debugger().cpu().read_opcode(space, pcbyte + numbytes, 1); } - uint32_t numbytes = maxbytes; + u32 numbytes = maxbytes; if (m_disasm != nullptr) { // disassemble to our buffer @@ -2881,12 +2881,12 @@ void device_debug::watchpoint_update_flags(address_space &space) // for a given CPU and address space //------------------------------------------------- -void device_debug::watchpoint_check(address_space& space, int type, offs_t address, uint64_t value_to_write, uint64_t mem_mask) +void device_debug::watchpoint_check(address_space& space, int type, offs_t address, u64 value_to_write, u64 mem_mask) { space.machine().debugger().cpu().watchpoint_check(space, type, address, value_to_write, mem_mask, m_wplist); } -void debugger_cpu::watchpoint_check(address_space& space, int type, offs_t address, uint64_t value_to_write, uint64_t mem_mask, device_debug::watchpoint** wplist) +void debugger_cpu::watchpoint_check(address_space& space, int type, offs_t address, u64 value_to_write, u64 mem_mask, device_debug::watchpoint** wplist) { // if we're within debugger code, don't stop if (m_within_instruction_hook || m_debugger_access) @@ -2915,15 +2915,16 @@ void debugger_cpu::watchpoint_check(address_space& space, int type, offs_t addre } // (1<<(size*8))-1 won't work when size is 8; let's just use a lut - static const uint64_t masks[] = {0, - 0xff, - 0xffff, - 0xffffff, - 0xffffffff, - U64(0xffffffffff), - U64(0xffffffffffff), - U64(0xffffffffffffff), - U64(0xffffffffffffffff)}; + static const u64 masks[] = { + 0x0U, + 0xffU, + 0xffffU, + 0xffffffU, + 0xffffffffU, + 0xffffffffffU, + 0xffffffffffffU, + 0xffffffffffffffU, + 0xffffffffffffffffU}; value_to_write &= masks[size]; if (space.endianness() == ENDIANNESS_LITTLE) @@ -2962,9 +2963,9 @@ void debugger_cpu::watchpoint_check(address_space& space, int type, offs_t addre { buffer = string_format("Stopped at watchpoint %X writing %s to %08X (PC=%X)", wp->index(), sizes[size], space.byte_to_address(address), pc); if (value_to_write >> 32) - buffer.append(string_format(" (data=%X%08X)", (uint32_t)(value_to_write >> 32), (uint32_t)value_to_write)); + buffer.append(string_format(" (data=%X%08X)", u32(value_to_write >> 32), u32(value_to_write))); else - buffer.append(string_format(" (data=%X)", (uint32_t)value_to_write)); + buffer.append(string_format(" (data=%X)", u32(value_to_write))); } else buffer = string_format("Stopped at watchpoint %X reading %s from %08X (PC=%X)", wp->index(), sizes[size], space.byte_to_address(address), pc); @@ -3029,7 +3030,7 @@ void device_debug::hotspot_check(address_space &space, offs_t address) // buffer and then disassembling them //------------------------------------------------- -uint32_t device_debug::dasm_wrapped(std::string &buffer, offs_t pc) +u32 device_debug::dasm_wrapped(std::string &buffer, offs_t pc) { assert(m_memory != nullptr && m_disasm != nullptr); @@ -3039,7 +3040,7 @@ uint32_t device_debug::dasm_wrapped(std::string &buffer, offs_t pc) offs_t pcbyte = space.address_to_byte(pc) & space.bytemask(); // fetch the bytes up to the maximum - uint8_t opbuf[64], argbuf[64]; + u8 opbuf[64], argbuf[64]; int maxbytes = m_disasm->max_opcode_bytes(); for (int numbytes = 0; numbytes < maxbytes; numbytes++) { @@ -3050,7 +3051,7 @@ uint32_t device_debug::dasm_wrapped(std::string &buffer, offs_t pc) // disassemble to our buffer char diasmbuf[200]; memset(diasmbuf, 0x00, 200); - uint32_t result = m_disasm->disassemble(diasmbuf, pc, opbuf, argbuf); + u32 result = m_disasm->disassemble(diasmbuf, pc, opbuf, argbuf); buffer.assign(diasmbuf); return result; } @@ -3061,7 +3062,7 @@ uint32_t device_debug::dasm_wrapped(std::string &buffer, offs_t pc) // current instruction pointer //------------------------------------------------- -uint64_t device_debug::get_current_pc(symbol_table &table, void *ref) +u64 device_debug::get_current_pc(symbol_table &table, void *ref) { device_t *device = reinterpret_cast(table.globalref()); return device->safe_pcbase(); @@ -3073,7 +3074,7 @@ uint64_t device_debug::get_current_pc(symbol_table &table, void *ref) // 'cycles' symbol //------------------------------------------------- -uint64_t device_debug::get_cycles(symbol_table &table, void *ref) +u64 device_debug::get_cycles(symbol_table &table, void *ref) { device_t *device = reinterpret_cast(table.globalref()); return device->debug()->m_exec->cycles_remaining(); @@ -3085,7 +3086,7 @@ uint64_t device_debug::get_cycles(symbol_table &table, void *ref) // 'totalcycles' symbol //------------------------------------------------- -uint64_t device_debug::get_totalcycles(symbol_table &table, void *ref) +u64 device_debug::get_totalcycles(symbol_table &table, void *ref) { device_t *device = reinterpret_cast(table.globalref()); return device->debug()->m_total_cycles; @@ -3097,7 +3098,7 @@ uint64_t device_debug::get_totalcycles(symbol_table &table, void *ref) // 'lastinstructioncycles' symbol //------------------------------------------------- -uint64_t device_debug::get_lastinstructioncycles(symbol_table &table, void *ref) +u64 device_debug::get_lastinstructioncycles(symbol_table &table, void *ref) { device_t *device = reinterpret_cast(table.globalref()); device_debug *debug = device->debug(); @@ -3110,7 +3111,7 @@ uint64_t device_debug::get_lastinstructioncycles(symbol_table &table, void *ref) // symbols //------------------------------------------------- -uint64_t device_debug::get_logunmap(symbol_table &table, void *ref) +u64 device_debug::get_logunmap(symbol_table &table, void *ref) { address_space &space = *reinterpret_cast(table.globalref()); return space.log_unmap(); @@ -3122,7 +3123,7 @@ uint64_t device_debug::get_logunmap(symbol_table &table, void *ref) // symbols //------------------------------------------------- -void device_debug::set_logunmap(symbol_table &table, void *ref, uint64_t value) +void device_debug::set_logunmap(symbol_table &table, void *ref, u64 value) { address_space &space = *reinterpret_cast(table.globalref()); space.set_log_unmap(value ? true : false); @@ -3134,7 +3135,7 @@ void device_debug::set_logunmap(symbol_table &table, void *ref, uint64_t value) // state symbols //------------------------------------------------- -uint64_t device_debug::get_state(symbol_table &table, void *ref) +u64 device_debug::get_state(symbol_table &table, void *ref) { device_t *device = reinterpret_cast(table.globalref()); return device->debug()->m_state->state_int(reinterpret_cast(ref)); @@ -3146,7 +3147,7 @@ uint64_t device_debug::get_state(symbol_table &table, void *ref) // state symbols //------------------------------------------------- -void device_debug::set_state(symbol_table &table, void *ref, uint64_t value) +void device_debug::set_state(symbol_table &table, void *ref, u64 value) { device_t *device = reinterpret_cast(table.globalref()); device->debug()->m_state->set_state_int(reinterpret_cast(ref), value); @@ -3454,7 +3455,7 @@ void device_debug::tracer::flush() // dasm_pc_tag - constructor //------------------------------------------------- -device_debug::dasm_pc_tag::dasm_pc_tag(const offs_t& address, const uint32_t& crc) +device_debug::dasm_pc_tag::dasm_pc_tag(const offs_t& address, const u32& crc) : m_address(address), m_crc(crc) { @@ -3466,7 +3467,7 @@ device_debug::dasm_pc_tag::dasm_pc_tag(const offs_t& address, const uint32_t& cr device_debug::dasm_memory_access::dasm_memory_access(const address_spacenum& address_space, const offs_t& address, - const uint64_t& data, + const u64& data, const offs_t& pc) : m_address_space(address_space), m_address(address), @@ -3479,7 +3480,7 @@ device_debug::dasm_memory_access::dasm_memory_access(const address_spacenum& add // dasm_comment - constructor //------------------------------------------------- -device_debug::dasm_comment::dasm_comment(offs_t address, uint32_t crc, const char *text, rgb_t color) +device_debug::dasm_comment::dasm_comment(offs_t address, u32 crc, const char *text, rgb_t color) : dasm_pc_tag(address, crc), m_text(text), m_color(std::move(color)) diff --git a/src/emu/debug/debugcpu.h b/src/emu/debug/debugcpu.h index bc262e382ef..079b17d1fd0 100644 --- a/src/emu/debug/debugcpu.h +++ b/src/emu/debug/debugcpu.h @@ -10,8 +10,8 @@ #pragma once -#ifndef __DEBUGCPU_H__ -#define __DEBUGCPU_H__ +#ifndef MAME_EMU_DEBUG_DEBUGCPU_H +#define MAME_EMU_DEBUG_DEBUGCPU_H #include "express.h" @@ -22,11 +22,11 @@ // CONSTANTS //************************************************************************** -const uint8_t WATCHPOINT_READ = 1; -const uint8_t WATCHPOINT_WRITE = 2; -const uint8_t WATCHPOINT_READWRITE = WATCHPOINT_READ | WATCHPOINT_WRITE; +constexpr u8 WATCHPOINT_READ = 1; +constexpr u8 WATCHPOINT_WRITE = 2; +constexpr u8 WATCHPOINT_READWRITE = WATCHPOINT_READ | WATCHPOINT_WRITE; -const int COMMENT_VERSION = 1; +constexpr int COMMENT_VERSION = 1; @@ -127,7 +127,7 @@ public: address_space & m_space; // address space int m_index; // user reported index bool m_enabled; // enabled? - uint8_t m_type; // type (read/write) + u8 m_type; // type (read/write) offs_t m_address; // start address offs_t m_length; // length of watch area parsed_expression m_condition; // condition @@ -179,8 +179,8 @@ public: void interrupt_hook(int irqline); void exception_hook(int exception); void instruction_hook(offs_t curpc); - void memory_read_hook(address_space &space, offs_t address, uint64_t mem_mask); - void memory_write_hook(address_space &space, offs_t address, uint64_t data, uint64_t mem_mask); + void memory_read_hook(address_space &space, offs_t address, u64 mem_mask); + void memory_write_hook(address_space &space, offs_t address, u64 data, u64 mem_mask); // hooks into our operations void set_instruction_hook(debug_instruction_hook_func hook); @@ -199,7 +199,7 @@ public: void go_vblank(); void go_interrupt(int irqline = -1); void go_exception(int exception); - void go_milliseconds(uint64_t milliseconds); + void go_milliseconds(u64 milliseconds); void go_next_device(); template @@ -240,11 +240,11 @@ public: void comment_add(offs_t address, const char *comment, rgb_t color); bool comment_remove(offs_t addr); const char *comment_text(offs_t addr) const; - uint32_t comment_count() const { return m_comment_set.size(); } - uint32_t comment_change_count() const { return m_comment_change; } + u32 comment_count() const { return m_comment_set.size(); } + u32 comment_change_count() const { return m_comment_change; } bool comment_export(xml_data_node &node); bool comment_import(xml_data_node const &node, bool is_inline); - uint32_t compute_opcode_crc32(offs_t pc) const; + u32 compute_opcode_crc32(offs_t pc) const; // history offs_t history_pc(int index) const; @@ -259,7 +259,7 @@ public: void set_track_mem(bool value) { m_track_mem = value; } offs_t track_mem_pc_from_space_address_data(const address_spacenum& space, const offs_t& address, - const uint64_t& data) const; + const u64& data) const; void track_mem_data_clear() { m_track_mem_set.clear(); } // tracing @@ -279,24 +279,24 @@ private: // internal helpers void prepare_for_step_overout(offs_t pc); - uint32_t dasm_wrapped(std::string &buffer, offs_t pc); + u32 dasm_wrapped(std::string &buffer, offs_t pc); // breakpoint and watchpoint helpers void breakpoint_update_flags(); void breakpoint_check(offs_t pc); void watchpoint_update_flags(address_space &space); - void watchpoint_check(address_space &space, int type, offs_t address, uint64_t value_to_write, uint64_t mem_mask); + void watchpoint_check(address_space &space, int type, offs_t address, u64 value_to_write, u64 mem_mask); void hotspot_check(address_space &space, offs_t address); // symbol get/set callbacks - static uint64_t get_current_pc(symbol_table &table, void *ref); - static uint64_t get_cycles(symbol_table &table, void *ref); - static uint64_t get_totalcycles(symbol_table &table, void *ref); - static uint64_t get_lastinstructioncycles(symbol_table &table, void *ref); - static uint64_t get_logunmap(symbol_table &table, void *ref); - static void set_logunmap(symbol_table &table, void *ref, uint64_t value); - static uint64_t get_state(symbol_table &table, void *ref); - static void set_state(symbol_table &table, void *ref, uint64_t value); + static u64 get_current_pc(symbol_table &table, void *ref); + static u64 get_cycles(symbol_table &table, void *ref); + static u64 get_totalcycles(symbol_table &table, void *ref); + static u64 get_lastinstructioncycles(symbol_table &table, void *ref); + static u64 get_logunmap(symbol_table &table, void *ref); + static void set_logunmap(symbol_table &table, void *ref, u64 value); + static u64 get_state(symbol_table &table, void *ref); + static void set_state(symbol_table &table, void *ref, u64 value); // basic device information device_t & m_device; // device we are attached to @@ -306,7 +306,7 @@ private: device_disasm_interface * m_disasm; // disasm interface, if present // global state - uint32_t m_flags; // debugging flags for this CPU + u32 m_flags; // debugging flags for this CPU symbol_table m_symtable; // symbol table for expression evaluation debug_instruction_hook_func m_instrhook; // per-instruction callback hook @@ -320,12 +320,12 @@ private: int m_stopirq; // stop IRQ number for DEBUG_FLAG_STOP_INTERRUPT int m_stopexception; // stop exception number for DEBUG_FLAG_STOP_EXCEPTION attotime m_endexectime; // ending time of the current execution - uint64_t m_total_cycles; // current total cycles - uint64_t m_last_total_cycles; // last total cycles + u64 m_total_cycles; // current total cycles + u64 m_last_total_cycles; // last total cycles // history offs_t m_pc_history[HISTORY_SIZE]; // history of recent PCs - uint32_t m_pc_history_index; // current history index + u32 m_pc_history_index; // current history index // breakpoints and watchpoints breakpoint * m_bplist; // list of breakpoints @@ -366,7 +366,7 @@ private: offs_t m_access; // access address offs_t m_pc; // PC of the access address_space * m_space; // space where the access occurred - uint32_t m_count; // number of hits + u32 m_count; // number of hits }; std::vector m_hotspots; // hotspot list int m_hotspot_threshhold; // threshhold for the number of hits to print @@ -375,7 +375,7 @@ private: class dasm_pc_tag { public: - dasm_pc_tag(const offs_t& address, const uint32_t& crc); + dasm_pc_tag(const offs_t& address, const u32& crc); // required to be included in a set bool operator < (const dasm_pc_tag& rhs) const @@ -386,7 +386,7 @@ private: } offs_t m_address; // Stores [nothing] for a given address & crc32 - uint32_t m_crc; + u32 m_crc; }; std::set m_track_pc_set; bool m_track_pc; @@ -395,13 +395,13 @@ private: class dasm_comment : public dasm_pc_tag { public: - dasm_comment(offs_t address, uint32_t crc, const char *text, rgb_t color); + dasm_comment(offs_t address, u32 crc, const char *text, rgb_t color); std::string m_text; // Stores comment text & color for a given address & crc32 - rgb_t m_color; + rgb_t m_color; }; std::set m_comment_set; // collection of comments - uint32_t m_comment_change; // change counter for comments + u32 m_comment_change; // change counter for comments // memory tracking class dasm_memory_access @@ -409,7 +409,7 @@ private: public: dasm_memory_access(const address_spacenum& address_space, const offs_t& address, - const uint64_t& data, + const u64& data, const offs_t& pc); // required to be included in a set @@ -426,31 +426,31 @@ private: // Stores the PC for a given address, memory region, and data value address_spacenum m_address_space; offs_t m_address; - uint64_t m_data; + u64 m_data; mutable offs_t m_pc; }; std::set m_track_mem_set; bool m_track_mem; // internal flag values - static const uint32_t DEBUG_FLAG_OBSERVING = 0x00000001; // observing this CPU - static const uint32_t DEBUG_FLAG_HISTORY = 0x00000002; // tracking this CPU's history - static const uint32_t DEBUG_FLAG_TRACING = 0x00000004; // tracing this CPU - static const uint32_t DEBUG_FLAG_TRACING_OVER = 0x00000008; // tracing this CPU with step over behavior - static const uint32_t DEBUG_FLAG_HOOKED = 0x00000010; // per-instruction callback hook - static const uint32_t DEBUG_FLAG_STEPPING = 0x00000020; // CPU is single stepping - static const uint32_t DEBUG_FLAG_STEPPING_OVER = 0x00000040; // CPU is stepping over a function - static const uint32_t DEBUG_FLAG_STEPPING_OUT = 0x00000080; // CPU is stepping out of a function - static const uint32_t DEBUG_FLAG_STOP_PC = 0x00000100; // there is a pending stop at cpu->breakpc - static const uint32_t DEBUG_FLAG_STOP_INTERRUPT = 0x00000400; // there is a pending stop on the next interrupt - static const uint32_t DEBUG_FLAG_STOP_EXCEPTION = 0x00000800; // there is a pending stop on the next exception - static const uint32_t DEBUG_FLAG_STOP_VBLANK = 0x00001000; // there is a pending stop on the next VBLANK - static const uint32_t DEBUG_FLAG_STOP_TIME = 0x00002000; // there is a pending stop at cpu->stoptime - static const uint32_t DEBUG_FLAG_LIVE_BP = 0x00010000; // there are live breakpoints for this CPU + static constexpr u32 DEBUG_FLAG_OBSERVING = 0x00000001; // observing this CPU + static constexpr u32 DEBUG_FLAG_HISTORY = 0x00000002; // tracking this CPU's history + static constexpr u32 DEBUG_FLAG_TRACING = 0x00000004; // tracing this CPU + static constexpr u32 DEBUG_FLAG_TRACING_OVER = 0x00000008; // tracing this CPU with step over behavior + static constexpr u32 DEBUG_FLAG_HOOKED = 0x00000010; // per-instruction callback hook + static constexpr u32 DEBUG_FLAG_STEPPING = 0x00000020; // CPU is single stepping + static constexpr u32 DEBUG_FLAG_STEPPING_OVER = 0x00000040; // CPU is stepping over a function + static constexpr u32 DEBUG_FLAG_STEPPING_OUT = 0x00000080; // CPU is stepping out of a function + static constexpr u32 DEBUG_FLAG_STOP_PC = 0x00000100; // there is a pending stop at cpu->breakpc + static constexpr u32 DEBUG_FLAG_STOP_INTERRUPT = 0x00000400; // there is a pending stop on the next interrupt + static constexpr u32 DEBUG_FLAG_STOP_EXCEPTION = 0x00000800; // there is a pending stop on the next exception + static constexpr u32 DEBUG_FLAG_STOP_VBLANK = 0x00001000; // there is a pending stop on the next VBLANK + static constexpr u32 DEBUG_FLAG_STOP_TIME = 0x00002000; // there is a pending stop at cpu->stoptime + static constexpr u32 DEBUG_FLAG_LIVE_BP = 0x00010000; // there are live breakpoints for this CPU - static const uint32_t DEBUG_FLAG_STEPPING_ANY = DEBUG_FLAG_STEPPING | DEBUG_FLAG_STEPPING_OVER | DEBUG_FLAG_STEPPING_OUT; - static const uint32_t DEBUG_FLAG_TRACING_ANY = DEBUG_FLAG_TRACING | DEBUG_FLAG_TRACING_OVER; - static const uint32_t DEBUG_FLAG_TRANSIENT = DEBUG_FLAG_STEPPING_ANY | DEBUG_FLAG_STOP_PC | + static constexpr u32 DEBUG_FLAG_STEPPING_ANY = DEBUG_FLAG_STEPPING | DEBUG_FLAG_STEPPING_OVER | DEBUG_FLAG_STEPPING_OUT; + static constexpr u32 DEBUG_FLAG_TRACING_ANY = DEBUG_FLAG_TRACING | DEBUG_FLAG_TRACING_OVER; + static constexpr u32 DEBUG_FLAG_TRANSIENT = DEBUG_FLAG_STEPPING_ANY | DEBUG_FLAG_STOP_PC | DEBUG_FLAG_STOP_INTERRUPT | DEBUG_FLAG_STOP_EXCEPTION | DEBUG_FLAG_STOP_VBLANK | DEBUG_FLAG_STOP_TIME; }; @@ -510,46 +510,46 @@ public: /* ----- debugger memory accessors ----- */ /* return a byte from the specified memory space */ - uint8_t read_byte(address_space &space, offs_t address, bool apply_translation); + u8 read_byte(address_space &space, offs_t address, bool apply_translation); /* return a word from the specified memory space */ - uint16_t read_word(address_space &space, offs_t address, bool apply_translation); + u16 read_word(address_space &space, offs_t address, bool apply_translation); /* return a dword from the specified memory space */ - uint32_t read_dword(address_space &space, offs_t address, bool apply_translation); + u32 read_dword(address_space &space, offs_t address, bool apply_translation); /* return a qword from the specified memory space */ - uint64_t read_qword(address_space &space, offs_t address, bool apply_translation); + u64 read_qword(address_space &space, offs_t address, bool apply_translation); /* return 1,2,4 or 8 bytes from the specified memory space */ - uint64_t read_memory(address_space &space, offs_t address, int size, bool apply_translation); + u64 read_memory(address_space &space, offs_t address, int size, bool apply_translation); /* write a byte to the specified memory space */ - void write_byte(address_space &space, offs_t address, uint8_t data, bool apply_translation); + void write_byte(address_space &space, offs_t address, u8 data, bool apply_translation); /* write a word to the specified memory space */ - void write_word(address_space &space, offs_t address, uint16_t data, bool apply_translation); + void write_word(address_space &space, offs_t address, u16 data, bool apply_translation); /* write a dword to the specified memory space */ - void write_dword(address_space &space, offs_t address, uint32_t data, bool apply_translation); + void write_dword(address_space &space, offs_t address, u32 data, bool apply_translation); /* write a qword to the specified memory space */ - void write_qword(address_space &space, offs_t address, uint64_t data, bool apply_translation); + void write_qword(address_space &space, offs_t address, u64 data, bool apply_translation); /* write 1,2,4 or 8 bytes to the specified memory space */ - void write_memory(address_space &space, offs_t address, uint64_t data, int size, bool apply_translation); + void write_memory(address_space &space, offs_t address, u64 data, int size, bool apply_translation); /* read 1,2,4 or 8 bytes at the given offset from opcode space */ - uint64_t read_opcode(address_space &space, offs_t offset, int size); + u64 read_opcode(address_space &space, offs_t offset, int size); // getters bool within_instruction_hook() const { return m_within_instruction_hook; } bool memory_modified() const { return m_memory_modified; } int execution_state() const { return m_execution_state; } device_t *live_cpu() { return m_livecpu; } - uint32_t get_breakpoint_index() { return m_bpindex++; } - uint32_t get_watchpoint_index() { return m_wpindex++; } - uint32_t get_registerpoint_index() { return m_rpindex++; } + u32 get_breakpoint_index() { return m_bpindex++; } + u32 get_watchpoint_index() { return m_wpindex++; } + u32 get_registerpoint_index() { return m_rpindex++; } // setters void set_visible_cpu(device_t * visiblecpu) { m_visiblecpu = visiblecpu; } @@ -568,26 +568,26 @@ public: void ensure_comments_loaded(); void reset_transient_flags(); void process_source_file(); - void watchpoint_check(address_space& space, int type, offs_t address, uint64_t value_to_write, uint64_t mem_mask, device_debug::watchpoint** wplist); + void watchpoint_check(address_space& space, int type, offs_t address, u64 value_to_write, u64 mem_mask, device_debug::watchpoint** wplist); private: static const size_t NUM_TEMP_VARIABLES; /* expression handlers */ - uint64_t expression_read_memory(void *param, const char *name, expression_space space, uint32_t address, int size); - uint64_t expression_read_program_direct(address_space &space, int opcode, offs_t address, int size); - uint64_t expression_read_memory_region(const char *rgntag, offs_t address, int size); - void expression_write_memory(void *param, const char *name, expression_space space, uint32_t address, int size, uint64_t data); - void expression_write_program_direct(address_space &space, int opcode, offs_t address, int size, uint64_t data); - void expression_write_memory_region(const char *rgntag, offs_t address, int size, uint64_t data); + u64 expression_read_memory(void *param, const char *name, expression_space space, u32 address, int size); + u64 expression_read_program_direct(address_space &space, int opcode, offs_t address, int size); + u64 expression_read_memory_region(const char *rgntag, offs_t address, int size); + void expression_write_memory(void *param, const char *name, expression_space space, u32 address, int size, u64 data); + void expression_write_program_direct(address_space &space, int opcode, offs_t address, int size, u64 data); + void expression_write_memory_region(const char *rgntag, offs_t address, int size, u64 data); expression_error::error_code expression_validate(void *param, const char *name, expression_space space); device_t* expression_get_device(const char *tag); /* variable getters/setters */ - uint64_t get_cpunum(symbol_table &table, void *ref); - uint64_t get_beamx(symbol_table &table, void *ref); - uint64_t get_beamy(symbol_table &table, void *ref); - uint64_t get_frame(symbol_table &table, void *ref); + u64 get_cpunum(symbol_table &table, void *ref); + u64 get_beamx(symbol_table &table, void *ref); + u64 get_beamy(symbol_table &table, void *ref); + u64 get_frame(symbol_table &table, void *ref); /* internal helpers */ void on_vblank(screen_device &device, bool vblank_state); @@ -602,25 +602,25 @@ private: std::unique_ptr m_symtable; // global symbol table - bool m_within_instruction_hook; - bool m_vblank_occurred; - bool m_memory_modified; - bool m_debugger_access; + bool m_within_instruction_hook; + bool m_vblank_occurred; + bool m_memory_modified; + bool m_debugger_access; int m_execution_state; device_t * m_stop_when_not_device; // stop execution when the device ceases to be this - uint32_t m_bpindex; - uint32_t m_wpindex; - uint32_t m_rpindex; + u32 m_bpindex; + u32 m_wpindex; + u32 m_rpindex; - uint64_t m_wpdata; - uint64_t m_wpaddr; - std::unique_ptr m_tempvar; + u64 m_wpdata; + u64 m_wpaddr; + std::unique_ptr m_tempvar; osd_ticks_t m_last_periodic_update_time; bool m_comments_loaded; }; -#endif +#endif // MAME_EMU_DEBUG_DEBUGCPU_H diff --git a/src/emu/debug/debughlp.cpp b/src/emu/debug/debughlp.cpp index 601bed4a440..ded8cafb993 100644 --- a/src/emu/debug/debughlp.cpp +++ b/src/emu/debug/debughlp.cpp @@ -1518,7 +1518,7 @@ const char *debug_get_help(const char *tag) /* make a lowercase copy of the tag */ for (i = 0; i <= taglen; i++) - tagcopy[i] = tolower((uint8_t)tag[i]); + tagcopy[i] = tolower(u8(tag[i])); /* find a match */ for (i = 0; i < ARRAY_LENGTH(static_help_list); i++) diff --git a/src/emu/debug/debughlp.h b/src/emu/debug/debughlp.h index 7f3eb6e4ad6..87881f6967f 100644 --- a/src/emu/debug/debughlp.h +++ b/src/emu/debug/debughlp.h @@ -8,8 +8,8 @@ *********************************************************************/ -#ifndef __DEBUGHLP_H__ -#define __DEBUGHLP_H__ +#ifndef MAME_EMU_DEBUG_DEBUGHLP_H +#define MAME_EMU_DEBUG_DEBUGHLP_H /*************************************************************************** @@ -19,4 +19,4 @@ /* help management */ const char * debug_get_help(const char *tag); -#endif +#endif // MAME_EMU_DEBUG_DEBUGHLP_H diff --git a/src/emu/debug/debugvw.cpp b/src/emu/debug/debugvw.cpp index c66034ef26b..f351896480e 100644 --- a/src/emu/debug/debugvw.cpp +++ b/src/emu/debug/debugvw.cpp @@ -506,7 +506,7 @@ bool debug_view_expression::recompute() // recompute the value of the expression try { - uint64_t newresult = m_parsed.execute(); + u64 newresult = m_parsed.execute(); if (newresult != m_result) { m_result = newresult; diff --git a/src/emu/debug/debugvw.h b/src/emu/debug/debugvw.h index 1dcdc9120c5..382f45e5e20 100644 --- a/src/emu/debug/debugvw.h +++ b/src/emu/debug/debugvw.h @@ -8,8 +8,8 @@ ***************************************************************************/ -#ifndef __DEBUGVIEW_H__ -#define __DEBUGVIEW_H__ +#ifndef MAME_EMU_DEBUG_DEBUGVIEW_H +#define MAME_EMU_DEBUG_DEBUGVIEW_H #include "express.h" @@ -43,36 +43,36 @@ enum debug_view_notification // attribute bits for debug_view_char.attrib -const uint8_t DCA_NORMAL = 0x00; // black on white -const uint8_t DCA_CHANGED = 0x01; // red foreground -const uint8_t DCA_SELECTED = 0x02; // light red background -const uint8_t DCA_INVALID = 0x04; // dark blue foreground -const uint8_t DCA_DISABLED = 0x08; // darker foreground -const uint8_t DCA_ANCILLARY = 0x10; // grey background -const uint8_t DCA_CURRENT = 0x20; // yellow background -const uint8_t DCA_COMMENT = 0x40; // green foreground -const uint8_t DCA_VISITED = 0x80; // light blue background +constexpr u8 DCA_NORMAL = 0x00; // black on white +constexpr u8 DCA_CHANGED = 0x01; // red foreground +constexpr u8 DCA_SELECTED = 0x02; // light red background +constexpr u8 DCA_INVALID = 0x04; // dark blue foreground +constexpr u8 DCA_DISABLED = 0x08; // darker foreground +constexpr u8 DCA_ANCILLARY = 0x10; // grey background +constexpr u8 DCA_CURRENT = 0x20; // yellow background +constexpr u8 DCA_COMMENT = 0x40; // green foreground +constexpr u8 DCA_VISITED = 0x80; // light blue background // special characters that can be passed to process_char() -const int DCH_UP = 1; // up arrow -const int DCH_DOWN = 2; // down arrow -const int DCH_LEFT = 3; // left arrow -const int DCH_RIGHT = 4; // right arrow -const int DCH_PUP = 5; // page up -const int DCH_PDOWN = 6; // page down -const int DCH_HOME = 7; // home -const int DCH_CTRLHOME = 8; // ctrl+home -const int DCH_END = 9; // end -const int DCH_CTRLEND = 10; // ctrl+end -const int DCH_CTRLRIGHT = 11; // ctrl+right -const int DCH_CTRLLEFT = 12; // ctrl+left +constexpr int DCH_UP = 1; // up arrow +constexpr int DCH_DOWN = 2; // down arrow +constexpr int DCH_LEFT = 3; // left arrow +constexpr int DCH_RIGHT = 4; // right arrow +constexpr int DCH_PUP = 5; // page up +constexpr int DCH_PDOWN = 6; // page down +constexpr int DCH_HOME = 7; // home +constexpr int DCH_CTRLHOME = 8; // ctrl+home +constexpr int DCH_END = 9; // end +constexpr int DCH_CTRLEND = 10; // ctrl+end +constexpr int DCH_CTRLRIGHT = 11; // ctrl+right +constexpr int DCH_CTRLLEFT = 12; // ctrl+left // special characters that can be passed to process_click() -const int DCK_LEFT_CLICK = 1; // left instantaneous click -const int DCK_RIGHT_CLICK = 2; // right instantaneous click -const int DCK_MIDDLE_CLICK = 3; // middle instantaneous click +constexpr int DCK_LEFT_CLICK = 1; // left instantaneous click +constexpr int DCK_RIGHT_CLICK = 2; // right instantaneous click +constexpr int DCK_MIDDLE_CLICK = 3; // middle instantaneous click //************************************************************************** @@ -90,8 +90,8 @@ typedef void (*debug_view_osd_update_func)(debug_view &view, void *osdprivate); // a single "character" in the debug view has an ASCII value and an attribute byte struct debug_view_char { - uint8_t byte; - uint8_t attrib; + u8 byte; + u8 attrib; }; @@ -101,8 +101,8 @@ class debug_view_xy public: debug_view_xy(int _x = 0, int _y = 0) : x(_x), y(_y) { } - int32_t x; - int32_t y; + s32 x; + s32 y; }; @@ -208,7 +208,7 @@ protected: // update info bool m_recompute; // does this view require a recomputation? - uint8_t m_update_level; // update level; updates when this hits 0 + u8 m_update_level; // update level; updates when this hits 0 bool m_update_pending; // true if there is a pending update bool m_osd_update_pending; // true if there is a pending update std::vector m_viewdata; // current array of view data @@ -259,8 +259,8 @@ public: // getters running_machine &machine() const { return m_machine; } bool dirty() const { return m_dirty; } - uint64_t last_value() const { return m_result; } - uint64_t value() { recompute(); return m_result; } + u64 last_value() const { return m_result; } + u64 value() { recompute(); return m_result; } const char *string() const { return m_string.c_str(); } symbol_table *context() const { return m_parsed.symbols(); } @@ -276,10 +276,10 @@ private: // internal state running_machine & m_machine; // reference to the machine bool m_dirty; // true if the expression needs to be re-evaluated - uint64_t m_result; // last result from the expression + u64 m_result; // last result from the expression parsed_expression m_parsed; // parsed expression data std::string m_string; // copy of the expression string }; -#endif +#endif // MAME_EMU_DEBUG_DEBUGVIEW_H diff --git a/src/emu/debug/dvbpoints.cpp b/src/emu/debug/dvbpoints.cpp index d7cd9527913..6bc4a008c5f 100644 --- a/src/emu/debug/dvbpoints.cpp +++ b/src/emu/debug/dvbpoints.cpp @@ -266,7 +266,7 @@ void debug_view_breakpoints::view_update() pad_ostream_to_length(linebuf, tableBreaks[5]); auto const &text(linebuf.vec()); - for (uint32_t i = m_topleft.x; i < (m_topleft.x + m_visible.x); i++, dest++) + for (u32 i = m_topleft.x; i < (m_topleft.x + m_visible.x); i++, dest++) { dest->byte = (i < text.size()) ? text[i] : ' '; dest->attrib = DCA_ANCILLARY; @@ -298,7 +298,7 @@ void debug_view_breakpoints::view_update() pad_ostream_to_length(linebuf, tableBreaks[5]); auto const &text(linebuf.vec()); - for (uint32_t i = m_topleft.x; i < (m_topleft.x + m_visible.x); i++, dest++) + for (u32 i = m_topleft.x; i < (m_topleft.x + m_visible.x); i++, dest++) { dest->byte = (i < text.size()) ? text[i] : ' '; dest->attrib = DCA_NORMAL; @@ -311,7 +311,7 @@ void debug_view_breakpoints::view_update() else { // Fill the remaining vertical space - for (uint32_t i = m_topleft.x; i < (m_topleft.x + m_visible.x); i++, dest++) + for (u32 i = m_topleft.x; i < (m_topleft.x + m_visible.x); i++, dest++) { dest->byte = ' '; dest->attrib = DCA_NORMAL; diff --git a/src/emu/debug/dvbpoints.h b/src/emu/debug/dvbpoints.h index 7e52e7d4cae..b7037e06b0f 100644 --- a/src/emu/debug/dvbpoints.h +++ b/src/emu/debug/dvbpoints.h @@ -8,8 +8,8 @@ ***************************************************************************/ -#ifndef __DVBPOINTS_H__ -#define __DVBPOINTS_H__ +#ifndef MAME_EMU_DEBUG_DVBPOINTS_H +#define MAME_EMU_DEBUG_DVBPOINTS_H #include "debugvw.h" #include "debugcpu.h" @@ -52,4 +52,4 @@ private: }; -#endif +#endif // MAME_EMU_DEBUG_DVBPOINTS_H diff --git a/src/emu/debug/dvdisasm.cpp b/src/emu/debug/dvdisasm.cpp index 3dab8d13dd3..b36f1255a48 100644 --- a/src/emu/debug/dvdisasm.cpp +++ b/src/emu/debug/dvdisasm.cpp @@ -133,8 +133,8 @@ void debug_view_disasm::view_notify(debug_view_notification type) void debug_view_disasm::view_char(int chval) { debug_view_xy origcursor = m_cursor; - uint8_t end_buffer = 3; - int32_t temp; + u8 end_buffer = 3; + s32 temp; switch (chval) { @@ -250,7 +250,7 @@ offs_t debug_view_disasm::find_pc_backwards(offs_t targetpc, int numinstrs) { // fill the buffer up to the target offs_t curpcbyte = source.m_space.address_to_byte(curpc) & source.m_space.logbytemask(); - uint8_t opbuf[1024], argbuf[1024]; + u8 opbuf[1024], argbuf[1024]; while (curpcbyte < fillpcbyte) { fillpcbyte--; @@ -397,7 +397,7 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines) offs_t physpcbyte = pcbyte; if (source.m_space.device().memory().translate(source.m_space.spacenum(), TRANSLATE_FETCH_DEBUG, physpcbyte)) { - uint8_t opbuf[64], argbuf[64]; + u8 opbuf[64], argbuf[64]; // fetch the bytes up to the maximum for (numbytes = 0; numbytes < maxbytes; numbytes++) @@ -466,14 +466,14 @@ void debug_view_disasm::view_update() m_recompute = true; // if we're tracking a value, make sure it is visible - uint64_t previous = m_expression.last_value(); - uint64_t result = m_expression.value(); + u64 previous = m_expression.last_value(); + u64 result = m_expression.value(); if (result != previous) { offs_t resultbyte = source.m_space.address_to_byte(result) & source.m_space.logbytemask(); // see if the new result is an address we already have - uint32_t row; + u32 row; for (row = 0; row < m_byteaddress.size(); row++) if (m_byteaddress[row] == resultbyte) break; @@ -512,7 +512,7 @@ recompute: else { // determine the addresses of what we will display - offs_t backpc = find_pc_backwards((uint32_t)m_expression.value(), m_backwards_steps); + offs_t backpc = find_pc_backwards(u32(m_expression.value()), m_backwards_steps); // put ourselves back in the top left m_topleft.y = 0; @@ -527,9 +527,9 @@ recompute: if (pcbyte != m_last_pcbyte) { // find the row with the PC on it - for (uint32_t row = 0; row < m_visible.y; row++) + for (u32 row = 0; row < m_visible.y; row++) { - uint32_t effrow = m_topleft.y + row; + u32 effrow = m_topleft.y + row; if (effrow >= m_byteaddress.size()) break; if (pcbyte == m_byteaddress[effrow]) @@ -552,13 +552,13 @@ recompute: // loop over visible rows debug_view_char *dest = &m_viewdata[0]; - for (uint32_t row = 0; row < m_visible.y; row++) + for (u32 row = 0; row < m_visible.y; row++) { - uint32_t effrow = m_topleft.y + row; - uint32_t col = 0; + u32 effrow = m_topleft.y + row; + u32 col = 0; // if this visible row is valid, add it to the buffer - uint8_t attrib = DCA_NORMAL; + u8 attrib = DCA_NORMAL; if (effrow < m_byteaddress.size()) { // if we're on the line with the PC, recompute and hilight it @@ -583,10 +583,10 @@ recompute: // get the effective string const char *data = &m_dasm.vec()[effrow * m_total.x]; - uint32_t len = (uint32_t)strlen(data); + u32 len = u32(strlen(data)); // copy data - uint32_t effcol = m_topleft.x; + u32 effcol = m_topleft.x; while (col < m_visible.x && effcol < len) { dest->byte = data[effcol++]; @@ -658,7 +658,7 @@ void debug_view_disasm::set_right_column(disasm_right_column contents) // instructions displayed before the home address //------------------------------------------------- -void debug_view_disasm::set_backward_steps(uint32_t steps) +void debug_view_disasm::set_backward_steps(u32 steps) { begin_update(); m_backwards_steps = steps; @@ -672,7 +672,7 @@ void debug_view_disasm::set_backward_steps(uint32_t steps) // of the main disassembly section //------------------------------------------------- -void debug_view_disasm::set_disasm_width(uint32_t width) +void debug_view_disasm::set_disasm_width(u32 width) { begin_update(); m_dasm_width = width; diff --git a/src/emu/debug/dvdisasm.h b/src/emu/debug/dvdisasm.h index 32a4e70eba5..ef8ad581f70 100644 --- a/src/emu/debug/dvdisasm.h +++ b/src/emu/debug/dvdisasm.h @@ -8,8 +8,8 @@ ***************************************************************************/ -#ifndef __DVDISASM_H__ -#define __DVDISASM_H__ +#ifndef MAME_EMU_DEBUG_DVDISASM_H +#define MAME_EMU_DEBUG_DVDISASM_H #include "debugvw.h" @@ -69,15 +69,15 @@ public: // getters const char *expression() const { return m_expression.string(); } disasm_right_column right_column() const { return m_right_column; } - uint32_t backward_steps() const { return m_backwards_steps; } - uint32_t disasm_width() const { return m_dasm_width; } + u32 backward_steps() const { return m_backwards_steps; } + u32 disasm_width() const { return m_dasm_width; } offs_t selected_address(); // setters void set_expression(const char *expression); void set_right_column(disasm_right_column contents); - void set_backward_steps(uint32_t steps); - void set_disasm_width(uint32_t width); + void set_backward_steps(u32 steps); + void set_disasm_width(u32 width); void set_selected_address(offs_t address); protected: @@ -96,11 +96,11 @@ private: // internal state disasm_right_column m_right_column; // right column contents - uint32_t m_backwards_steps; // number of backwards steps - uint32_t m_dasm_width; // width of the disassembly area - uint8_t * m_last_direct_raw; // last direct raw value - uint8_t * m_last_direct_decrypted;// last direct decrypted value - uint32_t m_last_change_count; // last comment change count + u32 m_backwards_steps; // number of backwards steps + u32 m_dasm_width; // width of the disassembly area + u8 * m_last_direct_raw; // last direct raw value + u8 * m_last_direct_decrypted;// last direct decrypted value + u32 m_last_change_count; // last comment change count offs_t m_last_pcbyte; // last PC byte value int m_divider1, m_divider2; // left and right divider columns int m_divider3; // comment divider column @@ -115,4 +115,4 @@ private: }; -#endif +#endif // MAME_EMU_DEBUG_DVDISASM_H diff --git a/src/emu/debug/dvmemory.cpp b/src/emu/debug/dvmemory.cpp index 5b828c989bb..ca73f1ac986 100644 --- a/src/emu/debug/dvmemory.cpp +++ b/src/emu/debug/dvmemory.cpp @@ -67,7 +67,7 @@ debug_view_memory_source::debug_view_memory_source(const char *name, memory_regi m_length(region.bytes()), m_offsetxor(ENDIAN_VALUE_NE_NNE(region.endianness(), 0, region.bytewidth() - 1)), m_endianness(region.endianness()), - m_prefsize(std::min(region.bytewidth(), 8)) + m_prefsize(std::min(region.bytewidth(), 8)) { } @@ -156,7 +156,7 @@ void debug_view_memory::enumerate_sources() for (int itemnum = 0; itemnum < 10000; itemnum++) { // stop when we run out of items - uint32_t valsize, valcount; + u32 valsize, valcount; void *base; const char *itemname = machine().save().indexed_item(itemnum, base, valsize, valcount); if (itemname == nullptr) @@ -206,15 +206,15 @@ void debug_view_memory::view_notify(debug_view_notification type) //------------------------------------------------- -// uint32_to_float - return a floating point number +// u32_to_float - return a floating point number // whose 32 bit representation is value //------------------------------------------------- -static inline float uint32_to_float(uint32_t value) +static inline float u32_to_float(u32 value) { union { float f; - uint32_t i; + u32 i; } v; v.i = value; @@ -222,15 +222,15 @@ static inline float uint32_to_float(uint32_t value) } //------------------------------------------------- -// uint64_to_double - return a floating point number +// u64_to_double - return a floating point number // whose 64 bit representation is value //------------------------------------------------- -static inline float uint64_to_double(uint64_t value) +static inline float u64_to_double(u64 value) { union { double f; - uint64_t i; + u64 i; } v; v.i = value; @@ -254,18 +254,18 @@ void debug_view_memory::view_update() const memory_view_pos &posdata = s_memory_pos_table[m_data_format]; // loop over visible rows - for (uint32_t row = 0; row < m_visible.y; row++) + for (u32 row = 0; row < m_visible.y; row++) { debug_view_char *destmin = &m_viewdata[row * m_visible.x]; debug_view_char *destmax = destmin + m_visible.x; debug_view_char *destrow = destmin - m_topleft.x; - uint32_t effrow = m_topleft.y + row; + u32 effrow = m_topleft.y + row; // reset the line of data; section 1 is normal, others are ancillary, cursor is selected debug_view_char *dest = destmin; for (int ch = 0; ch < m_visible.x; ch++, dest++) { - uint32_t effcol = m_topleft.x + ch; + u32 effcol = m_topleft.x + ch; dest->byte = ' '; dest->attrib = DCA_ANCILLARY; if (m_section[1].contains(effcol)) @@ -297,13 +297,13 @@ void debug_view_memory::view_update() int spacing = posdata.m_spacing; if (m_data_format <= 8) { - uint64_t chunkdata; + u64 chunkdata; bool ismapped = read(m_bytes_per_chunk, addrbyte + chunknum * m_bytes_per_chunk, chunkdata); dest = destrow + m_section[1].m_pos + 1 + chunkindex * spacing; for (int ch = 0; ch < posdata.m_spacing; ch++, dest++) if (dest >= destmin && dest < destmax) { - uint8_t shift = posdata.m_shift[ch]; + u8 shift = posdata.m_shift[ch]; if (shift < 64) dest->byte = ismapped ? "0123456789ABCDEF"[(chunkdata >> shift) & 0x0f] : '*'; } @@ -311,7 +311,7 @@ void debug_view_memory::view_update() else { int ch; char valuetext[64]; - uint64_t chunkdata = 0; + u64 chunkdata = 0; floatx80 chunkdata80 = { 0, 0 }; bool ismapped; @@ -324,14 +324,14 @@ void debug_view_memory::view_update() switch (m_data_format) { case 9: - sprintf(valuetext, "%.8g", uint32_to_float((uint32_t)chunkdata)); + sprintf(valuetext, "%.8g", u32_to_float(u32(chunkdata))); break; case 10: - sprintf(valuetext, "%.24g", uint64_to_double(chunkdata)); + sprintf(valuetext, "%.24g", u64_to_double(chunkdata)); break; case 11: float64 f64 = floatx80_to_float64(chunkdata80); - sprintf(valuetext, "%.24g", uint64_to_double(f64)); + sprintf(valuetext, "%.24g", u64_to_double(f64)); break; } else { @@ -357,7 +357,7 @@ void debug_view_memory::view_update() for (int ch = 0; ch < m_bytes_per_row; ch++, dest++) if (dest >= destmin && dest < destmax) { - uint64_t chval; + u64 chval; bool ismapped = read(1, addrbyte + ch, chval); dest->byte = (ismapped && isprint(chval)) ? chval : '.'; } @@ -395,7 +395,7 @@ void debug_view_memory::view_char(int chval) break; case DCH_PUP: - for (uint32_t delta = (m_visible.y - 2) * m_bytes_per_row; delta > 0; delta -= m_bytes_per_row) + for (u32 delta = (m_visible.y - 2) * m_bytes_per_row; delta > 0; delta -= m_bytes_per_row) if (pos.m_address >= m_byte_offset + delta) { pos.m_address -= delta; @@ -404,7 +404,7 @@ void debug_view_memory::view_char(int chval) break; case DCH_PDOWN: - for (uint32_t delta = (m_visible.y - 2) * m_bytes_per_row; delta > 0; delta -= m_bytes_per_row) + for (u32 delta = (m_visible.y - 2) * m_bytes_per_row; delta > 0; delta -= m_bytes_per_row) if (pos.m_address <= m_maxaddr - delta) { pos.m_address += delta; @@ -449,13 +449,13 @@ void debug_view_memory::view_char(int chval) if (hexchar == nullptr) break; - uint64_t data; + u64 data; bool ismapped = read(m_bytes_per_chunk, pos.m_address, data); if (!ismapped) break; - data &= ~((uint64_t)0x0f << pos.m_shift); - data |= (uint64_t)(hexchar - hexvals) << pos.m_shift; + data &= ~(u64(0x0f) << pos.m_shift); + data |= u64(hexchar - hexvals) << pos.m_shift; write(m_bytes_per_chunk, pos.m_address, data); // fall through to the right-arrow press } @@ -549,7 +549,7 @@ void debug_view_memory::recompute() // if we are viewing a space with a minimum chunk size, clamp the bytes per chunk if (source.m_space != nullptr && source.m_space->byte_to_address(1) > 1) { - uint32_t min_bytes_per_chunk = source.m_space->byte_to_address(1); + u32 min_bytes_per_chunk = source.m_space->byte_to_address(1); while (m_bytes_per_chunk < min_bytes_per_chunk) { m_bytes_per_chunk *= 2; @@ -590,7 +590,7 @@ void debug_view_memory::recompute() } // derive total sizes from that - m_total.y = ((uint64_t)m_maxaddr - (uint64_t)m_byte_offset + (uint64_t)m_bytes_per_row /*- 1*/) / m_bytes_per_row; + m_total.y = (u64(m_maxaddr) - u64(m_byte_offset) + u64(m_bytes_per_row) /*- 1*/) / m_bytes_per_row; // reset the current cursor position set_cursor_pos(pos); @@ -732,7 +732,7 @@ void debug_view_memory::set_cursor_pos(cursor_pos pos) // read - generic memory view data reader //------------------------------------------------- -bool debug_view_memory::read(uint8_t size, offs_t offs, uint64_t &data) +bool debug_view_memory::read(u8 size, offs_t offs, u64 &data) { const debug_view_memory_source &source = downcast(*m_source); @@ -742,7 +742,7 @@ bool debug_view_memory::read(uint8_t size, offs_t offs, uint64_t &data) offs_t dummyaddr = offs; bool ismapped = m_no_translation ? true : source.m_memintf->translate(source.m_space->spacenum(), TRANSLATE_READ_DEBUG, dummyaddr); - data = ~(uint64_t)0; + data = ~u64(0); if (ismapped) { switch (size) @@ -761,7 +761,7 @@ bool debug_view_memory::read(uint8_t size, offs_t offs, uint64_t &data) { size /= 2; - uint64_t data0, data1; + u64 data0, data1; bool ismapped = read(size, offs + 0 * size, data0); ismapped |= read(size, offs + 1 * size, data1); @@ -776,7 +776,7 @@ bool debug_view_memory::read(uint8_t size, offs_t offs, uint64_t &data) offs ^= source.m_offsetxor; if (offs >= source.m_length) return false; - data = *((uint8_t *)source.m_base + offs); + data = *((u8 *)source.m_base + offs); return true; } @@ -785,9 +785,9 @@ bool debug_view_memory::read(uint8_t size, offs_t offs, uint64_t &data) // read - read a 80 bit value //------------------------------------------------- -bool debug_view_memory::read(uint8_t size, offs_t offs, floatx80 &data) +bool debug_view_memory::read(u8 size, offs_t offs, floatx80 &data) { - uint64_t t; + u64 t; bool mappedhi, mappedlo; const debug_view_memory_source &source = downcast(*m_source); @@ -810,7 +810,7 @@ bool debug_view_memory::read(uint8_t size, offs_t offs, floatx80 &data) // write - generic memory view data writer //------------------------------------------------- -void debug_view_memory::write(uint8_t size, offs_t offs, uint64_t data) +void debug_view_memory::write(u8 size, offs_t offs, u64 data) { const debug_view_memory_source &source = downcast(*m_source); @@ -848,7 +848,7 @@ void debug_view_memory::write(uint8_t size, offs_t offs, uint64_t data) offs ^= source.m_offsetxor; if (offs >= source.m_length) return; - *((uint8_t *)source.m_base + offs) = data; + *((u8 *)source.m_base + offs) = data; // hack for FD1094 editing #ifdef FD1094_HACK @@ -880,7 +880,7 @@ void debug_view_memory::set_expression(const char *expression) // chunks displayed across a row //------------------------------------------------- -void debug_view_memory::set_chunks_per_row(uint32_t rowchunks) +void debug_view_memory::set_chunks_per_row(u32 rowchunks) { if (rowchunks < 1) return; diff --git a/src/emu/debug/dvmemory.h b/src/emu/debug/dvmemory.h index 695ba5909b0..ca659b64bda 100644 --- a/src/emu/debug/dvmemory.h +++ b/src/emu/debug/dvmemory.h @@ -8,8 +8,8 @@ ***************************************************************************/ -#ifndef __DVMEMORY_H__ -#define __DVMEMORY_H__ +#ifndef MAME_EMU_DEBUG_DVMEMORY_H +#define MAME_EMU_DEBUG_DVMEMORY_H #include "softfloat/mamesf.h" #include "softfloat/softfloat.h" @@ -37,7 +37,7 @@ private: offs_t m_length; // length of memory offs_t m_offsetxor; // XOR to apply to offsets endianness_t m_endianness; // endianness of memory - uint8_t m_prefsize; // preferred bytes per chunk + u8 m_prefsize; // preferred bytes per chunk }; @@ -54,7 +54,7 @@ public: // getters const char *expression() const { return m_expression.string(); } int get_data_format() { flush_updates(); return m_data_format; } - uint32_t chunks_per_row() { flush_updates(); return m_chunks_per_row; } + u32 chunks_per_row() { flush_updates(); return m_chunks_per_row; } bool reverse() const { return m_reverse_view; } bool ascii() const { return m_ascii_view; } bool physical() const { return m_no_translation; } @@ -62,7 +62,7 @@ public: // setters void set_expression(const char *expression); - void set_chunks_per_row(uint32_t rowchunks); + void set_chunks_per_row(u32 rowchunks); void set_data_format(int format); // 1-8 current values 9 32bit floating point void set_reverse(bool reverse); void set_ascii(bool reverse); @@ -78,9 +78,9 @@ protected: private: struct cursor_pos { - cursor_pos(offs_t address = 0, uint8_t shift = 0) : m_address(address), m_shift(shift) { } + cursor_pos(offs_t address = 0, u8 shift = 0) : m_address(address), m_shift(shift) { } offs_t m_address; - uint8_t m_shift; + u8 m_shift; }; // internal helpers @@ -95,36 +95,36 @@ private: void end_update_and_set_cursor_pos(cursor_pos pos) { set_cursor_pos(pos); end_update(); } // memory access - bool read(uint8_t size, offs_t offs, uint64_t &data); - void write(uint8_t size, offs_t offs, uint64_t data); - bool read(uint8_t size, offs_t offs, floatx80 &data); + bool read(u8 size, offs_t offs, u64 &data); + void write(u8 size, offs_t offs, u64 data); + bool read(u8 size, offs_t offs, floatx80 &data); // internal state debug_view_expression m_expression; // expression describing the start address - uint32_t m_chunks_per_row; // number of chunks displayed per line - uint8_t m_bytes_per_chunk; // bytes per chunk + u32 m_chunks_per_row; // number of chunks displayed per line + u8 m_bytes_per_chunk; // bytes per chunk int m_data_format; // 1-8 current values 9 32bit floating point bool m_reverse_view; // reverse-endian view? bool m_ascii_view; // display ASCII characters? bool m_no_translation; // don't run addresses through the cpu translation hook bool m_edit_enabled; // can modify contents ? offs_t m_maxaddr; // (derived) maximum address to display - uint32_t m_bytes_per_row; // (derived) number of bytes displayed per line - uint32_t m_byte_offset; // (derived) offset of starting visible byte + u32 m_bytes_per_row; // (derived) number of bytes displayed per line + u32 m_byte_offset; // (derived) offset of starting visible byte std::string m_addrformat; // (derived) format string to use to print addresses struct section { bool contains(int x) const { return x >= m_pos && x < m_pos + m_width; } - int32_t m_pos; /* starting position */ - int32_t m_width; /* width of this section */ + s32 m_pos; /* starting position */ + s32 m_width; /* width of this section */ }; section m_section[3]; // (derived) 3 sections to manage struct memory_view_pos { - uint8_t m_spacing; /* spacing between each entry */ - uint8_t m_shift[24]; /* shift for each character */ + u8 m_spacing; /* spacing between each entry */ + u8 m_shift[24]; /* shift for each character */ }; static const memory_view_pos s_memory_pos_table[12]; // table for rendering at different data formats @@ -133,4 +133,4 @@ private: }; -#endif +#endif // MAME_EMU_DEBUG_DVMEMORY_H diff --git a/src/emu/debug/dvstate.cpp b/src/emu/debug/dvstate.cpp index fe3ea7d8082..a7a2215bd9e 100644 --- a/src/emu/debug/dvstate.cpp +++ b/src/emu/debug/dvstate.cpp @@ -142,7 +142,7 @@ void debug_view_state::recompute() // count the entries and determine the maximum tag and value sizes std::size_t count = 0; std::size_t maxtaglen = 0; - uint8_t maxvallen = 0; + u8 maxvallen = 0; for (auto const &item : m_state_list) { count++; @@ -152,8 +152,8 @@ void debug_view_state::recompute() // set the current divider and total cols m_divider = unsigned(1U + maxtaglen + 1U); - m_total.x = uint32_t(1U + maxtaglen + 2U + maxvallen + 1U); - m_total.y = uint32_t(count); + m_total.x = u32(1U + maxtaglen + 2U + maxvallen + 1U); + m_total.y = u32(count); m_topleft.x = 0; m_topleft.y = 0; @@ -187,17 +187,17 @@ void debug_view_state::view_update() // get cycle count if we have an execute interface debug_view_state_source const &source(downcast(*m_source)); - uint64_t const total_cycles(source.m_execintf ? source.m_execintf->total_cycles() : 0); + u64 const total_cycles(source.m_execintf ? source.m_execintf->total_cycles() : 0); bool const cycles_changed(m_last_update != total_cycles); // loop over rows auto it(m_state_list.begin()); screen_device const *const screen(machine().first_screen()); debug_view_char *dest(&m_viewdata[0]); - for (int32_t index = 0, limit = m_topleft.y + m_visible.y; (index < limit) || (it != m_state_list.end()); ++index) + for (s32 index = 0, limit = m_topleft.y + m_visible.y; (index < limit) || (it != m_state_list.end()); ++index) { bool const visible((index >= m_topleft.y) && (index < limit)); - uint32_t col(0); + u32 col(0); if (it != m_state_list.end()) { @@ -254,11 +254,11 @@ void debug_view_state::view_update() if (visible) { // see if we changed - const uint8_t attrib(curitem.changed() ? DCA_CHANGED: DCA_NORMAL); + const u8 attrib(curitem.changed() ? DCA_CHANGED: DCA_NORMAL); // build up a string char temp[256]; - uint32_t len(0); + u32 len(0); if (curitem.m_symbol.length() < (m_divider - 1)) { memset(&temp[len], ' ', m_divider - 1 - curitem.m_symbol.length()); @@ -278,7 +278,7 @@ void debug_view_state::view_update() temp[len] = 0; // copy data - for (uint32_t effcol = m_topleft.x; (col < m_visible.x) && (effcol < len); ++dest, ++col) + for (u32 effcol = m_topleft.x; (col < m_visible.x) && (effcol < len); ++dest, ++col) { dest->byte = temp[effcol++]; dest->attrib = attrib | ((effcol <= m_divider) ? DCA_ANCILLARY : DCA_NORMAL); @@ -305,7 +305,7 @@ void debug_view_state::view_update() // state_item - constructor //------------------------------------------------- -debug_view_state::state_item::state_item(int index, const char *name, uint8_t valuechars) +debug_view_state::state_item::state_item(int index, const char *name, u8 valuechars) : m_lastval(0) , m_currval(0) , m_index(index) @@ -319,7 +319,7 @@ debug_view_state::state_item::state_item(int index, const char *name, uint8_t va // update - update value and save previous //------------------------------------------------- -void debug_view_state::state_item::update(uint64_t newval, bool save) +void debug_view_state::state_item::update(u64 newval, bool save) { if (save) m_lastval = m_currval; diff --git a/src/emu/debug/dvstate.h b/src/emu/debug/dvstate.h index ffc24d6ba57..402ed09ec23 100644 --- a/src/emu/debug/dvstate.h +++ b/src/emu/debug/dvstate.h @@ -53,24 +53,24 @@ private: class state_item { public: - state_item(int index, const char *name, uint8_t valuechars); + state_item(int index, const char *name, u8 valuechars); state_item(const state_item &) = default; state_item(state_item &&) = default; state_item &operator=(const state_item &) = default; state_item &operator=(state_item &&) = default; - uint64_t value() const { return m_currval; } + u64 value() const { return m_currval; } bool changed() const { return m_lastval != m_currval; } int index() const { return m_index; } - uint8_t value_length() const { return m_vallen; } + u8 value_length() const { return m_vallen; } - void update(uint64_t newval, bool save); + void update(u64 newval, bool save); private: - uint64_t m_lastval; // last value - uint64_t m_currval; // current value + u64 m_lastval; // last value + u64 m_currval; // current value int m_index; // index - uint8_t m_vallen; // number of value chars + u8 m_vallen; // number of value chars public: std::string m_symbol; // symbol @@ -83,15 +83,15 @@ private: // internal state int m_divider; // dividing column - uint64_t m_last_update; // execution counter at last update + u64 m_last_update; // execution counter at last update std::vector m_state_list; // state data // constants - static const int REG_DIVIDER = -10; - static const int REG_CYCLES = -11; - static const int REG_BEAMX = -12; - static const int REG_BEAMY = -13; - static const int REG_FRAME = -14; + static constexpr int REG_DIVIDER = -10; + static constexpr int REG_CYCLES = -11; + static constexpr int REG_BEAMX = -12; + static constexpr int REG_BEAMY = -13; + static constexpr int REG_FRAME = -14; }; diff --git a/src/emu/debug/dvtext.cpp b/src/emu/debug/dvtext.cpp index 3a86e0eb877..e4672b81974 100644 --- a/src/emu/debug/dvtext.cpp +++ b/src/emu/debug/dvtext.cpp @@ -53,7 +53,7 @@ void debug_view_textbuf::view_update() m_total.x = 80; // determine the starting sequence number - uint32_t curseq = 0; + u32 curseq = 0; if (!m_at_bottom) { curseq = m_topseq; @@ -72,16 +72,16 @@ void debug_view_textbuf::view_update() // loop over visible rows debug_view_char *dest = &m_viewdata[0]; - for (uint32_t row = 0; row < m_visible.y; row++) + for (u32 row = 0; row < m_visible.y; row++) { const char *line = text_buffer_get_seqnum_line(&m_textbuf, curseq++); - uint32_t col = 0; + u32 col = 0; // if this visible row is valid, add it to the buffer if (line != nullptr) { size_t len = strlen(line); - uint32_t effcol = m_topleft.x; + u32 effcol = m_topleft.x; // copy data while (col < m_visible.x && effcol < len) diff --git a/src/emu/debug/dvtext.h b/src/emu/debug/dvtext.h index 7a0efbb9a61..01bd4ee5706 100644 --- a/src/emu/debug/dvtext.h +++ b/src/emu/debug/dvtext.h @@ -8,8 +8,8 @@ ***************************************************************************/ -#ifndef __DVTEXT_H__ -#define __DVTEXT_H__ +#ifndef MAME_EMU_DEBUG_DVTEXT_H +#define MAME_EMU_DEBUG_DVTEXT_H #include "debugvw.h" #include "textbuf.h" @@ -37,8 +37,8 @@ protected: private: // internal state text_buffer & m_textbuf; /* pointer to the text buffer */ - bool m_at_bottom; /* are we tracking new stuff being added? */ - uint32_t m_topseq; /* sequence number of the top line */ + bool m_at_bottom; /* are we tracking new stuff being added? */ + u32 m_topseq; /* sequence number of the top line */ }; @@ -58,4 +58,4 @@ class debug_view_log : public debug_view_textbuf }; -#endif +#endif // MAME_EMU_DEBUG_DVTEXT_H diff --git a/src/emu/debug/dvwpoints.cpp b/src/emu/debug/dvwpoints.cpp index 68f7d9d5389..d3eb7a00de7 100644 --- a/src/emu/debug/dvwpoints.cpp +++ b/src/emu/debug/dvwpoints.cpp @@ -300,7 +300,7 @@ void debug_view_watchpoints::view_update() pad_ostream_to_length(linebuf, tableBreaks[7]); auto const &text(linebuf.vec()); - for (uint32_t i = m_topleft.x; i < (m_topleft.x + m_visible.x); i++, dest++) + for (u32 i = m_topleft.x; i < (m_topleft.x + m_visible.x); i++, dest++) { dest->byte = (i < text.size()) ? text[i] : ' '; dest->attrib = DCA_ANCILLARY; @@ -339,7 +339,7 @@ void debug_view_watchpoints::view_update() pad_ostream_to_length(linebuf, tableBreaks[7]); auto const &text(linebuf.vec()); - for (uint32_t i = m_topleft.x; i < (m_topleft.x + m_visible.x); i++, dest++) + for (u32 i = m_topleft.x; i < (m_topleft.x + m_visible.x); i++, dest++) { dest->byte = (i < text.size()) ? text[i] : ' '; dest->attrib = DCA_NORMAL; diff --git a/src/emu/debug/express.cpp b/src/emu/debug/express.cpp index 7c3cc74b3d0..ebc7765ef31 100644 --- a/src/emu/debug/express.cpp +++ b/src/emu/debug/express.cpp @@ -112,24 +112,24 @@ class integer_symbol_entry : public symbol_entry { public: // construction/destruction - integer_symbol_entry(symbol_table &table, const char *name, symbol_table::read_write rw, uint64_t *ptr = nullptr); - integer_symbol_entry(symbol_table &table, const char *name, uint64_t constval); + integer_symbol_entry(symbol_table &table, const char *name, symbol_table::read_write rw, u64 *ptr = nullptr); + integer_symbol_entry(symbol_table &table, const char *name, u64 constval); integer_symbol_entry(symbol_table &table, const char *name, void *ref, symbol_table::getter_func getter, symbol_table::setter_func setter); // symbol access virtual bool is_lval() const override; - virtual uint64_t value() const override; - virtual void set_value(uint64_t newvalue) override; + virtual u64 value() const override; + virtual void set_value(u64 newvalue) override; private: // internal helpers - static uint64_t internal_getter(symbol_table &table, void *symref); - static void internal_setter(symbol_table &table, void *symref, uint64_t value); + static u64 internal_getter(symbol_table &table, void *symref); + static void internal_setter(symbol_table &table, void *symref, u64 value); // internal state symbol_table::getter_func m_getter; symbol_table::setter_func m_setter; - uint64_t m_value; + u64 m_value; }; @@ -142,16 +142,16 @@ public: // symbol access virtual bool is_lval() const override; - virtual uint64_t value() const override; - virtual void set_value(uint64_t newvalue) override; + virtual u64 value() const override; + virtual void set_value(u64 newvalue) override; // execution helper - virtual uint64_t execute(int numparams, const uint64_t *paramlist); + virtual u64 execute(int numparams, const u64 *paramlist); private: // internal state - uint16_t m_minparams; - uint16_t m_maxparams; + u16 m_minparams; + u16 m_maxparams; symbol_table::execute_func m_execute; }; @@ -231,7 +231,7 @@ symbol_entry::~symbol_entry() // integer_symbol_entry - constructor //------------------------------------------------- -integer_symbol_entry::integer_symbol_entry(symbol_table &table, const char *name, symbol_table::read_write rw, uint64_t *ptr) +integer_symbol_entry::integer_symbol_entry(symbol_table &table, const char *name, symbol_table::read_write rw, u64 *ptr) : symbol_entry(table, SMT_INTEGER, name, (ptr == nullptr) ? &m_value : ptr), m_getter(internal_getter), m_setter((rw == symbol_table::READ_ONLY) ? nullptr : internal_setter), @@ -240,7 +240,7 @@ integer_symbol_entry::integer_symbol_entry(symbol_table &table, const char *name } -integer_symbol_entry::integer_symbol_entry(symbol_table &table, const char *name, uint64_t constval) +integer_symbol_entry::integer_symbol_entry(symbol_table &table, const char *name, u64 constval) : symbol_entry(table, SMT_INTEGER, name, &m_value), m_getter(internal_getter), m_setter(nullptr), @@ -272,7 +272,7 @@ bool integer_symbol_entry::is_lval() const // value - return the value of this symbol //------------------------------------------------- -uint64_t integer_symbol_entry::value() const +u64 integer_symbol_entry::value() const { return m_getter(m_table, m_ref); } @@ -282,7 +282,7 @@ uint64_t integer_symbol_entry::value() const // set_value - set the value of this symbol //------------------------------------------------- -void integer_symbol_entry::set_value(uint64_t newvalue) +void integer_symbol_entry::set_value(u64 newvalue) { if (m_setter != nullptr) m_setter(m_table, m_ref, newvalue); @@ -296,9 +296,9 @@ void integer_symbol_entry::set_value(uint64_t newvalue) // returning the value of a variable //------------------------------------------------- -uint64_t integer_symbol_entry::internal_getter(symbol_table &table, void *symref) +u64 integer_symbol_entry::internal_getter(symbol_table &table, void *symref) { - return *(uint64_t *)symref; + return *(u64 *)symref; } @@ -307,9 +307,9 @@ uint64_t integer_symbol_entry::internal_getter(symbol_table &table, void *symref // the value of a variable //------------------------------------------------- -void integer_symbol_entry::internal_setter(symbol_table &table, void *symref, uint64_t value) +void integer_symbol_entry::internal_setter(symbol_table &table, void *symref, u64 value) { - *(uint64_t *)symref = value; + *(u64 *)symref = value; } @@ -345,7 +345,7 @@ bool function_symbol_entry::is_lval() const // value - return the value of this symbol //------------------------------------------------- -uint64_t function_symbol_entry::value() const +u64 function_symbol_entry::value() const { throw emu_fatalerror("Symbol '%s' is a function and cannot be used in this context", m_name.c_str()); } @@ -355,7 +355,7 @@ uint64_t function_symbol_entry::value() const // set_value - set the value of this symbol //------------------------------------------------- -void function_symbol_entry::set_value(uint64_t newvalue) +void function_symbol_entry::set_value(u64 newvalue) { throw emu_fatalerror("Symbol '%s' is a function and cannot be written", m_name.c_str()); } @@ -365,7 +365,7 @@ void function_symbol_entry::set_value(uint64_t newvalue) // execute - execute the function //------------------------------------------------- -uint64_t function_symbol_entry::execute(int numparams, const uint64_t *paramlist) +u64 function_symbol_entry::execute(int numparams, const u64 *paramlist) { if (numparams < m_minparams) throw emu_fatalerror("Function '%s' requires at least %d parameters", m_name.c_str(), m_minparams); @@ -396,7 +396,7 @@ symbol_table::symbol_table(void *globalref, symbol_table *parent) //------------------------------------------------- -// add - add a new uint64_t pointer symbol +// add - add a new u64 pointer symbol //------------------------------------------------- void symbol_table::configure_memory(void *param, valid_func valid, read_func read, write_func write) @@ -409,10 +409,10 @@ void symbol_table::configure_memory(void *param, valid_func valid, read_func rea //------------------------------------------------- -// add - add a new uint64_t pointer symbol +// add - add a new u64 pointer symbol //------------------------------------------------- -void symbol_table::add(const char *name, read_write rw, uint64_t *ptr) +void symbol_table::add(const char *name, read_write rw, u64 *ptr) { m_symlist.erase(name); m_symlist.emplace(name, std::make_unique(*this, name, rw, ptr)); @@ -423,7 +423,7 @@ void symbol_table::add(const char *name, read_write rw, uint64_t *ptr) // add - add a new value symbol //------------------------------------------------- -void symbol_table::add(const char *name, uint64_t value) +void symbol_table::add(const char *name, u64 value) { m_symlist.erase(name); m_symlist.emplace(name, std::make_unique(*this, name, value)); @@ -474,7 +474,7 @@ symbol_entry *symbol_table::find_deep(const char *symbol) // value - return the value of a symbol //------------------------------------------------- -uint64_t symbol_table::value(const char *symbol) +u64 symbol_table::value(const char *symbol) { symbol_entry *entry = find_deep(symbol); return (entry != nullptr) ? entry->value() : 0; @@ -485,7 +485,7 @@ uint64_t symbol_table::value(const char *symbol) // set_value - set the value of a symbol //------------------------------------------------- -void symbol_table::set_value(const char *symbol, uint64_t value) +void symbol_table::set_value(const char *symbol, u64 value) { symbol_entry *entry = find_deep(symbol); if (entry != nullptr) @@ -516,7 +516,7 @@ expression_error::error_code symbol_table::memory_valid(const char *name, expres // memory_value - return a value read from memory //------------------------------------------------- -uint64_t symbol_table::memory_value(const char *name, expression_space space, uint32_t offset, int size) +u64 symbol_table::memory_value(const char *name, expression_space space, u32 offset, int size) { // walk up the table hierarchy to find the owner for (symbol_table *symtable = this; symtable != nullptr; symtable = symtable->m_parent) @@ -535,7 +535,7 @@ uint64_t symbol_table::memory_value(const char *name, expression_space space, ui // set_memory_value - write a value to memory //------------------------------------------------- -void symbol_table::set_memory_value(const char *name, expression_space space, uint32_t offset, int size, uint64_t value) +void symbol_table::set_memory_value(const char *name, expression_space space, u32 offset, int size, u64 value) { // walk up the table hierarchy to find the owner for (symbol_table *symtable = this; symtable != nullptr; symtable = symtable->m_parent) @@ -558,7 +558,7 @@ void symbol_table::set_memory_value(const char *name, expression_space space, ui // parsed_expression - constructor //------------------------------------------------- -parsed_expression::parsed_expression(symbol_table *symtable, const char *expression, uint64_t *result) +parsed_expression::parsed_expression(symbol_table *symtable, const char *expression, u64 *result) : m_symtable(symtable), m_token_stack_ptr(0) { @@ -627,7 +627,7 @@ void parsed_expression::print_tokens(FILE *out) break; case parse_token::NUMBER: - fprintf(out, "NUMBER: %08X%08X\n", (uint32_t)(token->value.i >> 32), (uint32_t)token->value.i); + fprintf(out, "NUMBER: %08X%08X\n", (u32)(token->value.i >> 32), u32(token->value.i)); break; case parse_token::STRING: @@ -635,7 +635,7 @@ void parsed_expression::print_tokens(FILE *out) break; case parse_token::SYMBOL: - fprintf(out, "SYMBOL: %08X%08X\n", (uint32_t)(token->value.i >> 32), (uint32_t)token->value.i); + fprintf(out, "SYMBOL: %08X%08X\n", u32(token->value.i >> 32), u32(token->value.i)); break; case parse_token::OPERATOR: @@ -708,7 +708,7 @@ void parsed_expression::parse_string_into_tokens() while (string[0] != 0) { // ignore any whitespace - while (string[0] != 0 && isspace((uint8_t)string[0])) + while (string[0] != 0 && isspace(u8(string[0]))) string++; if (string[0] == 0) break; @@ -717,7 +717,7 @@ void parsed_expression::parse_string_into_tokens() parse_token &token = m_tokenlist.append(*global_alloc(parse_token(string - stringstart))); // switch off the first character - switch (tolower((uint8_t)string[0])) + switch (tolower(u8(string[0]))) { case '(': string += 1, token.configure_operator(TVL_LPAREN, 0); @@ -865,7 +865,7 @@ void parsed_expression::parse_symbol_or_number(parse_token &token, const char *& while (1) { static const char valid[] = "abcdefghijklmnopqrstuvwxyz0123456789_$#.:"; - char val = tolower((uint8_t)string[0]); + char val = tolower(u8(string[0])); if (val == 0 || strchr(valid, val) == nullptr) break; buffer.append(&val, 1); @@ -965,12 +965,12 @@ void parsed_expression::parse_symbol_or_number(parse_token &token, const char *& void parsed_expression::parse_number(parse_token &token, const char *string, int base, expression_error::error_code errcode) { // parse the actual value - uint64_t value = 0; + u64 value = 0; while (*string != 0) { // look up the number's value, stopping if not valid static const char numbers[] = "0123456789abcdef"; - const char *ptr = strchr(numbers, tolower((uint8_t)*string)); + const char *ptr = strchr(numbers, tolower(u8(*string))); if (ptr == nullptr) break; @@ -980,7 +980,7 @@ void parsed_expression::parse_number(parse_token &token, const char *string, int break; // shift previous digits up and add in new digit - value = (value * (uint64_t)base) + digit; + value = (value * u64(base)) + digit; string++; } @@ -1001,7 +1001,7 @@ void parsed_expression::parse_quoted_char(parse_token &token, const char *&strin { // accumulate the value of the character token string++; - uint64_t value = 0; + u64 value = 0; while (string[0] != 0) { // allow '' to mean a nested single quote @@ -1011,7 +1011,7 @@ void parsed_expression::parse_quoted_char(parse_token &token, const char *&strin break; string++; } - value = (value << 8) | (uint8_t)*string++; + value = (value << 8) | u8(*string++); } // if we didn't find the ending quote, report an error @@ -1388,7 +1388,7 @@ inline void parsed_expression::pop_token_rval(parse_token &token) // of tokens //------------------------------------------------- -uint64_t parsed_expression::execute_tokens() +u64 parsed_expression::execute_tokens() { // reset the token stack m_token_stack_ptr = 0; @@ -1674,7 +1674,7 @@ parsed_expression::parse_token::parse_token(int offset) // for a SYMBOL token //------------------------------------------------- -uint64_t parsed_expression::parse_token::get_lval_value(symbol_table *table) +u64 parsed_expression::parse_token::get_lval_value(symbol_table *table) { // get the value of a symbol if (is_symbol()) @@ -1693,7 +1693,7 @@ uint64_t parsed_expression::parse_token::get_lval_value(symbol_table *table) // for a SYMBOL token //------------------------------------------------- -inline void parsed_expression::parse_token::set_lval_value(symbol_table *table, uint64_t value) +inline void parsed_expression::parse_token::set_lval_value(symbol_table *table, u64 value) { // set the value of a symbol if (is_symbol()) @@ -1713,7 +1713,7 @@ inline void parsed_expression::parse_token::set_lval_value(symbol_table *table, void parsed_expression::execute_function(parse_token &token) { // pop off all pushed parameters - uint64_t funcparams[MAX_FUNCTION_PARAMS]; + u64 funcparams[MAX_FUNCTION_PARAMS]; symbol_entry *symbol = nullptr; int paramcount = 0; while (paramcount < MAX_FUNCTION_PARAMS) diff --git a/src/emu/debug/express.h b/src/emu/debug/express.h index 7618bfada20..b9ddde14501 100644 --- a/src/emu/debug/express.h +++ b/src/emu/debug/express.h @@ -129,8 +129,8 @@ public: // symbol access virtual bool is_lval() const = 0; - virtual uint64_t value() const = 0; - virtual void set_value(uint64_t newvalue) = 0; + virtual u64 value() const = 0; + virtual void set_value(u64 newvalue) = 0; protected: // internal state @@ -150,16 +150,16 @@ class symbol_table { public: // callback functions for getting/setting a symbol value - typedef std::function getter_func; - typedef std::function setter_func; + typedef std::function getter_func; + typedef std::function setter_func; // callback functions for function execution - typedef std::function execute_func; + typedef std::function execute_func; // callback functions for memory reads/writes typedef std::function valid_func; - typedef std::function read_func; - typedef std::function write_func; + typedef std::function read_func; + typedef std::function write_func; enum read_write { @@ -179,21 +179,21 @@ public: void configure_memory(void *param, valid_func valid, read_func read, write_func write); // symbol access - void add(const char *name, read_write rw, uint64_t *ptr = nullptr); - void add(const char *name, uint64_t constvalue); + void add(const char *name, read_write rw, u64 *ptr = nullptr); + void add(const char *name, u64 constvalue); void add(const char *name, void *ref, getter_func getter, setter_func setter = nullptr); void add(const char *name, void *ref, int minparams, int maxparams, execute_func execute); symbol_entry *find(const char *name) const { if (name) { auto search = m_symlist.find(name); if (search != m_symlist.end()) return search->second.get(); else return nullptr; } else return nullptr; } symbol_entry *find_deep(const char *name); // value getter/setter - uint64_t value(const char *symbol); - void set_value(const char *symbol, uint64_t value); + u64 value(const char *symbol); + void set_value(const char *symbol, u64 value); // memory accessors expression_error::error_code memory_valid(const char *name, expression_space space); - uint64_t memory_value(const char *name, expression_space space, uint32_t offset, int size); - void set_memory_value(const char *name, expression_space space, uint32_t offset, int size, uint64_t value); + u64 memory_value(const char *name, expression_space space, u32 offset, int size); + void set_memory_value(const char *name, expression_space space, u32 offset, int size, u64 value); private: // internal state @@ -216,7 +216,7 @@ class parsed_expression public: // construction/destruction parsed_expression(const parsed_expression &src) { copy(src); } - parsed_expression(symbol_table *symtable = nullptr, const char *expression = nullptr, uint64_t *result = nullptr); + parsed_expression(symbol_table *symtable = nullptr, const char *expression = nullptr, u64 *result = nullptr); // operators parsed_expression &operator=(const parsed_expression &src) { copy(src); return *this; } @@ -231,7 +231,7 @@ public: // execution void parse(const char *string); - uint64_t execute() { return execute_tokens(); } + u64 execute() { return execute_tokens(); } private: // a single token @@ -279,15 +279,15 @@ private: bool is_memory() const { return (m_type == MEMORY); } bool is_symbol() const { return (m_type == SYMBOL); } bool is_operator() const { return (m_type == OPERATOR); } - bool is_operator(uint8_t type) const { return (m_type == OPERATOR && optype() == type); } + bool is_operator(u8 type) const { return (m_type == OPERATOR && optype() == type); } bool is_lval() const { return ((m_type == SYMBOL && m_symbol->is_lval()) || m_type == MEMORY); } - uint64_t value() const { assert(m_type == NUMBER); return m_value; } - uint32_t address() const { assert(m_type == MEMORY); return m_value; } + u64 value() const { assert(m_type == NUMBER); return m_value; } + u32 address() const { assert(m_type == MEMORY); return m_value; } symbol_entry *symbol() const { assert(m_type == SYMBOL); return m_symbol; } - uint8_t optype() const { assert(m_type == OPERATOR); return (m_flags & TIN_OPTYPE_MASK) >> TIN_OPTYPE_SHIFT; } - uint8_t precedence() const { assert(m_type == OPERATOR); return (m_flags & TIN_PRECEDENCE_MASK) >> TIN_PRECEDENCE_SHIFT; } + u8 optype() const { assert(m_type == OPERATOR); return (m_flags & TIN_OPTYPE_MASK) >> TIN_OPTYPE_SHIFT; } + u8 precedence() const { assert(m_type == OPERATOR); return (m_flags & TIN_PRECEDENCE_MASK) >> TIN_PRECEDENCE_SHIFT; } bool is_function_separator() const { assert(m_type == OPERATOR); return ((m_flags & TIN_FUNCTION_MASK) != 0); } bool right_to_left() const { assert(m_type == OPERATOR); return ((m_flags & TIN_RIGHT_TO_LEFT_MASK) != 0); } expression_space memory_space() const { assert(m_type == OPERATOR || m_type == MEMORY); return expression_space((m_flags & TIN_MEMORY_SPACE_MASK) >> TIN_MEMORY_SPACE_SHIFT); } @@ -297,11 +297,11 @@ private: parse_token &set_offset(int offset) { m_offset = offset; return *this; } parse_token &set_offset(const parse_token &src) { m_offset = src.m_offset; return *this; } parse_token &set_offset(const parse_token &src1, const parse_token &src2) { m_offset = std::min(src1.m_offset, src2.m_offset); return *this; } - parse_token &configure_number(uint64_t value) { m_type = NUMBER; m_value = value; return *this; } + parse_token &configure_number(u64 value) { m_type = NUMBER; m_value = value; return *this; } parse_token &configure_string(const char *string) { m_type = STRING; m_string = string; return *this; } - parse_token &configure_memory(uint32_t address, parse_token &memoryat) { m_type = MEMORY; m_value = address; m_flags = memoryat.m_flags; m_string = memoryat.m_string; return *this; } + parse_token &configure_memory(u32 address, parse_token &memoryat) { m_type = MEMORY; m_value = address; m_flags = memoryat.m_flags; m_string = memoryat.m_string; return *this; } parse_token &configure_symbol(symbol_entry &symbol) { m_type = SYMBOL; m_symbol = &symbol; return *this; } - parse_token &configure_operator(uint8_t optype, uint8_t precedence) + parse_token &configure_operator(u8 optype, u8 precedence) { m_type = OPERATOR; m_flags = ((optype << TIN_OPTYPE_SHIFT) & TIN_OPTYPE_MASK) | ((precedence << TIN_PRECEDENCE_SHIFT) & TIN_PRECEDENCE_MASK); return *this; } parse_token &set_function_separator() { assert(m_type == OPERATOR); m_flags |= TIN_FUNCTION_MASK; return *this; } @@ -311,16 +311,16 @@ private: parse_token &set_memory_source(const char *string) { assert(m_type == OPERATOR || m_type == MEMORY); m_string = string; return *this; } // access - uint64_t get_lval_value(symbol_table *symtable); - void set_lval_value(symbol_table *symtable, uint64_t value); + u64 get_lval_value(symbol_table *symtable); + void set_lval_value(symbol_table *symtable, u64 value); private: // internal state parse_token * m_next; // next token in list token_type m_type; // type of token int m_offset; // offset within the string - uint64_t m_value; // integral value - uint32_t m_flags; // additional flags/info + u64 m_value; // integral value + u32 m_flags; // additional flags/info const char * m_string; // associated string symbol_entry * m_symbol; // symbol pointer }; @@ -366,7 +366,7 @@ private: parse_token *peek_token(int count); void pop_token_lval(parse_token &token); void pop_token_rval(parse_token &token); - uint64_t execute_tokens(); + u64 execute_tokens(); void execute_function(parse_token &token); // constants diff --git a/src/emu/debug/textbuf.cpp b/src/emu/debug/textbuf.cpp index 3e5202476c4..279ce8dead6 100644 --- a/src/emu/debug/textbuf.cpp +++ b/src/emu/debug/textbuf.cpp @@ -27,16 +27,16 @@ struct text_buffer { - char * buffer; - int32_t * lineoffs; - int32_t bufsize; - int32_t bufstart; - int32_t bufend; - int32_t linesize; - int32_t linestart; - int32_t lineend; - uint32_t linestartseq; - int32_t maxwidth; + char * buffer; + s32 * lineoffs; + s32 bufsize; + s32 bufstart; + s32 bufend; + s32 linesize; + s32 linestart; + s32 lineend; + u32 linestartseq; + s32 maxwidth; }; @@ -50,9 +50,9 @@ struct text_buffer currently held in the buffer -------------------------------------------------*/ -static inline int32_t buffer_used(text_buffer *text) +static inline s32 buffer_used(text_buffer *text) { - int32_t used = text->bufend - text->bufstart; + s32 used = text->bufend - text->bufstart; if (used < 0) used += text->bufsize; return used; @@ -64,7 +64,7 @@ static inline int32_t buffer_used(text_buffer *text) available in the buffer -------------------------------------------------*/ -static inline int32_t buffer_space(text_buffer *text) +static inline s32 buffer_space(text_buffer *text) { return text->bufsize - buffer_used(text); } @@ -81,7 +81,7 @@ static inline int32_t buffer_space(text_buffer *text) text_buffer_alloc - allocate a new text buffer -------------------------------------------------*/ -text_buffer *text_buffer_alloc(uint32_t bytes, uint32_t lines) +text_buffer *text_buffer_alloc(u32 bytes, u32 lines) { text_buffer *text; @@ -99,7 +99,7 @@ text_buffer *text_buffer_alloc(uint32_t bytes, uint32_t lines) } /* allocate memory for the lines array */ - text->lineoffs = global_alloc_array_nothrow(int32_t, lines); + text->lineoffs = global_alloc_array_nothrow(s32, lines); if (!text->lineoffs) { global_free_array(text->buffer); @@ -179,11 +179,11 @@ void text_buffer_print(text_buffer *text, const char *data) void text_buffer_print_wrap(text_buffer *text, const char *data, int wrapcol) { - int32_t stopcol = (wrapcol < MAX_LINE_LENGTH) ? wrapcol : MAX_LINE_LENGTH; - int32_t needed_space; + s32 stopcol = (wrapcol < MAX_LINE_LENGTH) ? wrapcol : MAX_LINE_LENGTH; + s32 needed_space; /* we need to ensure there is enough space for this string plus enough for the max line length */ - needed_space = (int32_t)strlen(data) + MAX_LINE_LENGTH; + needed_space = s32(strlen(data)) + MAX_LINE_LENGTH; /* make space in the buffer if we need to */ while (buffer_space(text) < needed_space && text->linestart != text->lineend) @@ -278,7 +278,7 @@ void text_buffer_print_wrap(text_buffer *text, const char *data, int wrapcol) width of all lines seen so far -------------------------------------------------*/ -uint32_t text_buffer_max_width(text_buffer *text) +u32 text_buffer_max_width(text_buffer *text) { return text->maxwidth; } @@ -289,9 +289,9 @@ uint32_t text_buffer_max_width(text_buffer *text) lines in the text buffer -------------------------------------------------*/ -uint32_t text_buffer_num_lines(text_buffer *text) +u32 text_buffer_num_lines(text_buffer *text) { - int32_t lines = text->lineend + 1 - text->linestart; + s32 lines = text->lineend + 1 - text->linestart; if (lines <= 0) lines += text->linesize; return lines; @@ -303,7 +303,7 @@ uint32_t text_buffer_num_lines(text_buffer *text) line index into a sequence number -------------------------------------------------*/ -uint32_t text_buffer_line_index_to_seqnum(text_buffer *text, uint32_t index) +u32 text_buffer_line_index_to_seqnum(text_buffer *text, u32 index) { return text->linestartseq + index; } @@ -314,10 +314,10 @@ uint32_t text_buffer_line_index_to_seqnum(text_buffer *text, uint32_t index) an indexed line in the buffer -------------------------------------------------*/ -const char *text_buffer_get_seqnum_line(text_buffer *text, uint32_t seqnum) +const char *text_buffer_get_seqnum_line(text_buffer *text, u32 seqnum) { - uint32_t numlines = text_buffer_num_lines(text); - uint32_t index = seqnum - text->linestartseq; + u32 numlines = text_buffer_num_lines(text); + u32 index = seqnum - text->linestartseq; if (index >= numlines) return nullptr; return &text->buffer[text->lineoffs[(text->linestart + index) % text->linesize]]; diff --git a/src/emu/debug/textbuf.h b/src/emu/debug/textbuf.h index e9b65c503a7..aed50428d30 100644 --- a/src/emu/debug/textbuf.h +++ b/src/emu/debug/textbuf.h @@ -8,8 +8,8 @@ ***************************************************************************/ -#ifndef __TEXTBUF_H__ -#define __TEXTBUF_H__ +#ifndef MAME_EMU_DEBUG_TEXTBUF_H +#define MAME_EMU_DEBUG_TEXTBUF_H /*************************************************************************** @@ -25,7 +25,7 @@ struct text_buffer; ***************************************************************************/ /* allocate a new text buffer */ -text_buffer *text_buffer_alloc(uint32_t bytes, uint32_t lines); +text_buffer *text_buffer_alloc(u32 bytes, u32 lines); /* free a text buffer */ void text_buffer_free(text_buffer *text); @@ -40,16 +40,16 @@ void text_buffer_print(text_buffer *text, const char *data); void text_buffer_print_wrap(text_buffer *text, const char *data, int wrapcol); /* get the maximum width of lines seen so far */ -uint32_t text_buffer_max_width(text_buffer *text); +u32 text_buffer_max_width(text_buffer *text); /* get the current number of lines in the buffer */ -uint32_t text_buffer_num_lines(text_buffer *text); +u32 text_buffer_num_lines(text_buffer *text); /* get an absolute sequence number for a given line */ -uint32_t text_buffer_line_index_to_seqnum(text_buffer *text, uint32_t index); +u32 text_buffer_line_index_to_seqnum(text_buffer *text, u32 index); /* get a sequenced line from the text buffer */ -const char *text_buffer_get_seqnum_line(text_buffer *text, uint32_t seqnum); +const char *text_buffer_get_seqnum_line(text_buffer *text, u32 seqnum); -#endif /* __TEXTBUF_H__ */ +#endif /* MAME_EMU_DEBUG_TEXTBUF_H */ diff --git a/src/emu/devcb.cpp b/src/emu/devcb.cpp index 2b392ddcb93..3d851ee8e2a 100644 --- a/src/emu/devcb.cpp +++ b/src/emu/devcb.cpp @@ -20,7 +20,7 @@ // devcb_base - constructor //------------------------------------------------- -devcb_base::devcb_base(device_t &device, uint64_t defmask) +devcb_base::devcb_base(device_t &device, u64 defmask) : m_device(device), m_rshift(0), m_mask(defmask), @@ -44,7 +44,7 @@ void devcb_base::reset(callback_type type) m_space = nullptr; m_target.ptr = nullptr; m_rshift = 0; - m_mask = ~U64(0); + m_mask = ~u64(0); } @@ -107,7 +107,7 @@ void devcb_base::resolve_space() // devcb_read_base - constructor //------------------------------------------------- -devcb_read_base::devcb_read_base(device_t &device, uint64_t defmask) +devcb_read_base::devcb_read_base(device_t &device, u64 defmask) : devcb_base(device, defmask), m_adapter(nullptr) { @@ -221,7 +221,7 @@ void devcb_read_base::resolve() // the given value //------------------------------------------------- -void devcb_read_base::resolve_safe(uint64_t none_constant_value) +void devcb_read_base::resolve_safe(u64 none_constant_value) { // convert to a constant if none specified if (m_type == CALLBACK_NONE) @@ -238,7 +238,7 @@ void devcb_read_base::resolve_safe(uint64_t none_constant_value) // unresolved adapter //------------------------------------------------- -uint64_t devcb_read_base::read_unresolved_adapter(address_space &space, offs_t offset, uint64_t mask) +u64 devcb_read_base::read_unresolved_adapter(address_space &space, offs_t offset, u64 mask) { throw emu_fatalerror("Attempted to read through an unresolved devcb item"); } @@ -248,7 +248,7 @@ uint64_t devcb_read_base::read_unresolved_adapter(address_space &space, offs_t o // read_line_adapter - read from a line delegate //------------------------------------------------- -uint64_t devcb_read_base::read_line_adapter(address_space &space, offs_t offset, uint64_t mask) +u64 devcb_read_base::read_line_adapter(address_space &space, offs_t offset, u64 mask) { return shift_mask_xor(m_readline() & 1); } @@ -258,7 +258,7 @@ uint64_t devcb_read_base::read_line_adapter(address_space &space, offs_t offset, // read8_adapter - read from an 8-bit delegate //------------------------------------------------- -uint64_t devcb_read_base::read8_adapter(address_space &space, offs_t offset, uint64_t mask) +u64 devcb_read_base::read8_adapter(address_space &space, offs_t offset, u64 mask) { return shift_mask_xor(m_read8(space, offset, unshift_mask(mask))); } @@ -268,7 +268,7 @@ uint64_t devcb_read_base::read8_adapter(address_space &space, offs_t offset, uin // read16_adapter - read from a 16-bit delegate //------------------------------------------------- -uint64_t devcb_read_base::read16_adapter(address_space &space, offs_t offset, uint64_t mask) +u64 devcb_read_base::read16_adapter(address_space &space, offs_t offset, u64 mask) { return shift_mask_xor(m_read16(space, offset, unshift_mask(mask))); } @@ -278,7 +278,7 @@ uint64_t devcb_read_base::read16_adapter(address_space &space, offs_t offset, ui // read32_adapter - read from a 32-bit delegate //------------------------------------------------- -uint64_t devcb_read_base::read32_adapter(address_space &space, offs_t offset, uint64_t mask) +u64 devcb_read_base::read32_adapter(address_space &space, offs_t offset, u64 mask) { return shift_mask_xor(m_read32(space, offset, unshift_mask(mask))); } @@ -288,7 +288,7 @@ uint64_t devcb_read_base::read32_adapter(address_space &space, offs_t offset, ui // read64_adapter - read from a 64-bit delegate //------------------------------------------------- -uint64_t devcb_read_base::read64_adapter(address_space &space, offs_t offset, uint64_t mask) +u64 devcb_read_base::read64_adapter(address_space &space, offs_t offset, u64 mask) { return shift_mask_xor(m_read64(space, offset, unshift_mask(mask))); } @@ -298,7 +298,7 @@ uint64_t devcb_read_base::read64_adapter(address_space &space, offs_t offset, ui // read_ioport - read from an I/O port //------------------------------------------------- -uint64_t devcb_read_base::read_ioport_adapter(address_space &space, offs_t offset, uint64_t mask) +u64 devcb_read_base::read_ioport_adapter(address_space &space, offs_t offset, u64 mask) { return shift_mask_xor(m_target.ioport->read()); } @@ -309,7 +309,7 @@ uint64_t devcb_read_base::read_ioport_adapter(address_space &space, offs_t offse // constant //------------------------------------------------- -uint64_t devcb_read_base::read_logged_adapter(address_space &space, offs_t offset, uint64_t mask) +u64 devcb_read_base::read_logged_adapter(address_space &space, offs_t offset, u64 mask) { m_device.logerror("%s: read %s\n", m_device.machine().describe_context(), m_target_tag); return shift_mask_xor(m_target_int); @@ -320,7 +320,7 @@ uint64_t devcb_read_base::read_logged_adapter(address_space &space, offs_t offse // read_constant - read from a constant //------------------------------------------------- -uint64_t devcb_read_base::read_constant_adapter(address_space &space, offs_t offset, uint64_t mask) +u64 devcb_read_base::read_constant_adapter(address_space &space, offs_t offset, u64 mask) { return shift_mask_xor(m_target_int); } @@ -335,7 +335,7 @@ uint64_t devcb_read_base::read_constant_adapter(address_space &space, offs_t off // devcb_write_base - constructor //------------------------------------------------- -devcb_write_base::devcb_write_base(device_t &device, uint64_t defmask) +devcb_write_base::devcb_write_base(device_t &device, u64 defmask) : devcb_base(device, defmask), m_adapter(nullptr) { @@ -458,7 +458,7 @@ void devcb_write_base::resolve_safe() // unresolved adapter //------------------------------------------------- -void devcb_write_base::write_unresolved_adapter(address_space &space, offs_t offset, uint64_t data, uint64_t mask) +void devcb_write_base::write_unresolved_adapter(address_space &space, offs_t offset, u64 data, u64 mask) { throw emu_fatalerror("Attempted to write through an unresolved devcb item"); } @@ -468,7 +468,7 @@ void devcb_write_base::write_unresolved_adapter(address_space &space, offs_t off // write_line_adapter - write from a line delegate //------------------------------------------------- -void devcb_write_base::write_line_adapter(address_space &space, offs_t offset, uint64_t data, uint64_t mask) +void devcb_write_base::write_line_adapter(address_space &space, offs_t offset, u64 data, u64 mask) { m_writeline(unshift_mask_xor(data) & 1); } @@ -478,7 +478,7 @@ void devcb_write_base::write_line_adapter(address_space &space, offs_t offset, u // write8_adapter - write from an 8-bit delegate //------------------------------------------------- -void devcb_write_base::write8_adapter(address_space &space, offs_t offset, uint64_t data, uint64_t mask) +void devcb_write_base::write8_adapter(address_space &space, offs_t offset, u64 data, u64 mask) { m_write8(space, offset, unshift_mask_xor(data), unshift_mask(mask)); } @@ -488,7 +488,7 @@ void devcb_write_base::write8_adapter(address_space &space, offs_t offset, uint6 // write16_adapter - write from a 16-bit delegate //------------------------------------------------- -void devcb_write_base::write16_adapter(address_space &space, offs_t offset, uint64_t data, uint64_t mask) +void devcb_write_base::write16_adapter(address_space &space, offs_t offset, u64 data, u64 mask) { m_write16(space, offset, unshift_mask_xor(data), unshift_mask(mask)); } @@ -498,7 +498,7 @@ void devcb_write_base::write16_adapter(address_space &space, offs_t offset, uint // write32_adapter - write from a 32-bit delegate //------------------------------------------------- -void devcb_write_base::write32_adapter(address_space &space, offs_t offset, uint64_t data, uint64_t mask) +void devcb_write_base::write32_adapter(address_space &space, offs_t offset, u64 data, u64 mask) { m_write32(space, offset, unshift_mask_xor(data), unshift_mask(mask)); } @@ -508,7 +508,7 @@ void devcb_write_base::write32_adapter(address_space &space, offs_t offset, uint // write64_adapter - write from a 64-bit delegate //------------------------------------------------- -void devcb_write_base::write64_adapter(address_space &space, offs_t offset, uint64_t data, uint64_t mask) +void devcb_write_base::write64_adapter(address_space &space, offs_t offset, u64 data, u64 mask) { m_write64(space, offset, unshift_mask_xor(data), unshift_mask(mask)); } @@ -518,7 +518,7 @@ void devcb_write_base::write64_adapter(address_space &space, offs_t offset, uint // write_ioport - write from an I/O port //------------------------------------------------- -void devcb_write_base::write_ioport_adapter(address_space &space, offs_t offset, uint64_t data, uint64_t mask) +void devcb_write_base::write_ioport_adapter(address_space &space, offs_t offset, u64 data, u64 mask) { if (m_target.ioport) m_target.ioport->write(unshift_mask_xor(data)); @@ -530,7 +530,7 @@ void devcb_write_base::write_ioport_adapter(address_space &space, offs_t offset, // adapter //------------------------------------------------- -void devcb_write_base::write_logged_adapter(address_space &space, offs_t offset, uint64_t data, uint64_t mask) +void devcb_write_base::write_logged_adapter(address_space &space, offs_t offset, u64 data, u64 mask) { m_device.logerror("%s: unresolved devcb write\n", m_device.machine().describe_context()); } @@ -540,7 +540,7 @@ void devcb_write_base::write_logged_adapter(address_space &space, offs_t offset, // write_constant - write from a constant //------------------------------------------------- -void devcb_write_base::write_noop_adapter(address_space &space, offs_t offset, uint64_t data, uint64_t mask) +void devcb_write_base::write_noop_adapter(address_space &space, offs_t offset, u64 data, u64 mask) { // constant for writes is a no-op } @@ -551,7 +551,7 @@ void devcb_write_base::write_noop_adapter(address_space &space, offs_t offset, u // input line //------------------------------------------------- -void devcb_write_base::write_inputline_adapter(address_space &space, offs_t offset, uint64_t data, uint64_t mask) +void devcb_write_base::write_inputline_adapter(address_space &space, offs_t offset, u64 data, u64 mask) { m_target.device->execute().set_input_line(m_target_int, unshift_mask_xor(data) & 1); } diff --git a/src/emu/devcb.h b/src/emu/devcb.h index 0440413f417..c30f9db431b 100644 --- a/src/emu/devcb.h +++ b/src/emu/devcb.h @@ -14,8 +14,8 @@ #error Dont include this file directly; include emu.h instead. #endif -#ifndef __DEVCB_H__ -#define __DEVCB_H__ +#ifndef MAME_EMU_DEVCB_H +#define MAME_EMU_DEVCB_H //************************************************************************** @@ -63,7 +63,7 @@ #define MCFG_DEVCB_RSHIFT(_shift) devcb->set_rshift(_shift); #define MCFG_DEVCB_MASK(_mask) devcb->set_mask(_mask); #define MCFG_DEVCB_XOR(_xor) devcb->set_xor(_xor); -#define MCFG_DEVCB_INVERT devcb->set_xor(~U64(0)); +#define MCFG_DEVCB_INVERT devcb->set_xor(~u64(0)); #define MCFG_DEVCB_ADDRESS_SPACE(_device, _spacenum) devcb->set_space(_device, _spacenum); @@ -98,7 +98,7 @@ protected: }; // construction/destruction - devcb_base(device_t &device, uint64_t defmask); + devcb_base(device_t &device, u64 defmask); public: // getters @@ -107,8 +107,8 @@ public: // additional configuration devcb_base &set_space(const char *device, address_spacenum space = AS_0) { m_space_tag = device; m_space_num = space; return *this; } devcb_base &set_rshift(int rshift) { m_rshift = rshift; return *this; } - devcb_base &set_mask(uint64_t mask) { m_mask = mask; return *this; } - devcb_base &set_xor(uint64_t xorval) { m_xor = xorval; return *this; } + devcb_base &set_mask(u64 mask) { m_mask = mask; return *this; } + devcb_base &set_xor(u64 xorval) { m_xor = xorval; return *this; } // construction helper classes class null_desc @@ -127,16 +127,16 @@ public: class constant_desc { public: - constant_desc(uint64_t value) { m_value = value; } - uint64_t m_value; + constant_desc(u64 value) { m_value = value; } + u64 m_value; }; class logger_desc { public: - logger_desc(const char *string, uint64_t value = 0) { m_string = string; m_value = value; } + logger_desc(const char *string, u64 value = 0) { m_string = string; m_value = value; } const char *m_string; - uint64_t m_value; + u64 m_value; }; class inputline_desc @@ -156,9 +156,9 @@ public: protected: // internal helpers - inline uint64_t shift_mask_xor(uint64_t value) const { return (((m_rshift < 0) ? (value << -m_rshift) : (value >> m_rshift)) ^ m_xor) & m_mask; } - inline uint64_t unshift_mask(uint64_t value) const { return (m_rshift < 0) ? ((value & m_mask) >> -m_rshift) : ((value & m_mask) << m_rshift); } - inline uint64_t unshift_mask_xor(uint64_t value) const { return (m_rshift < 0) ? (((value ^ m_xor) & m_mask) >> -m_rshift) : (((value ^ m_xor) & m_mask) << m_rshift); } + inline u64 shift_mask_xor(u64 value) const { return (((m_rshift < 0) ? (value << -m_rshift) : (value >> m_rshift)) ^ m_xor) & m_mask; } + inline u64 unshift_mask(u64 value) const { return (m_rshift < 0) ? ((value & m_mask) >> -m_rshift) : ((value & m_mask) << m_rshift); } + inline u64 unshift_mask_xor(u64 value) const { return (m_rshift < 0) ? (((value ^ m_xor) & m_mask) >> -m_rshift) : (((value ^ m_xor) & m_mask) << m_rshift); } void reset(callback_type type = CALLBACK_NONE); void resolve_ioport(); void resolve_inputline(); @@ -176,7 +176,7 @@ protected: device_t & m_device; // reference to our owning device callback_type m_type; // type of callback registered const char * m_target_tag; // tag of target object - uint64_t m_target_int; // integer value of target object + u64 m_target_int; // integer value of target object const char * m_space_tag; // tag of address space device address_spacenum m_space_num; // address space number of space device @@ -184,8 +184,8 @@ protected: address_space * m_space; // target address space callback_target m_target; // resolved pointer to target object int m_rshift; // right shift to apply to data read - uint64_t m_mask; // mask to apply to data read - uint64_t m_xor; // XOR to apply to data read + u64 m_mask; // mask to apply to data read + u64 m_xor; // XOR to apply to data read }; @@ -195,7 +195,7 @@ class devcb_read_base : public devcb_base { protected: // construction/destruction - devcb_read_base(device_t &device, uint64_t defmask); + devcb_read_base(device_t &device, u64 defmask); public: // callback configuration @@ -208,22 +208,22 @@ public: // resolution void resolve(); - void resolve_safe(uint64_t none_constant_value); + void resolve_safe(u64 none_constant_value); protected: // internal helpers void reset(callback_type type = CALLBACK_NONE); // adapters - uint64_t read_unresolved_adapter(address_space &space, offs_t offset, uint64_t mask); - uint64_t read_line_adapter(address_space &space, offs_t offset, uint64_t mask); - uint64_t read8_adapter(address_space &space, offs_t offset, uint64_t mask); - uint64_t read16_adapter(address_space &space, offs_t offset, uint64_t mask); - uint64_t read32_adapter(address_space &space, offs_t offset, uint64_t mask); - uint64_t read64_adapter(address_space &space, offs_t offset, uint64_t mask); - uint64_t read_ioport_adapter(address_space &space, offs_t offset, uint64_t mask); - uint64_t read_logged_adapter(address_space &space, offs_t offset, uint64_t mask); - uint64_t read_constant_adapter(address_space &space, offs_t offset, uint64_t mask); + u64 read_unresolved_adapter(address_space &space, offs_t offset, u64 mask); + u64 read_line_adapter(address_space &space, offs_t offset, u64 mask); + u64 read8_adapter(address_space &space, offs_t offset, u64 mask); + u64 read16_adapter(address_space &space, offs_t offset, u64 mask); + u64 read32_adapter(address_space &space, offs_t offset, u64 mask); + u64 read64_adapter(address_space &space, offs_t offset, u64 mask); + u64 read_ioport_adapter(address_space &space, offs_t offset, u64 mask); + u64 read_logged_adapter(address_space &space, offs_t offset, u64 mask); + u64 read_constant_adapter(address_space &space, offs_t offset, u64 mask); // configuration read_line_delegate m_readline; // copy of registered line reader @@ -233,7 +233,7 @@ protected: read64_delegate m_read64; // copy of registered 64-bit reader // derived state - typedef uint64_t (devcb_read_base::*adapter_func)(address_space &, offs_t, uint64_t); + typedef u64 (devcb_read_base::*adapter_func)(address_space &, offs_t, u64); adapter_func m_adapter; // actual callback to invoke }; @@ -244,7 +244,7 @@ class devcb_write_base : public devcb_base { protected: // construction/destruction - devcb_write_base(device_t &device, uint64_t defmask); + devcb_write_base(device_t &device, u64 defmask); public: // callback configuration @@ -264,16 +264,16 @@ protected: void reset(callback_type type = CALLBACK_NONE); // adapters - void write_unresolved_adapter(address_space &space, offs_t offset, uint64_t data, uint64_t mask); - void write_line_adapter(address_space &space, offs_t offset, uint64_t data, uint64_t mask); - void write8_adapter(address_space &space, offs_t offset, uint64_t data, uint64_t mask); - void write16_adapter(address_space &space, offs_t offset, uint64_t data, uint64_t mask); - void write32_adapter(address_space &space, offs_t offset, uint64_t data, uint64_t mask); - void write64_adapter(address_space &space, offs_t offset, uint64_t data, uint64_t mask); - void write_ioport_adapter(address_space &space, offs_t offset, uint64_t data, uint64_t mask); - void write_logged_adapter(address_space &space, offs_t offset, uint64_t data, uint64_t mask); - void write_noop_adapter(address_space &space, offs_t offset, uint64_t data, uint64_t mask); - void write_inputline_adapter(address_space &space, offs_t offset, uint64_t data, uint64_t mask); + void write_unresolved_adapter(address_space &space, offs_t offset, u64 data, u64 mask); + void write_line_adapter(address_space &space, offs_t offset, u64 data, u64 mask); + void write8_adapter(address_space &space, offs_t offset, u64 data, u64 mask); + void write16_adapter(address_space &space, offs_t offset, u64 data, u64 mask); + void write32_adapter(address_space &space, offs_t offset, u64 data, u64 mask); + void write64_adapter(address_space &space, offs_t offset, u64 data, u64 mask); + void write_ioport_adapter(address_space &space, offs_t offset, u64 data, u64 mask); + void write_logged_adapter(address_space &space, offs_t offset, u64 data, u64 mask); + void write_noop_adapter(address_space &space, offs_t offset, u64 data, u64 mask); + void write_inputline_adapter(address_space &space, offs_t offset, u64 data, u64 mask); // configuration write_line_delegate m_writeline; // copy of registered line writer @@ -283,7 +283,7 @@ protected: write64_delegate m_write64; // copy of registered 64-bit writer // derived state - typedef void (devcb_write_base::*adapter_func)(address_space &, offs_t, uint64_t, uint64_t); + typedef void (devcb_write_base::*adapter_func)(address_space &, offs_t, u64, u64); adapter_func m_adapter; // actual callback to invoke }; @@ -294,8 +294,8 @@ class devcb_read_line : public devcb_read_base { public: devcb_read_line(device_t &device) : devcb_read_base(device, 0xff) { } - int operator()() { return (this->*m_adapter)(*m_space, 0, U64(0xff)) & 1; } - int operator()(address_space &space) { return (this->*m_adapter)((m_space_tag != nullptr) ? *m_space : space, 0, U64(0xff)) & 1; } + int operator()() { return (this->*m_adapter)(*m_space, 0, 0xffU) & 1; } + int operator()(address_space &space) { return (this->*m_adapter)((m_space_tag != nullptr) ? *m_space : space, 0, 0xffU) & 1; } }; @@ -305,8 +305,8 @@ class devcb_read8 : public devcb_read_base { public: devcb_read8(device_t &device) : devcb_read_base(device, 0xff) { } - uint8_t operator()(offs_t offset = 0, uint8_t mask = 0xff) { return (this->*m_adapter)(*m_space, offset, mask) & mask; } - uint8_t operator()(address_space &space, offs_t offset = 0, uint8_t mask = 0xff) { return (this->*m_adapter)((m_space_tag != nullptr) ? *m_space : space, offset, mask) & mask; } + u8 operator()(offs_t offset = 0, u8 mask = 0xff) { return (this->*m_adapter)(*m_space, offset, mask) & mask; } + u8 operator()(address_space &space, offs_t offset = 0, u8 mask = 0xff) { return (this->*m_adapter)((m_space_tag != nullptr) ? *m_space : space, offset, mask) & mask; } }; @@ -316,8 +316,8 @@ class devcb_read16 : public devcb_read_base { public: devcb_read16(device_t &device) : devcb_read_base(device, 0xffff) { } - uint16_t operator()(offs_t offset = 0, uint16_t mask = 0xffff) { return (this->*m_adapter)(*m_space, offset, mask) & mask; } - uint16_t operator()(address_space &space, offs_t offset = 0, uint16_t mask = 0xffff) { return (this->*m_adapter)((m_space_tag != nullptr) ? *m_space : space, offset, mask) & mask; } + u16 operator()(offs_t offset = 0, u16 mask = 0xffff) { return (this->*m_adapter)(*m_space, offset, mask) & mask; } + u16 operator()(address_space &space, offs_t offset = 0, u16 mask = 0xffff) { return (this->*m_adapter)((m_space_tag != nullptr) ? *m_space : space, offset, mask) & mask; } }; @@ -327,8 +327,8 @@ class devcb_read32 : public devcb_read_base { public: devcb_read32(device_t &device) : devcb_read_base(device, 0xffffffff) { } - uint32_t operator()(offs_t offset = 0, uint32_t mask = 0xffffffff) { return (this->*m_adapter)(*m_space, offset, mask) & mask; } - uint32_t operator()(address_space &space, offs_t offset = 0, uint32_t mask = 0xffffffff) { return (this->*m_adapter)((m_space_tag != nullptr) ? *m_space : space, offset, mask) & mask; } + u32 operator()(offs_t offset = 0, u32 mask = 0xffffffff) { return (this->*m_adapter)(*m_space, offset, mask) & mask; } + u32 operator()(address_space &space, offs_t offset = 0, u32 mask = 0xffffffff) { return (this->*m_adapter)((m_space_tag != nullptr) ? *m_space : space, offset, mask) & mask; } }; @@ -337,9 +337,9 @@ public: class devcb_read64 : public devcb_read_base { public: - devcb_read64(device_t &device) : devcb_read_base(device, U64(0xffffffffffffffff)) { } - uint64_t operator()(offs_t offset = 0, uint64_t mask = U64(0xffffffffffffffff)) { return (this->*m_adapter)(*m_space, offset, mask) & mask; } - uint64_t operator()(address_space &space, offs_t offset = 0, uint64_t mask = U64(0xffffffffffffffff)) { return (this->*m_adapter)((m_space_tag != nullptr) ? *m_space : space, offset, mask) & mask; } + devcb_read64(device_t &device) : devcb_read_base(device, 0xffffffffffffffffU) { } + u64 operator()(offs_t offset = 0, u64 mask = 0xffffffffffffffffU) { return (this->*m_adapter)(*m_space, offset, mask) & mask; } + u64 operator()(address_space &space, offs_t offset = 0, u64 mask = 0xffffffffffffffffU) { return (this->*m_adapter)((m_space_tag != nullptr) ? *m_space : space, offset, mask) & mask; } }; @@ -349,8 +349,8 @@ class devcb_write_line : public devcb_write_base { public: devcb_write_line(device_t &device) : devcb_write_base(device, 0xff) { } - void operator()(int state) { (this->*m_adapter)(*m_space, 0, state & 1, U64(0xff)); } - void operator()(address_space &space, int state) { (this->*m_adapter)((m_space_tag != nullptr) ? *m_space : space, 0, state & 1, U64(0xff)); } + void operator()(int state) { (this->*m_adapter)(*m_space, 0, state & 1, 0xffU); } + void operator()(address_space &space, int state) { (this->*m_adapter)((m_space_tag != nullptr) ? *m_space : space, 0, state & 1, 0xffU); } }; @@ -360,9 +360,9 @@ class devcb_write8 : public devcb_write_base { public: devcb_write8(device_t &device) : devcb_write_base(device, 0xff) { } - void operator()(uint8_t data, uint8_t mask = 0xff) { (this->*m_adapter)(*m_space, 0, data, mask); } - void operator()(offs_t offset, uint8_t data, uint8_t mask = 0xff) { (this->*m_adapter)(*m_space, offset, data, mask); } - void operator()(address_space &space, offs_t offset, uint8_t data, uint8_t mask = 0xff) { (this->*m_adapter)((m_space_tag != nullptr) ? *m_space : space, offset, data, mask); } + void operator()(u8 data, u8 mask = 0xff) { (this->*m_adapter)(*m_space, 0, data, mask); } + void operator()(offs_t offset, u8 data, u8 mask = 0xff) { (this->*m_adapter)(*m_space, offset, data, mask); } + void operator()(address_space &space, offs_t offset, u8 data, u8 mask = 0xff) { (this->*m_adapter)((m_space_tag != nullptr) ? *m_space : space, offset, data, mask); } }; @@ -372,9 +372,9 @@ class devcb_write16 : public devcb_write_base { public: devcb_write16(device_t &device) : devcb_write_base(device, 0xffff) { } - void operator()(uint16_t data, uint16_t mask = 0xffff) { (this->*m_adapter)(*m_space, 0, data, mask); } - void operator()(offs_t offset, uint16_t data, uint16_t mask = 0xffff) { (this->*m_adapter)(*m_space, offset, data, mask); } - void operator()(address_space &space, offs_t offset, uint16_t data, uint16_t mask = 0xffff) { (this->*m_adapter)((m_space_tag != nullptr) ? *m_space : space, offset, data, mask); } + void operator()(u16 data, u16 mask = 0xffff) { (this->*m_adapter)(*m_space, 0, data, mask); } + void operator()(offs_t offset, u16 data, u16 mask = 0xffff) { (this->*m_adapter)(*m_space, offset, data, mask); } + void operator()(address_space &space, offs_t offset, u16 data, u16 mask = 0xffff) { (this->*m_adapter)((m_space_tag != nullptr) ? *m_space : space, offset, data, mask); } }; @@ -384,9 +384,9 @@ class devcb_write32 : public devcb_write_base { public: devcb_write32(device_t &device) : devcb_write_base(device, 0xffffffff) { } - void operator()(uint32_t data, uint32_t mask = 0xffffffff) { (this->*m_adapter)(*m_space, 0, data, mask); } - void operator()(offs_t offset, uint32_t data, uint32_t mask = 0xffffffff) { (this->*m_adapter)(*m_space, offset, data, mask); } - void operator()(address_space &space, offs_t offset, uint32_t data, uint32_t mask = 0xffffffff) { (this->*m_adapter)((m_space_tag != nullptr) ? *m_space : space, offset, data, mask); } + void operator()(u32 data, u32 mask = 0xffffffff) { (this->*m_adapter)(*m_space, 0, data, mask); } + void operator()(offs_t offset, u32 data, u32 mask = 0xffffffff) { (this->*m_adapter)(*m_space, offset, data, mask); } + void operator()(address_space &space, offs_t offset, u32 data, u32 mask = 0xffffffff) { (this->*m_adapter)((m_space_tag != nullptr) ? *m_space : space, offset, data, mask); } }; @@ -395,11 +395,11 @@ public: class devcb_write64 : public devcb_write_base { public: - devcb_write64(device_t &device) : devcb_write_base(device, U64(0xffffffffffffffff)) { } - void operator()(uint64_t data, uint64_t mask = U64(0xffffffffffffffff)) { (this->*m_adapter)(*m_space, 0, data, mask); } - void operator()(offs_t offset, uint64_t data, uint64_t mask = U64(0xffffffffffffffff)) { (this->*m_adapter)(*m_space, offset, data, mask); } - void operator()(address_space &space, offs_t offset, uint64_t data, uint64_t mask = U64(0xffffffffffffffff)) { (this->*m_adapter)((m_space_tag != nullptr) ? *m_space : space, offset, data, mask); } + devcb_write64(device_t &device) : devcb_write_base(device, 0xffffffffffffffffU) { } + void operator()(u64 data, u64 mask = 0xffffffffffffffffU) { (this->*m_adapter)(*m_space, 0, data, mask); } + void operator()(offs_t offset, u64 data, u64 mask = 0xffffffffffffffffU) { (this->*m_adapter)(*m_space, offset, data, mask); } + void operator()(address_space &space, offs_t offset, u64 data, u64 mask = 0xffffffffffffffffU) { (this->*m_adapter)((m_space_tag != nullptr) ? *m_space : space, offset, data, mask); } }; -#endif /* __DEVCB_H__ */ +#endif /* MAME_EMU_DEVCB_H */ diff --git a/src/emu/devcpu.cpp b/src/emu/devcpu.cpp index 42e48ce588d..f07c8b4a885 100644 --- a/src/emu/devcpu.cpp +++ b/src/emu/devcpu.cpp @@ -21,7 +21,7 @@ // cpu_device - constructor //------------------------------------------------- -cpu_device::cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source) +cpu_device::cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, const char *shortname, const char *source) : device_t(mconfig, type, name, tag, owner, clock, shortname, source), device_execute_interface(mconfig, *this), device_memory_interface(mconfig, *this), diff --git a/src/emu/devcpu.h b/src/emu/devcpu.h index bfd299ed5ff..54174b1f45b 100644 --- a/src/emu/devcpu.h +++ b/src/emu/devcpu.h @@ -14,8 +14,8 @@ #error Dont include this file directly; include emu.h instead. #endif -#ifndef __DEVCPU_H__ -#define __DEVCPU_H__ +#ifndef MAME_EMU_DEVCPU_H +#define MAME_EMU_DEVCPU_H //************************************************************************** // CPU DEVICE CONFIGURATION MACROS @@ -54,7 +54,7 @@ //************************************************************************** #define CPU_DISASSEMBLE_NAME(name) cpu_disassemble_##name -#define CPU_DISASSEMBLE(name) offs_t CPU_DISASSEMBLE_NAME(name)(cpu_device *device, char *buffer, offs_t pc, const uint8_t *oprom, const uint8_t *opram, int options) +#define CPU_DISASSEMBLE(name) offs_t CPU_DISASSEMBLE_NAME(name)(cpu_device *device, char *buffer, offs_t pc, const u8 *oprom, const u8 *opram, int options) #define CPU_DISASSEMBLE_CALL(name) CPU_DISASSEMBLE_NAME(name)(device, buffer, pc, oprom, opram, options) @@ -79,7 +79,7 @@ public: protected: // construction/destruction - cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source); + cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, const char *shortname, const char *source); virtual ~cpu_device(); private: @@ -88,7 +88,7 @@ private: }; -typedef offs_t (*cpu_disassemble_func)(cpu_device *device, char *buffer, offs_t pc, const uint8_t *oprom, const uint8_t *opram, int options); +typedef offs_t (*cpu_disassemble_func)(cpu_device *device, char *buffer, offs_t pc, const u8 *oprom, const u8 *opram, int options); -#endif /* __CPUINTRF_H__ */ +#endif /* MAME_EMU_DEVCPU_H */ diff --git a/src/emu/devdelegate.h b/src/emu/devdelegate.h index f76116004aa..47af86d84c3 100644 --- a/src/emu/devdelegate.h +++ b/src/emu/devdelegate.h @@ -8,10 +8,10 @@ ***************************************************************************/ -#pragma once +#ifndef MAME_EMU_DEVDELEGATE_H +#define MAME_EMU_DEVDELEGATE_H -#ifndef __DEVDELEGATE_H__ -#define __DEVDELEGATE_H__ +#pragma once #include "delegate.h" @@ -104,4 +104,4 @@ public: }; -#endif /* __DEVDELEGATE_H__ */ +#endif /* MAME_EMU_DEVDELEGATE_H */ diff --git a/src/emu/devfind.cpp b/src/emu/devfind.cpp index 90daaa0a499..7eb309bbfd2 100644 --- a/src/emu/devfind.cpp +++ b/src/emu/devfind.cpp @@ -22,23 +22,23 @@ template class object_finder_base; template class object_finder_base; template class object_finder_base; -template class object_finder_base; -template class object_finder_base; -template class object_finder_base; -template class object_finder_base; -template class object_finder_base; -template class object_finder_base; -template class object_finder_base; -template class object_finder_base; +template class object_finder_base; +template class object_finder_base; +template class object_finder_base; +template class object_finder_base; +template class object_finder_base; +template class object_finder_base; +template class object_finder_base; +template class object_finder_base; -template class object_finder_base; -template class object_finder_base; -template class object_finder_base; -template class object_finder_base; -template class object_finder_base; -template class object_finder_base; -template class object_finder_base; -template class object_finder_base; +template class object_finder_base; +template class object_finder_base; +template class object_finder_base; +template class object_finder_base; +template class object_finder_base; +template class object_finder_base; +template class object_finder_base; +template class object_finder_base; template class memory_region_finder; template class memory_region_finder; @@ -49,41 +49,41 @@ template class memory_bank_finder; template class ioport_finder; template class ioport_finder; -template class region_ptr_finder; -template class region_ptr_finder; -template class region_ptr_finder; -template class region_ptr_finder; -template class region_ptr_finder; -template class region_ptr_finder; -template class region_ptr_finder; -template class region_ptr_finder; +template class region_ptr_finder; +template class region_ptr_finder; +template class region_ptr_finder; +template class region_ptr_finder; +template class region_ptr_finder; +template class region_ptr_finder; +template class region_ptr_finder; +template class region_ptr_finder; -template class region_ptr_finder; -template class region_ptr_finder; -template class region_ptr_finder; -template class region_ptr_finder; -template class region_ptr_finder; -template class region_ptr_finder; -template class region_ptr_finder; -template class region_ptr_finder; +template class region_ptr_finder; +template class region_ptr_finder; +template class region_ptr_finder; +template class region_ptr_finder; +template class region_ptr_finder; +template class region_ptr_finder; +template class region_ptr_finder; +template class region_ptr_finder; -template class shared_ptr_finder; -template class shared_ptr_finder; -template class shared_ptr_finder; -template class shared_ptr_finder; -template class shared_ptr_finder; -template class shared_ptr_finder; -template class shared_ptr_finder; -template class shared_ptr_finder; +template class shared_ptr_finder; +template class shared_ptr_finder; +template class shared_ptr_finder; +template class shared_ptr_finder; +template class shared_ptr_finder; +template class shared_ptr_finder; +template class shared_ptr_finder; +template class shared_ptr_finder; -template class shared_ptr_finder; -template class shared_ptr_finder; -template class shared_ptr_finder; -template class shared_ptr_finder; -template class shared_ptr_finder; -template class shared_ptr_finder; -template class shared_ptr_finder; -template class shared_ptr_finder; +template class shared_ptr_finder; +template class shared_ptr_finder; +template class shared_ptr_finder; +template class shared_ptr_finder; +template class shared_ptr_finder; +template class shared_ptr_finder; +template class shared_ptr_finder; +template class shared_ptr_finder; @@ -119,7 +119,7 @@ finder_base::~finder_base() // find_memregion - find memory region //------------------------------------------------- -void *finder_base::find_memregion(uint8_t width, size_t &length, bool required) const +void *finder_base::find_memregion(u8 width, size_t &length, bool required) const { // look up the region and return nullptr if not found memory_region *const region = m_base.memregion(m_tag); @@ -194,7 +194,7 @@ bool finder_base::validate_memregion(size_t bytes, bool required) const // find_memshare - find memory share //------------------------------------------------- -void *finder_base::find_memshare(uint8_t width, size_t &bytes, bool required) const +void *finder_base::find_memshare(u8 width, size_t &bytes, bool required) const { // look up the share and return nullptr if not found memory_share *share = m_base.memshare(m_tag); diff --git a/src/emu/devfind.h b/src/emu/devfind.h index b68bea2d46a..094bb5a194c 100644 --- a/src/emu/devfind.h +++ b/src/emu/devfind.h @@ -205,7 +205,7 @@ protected: /// found. /// \return Base pointer of the memeroy region if a matching region /// is found, or nullptr otherwise. - void *find_memregion(uint8_t width, size_t &length, bool required) const; + void *find_memregion(u8 width, size_t &length, bool required) const; /// \brief Check that memory region exists /// @@ -240,7 +240,7 @@ protected: /// found. /// \return Pointer to base of memory share if a matching memory /// share is found, or nullptr otherwise. - void *find_memshare(uint8_t width, size_t &bytes, bool required) const; + void *find_memshare(u8 width, size_t &bytes, bool required) const; /// \brief Log if object was not found /// @@ -646,12 +646,12 @@ public: /// \brief Get length in units of elements /// \return Length in units of elements or zero if no matching /// memory region has been found. - uint32_t length() const { return m_length; } + u32 length() const { return m_length; } /// \brief Get length in units of bytes /// \return Length in units of bytes or zero if no matching memory /// region has been found. - uint32_t bytes() const { return m_length * sizeof(PointerType); } + u32 bytes() const { return m_length * sizeof(PointerType); } /// \brief Get index mask /// @@ -659,7 +659,7 @@ public: /// used as a mask for index values if the length is a power of two. /// Result is undefined if no matching memory region has been found. /// \return Length in units of elements minus one. - uint32_t mask() const { return m_length - 1; } + u32 mask() const { return m_length - 1; } private: /// \brief Find memory region base pointer @@ -726,7 +726,7 @@ class shared_ptr_finder : public object_finder_base { public: // construction/destruction - shared_ptr_finder(device_t &base, char const *tag, uint8_t width = sizeof(PointerType) * 8) + shared_ptr_finder(device_t &base, char const *tag, u8 width = sizeof(PointerType) * 8) : object_finder_base(base, tag) , m_width(width) , m_bytes(0) @@ -738,14 +738,14 @@ public: PointerType &operator[](int index) const { return this->m_target[index]; } // getter for explicit fetching - uint32_t bytes() const { return m_bytes; } - uint32_t mask() const { return m_bytes - 1; } // FIXME: wrong when sizeof(PointerType) != 1 + u32 bytes() const { return m_bytes; } + u32 mask() const { return m_bytes - 1; } // FIXME: wrong when sizeof(PointerType) != 1 // setter for setting the object void set_target(PointerType *target, size_t bytes) { this->m_target = target; m_bytes = bytes; } // dynamic allocation of a shared pointer - void allocate(uint32_t entries) + void allocate(u32 entries) { assert(m_allocated.empty()); m_allocated.resize(entries); @@ -764,7 +764,7 @@ private: } // internal state - uint8_t const m_width; + u8 const m_width; size_t m_bytes; std::vector m_allocated; }; @@ -788,23 +788,23 @@ extern template class object_finder_base; extern template class object_finder_base; extern template class object_finder_base; -extern template class object_finder_base; -extern template class object_finder_base; -extern template class object_finder_base; -extern template class object_finder_base; -extern template class object_finder_base; -extern template class object_finder_base; -extern template class object_finder_base; -extern template class object_finder_base; +extern template class object_finder_base; +extern template class object_finder_base; +extern template class object_finder_base; +extern template class object_finder_base; +extern template class object_finder_base; +extern template class object_finder_base; +extern template class object_finder_base; +extern template class object_finder_base; -extern template class object_finder_base; -extern template class object_finder_base; -extern template class object_finder_base; -extern template class object_finder_base; -extern template class object_finder_base; -extern template class object_finder_base; -extern template class object_finder_base; -extern template class object_finder_base; +extern template class object_finder_base; +extern template class object_finder_base; +extern template class object_finder_base; +extern template class object_finder_base; +extern template class object_finder_base; +extern template class object_finder_base; +extern template class object_finder_base; +extern template class object_finder_base; extern template class memory_region_finder; extern template class memory_region_finder; @@ -815,41 +815,41 @@ extern template class memory_bank_finder; extern template class ioport_finder; extern template class ioport_finder; -extern template class region_ptr_finder; -extern template class region_ptr_finder; -extern template class region_ptr_finder; -extern template class region_ptr_finder; -extern template class region_ptr_finder; -extern template class region_ptr_finder; -extern template class region_ptr_finder; -extern template class region_ptr_finder; +extern template class region_ptr_finder; +extern template class region_ptr_finder; +extern template class region_ptr_finder; +extern template class region_ptr_finder; +extern template class region_ptr_finder; +extern template class region_ptr_finder; +extern template class region_ptr_finder; +extern template class region_ptr_finder; -extern template class region_ptr_finder; -extern template class region_ptr_finder; -extern template class region_ptr_finder; -extern template class region_ptr_finder; -extern template class region_ptr_finder; -extern template class region_ptr_finder; -extern template class region_ptr_finder; -extern template class region_ptr_finder; +extern template class region_ptr_finder; +extern template class region_ptr_finder; +extern template class region_ptr_finder; +extern template class region_ptr_finder; +extern template class region_ptr_finder; +extern template class region_ptr_finder; +extern template class region_ptr_finder; +extern template class region_ptr_finder; -extern template class shared_ptr_finder; -extern template class shared_ptr_finder; -extern template class shared_ptr_finder; -extern template class shared_ptr_finder; -extern template class shared_ptr_finder; -extern template class shared_ptr_finder; -extern template class shared_ptr_finder; -extern template class shared_ptr_finder; +extern template class shared_ptr_finder; +extern template class shared_ptr_finder; +extern template class shared_ptr_finder; +extern template class shared_ptr_finder; +extern template class shared_ptr_finder; +extern template class shared_ptr_finder; +extern template class shared_ptr_finder; +extern template class shared_ptr_finder; -extern template class shared_ptr_finder; -extern template class shared_ptr_finder; -extern template class shared_ptr_finder; -extern template class shared_ptr_finder; -extern template class shared_ptr_finder; -extern template class shared_ptr_finder; -extern template class shared_ptr_finder; -extern template class shared_ptr_finder; +extern template class shared_ptr_finder; +extern template class shared_ptr_finder; +extern template class shared_ptr_finder; +extern template class shared_ptr_finder; +extern template class shared_ptr_finder; +extern template class shared_ptr_finder; +extern template class shared_ptr_finder; +extern template class shared_ptr_finder; #endif // MAME_EMU_DEVFIND_H /** \} */ diff --git a/src/emu/device.cpp b/src/emu/device.cpp index 2e612694bd5..321c7b18390 100644 --- a/src/emu/device.cpp +++ b/src/emu/device.cpp @@ -23,7 +23,7 @@ // from the provided config //------------------------------------------------- -device_t::device_t(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source) +device_t::device_t(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, const char *shortname, const char *source) : m_type(type), m_name(name), m_shortname(shortname), @@ -157,7 +157,7 @@ std::string device_t::parameter(const char *tag) const // a device //------------------------------------------------- -void device_t::static_set_clock(device_t &device, uint32_t clock) +void device_t::static_set_clock(device_t &device, u32 clock) { // derive the clock from our owner if requested if ((clock & 0xff000000) == 0xff000000) @@ -237,7 +237,7 @@ void device_t::reset() // unscaled clock //------------------------------------------------- -void device_t::set_unscaled_clock(uint32_t clock) +void device_t::set_unscaled_clock(u32 clock) { m_unscaled_clock = clock; m_clock = m_unscaled_clock * m_clock_scale; @@ -265,15 +265,15 @@ void device_t::set_clock_scale(double clockscale) // clock ticks to an attotime //------------------------------------------------- -attotime device_t::clocks_to_attotime(uint64_t numclocks) const +attotime device_t::clocks_to_attotime(u64 numclocks) const { if (numclocks < m_clock) return attotime(0, numclocks * m_attoseconds_per_clock); else { - uint32_t remainder; - uint32_t quotient = divu_64x32_rem(numclocks, m_clock, &remainder); - return attotime(quotient, (uint64_t)remainder * (uint64_t)m_attoseconds_per_clock); + u32 remainder; + u32 quotient = divu_64x32_rem(numclocks, m_clock, &remainder); + return attotime(quotient, u64(remainder) * u64(m_attoseconds_per_clock)); } } @@ -283,9 +283,9 @@ attotime device_t::clocks_to_attotime(uint64_t numclocks) const // attotime to CPU clock ticks //------------------------------------------------- -uint64_t device_t::attotime_to_clocks(const attotime &duration) const +u64 device_t::attotime_to_clocks(const attotime &duration) const { - return mulu_32x32(duration.seconds(), m_clock) + (uint64_t)duration.attoseconds() / (uint64_t)m_attoseconds_per_clock; + return mulu_32x32(duration.seconds(), m_clock) + u64(duration.attoseconds()) / u64(m_attoseconds_per_clock); } diff --git a/src/emu/device.h b/src/emu/device.h index efc389f1823..37cf6631e4a 100644 --- a/src/emu/device.h +++ b/src/emu/device.h @@ -14,8 +14,8 @@ #error Dont include this file directly; include emu.h instead. #endif -#ifndef __DEVICE_H__ -#define __DEVICE_H__ +#ifndef MAME_EMU_DEVICE_H +#define MAME_EMU_DEVICE_H @@ -81,19 +81,19 @@ class device_missing_dependencies : public emu_exception { }; // a device_type is simply a pointer to its alloc function -typedef device_t *(*device_type)(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); +typedef device_t *(*device_type)(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); // this template function creates a stub which constructs a device template -device_t *device_creator(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +device_t *device_creator(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) { return global_alloc_clear<_DeviceClass>(mconfig, tag, owner, clock); } // timer IDs for devices -typedef uint32_t device_timer_id; +typedef u32 device_timer_id; // ======================> device_t @@ -194,7 +194,7 @@ class device_t : public delegate_late_bind protected: // construction/destruction - device_t(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source); + device_t(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, const char *shortname, const char *source); public: virtual ~device_t(); @@ -209,15 +209,15 @@ public: const char *source() const { return m_source.c_str(); } device_t *owner() const { return m_owner; } device_t *next() const { return m_next; } - uint32_t configured_clock() const { return m_configured_clock; } + u32 configured_clock() const { return m_configured_clock; } const machine_config &mconfig() const { return m_machine_config; } const input_device_default *input_ports_defaults() const { return m_input_defaults; } const std::vector &rom_region_vector() const; const rom_entry *rom_region() const { return rom_region_vector().data(); } machine_config_constructor machine_config_additions() const { return device_mconfig_additions(); } ioport_constructor input_ports() const { return device_input_ports(); } - uint8_t default_bios() const { return m_default_bios; } - uint8_t system_bios() const { return m_system_bios; } + u8 default_bios() const { return m_default_bios; } + u8 system_bios() const { return m_system_bios; } std::string default_bios_tag() const { return m_default_bios_tag; } // interface helpers @@ -255,7 +255,7 @@ public: std::string parameter(const char *tag) const; // configuration helpers - static void static_set_clock(device_t &device, uint32_t clock); + static void static_set_clock(device_t &device, u32 clock); static void static_set_input_default(device_t &device, const input_device_default *config) { device.m_input_defaults = config; } static void static_set_default_bios_tag(device_t &device, const char *tag) { std::string default_bios_tag(tag); device.m_default_bios_tag = default_bios_tag; } @@ -267,13 +267,13 @@ public: void reset(); // clock/timing accessors - uint32_t clock() const { return m_clock; } - uint32_t unscaled_clock() const { return m_unscaled_clock; } - void set_unscaled_clock(uint32_t clock); + u32 clock() const { return m_clock; } + u32 unscaled_clock() const { return m_unscaled_clock; } + void set_unscaled_clock(u32 clock); double clock_scale() const { return m_clock_scale; } void set_clock_scale(double clockscale); - attotime clocks_to_attotime(uint64_t clocks) const; - uint64_t attotime_to_clocks(const attotime &duration) const; + attotime clocks_to_attotime(u64 clocks) const; + u64 attotime_to_clocks(const attotime &duration) const; // timer interfaces emu_timer *timer_alloc(device_timer_id id = 0, void *ptr = nullptr); @@ -285,15 +285,15 @@ public: template void ATTR_COLD save_item(_ItemType &value, const char *valname, int index = 0) { assert(m_save != nullptr); m_save->save_item(this, name(), tag(), index, value, valname); } template - void ATTR_COLD save_pointer(_ItemType *value, const char *valname, uint32_t count, int index = 0) { assert(m_save != nullptr); m_save->save_pointer(this, name(), tag(), index, value, valname, count); } + void ATTR_COLD save_pointer(_ItemType *value, const char *valname, u32 count, int index = 0) { assert(m_save != nullptr); m_save->save_pointer(this, name(), tag(), index, value, valname, count); } // debugging device_debug *debug() const { return m_debug.get(); } offs_t safe_pc() const; offs_t safe_pcbase() const; - void set_default_bios(uint8_t bios) { m_default_bios = bios; } - void set_system_bios(uint8_t bios) { m_system_bios = bios; } + void set_default_bios(u8 bios) { m_default_bios = bios; } + void set_system_bios(u8 bios) { m_system_bios = bios; } bool findit(bool isvalidation = false) const; // misc @@ -345,9 +345,9 @@ protected: interface_list m_interfaces; // container for list of interfaces // device clocks - uint32_t m_configured_clock; // originally configured device clock - uint32_t m_unscaled_clock; // current unscaled device clock - uint32_t m_clock; // current device clock, after scaling + u32 m_configured_clock; // originally configured device clock + u32 m_unscaled_clock; // current unscaled device clock + u32 m_clock; // current device clock, after scaling double m_clock_scale; // clock scale factor attoseconds_t m_attoseconds_per_clock;// period in attoseconds @@ -355,8 +355,8 @@ protected: const machine_config & m_machine_config; // reference to the machine's configuration const input_device_default *m_input_defaults; // devices input ports default overrides - uint8_t m_system_bios; // the system BIOS we wish to load - uint8_t m_default_bios; // the default system BIOS + u8 m_system_bios; // the system BIOS we wish to load + u8 m_default_bios; // the default system BIOS std::string m_default_bios_tag; // tag of the default system BIOS private: @@ -792,4 +792,4 @@ inline device_t::interface_list::auto_iterator device_t::interface_list::auto_it } -#endif /* __DEVICE_H__ */ +#endif /* MAME_EMU_DEVICE_H */ diff --git a/src/emu/didisasm.cpp b/src/emu/didisasm.cpp index 33a4a0d002a..56777ea79bb 100644 --- a/src/emu/didisasm.cpp +++ b/src/emu/didisasm.cpp @@ -64,7 +64,7 @@ void device_disasm_interface::static_set_dasm_override(device_t &device, dasm_ov // disassemble - interface for disassembly //------------------------------------------------- -offs_t device_disasm_interface::disassemble(char *buffer, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) +offs_t device_disasm_interface::disassemble(char *buffer, offs_t pc, const u8 *oprom, const u8 *opram, u32 options) { offs_t result = 0; diff --git a/src/emu/didisasm.h b/src/emu/didisasm.h index d4064f6434d..19379e2d7a1 100644 --- a/src/emu/didisasm.h +++ b/src/emu/didisasm.h @@ -14,8 +14,8 @@ #error Dont include this file directly; include emu.h instead. #endif -#ifndef __DIDISASM_H__ -#define __DIDISASM_H__ +#ifndef MAME_EMU_DIDISASM_H +#define MAME_EMU_DIDISASM_H //************************************************************************** @@ -23,12 +23,12 @@ //************************************************************************** // Disassembler constants -const uint32_t DASMFLAG_SUPPORTED = 0x80000000; // are disassembly flags supported? -const uint32_t DASMFLAG_STEP_OUT = 0x40000000; // this instruction should be the end of a step out sequence -const uint32_t DASMFLAG_STEP_OVER = 0x20000000; // this instruction should be stepped over by setting a breakpoint afterwards -const uint32_t DASMFLAG_OVERINSTMASK = 0x18000000; // number of extra instructions to skip when stepping over -const uint32_t DASMFLAG_OVERINSTSHIFT = 27; // bits to shift after masking to get the value -const uint32_t DASMFLAG_LENGTHMASK = 0x0000ffff; // the low 16-bits contain the actual length +const u32 DASMFLAG_SUPPORTED = 0x80000000; // are disassembly flags supported? +const u32 DASMFLAG_STEP_OUT = 0x40000000; // this instruction should be the end of a step out sequence +const u32 DASMFLAG_STEP_OVER = 0x20000000; // this instruction should be stepped over by setting a breakpoint afterwards +const u32 DASMFLAG_OVERINSTMASK = 0x18000000; // number of extra instructions to skip when stepping over +const u32 DASMFLAG_OVERINSTSHIFT = 27; // bits to shift after masking to get the value +const u32 DASMFLAG_LENGTHMASK = 0x0000ffff; // the low 16-bits contain the actual length @@ -53,7 +53,7 @@ const uint32_t DASMFLAG_LENGTHMASK = 0x0000ffff; // the low 16-bits contain // TYPE DEFINITIONS //************************************************************************** -typedef device_delegate dasm_override_delegate; +typedef device_delegate dasm_override_delegate; // ======================> device_disasm_interface @@ -66,20 +66,20 @@ public: virtual ~device_disasm_interface(); // configuration access - uint32_t min_opcode_bytes() const { return disasm_min_opcode_bytes(); } - uint32_t max_opcode_bytes() const { return disasm_max_opcode_bytes(); } + u32 min_opcode_bytes() const { return disasm_min_opcode_bytes(); } + u32 max_opcode_bytes() const { return disasm_max_opcode_bytes(); } // static inline configuration helpers static void static_set_dasm_override(device_t &device, dasm_override_delegate dasm_override); // interface for disassembly - offs_t disassemble(char *buffer, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options = 0); + offs_t disassemble(char *buffer, offs_t pc, const u8 *oprom, const u8 *opram, u32 options = 0); protected: // required operation overrides - virtual uint32_t disasm_min_opcode_bytes() const = 0; - virtual uint32_t disasm_max_opcode_bytes() const = 0; - virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options) = 0; + virtual u32 disasm_min_opcode_bytes() const = 0; + virtual u32 disasm_max_opcode_bytes() const = 0; + virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const u8 *oprom, const u8 *opram, u32 options) = 0; // interface-level overrides virtual void interface_pre_start() override; @@ -92,4 +92,4 @@ private: typedef device_interface_iterator disasm_interface_iterator; -#endif /* __DIDISASM_H__ */ +#endif /* MAME_EMU_DIDISASM_H */ diff --git a/src/emu/diexec.cpp b/src/emu/diexec.cpp index 02c46244c0a..ea20860c426 100644 --- a/src/emu/diexec.cpp +++ b/src/emu/diexec.cpp @@ -154,7 +154,7 @@ bool device_execute_interface::executing() const // remaining in this timeslice //------------------------------------------------- -int32_t device_execute_interface::cycles_remaining() const +s32 device_execute_interface::cycles_remaining() const { return executing() ? *m_icountptr : 0; } @@ -235,7 +235,7 @@ void device_execute_interface::suspend_resume_changed() // suspend - set a suspend reason for this device //------------------------------------------------- -void device_execute_interface::suspend(uint32_t reason, bool eatcycles) +void device_execute_interface::suspend(u32 reason, bool eatcycles) { if (TEMPLOG) printf("suspend %s (%X)\n", device().tag(), reason); // set the suspend reason and eat cycles flag @@ -250,7 +250,7 @@ if (TEMPLOG) printf("suspend %s (%X)\n", device().tag(), reason); // device //------------------------------------------------- -void device_execute_interface::resume(uint32_t reason) +void device_execute_interface::resume(u32 reason) { if (TEMPLOG) printf("resume %s (%X)\n", device().tag(), reason); // clear the suspend reason and eat cycles flag @@ -333,7 +333,7 @@ attotime device_execute_interface::local_time() const // cycles executed on this device //------------------------------------------------- -uint64_t device_execute_interface::total_cycles() const +u64 device_execute_interface::total_cycles() const { if (executing()) { @@ -350,7 +350,7 @@ uint64_t device_execute_interface::total_cycles() const // of clocks to cycles, rounding down if necessary //------------------------------------------------- -uint64_t device_execute_interface::execute_clocks_to_cycles(uint64_t clocks) const +u64 device_execute_interface::execute_clocks_to_cycles(u64 clocks) const { return clocks; } @@ -361,7 +361,7 @@ uint64_t device_execute_interface::execute_clocks_to_cycles(uint64_t clocks) con // of cycles to clocks, rounding down if necessary //------------------------------------------------- -uint64_t device_execute_interface::execute_cycles_to_clocks(uint64_t cycles) const +u64 device_execute_interface::execute_cycles_to_clocks(u64 cycles) const { return cycles; } @@ -373,7 +373,7 @@ uint64_t device_execute_interface::execute_cycles_to_clocks(uint64_t cycles) con // operation can take //------------------------------------------------- -uint32_t device_execute_interface::execute_min_cycles() const +u32 device_execute_interface::execute_min_cycles() const { return 1; } @@ -385,7 +385,7 @@ uint32_t device_execute_interface::execute_min_cycles() const // operation can take //------------------------------------------------- -uint32_t device_execute_interface::execute_max_cycles() const +u32 device_execute_interface::execute_max_cycles() const { return 1; } @@ -396,7 +396,7 @@ uint32_t device_execute_interface::execute_max_cycles() const // of input lines for the device //------------------------------------------------- -uint32_t device_execute_interface::execute_input_lines() const +u32 device_execute_interface::execute_input_lines() const { return 0; } @@ -407,7 +407,7 @@ uint32_t device_execute_interface::execute_input_lines() const // IRQ vector when an acknowledge is processed //------------------------------------------------- -uint32_t device_execute_interface::execute_default_irq_vector() const +u32 device_execute_interface::execute_default_irq_vector() const { return 0; } @@ -419,7 +419,7 @@ uint32_t device_execute_interface::execute_default_irq_vector() const // spinning devices for performance optimization) //------------------------------------------------- -void device_execute_interface::execute_burn(int32_t cycles) +void device_execute_interface::execute_burn(s32 cycles) { // by default, do nothing } @@ -584,7 +584,7 @@ void device_execute_interface::interface_clock_changed() m_attoseconds_per_cycle = HZ_TO_ATTOSECONDS(m_cycles_per_second); // update the device's divisor - int64_t attos = m_attoseconds_per_cycle; + s64 attos = m_attoseconds_per_cycle; m_divshift = 0; while (attos >= (1UL << 31)) { @@ -803,7 +803,7 @@ if (TEMPLOG) printf("empty_queue(%s,%d,%d)\n", m_execute->device().tag(), m_line // loop over all events for (int curevent = 0; curevent < m_qindex; curevent++) { - int32_t input_event = m_queue[curevent]; + s32 input_event = m_queue[curevent]; // set the input line state and vector m_curstate = input_event & 0xff; diff --git a/src/emu/diexec.h b/src/emu/diexec.h index 3a0f5bfa53a..daec1a98a0c 100644 --- a/src/emu/diexec.h +++ b/src/emu/diexec.h @@ -14,8 +14,8 @@ #error Dont include this file directly; include emu.h instead. #endif -#ifndef __DIEXEC_H__ -#define __DIEXEC_H__ +#ifndef MAME_EMU_DIEXEC_H +#define MAME_EMU_DIEXEC_H //************************************************************************** @@ -23,14 +23,14 @@ //************************************************************************** // suspension reasons for executing devices -const uint32_t SUSPEND_REASON_HALT = 0x0001; // HALT line set (or equivalent) -const uint32_t SUSPEND_REASON_RESET = 0x0002; // RESET line set (or equivalent) -const uint32_t SUSPEND_REASON_SPIN = 0x0004; // currently spinning -const uint32_t SUSPEND_REASON_TRIGGER = 0x0008; // waiting for a trigger -const uint32_t SUSPEND_REASON_DISABLE = 0x0010; // disabled (due to disable flag) -const uint32_t SUSPEND_REASON_TIMESLICE = 0x0020; // waiting for the next timeslice -const uint32_t SUSPEND_REASON_CLOCK = 0x0040; // currently not clocked -const uint32_t SUSPEND_ANY_REASON = ~0; // all of the above +constexpr u32 SUSPEND_REASON_HALT = 0x0001; // HALT line set (or equivalent) +constexpr u32 SUSPEND_REASON_RESET = 0x0002; // RESET line set (or equivalent) +constexpr u32 SUSPEND_REASON_SPIN = 0x0004; // currently spinning +constexpr u32 SUSPEND_REASON_TRIGGER = 0x0008; // waiting for a trigger +constexpr u32 SUSPEND_REASON_DISABLE = 0x0010; // disabled (due to disable flag) +constexpr u32 SUSPEND_REASON_TIMESLICE = 0x0020; // waiting for the next timeslice +constexpr u32 SUSPEND_REASON_CLOCK = 0x0040; // currently not clocked +constexpr u32 SUSPEND_ANY_REASON = ~0; // all of the above // I/O line states @@ -71,7 +71,7 @@ enum // MACROS //************************************************************************** -#define TIMER_CALLBACK_MEMBER(name) void name(void *ptr, int32_t param) +#define TIMER_CALLBACK_MEMBER(name) void name(void *ptr, s32 param) // IRQ callback to be called by device implementations when an IRQ is actually taken #define IRQ_CALLBACK_MEMBER(func) int func(device_t &device, int irqline) @@ -138,14 +138,14 @@ public: // configuration access bool disabled() const { return m_disabled; } - uint64_t clocks_to_cycles(uint64_t clocks) const { return execute_clocks_to_cycles(clocks); } - uint64_t cycles_to_clocks(uint64_t cycles) const { return execute_cycles_to_clocks(cycles); } - uint32_t min_cycles() const { return execute_min_cycles(); } - uint32_t max_cycles() const { return execute_max_cycles(); } - attotime cycles_to_attotime(uint64_t cycles) const { return device().clocks_to_attotime(cycles_to_clocks(cycles)); } - uint64_t attotime_to_cycles(const attotime &duration) const { return clocks_to_cycles(device().attotime_to_clocks(duration)); } - uint32_t input_lines() const { return execute_input_lines(); } - uint32_t default_irq_vector() const { return execute_default_irq_vector(); } + u64 clocks_to_cycles(u64 clocks) const { return execute_clocks_to_cycles(clocks); } + u64 cycles_to_clocks(u64 cycles) const { return execute_cycles_to_clocks(cycles); } + u32 min_cycles() const { return execute_min_cycles(); } + u32 max_cycles() const { return execute_max_cycles(); } + attotime cycles_to_attotime(u64 cycles) const { return device().clocks_to_attotime(cycles_to_clocks(cycles)); } + u64 attotime_to_cycles(const attotime &duration) const { return clocks_to_cycles(device().attotime_to_clocks(duration)); } + u32 input_lines() const { return execute_input_lines(); } + u32 default_irq_vector() const { return execute_default_irq_vector(); } // static inline configuration helpers static void static_set_disable(device_t &device); @@ -156,7 +156,7 @@ public: // execution management device_scheduler &scheduler() const { assert(m_scheduler != nullptr); return *m_scheduler; } bool executing() const; - int32_t cycles_remaining() const; + s32 cycles_remaining() const; void eat_cycles(int cycles); void adjust_icount(int delta); void abort_timeslice(); @@ -168,9 +168,9 @@ public: int input_state(int linenum) const { return m_input[linenum].m_curstate; } // suspend/resume - void suspend(uint32_t reason, bool eatcycles); - void resume(uint32_t reason); - bool suspended(uint32_t reason = SUSPEND_ANY_REASON) const { return (m_nextsuspend & reason) != 0; } + void suspend(u32 reason, bool eatcycles); + void resume(u32 reason); + bool suspended(u32 reason = SUSPEND_ANY_REASON) const { return (m_nextsuspend & reason) != 0; } void yield() { suspend(SUSPEND_REASON_TIMESLICE, false); } void spin() { suspend(SUSPEND_REASON_TIMESLICE, true); } void spin_until_trigger(int trigid) { suspend_until_trigger(trigid, true); } @@ -184,7 +184,7 @@ public: // time and cycle accounting attotime local_time() const; - uint64_t total_cycles() const; + u64 total_cycles() const; // required operation overrides void run() { execute_run(); } @@ -195,18 +195,18 @@ public: protected: // clock and cycle information getters - virtual uint64_t execute_clocks_to_cycles(uint64_t clocks) const; - virtual uint64_t execute_cycles_to_clocks(uint64_t cycles) const; - virtual uint32_t execute_min_cycles() const; - virtual uint32_t execute_max_cycles() const; + virtual u64 execute_clocks_to_cycles(u64 clocks) const; + virtual u64 execute_cycles_to_clocks(u64 cycles) const; + virtual u32 execute_min_cycles() const; + virtual u32 execute_max_cycles() const; // input line information getters - virtual uint32_t execute_input_lines() const; - virtual uint32_t execute_default_irq_vector() const; + virtual u32 execute_input_lines() const; + virtual u32 execute_default_irq_vector() const; // optional operation overrides virtual void execute_run() = 0; - virtual void execute_burn(int32_t cycles); + virtual void execute_burn(s32 cycles); virtual void execute_set_input(int linenum, int state); // interface-level overrides @@ -239,10 +239,10 @@ protected: device_execute_interface *m_execute;// pointer to the execute interface int m_linenum; // which input line we are - int32_t m_stored_vector; // most recently written vector - int32_t m_curvector; // most recently processed vector - uint8_t m_curstate; // most recently processed state - int32_t m_queue[32]; // queue of pending events + s32 m_stored_vector; // most recently written vector + s32 m_curvector; // most recently processed vector + u8 m_curstate; // most recently processed state + s32 m_queue[32]; // queue of pending events int m_qindex; // index within the queue private: @@ -274,19 +274,19 @@ protected: int m_cycles_stolen; // number of cycles we artificially stole // suspend states - uint32_t m_suspend; // suspend reason mask (0 = not suspended) - uint32_t m_nextsuspend; // pending suspend reason mask - uint8_t m_eatcycles; // true if we eat cycles while suspended - uint8_t m_nexteatcycles; // pending value - int32_t m_trigger; // pending trigger to release a trigger suspension - int32_t m_inttrigger; // interrupt trigger index + u32 m_suspend; // suspend reason mask (0 = not suspended) + u32 m_nextsuspend; // pending suspend reason mask + u8 m_eatcycles; // true if we eat cycles while suspended + u8 m_nexteatcycles; // pending value + s32 m_trigger; // pending trigger to release a trigger suspension + s32 m_inttrigger; // interrupt trigger index // clock and timing information - uint64_t m_totalcycles; // total device cycles executed + u64 m_totalcycles; // total device cycles executed attotime m_localtime; // local time, relative to the timer system's global time - int32_t m_divisor; // 32-bit attoseconds_per_cycle divisor - uint8_t m_divshift; // right shift amount to fit the divisor into 32 bits - uint32_t m_cycles_per_second; // cycles per second, adjusted for multipliers + s32 m_divisor; // 32-bit attoseconds_per_cycle divisor + u8 m_divshift; // right shift amount to fit the divisor into 32 bits + u32 m_cycles_per_second; // cycles per second, adjusted for multipliers attoseconds_t m_attoseconds_per_cycle; // attoseconds per adjusted clock cycle private: @@ -305,4 +305,4 @@ private: typedef device_interface_iterator execute_interface_iterator; -#endif /* __DIEXEC_H__ */ +#endif /* MAME_EMU_DIEXEC_H */ diff --git a/src/emu/digfx.cpp b/src/emu/digfx.cpp index 56fe96865b9..e47d44036a8 100644 --- a/src/emu/digfx.cpp +++ b/src/emu/digfx.cpp @@ -124,23 +124,23 @@ void device_gfx_interface::decode_gfx(const gfx_decode_entry *gfxdecodeinfo) // local variables to hold mutable copies of gfx layout data gfx_layout glcopy; - std::vector extxoffs(0); - std::vector extyoffs(0); + std::vector extxoffs(0); + std::vector extyoffs(0); // loop over all elements - for (uint8_t curgfx = 0; curgfx < MAX_GFX_ELEMENTS && gfxdecodeinfo[curgfx].gfxlayout != nullptr; curgfx++) + for (u8 curgfx = 0; curgfx < MAX_GFX_ELEMENTS && gfxdecodeinfo[curgfx].gfxlayout != nullptr; curgfx++) { const gfx_decode_entry &gfx = gfxdecodeinfo[curgfx]; // extract the scale factors and xormask - uint32_t xscale = GFXENTRY_GETXSCALE(gfx.flags); - uint32_t yscale = GFXENTRY_GETYSCALE(gfx.flags); - uint32_t xormask = GFXENTRY_ISREVERSE(gfx.flags) ? 7 : 0; + u32 xscale = GFXENTRY_GETXSCALE(gfx.flags); + u32 yscale = GFXENTRY_GETYSCALE(gfx.flags); + u32 xormask = GFXENTRY_ISREVERSE(gfx.flags) ? 7 : 0; // resolve the region - uint32_t region_length; - const uint8_t *region_base; - uint8_t region_width; + u32 region_length; + const u8 *region_base; + u8 region_width; endianness_t region_endianness; if (gfx.memory_region != nullptr) @@ -151,7 +151,7 @@ void device_gfx_interface::decode_gfx(const gfx_decode_entry *gfxdecodeinfo) memory_share *share = basedevice.memshare(gfx.memory_region); assert(share != nullptr); region_length = 8 * share->bytes(); - region_base = reinterpret_cast(share->ptr()); + region_base = reinterpret_cast(share->ptr()); region_width = share->bytewidth(); region_endianness = share->endianness(); } @@ -205,8 +205,8 @@ void device_gfx_interface::decode_gfx(const gfx_decode_entry *gfxdecodeinfo) // copy the X and Y offsets into our temporary arrays extxoffs.resize(glcopy.width * xscale); extyoffs.resize(glcopy.height * yscale); - memcpy(&extxoffs[0], (glcopy.extxoffs != nullptr) ? glcopy.extxoffs : glcopy.xoffset, glcopy.width * sizeof(uint32_t)); - memcpy(&extyoffs[0], (glcopy.extyoffs != nullptr) ? glcopy.extyoffs : glcopy.yoffset, glcopy.height * sizeof(uint32_t)); + memcpy(&extxoffs[0], (glcopy.extxoffs != nullptr) ? glcopy.extxoffs : glcopy.xoffset, glcopy.width * sizeof(u32)); + memcpy(&extyoffs[0], (glcopy.extyoffs != nullptr) ? glcopy.extyoffs : glcopy.yoffset, glcopy.height * sizeof(u32)); // always use the extended offsets here glcopy.extxoffs = &extxoffs[0]; @@ -229,7 +229,7 @@ void device_gfx_interface::decode_gfx(const gfx_decode_entry *gfxdecodeinfo) // loop over all the planes, converting fractions for (int j = 0; j < glcopy.planes; j++) { - uint32_t value1 = glcopy.planeoffset[j]; + u32 value1 = glcopy.planeoffset[j]; if (IS_FRAC(value1)) { assert(region_length != 0); @@ -240,7 +240,7 @@ void device_gfx_interface::decode_gfx(const gfx_decode_entry *gfxdecodeinfo) // loop over all the X/Y offsets, converting fractions for (int j = 0; j < glcopy.width; j++) { - uint32_t value2 = extxoffs[j]; + u32 value2 = extxoffs[j]; if (IS_FRAC(value2)) { assert(region_length != 0); @@ -250,7 +250,7 @@ void device_gfx_interface::decode_gfx(const gfx_decode_entry *gfxdecodeinfo) for (int j = 0; j < glcopy.height; j++) { - uint32_t value3 = extyoffs[j]; + u32 value3 = extyoffs[j]; if (IS_FRAC(value3)) { assert(region_length != 0); @@ -328,7 +328,7 @@ void device_gfx_interface::interface_validity_check(validity_checker &valid) con else gfxregion = device().owner()->subtag(region); - uint32_t region_length = valid.region_length(gfxregion.c_str()); + u32 region_length = valid.region_length(gfxregion.c_str()); if (region_length == 0) osd_printf_error("gfx[%d] references nonexistent region '%s'\n", gfxnum, gfxregion.c_str()); diff --git a/src/emu/digfx.h b/src/emu/digfx.h index 9ce8c354db8..a8f8a80f672 100644 --- a/src/emu/digfx.h +++ b/src/emu/digfx.h @@ -14,8 +14,8 @@ #error Dont include this file directly; include emu.h instead. #endif -#ifndef __DIGFX_H__ -#define __DIGFX_H__ +#ifndef MAME_EMU_DIGFX_H +#define MAME_EMU_DIGFX_H @@ -23,9 +23,9 @@ // CONSTANTS //************************************************************************** -const uint8_t MAX_GFX_ELEMENTS = 32; -const uint16_t MAX_GFX_PLANES = 8; -const uint16_t MAX_GFX_SIZE = 32; +constexpr u8 MAX_GFX_ELEMENTS = 32; +constexpr u16 MAX_GFX_PLANES = 8; +constexpr u16 MAX_GFX_SIZE = 32; @@ -160,29 +160,29 @@ class palette_device; struct gfx_layout { - uint32_t xoffs(int x) const { return (extxoffs != nullptr) ? extxoffs[x] : xoffset[x]; } - uint32_t yoffs(int y) const { return (extyoffs != nullptr) ? extyoffs[y] : yoffset[y]; } + u32 xoffs(int x) const { return (extxoffs != nullptr) ? extxoffs[x] : xoffset[x]; } + u32 yoffs(int y) const { return (extyoffs != nullptr) ? extyoffs[y] : yoffset[y]; } - uint16_t width; // pixel width of each element - uint16_t height; // pixel height of each element - uint32_t total; // total number of elements, or RGN_FRAC() - uint16_t planes; // number of bitplanes - uint32_t planeoffset[MAX_GFX_PLANES]; // bit offset of each bitplane - uint32_t xoffset[MAX_GFX_SIZE]; // bit offset of each horizontal pixel - uint32_t yoffset[MAX_GFX_SIZE]; // bit offset of each vertical pixel - uint32_t charincrement; // distance between two consecutive elements (in bits) - const uint32_t * extxoffs; // extended X offset array for really big layouts - const uint32_t * extyoffs; // extended Y offset array for really big layouts + u16 width; // pixel width of each element + u16 height; // pixel height of each element + u32 total; // total number of elements, or RGN_FRAC() + u16 planes; // number of bitplanes + u32 planeoffset[MAX_GFX_PLANES]; // bit offset of each bitplane + u32 xoffset[MAX_GFX_SIZE]; // bit offset of each horizontal pixel + u32 yoffset[MAX_GFX_SIZE]; // bit offset of each vertical pixel + u32 charincrement; // distance between two consecutive elements (in bits) + const u32 * extxoffs; // extended X offset array for really big layouts + const u32 * extyoffs; // extended Y offset array for really big layouts }; struct gfx_decode_entry { const char * memory_region; // memory region where the data resides - uint32_t start; // offset of beginning of data to decode + u32 start; // offset of beginning of data to decode const gfx_layout *gfxlayout; // pointer to gfx_layout describing the layout; nullptr marks the end of the array - uint16_t color_codes_start; // offset in the color lookup table where color codes start - uint16_t total_color_codes; // total number of color codes - uint32_t flags; // flags and optional scaling factors + u16 color_codes_start; // offset in the color lookup table where color codes start + u16 total_color_codes; // total number of color codes + u32 flags; // flags and optional scaling factors }; // ======================> device_gfx_interface @@ -201,13 +201,13 @@ public: // getters palette_device &palette() const { assert(m_palette != nullptr); return *m_palette; } - gfx_element *gfx(uint8_t index) const { assert(index < MAX_GFX_ELEMENTS); return m_gfx[index].get(); } + gfx_element *gfx(u8 index) const { assert(index < MAX_GFX_ELEMENTS); return m_gfx[index].get(); } // decoding void decode_gfx(const gfx_decode_entry *gfxdecodeinfo); void decode_gfx() { decode_gfx(m_gfxdecodeinfo); } - void set_gfx(uint8_t index, std::unique_ptr &&element) { assert(index < MAX_GFX_ELEMENTS); m_gfx[index] = std::move(element); } + void set_gfx(u8 index, std::unique_ptr &&element) { assert(index < MAX_GFX_ELEMENTS); m_gfx[index] = std::move(element); } protected: // interface-level overrides @@ -232,4 +232,4 @@ private: typedef device_interface_iterator gfx_interface_iterator; -#endif /* __DIGFX_H__ */ +#endif /* MAME_EMU_DIGFX_H */ diff --git a/src/emu/diimage.cpp b/src/emu/diimage.cpp index cf945be1517..e4977f2de3d 100644 --- a/src/emu/diimage.cpp +++ b/src/emu/diimage.cpp @@ -177,7 +177,7 @@ void device_image_interface::device_compute_hash(util::hash_collection &hashes, if (partialhash) partialhash(hashes, (const unsigned char*)data, length, types); else - hashes.compute(reinterpret_cast(data), length, types); + hashes.compute(reinterpret_cast(data), length, types); } //------------------------------------------------- @@ -431,7 +431,7 @@ const std::string &device_image_interface::working_directory() // get_software_region //------------------------------------------------- -uint8_t *device_image_interface::get_software_region(const char *tag) +u8 *device_image_interface::get_software_region(const char *tag) { char full_tag[256]; @@ -448,7 +448,7 @@ uint8_t *device_image_interface::get_software_region(const char *tag) // image_get_software_region_length //------------------------------------------------- -uint32_t device_image_interface::get_software_region_length(const char *tag) +u32 device_image_interface::get_software_region_length(const char *tag) { char full_tag[256]; @@ -473,7 +473,7 @@ const char *device_image_interface::get_feature(const char *feature_name) // load_software_region - //------------------------------------------------- -bool device_image_interface::load_software_region(const char *tag, optional_shared_ptr &ptr) +bool device_image_interface::load_software_region(const char *tag, optional_shared_ptr &ptr) { size_t size = get_software_region_length(tag); @@ -498,11 +498,11 @@ bool device_image_interface::load_software_region(const char *tag, optional_shar void device_image_interface::run_hash(void (*partialhash)(util::hash_collection &, const unsigned char *, unsigned long, const char *), util::hash_collection &hashes, const char *types) { - uint32_t size; - std::vector buf; + u32 size; + std::vector buf; hashes.reset(); - size = (uint32_t) length(); + size = (u32) length(); buf.resize(size); memset(&buf[0], 0, size); @@ -527,7 +527,7 @@ void device_image_interface::image_checkhash() device_image_partialhash_func partialhash; // only calculate CRC if it hasn't been calculated, and the open_mode is read only - uint32_t crcval; + u32 crcval; if (!m_hash.crc(crcval) && is_readonly() && !m_created) { // do not cause a linear read of 600 megs please @@ -547,9 +547,9 @@ void device_image_interface::image_checkhash() return; } -uint32_t device_image_interface::crc() +u32 device_image_interface::crc() { - uint32_t crc = 0; + u32 crc = 0; image_checkhash(); m_hash.crc(crc); @@ -741,7 +741,7 @@ image_error_t device_image_interface::image_error_from_file_error(osd_file::erro // specific path //------------------------------------------------- -image_error_t device_image_interface::load_image_by_path(uint32_t open_flags, const std::string &path) +image_error_t device_image_interface::load_image_by_path(u32 open_flags, const std::string &path) { std::string revised_path; @@ -786,9 +786,9 @@ int device_image_interface::reopen_for_write(const std::string &path) // flags to use, and in what order //------------------------------------------------- -std::vector device_image_interface::determine_open_plan(bool is_create) +std::vector device_image_interface::determine_open_plan(bool is_create) { - std::vector open_plan; + std::vector open_plan; // emit flags into a vector if (!is_create && is_readable() && is_writeable()) @@ -822,13 +822,13 @@ static void dump_wrong_and_correct_checksums(const util::hash_collection &hashes // and hash signatures of a file //------------------------------------------------- -static int verify_length_and_hash(emu_file *file, const char *name, uint32_t explength, const util::hash_collection &hashes) +static int verify_length_and_hash(emu_file *file, const char *name, u32 explength, const util::hash_collection &hashes) { int retVal = 0; if (file==nullptr) return 0; // verify length - uint32_t actlength = file->size(); + u32 actlength = file->size(); if (explength != actlength) { osd_printf_error("%s WRONG LENGTH (expected: %d found: %d)\n", name, explength, actlength); @@ -879,14 +879,14 @@ bool device_image_interface::load_software(software_list_device &swlist, const c { osd_file::error filerr = osd_file::error::NOT_FOUND; - uint32_t crc = 0; + u32 crc = 0; bool has_crc = util::hash_collection(ROM_GETHASHDATA(romp)).crc(crc); const software_info *swinfo = swlist.find(swname); if (swinfo == nullptr) return false; - uint32_t supported = swinfo->supported(); + u32 supported = swinfo->supported(); if (supported == SOFTWARE_SUPPORTED_PARTIAL) osd_printf_error("WARNING: support for software %s (in list %s) is only partial\n", swname, swlist.list_name().c_str()); if (supported == SOFTWARE_SUPPORTED_NO) @@ -984,7 +984,7 @@ image_init_result device_image_interface::load_internal(const std::string &path, if (core_opens_image_file()) { // determine open plan - std::vector open_plan = determine_open_plan(is_create); + std::vector open_plan = determine_open_plan(is_create); // attempt to open the file in various ways for (auto iter = open_plan.cbegin(); !m_file && iter != open_plan.cend(); iter++) @@ -1491,7 +1491,7 @@ std::string device_image_interface::software_get_default_slot(const char *defaul //---------------------------------------------------------------------------- -static int image_fseek_thunk(void *file, int64_t offset, int whence) +static int image_fseek_thunk(void *file, s64 offset, int whence) { device_image_interface *image = (device_image_interface *) file; return image->fseek(offset, whence); @@ -1509,7 +1509,7 @@ static size_t image_fwrite_thunk(void *file, const void *buffer, size_t length) return image->fwrite(buffer, length); } -static uint64_t image_fsize_thunk(void *file) +static u64 image_fsize_thunk(void *file) { device_image_interface *image = (device_image_interface *) file; return image->length(); diff --git a/src/emu/diimage.h b/src/emu/diimage.h index 8c9aaaf9e7f..3e25c1fb565 100644 --- a/src/emu/diimage.h +++ b/src/emu/diimage.h @@ -14,8 +14,8 @@ #error Dont include this file directly; include emu.h instead. #endif -#ifndef __DIIMAGE_H__ -#define __DIIMAGE_H__ +#ifndef MAME_EMU_DIIMAGE_H +#define MAME_EMU_DIIMAGE_H #include #include @@ -179,16 +179,16 @@ public: bool is_filetype(const std::string &candidate_filetype) { return !core_stricmp(filetype().c_str(), candidate_filetype.c_str()); } bool is_open() const { return bool(m_file); } util::core_file &image_core_file() const { return *m_file; } - uint64_t length() { check_for_file(); return m_file->size(); } + u64 length() { check_for_file(); return m_file->size(); } bool is_readonly() const { return m_readonly; } - uint32_t fread(void *buffer, uint32_t length) { check_for_file(); return m_file->read(buffer, length); } - uint32_t fread(optional_shared_ptr &ptr, uint32_t length) { ptr.allocate(length); return fread(ptr.target(), length); } - uint32_t fread(optional_shared_ptr &ptr, uint32_t length, offs_t offset) { ptr.allocate(length); return fread(ptr + offset, length - offset); } - uint32_t fwrite(const void *buffer, uint32_t length) { check_for_file(); return m_file->write(buffer, length); } - int fseek(int64_t offset, int whence) { check_for_file(); return m_file->seek(offset, whence); } - uint64_t ftell() { check_for_file(); return m_file->tell(); } + u32 fread(void *buffer, u32 length) { check_for_file(); return m_file->read(buffer, length); } + u32 fread(optional_shared_ptr &ptr, u32 length) { ptr.allocate(length); return fread(ptr.target(), length); } + u32 fread(optional_shared_ptr &ptr, u32 length, offs_t offset) { ptr.allocate(length); return fread(ptr + offset, length - offset); } + u32 fwrite(const void *buffer, u32 length) { check_for_file(); return m_file->write(buffer, length); } + int fseek(s64 offset, int whence) { check_for_file(); return m_file->seek(offset, whence); } + u64 ftell() { check_for_file(); return m_file->tell(); } int fgetc() { char ch; if (fread(&ch, 1) != 1) ch = '\0'; return ch; } - char *fgets(char *buffer, uint32_t length) { check_for_file(); return m_file->gets(buffer, length); } + char *fgets(char *buffer, u32 length) { check_for_file(); return m_file->gets(buffer, length); } int image_feof() { check_for_file(); return m_file->eof(); } void *ptr() {check_for_file(); return const_cast(m_file->buffer()); } // configuration access @@ -197,7 +197,7 @@ public: const std::string &longname() const { return m_longname; } const std::string &manufacturer() const { return m_manufacturer; } const std::string &year() const { return m_year; } - uint32_t supported() const { return m_supported; } + u32 supported() const { return m_supported; } const software_info *software_entry() const { return m_software_info_ptr; } const software_part *part_entry() const { return m_software_part_ptr; } @@ -207,12 +207,12 @@ public: void set_working_directory(const char *working_directory) { m_working_directory = working_directory; } const std::string &working_directory(); - uint8_t *get_software_region(const char *tag); - uint32_t get_software_region_length(const char *tag); + u8 *get_software_region(const char *tag); + u32 get_software_region_length(const char *tag); const char *get_feature(const char *feature_name); - bool load_software_region(const char *tag, optional_shared_ptr &ptr); + bool load_software_region(const char *tag, optional_shared_ptr &ptr); - uint32_t crc(); + u32 crc(); util::hash_collection& hash() { return m_hash; } void battery_load(void *buffer, int length, int fill); @@ -255,7 +255,7 @@ protected: virtual const bool use_software_list_file_extension_for_filetype() const { return false; } image_init_result load_internal(const std::string &path, bool is_create, int create_format, util::option_resolution *create_args, bool just_load); - image_error_t load_image_by_path(uint32_t open_flags, const std::string &path); + image_error_t load_image_by_path(u32 open_flags, const std::string &path); void clear(); bool is_loaded(); @@ -308,7 +308,7 @@ protected: private: static image_error_t image_error_from_file_error(osd_file::error filerr); bool schedule_postload_hard_reset_if_needed(); - std::vector determine_open_plan(bool is_create); + std::vector determine_open_plan(bool is_create); // creation info formatlist_type m_formatlist; @@ -320,7 +320,7 @@ private: std::string m_longname; std::string m_manufacturer; std::string m_year; - uint32_t m_supported; + u32 m_supported; // flags bool m_readonly; @@ -346,4 +346,4 @@ private: // iterator typedef device_interface_iterator image_interface_iterator; -#endif /* __DIIMAGE_H__ */ +#endif /* MAME_EMU_DIIMAGE_H */ diff --git a/src/emu/dimemory.cpp b/src/emu/dimemory.cpp index 9d038af72d9..e42ad28e9d3 100644 --- a/src/emu/dimemory.cpp +++ b/src/emu/dimemory.cpp @@ -50,7 +50,7 @@ address_space_config::address_space_config() @param internal @param defmap */ -address_space_config::address_space_config(const char *name, endianness_t endian, uint8_t datawidth, uint8_t addrwidth, int8_t addrshift, address_map_constructor internal, address_map_constructor defmap) +address_space_config::address_space_config(const char *name, endianness_t endian, u8 datawidth, u8 addrwidth, s8 addrshift, address_map_constructor internal, address_map_constructor defmap) : m_name(name), m_endianness(endian), m_databus_width(datawidth), @@ -64,7 +64,7 @@ address_space_config::address_space_config(const char *name, endianness_t endian { } -address_space_config::address_space_config(const char *name, endianness_t endian, uint8_t datawidth, uint8_t addrwidth, int8_t addrshift, uint8_t logwidth, uint8_t pageshift, address_map_constructor internal, address_map_constructor defmap) +address_space_config::address_space_config(const char *name, endianness_t endian, u8 datawidth, u8 addrwidth, s8 addrshift, u8 logwidth, u8 pageshift, address_map_constructor internal, address_map_constructor defmap) : m_name(name), m_endianness(endian), m_databus_width(datawidth), @@ -78,7 +78,7 @@ address_space_config::address_space_config(const char *name, endianness_t endian { } -address_space_config::address_space_config(const char *name, endianness_t endian, uint8_t datawidth, uint8_t addrwidth, int8_t addrshift, address_map_delegate internal, address_map_delegate defmap) +address_space_config::address_space_config(const char *name, endianness_t endian, u8 datawidth, u8 addrwidth, s8 addrshift, address_map_delegate internal, address_map_delegate defmap) : m_name(name), m_endianness(endian), m_databus_width(datawidth), @@ -94,7 +94,7 @@ address_space_config::address_space_config(const char *name, endianness_t endian { } -address_space_config::address_space_config(const char *name, endianness_t endian, uint8_t datawidth, uint8_t addrwidth, int8_t addrshift, uint8_t logwidth, uint8_t pageshift, address_map_delegate internal, address_map_delegate defmap) +address_space_config::address_space_config(const char *name, endianness_t endian, u8 datawidth, u8 addrwidth, s8 addrshift, u8 logwidth, u8 pageshift, address_map_delegate internal, address_map_delegate defmap) : m_name(name), m_endianness(endian), m_databus_width(datawidth), @@ -189,7 +189,7 @@ bool device_memory_interface::memory_translate(address_spacenum spacenum, int in // handled by bypassing the memory system //------------------------------------------------- -bool device_memory_interface::memory_read(address_spacenum spacenum, offs_t offset, int size, uint64_t &value) +bool device_memory_interface::memory_read(address_spacenum spacenum, offs_t offset, int size, u64 &value) { // by default, we don't do anything return false; @@ -204,7 +204,7 @@ bool device_memory_interface::memory_read(address_spacenum spacenum, offs_t offs // handled by bypassing the memory system //------------------------------------------------- -bool device_memory_interface::memory_write(address_spacenum spacenum, offs_t offset, int size, uint64_t value) +bool device_memory_interface::memory_write(address_spacenum spacenum, offs_t offset, int size, u64 value) { // by default, we don't do anything return false; @@ -220,7 +220,7 @@ bool device_memory_interface::memory_write(address_spacenum spacenum, offs_t off // system //------------------------------------------------- -bool device_memory_interface::memory_readop(offs_t offset, int size, uint64_t &value) +bool device_memory_interface::memory_readop(offs_t offset, int size, u64 &value) { // by default, we don't do anything return false; diff --git a/src/emu/dimemory.h b/src/emu/dimemory.h index 67aef5abcd9..c5a3226c053 100644 --- a/src/emu/dimemory.h +++ b/src/emu/dimemory.h @@ -14,8 +14,8 @@ #error Dont include this file directly; include emu.h instead. #endif -#ifndef __DIMEMORY_H__ -#define __DIMEMORY_H__ +#ifndef MAME_EMU_DIMEMORY_H +#define MAME_EMU_DIMEMORY_H //************************************************************************** @@ -23,19 +23,19 @@ //************************************************************************** // Translation intentions -const int TRANSLATE_TYPE_MASK = 0x03; // read write or fetch -const int TRANSLATE_USER_MASK = 0x04; // user mode or fully privileged -const int TRANSLATE_DEBUG_MASK = 0x08; // debug mode (no side effects) +constexpr int TRANSLATE_TYPE_MASK = 0x03; // read write or fetch +constexpr int TRANSLATE_USER_MASK = 0x04; // user mode or fully privileged +constexpr int TRANSLATE_DEBUG_MASK = 0x08; // debug mode (no side effects) -const int TRANSLATE_READ = 0; // translate for read -const int TRANSLATE_WRITE = 1; // translate for write -const int TRANSLATE_FETCH = 2; // translate for instruction fetch -const int TRANSLATE_READ_USER = (TRANSLATE_READ | TRANSLATE_USER_MASK); -const int TRANSLATE_WRITE_USER = (TRANSLATE_WRITE | TRANSLATE_USER_MASK); -const int TRANSLATE_FETCH_USER = (TRANSLATE_FETCH | TRANSLATE_USER_MASK); -const int TRANSLATE_READ_DEBUG = (TRANSLATE_READ | TRANSLATE_DEBUG_MASK); -const int TRANSLATE_WRITE_DEBUG = (TRANSLATE_WRITE | TRANSLATE_DEBUG_MASK); -const int TRANSLATE_FETCH_DEBUG = (TRANSLATE_FETCH | TRANSLATE_DEBUG_MASK); +constexpr int TRANSLATE_READ = 0; // translate for read +constexpr int TRANSLATE_WRITE = 1; // translate for write +constexpr int TRANSLATE_FETCH = 2; // translate for instruction fetch +constexpr int TRANSLATE_READ_USER = (TRANSLATE_READ | TRANSLATE_USER_MASK); +constexpr int TRANSLATE_WRITE_USER = (TRANSLATE_WRITE | TRANSLATE_USER_MASK); +constexpr int TRANSLATE_FETCH_USER = (TRANSLATE_FETCH | TRANSLATE_USER_MASK); +constexpr int TRANSLATE_READ_DEBUG = (TRANSLATE_READ | TRANSLATE_DEBUG_MASK); +constexpr int TRANSLATE_WRITE_DEBUG = (TRANSLATE_WRITE | TRANSLATE_DEBUG_MASK); +constexpr int TRANSLATE_FETCH_DEBUG = (TRANSLATE_FETCH | TRANSLATE_DEBUG_MASK); @@ -100,9 +100,9 @@ public: bool translate(address_spacenum spacenum, int intention, offs_t &address) { return memory_translate(spacenum, intention, address); } // read/write access - bool read(address_spacenum spacenum, offs_t offset, int size, uint64_t &value) { return memory_read(spacenum, offset, size, value); } - bool write(address_spacenum spacenum, offs_t offset, int size, uint64_t value) { return memory_write(spacenum, offset, size, value); } - bool readop(offs_t offset, int size, uint64_t &value) { return memory_readop(offset, size, value); } + bool read(address_spacenum spacenum, offs_t offset, int size, u64 &value) { return memory_read(spacenum, offset, size, value); } + bool write(address_spacenum spacenum, offs_t offset, int size, u64 value) { return memory_write(spacenum, offset, size, value); } + bool readop(offs_t offset, int size, u64 &value) { return memory_readop(offset, size, value); } // deliberately ambiguous functions; if you have the memory interface // just use it @@ -114,9 +114,9 @@ protected: // optional operation overrides virtual bool memory_translate(address_spacenum spacenum, int intention, offs_t &address); - virtual bool memory_read(address_spacenum spacenum, offs_t offset, int size, uint64_t &value); - virtual bool memory_write(address_spacenum spacenum, offs_t offset, int size, uint64_t value); - virtual bool memory_readop(offs_t offset, int size, uint64_t &value); + virtual bool memory_read(address_spacenum spacenum, offs_t offset, int size, u64 &value); + virtual bool memory_write(address_spacenum spacenum, offs_t offset, int size, u64 value); + virtual bool memory_readop(offs_t offset, int size, u64 &value); // interface-level overrides virtual void interface_validity_check(validity_checker &valid) const override; @@ -134,4 +134,4 @@ typedef device_interface_iterator memory_interface_iter -#endif /* __DIMEMORY_H__ */ +#endif /* MAME_EMU_DIMEMORY_H */ diff --git a/src/emu/dinetwork.cpp b/src/emu/dinetwork.cpp index 03bbd409721..841a7e2524a 100644 --- a/src/emu/dinetwork.cpp +++ b/src/emu/dinetwork.cpp @@ -16,13 +16,13 @@ device_network_interface::~device_network_interface() { } -int device_network_interface::send(uint8_t *buf, int len) const +int device_network_interface::send(u8 *buf, int len) const { if(!m_dev) return 0; return m_dev->send(buf, len); } -void device_network_interface::recv_cb(uint8_t *buf, int len) +void device_network_interface::recv_cb(u8 *buf, int len) { } diff --git a/src/emu/dinetwork.h b/src/emu/dinetwork.h index 44ca6113a22..8cf6ec9c5a7 100644 --- a/src/emu/dinetwork.h +++ b/src/emu/dinetwork.h @@ -1,7 +1,7 @@ // license:BSD-3-Clause // copyright-holders:Carl, Miodrag Milanovic -#ifndef __DINETWORK_H__ -#define __DINETWORK_H__ +#ifndef MAME_EMU_DINETWORK_H +#define MAME_EMU_DINETWORK_H class osd_netdev; @@ -19,8 +19,8 @@ public: bool get_promisc() const { return m_promisc; } int get_interface() const { return m_intf; } - int send(uint8_t *buf, int len) const; - virtual void recv_cb(uint8_t *buf, int len); + int send(u8 *buf, int len) const; + virtual void recv_cb(u8 *buf, int len); protected: bool m_promisc; @@ -34,4 +34,4 @@ protected: // iterator typedef device_interface_iterator network_interface_iterator; -#endif +#endif // MAME_EMU_DINETWORK_H diff --git a/src/emu/dinvram.h b/src/emu/dinvram.h index 90f5651f7de..d48889d29dd 100644 --- a/src/emu/dinvram.h +++ b/src/emu/dinvram.h @@ -14,8 +14,8 @@ #error Dont include this file directly; include emu.h instead. #endif -#ifndef __DINVRAM_H__ -#define __DINVRAM_H__ +#ifndef MAME_EMU_DINVRAM +#define MAME_EMU_DINVRAM //************************************************************************** @@ -49,4 +49,4 @@ protected: typedef device_interface_iterator nvram_interface_iterator; -#endif /* __DINVRAM_H__ */ +#endif /* MAME_EMU_DINVRAM */ diff --git a/src/emu/dioutput.h b/src/emu/dioutput.h index 1ba6f9d9f81..70426a88509 100644 --- a/src/emu/dioutput.h +++ b/src/emu/dioutput.h @@ -14,8 +14,8 @@ #error Dont include this file directly; include emu.h instead. #endif -#ifndef __DIOUTPUT_H__ -#define __DIOUTPUT_H__ +#ifndef MAME_EMU_DIOUTPUT_H +#define MAME_EMU_DIOUTPUT_H @@ -59,4 +59,4 @@ protected: -#endif /* __DIOUTPUT_H__ */ +#endif /* MAME_EMU_DIOUTPUT_H */ diff --git a/src/emu/dipty.cpp b/src/emu/dipty.cpp index 7fab9b53a32..2759b27078a 100644 --- a/src/emu/dipty.cpp +++ b/src/emu/dipty.cpp @@ -51,18 +51,18 @@ bool device_pty_interface::is_open() const return m_opened; } -ssize_t device_pty_interface::read(uint8_t *rx_chars , size_t count) const +ssize_t device_pty_interface::read(u8 *rx_chars , size_t count) const { - std::uint32_t actual_bytes; + u32 actual_bytes; if (m_opened && m_pty_master->read(rx_chars, 0, count, actual_bytes) == osd_file::error::NONE) return actual_bytes; else return -1; } -void device_pty_interface::write(uint8_t tx_char) const +void device_pty_interface::write(u8 tx_char) const { - std::uint32_t actual_bytes; + u32 actual_bytes; if (m_opened) m_pty_master->write(&tx_char, 0, 1, actual_bytes); } diff --git a/src/emu/dipty.h b/src/emu/dipty.h index f9b38232c80..4d13f9f8470 100644 --- a/src/emu/dipty.h +++ b/src/emu/dipty.h @@ -29,8 +29,8 @@ public: bool is_open() const; - ssize_t read(uint8_t *rx_chars , size_t count) const; - void write(uint8_t tx_char) const; + ssize_t read(u8 *rx_chars , size_t count) const; + void write(u8 tx_char) const; bool is_slave_connected() const; diff --git a/src/emu/dirom.cpp b/src/emu/dirom.cpp index 85cd3e3c6b3..a4a9aadc365 100644 --- a/src/emu/dirom.cpp +++ b/src/emu/dirom.cpp @@ -1,7 +1,7 @@ #include "emu.h" -device_rom_interface::device_rom_interface(const machine_config &mconfig, device_t &device, uint8_t addrwidth, endianness_t endian, uint8_t datawidth) : +device_rom_interface::device_rom_interface(const machine_config &mconfig, device_t &device, u8 addrwidth, endianness_t endian, u8 datawidth) : device_memory_interface(mconfig, device), m_rom_config("rom", endian, datawidth, addrwidth) { @@ -41,10 +41,10 @@ void device_rom_interface::reset_bank() m_bank->set_entry(m_cur_bank); } -void device_rom_interface::set_rom(const void *base, uint32_t size) +void device_rom_interface::set_rom(const void *base, u32 size) { - uint32_t mend = m_rom_config.addr_width() == 32 ? 0xffffffff : (1 << m_rom_config.addr_width()) - 1; - uint32_t rend = size-1; + u32 mend = m_rom_config.addr_width() == 32 ? 0xffffffff : (1 << m_rom_config.addr_width()) - 1; + u32 rend = size-1; m_bank_count = mend == 0xffffffff ? 1 : (rend+1) / (mend+1); if(m_bank_count < 1) m_bank_count = 1; @@ -57,7 +57,7 @@ void device_rom_interface::set_rom(const void *base, uint32_t size) } else { // Round up to the nearest power-of-two-minus-one - uint32_t rmask = rend; + u32 rmask = rend; rmask |= rmask >> 1; rmask |= rmask >> 2; rmask |= rmask >> 4; @@ -85,7 +85,7 @@ void device_rom_interface::interface_pre_start() if(reg) set_rom(reg->base(), reg->bytes()); else { - uint32_t end = m_rom_config.addr_width() == 32 ? 0xffffffff : (1 << m_rom_config.addr_width()) - 1; + u32 end = m_rom_config.addr_width() == 32 ? 0xffffffff : (1 << m_rom_config.addr_width()) - 1; space().unmap_read(0, end); } } diff --git a/src/emu/dirom.h b/src/emu/dirom.h index cc8ee590ea9..ddbf35c9946 100644 --- a/src/emu/dirom.h +++ b/src/emu/dirom.h @@ -14,21 +14,21 @@ #error Dont include this file directly; include emu.h instead. #endif -#ifndef __DIROM_H__ -#define __DIROM_H__ +#ifndef MAME_EMU_DIROM_H +#define MAME_EMU_DIROM_H class device_rom_interface : public device_memory_interface { public: - device_rom_interface(const machine_config &mconfig, device_t &device, uint8_t addrwidth, endianness_t endian = ENDIANNESS_LITTLE, uint8_t datawidth = 8); + device_rom_interface(const machine_config &mconfig, device_t &device, u8 addrwidth, endianness_t endian = ENDIANNESS_LITTLE, u8 datawidth = 8); virtual ~device_rom_interface(); - inline uint8_t read_byte(offs_t byteaddress) { return m_rom_direct->read_byte(byteaddress); } - inline uint16_t read_word(offs_t byteaddress) { return m_rom_direct->read_word(byteaddress); } - inline uint32_t read_dword(offs_t byteaddress) { return m_rom_direct->read_dword(byteaddress); } - inline uint64_t read_qword(offs_t byteaddress) { return m_rom_direct->read_qword(byteaddress); } + inline u8 read_byte(offs_t byteaddress) { return m_rom_direct->read_byte(byteaddress); } + inline u16 read_word(offs_t byteaddress) { return m_rom_direct->read_word(byteaddress); } + inline u32 read_dword(offs_t byteaddress) { return m_rom_direct->read_dword(byteaddress); } + inline u64 read_qword(offs_t byteaddress) { return m_rom_direct->read_qword(byteaddress); } - void set_rom(const void *base, uint32_t size); + void set_rom(const void *base, u32 size); void set_rom_bank(int bank); protected: @@ -52,4 +52,4 @@ private: void reset_bank(); }; -#endif +#endif // MAME_EMU_DIROM_H diff --git a/src/emu/dirtc.cpp b/src/emu/dirtc.cpp index 12c7b5c1098..4243622822b 100644 --- a/src/emu/dirtc.cpp +++ b/src/emu/dirtc.cpp @@ -87,7 +87,7 @@ void device_rtc_interface::set_current_time(const system_time &systime) // convert_to_bcd - //------------------------------------------------- -uint8_t device_rtc_interface::convert_to_bcd(int val) +u8 device_rtc_interface::convert_to_bcd(int val) { return ((val / 10) << 4) | (val % 10); } @@ -97,7 +97,7 @@ uint8_t device_rtc_interface::convert_to_bcd(int val) // bcd_to_integer - //------------------------------------------------- -int device_rtc_interface::bcd_to_integer(uint8_t val) +int device_rtc_interface::bcd_to_integer(u8 val) { return (((val & 0xf0) >> 4) * 10) + (val & 0x0f); } diff --git a/src/emu/dirtc.h b/src/emu/dirtc.h index d486250ffac..acc4cfe4487 100644 --- a/src/emu/dirtc.h +++ b/src/emu/dirtc.h @@ -53,8 +53,8 @@ public: bool has_battery() const { return rtc_battery_backed(); } protected: - static uint8_t convert_to_bcd(int val); - static int bcd_to_integer(uint8_t val); + static u8 convert_to_bcd(int val); + static int bcd_to_integer(u8 val); void set_clock_register(int register, int value); int get_clock_register(int register); diff --git a/src/emu/diserial.cpp b/src/emu/diserial.cpp index 237d4ba7f67..9fae3f494f8 100644 --- a/src/emu/diserial.cpp +++ b/src/emu/diserial.cpp @@ -295,7 +295,7 @@ void device_serial_interface::receive_register_update_bit(int bit) void device_serial_interface::receive_register_extract() { - uint8_t data; + u8 data; receive_register_reset(); @@ -369,7 +369,7 @@ void device_serial_interface::transmit_register_add_bit(int bit) /* generate data in stream format ready for transfer */ -void device_serial_interface::transmit_register_setup(uint8_t data_byte) +void device_serial_interface::transmit_register_setup(u8 data_byte) { int i; unsigned char transmit_data; @@ -434,7 +434,7 @@ void device_serial_interface::transmit_register_setup(uint8_t data_byte) /* get a bit from the transmit register */ -uint8_t device_serial_interface::transmit_register_get_data_bit() +u8 device_serial_interface::transmit_register_get_data_bit() { int bit; diff --git a/src/emu/diserial.h b/src/emu/diserial.h index 4555c5a05b9..27c4cb00d74 100644 --- a/src/emu/diserial.h +++ b/src/emu/diserial.h @@ -92,20 +92,20 @@ protected: void set_rcv_rate(const attotime &rate); void set_tra_rate(const attotime &rate); - void set_rcv_rate(uint32_t clock, int div) { set_rcv_rate((clock && div) ? (attotime::from_hz(clock) * div) : attotime::never); } - void set_tra_rate(uint32_t clock, int div) { set_tra_rate((clock && div) ? (attotime::from_hz(clock) * div) : attotime::never); } + void set_rcv_rate(u32 clock, int div) { set_rcv_rate((clock && div) ? (attotime::from_hz(clock) * div) : attotime::never); } + void set_tra_rate(u32 clock, int div) { set_tra_rate((clock && div) ? (attotime::from_hz(clock) * div) : attotime::never); } void set_rcv_rate(int baud) { set_rcv_rate(baud ? attotime::from_hz(baud) : attotime::never); } void set_tra_rate(int baud) { set_tra_rate(baud ? attotime::from_hz(baud) : attotime::never); } void set_rate(const attotime &rate) { set_rcv_rate(rate); set_tra_rate(rate); } - void set_rate(uint32_t clock, int div) { set_rcv_rate(clock, div); set_tra_rate(clock, div); } + void set_rate(u32 clock, int div) { set_rcv_rate(clock, div); set_tra_rate(clock, div); } void set_rate(int baud) { set_rcv_rate(baud); set_tra_rate(baud); } void transmit_register_reset(); void transmit_register_add_bit(int bit); - void transmit_register_setup(uint8_t data_byte); - uint8_t transmit_register_get_data_bit(); + void transmit_register_setup(u8 data_byte); + u8 transmit_register_get_data_bit(); - uint8_t serial_helper_get_parity(uint8_t data) { return m_serial_parity_table[data]; } + u8 serial_helper_get_parity(u8 data) { return m_serial_parity_table[data]; } bool is_receive_register_full(); bool is_transmit_register_empty(); @@ -114,7 +114,7 @@ protected: bool is_receive_framing_error() const { return m_rcv_framing_error; } bool is_receive_parity_error() const { return m_rcv_parity_error; } - uint8_t get_received_char() const { return m_rcv_byte_received; } + u8 get_received_char() const { return m_rcv_byte_received; } virtual void tra_callback() { } virtual void rcv_callback() { receive_register_update_bit(m_rcv_line); } @@ -137,48 +137,48 @@ protected: private: enum { TRA_TIMER_ID = 10000, RCV_TIMER_ID }; - uint8_t m_serial_parity_table[256]; + u8 m_serial_parity_table[256]; // Data frame // number of start bits int m_df_start_bit_count; // length of word in bits - uint8_t m_df_word_length; + u8 m_df_word_length; // parity state - uint8_t m_df_parity; + u8 m_df_parity; // number of stop bits - uint8_t m_df_stop_bit_count; + u8 m_df_stop_bit_count; // Receive register /* data */ - uint16_t m_rcv_register_data; + u16 m_rcv_register_data; /* flags */ - uint8_t m_rcv_flags; + u8 m_rcv_flags; /* bit count received */ - uint8_t m_rcv_bit_count_received; + u8 m_rcv_bit_count_received; /* length of data to receive - includes data bits, parity bit and stop bit */ - uint8_t m_rcv_bit_count; + u8 m_rcv_bit_count; /* the byte of data received */ - uint8_t m_rcv_byte_received; + u8 m_rcv_byte_received; bool m_rcv_framing_error; bool m_rcv_parity_error; // Transmit register /* data */ - uint16_t m_tra_register_data; + u16 m_tra_register_data; /* flags */ - uint8_t m_tra_flags; + u8 m_tra_flags; /* number of bits transmitted */ - uint8_t m_tra_bit_count_transmitted; + u8 m_tra_bit_count_transmitted; /* length of data to send */ - uint8_t m_tra_bit_count; + u8 m_tra_bit_count; emu_timer *m_rcv_clock; emu_timer *m_tra_clock; attotime m_rcv_rate; attotime m_tra_rate; - uint8_t m_rcv_line; + u8 m_rcv_line; int m_tra_clock_state, m_rcv_clock_state; @@ -187,7 +187,7 @@ private: }; -template +template class device_buffered_serial_interface : public device_serial_interface { protected: @@ -219,7 +219,7 @@ protected: m_empty = 1U; } - void transmit_byte(uint8_t byte) + void transmit_byte(u8 byte) { assert(!m_empty || (m_head == m_tail)); assert(m_head < ARRAY_LENGTH(m_fifo)); @@ -260,11 +260,11 @@ protected: } private: - virtual void received_byte(uint8_t byte) = 0; + virtual void received_byte(u8 byte) = 0; - uint8_t m_fifo[FIFO_LENGTH]; - uint32_t m_head = 0U, m_tail = 0U; - uint8_t m_empty = 1U; + u8 m_fifo[FIFO_LENGTH]; + u32 m_head = 0U, m_tail = 0U; + u8 m_empty = 1U; }; #endif // MAME_EMU_DISERIAL_H diff --git a/src/emu/dislot.h b/src/emu/dislot.h index f7b404a635d..967442631de 100644 --- a/src/emu/dislot.h +++ b/src/emu/dislot.h @@ -6,8 +6,8 @@ #error Dont include this file directly; include emu.h instead. #endif -#ifndef __DISLOT_H__ -#define __DISLOT_H__ +#ifndef MAME_EMU_DISLOT_H +#define MAME_EMU_DISLOT_H //************************************************************************** // LEGACY MACROS @@ -77,7 +77,7 @@ public: const char *default_bios() const { return m_default_bios; } machine_config_constructor machine_config() const { return m_machine_config; } const input_device_default *input_device_defaults() const { return m_input_device_defaults; } - uint32_t clock() const { return m_clock; } + u32 clock() const { return m_clock; } private: // internal state @@ -87,7 +87,7 @@ private: const char *m_default_bios; machine_config_constructor m_machine_config; const input_device_default *m_input_device_defaults; - uint32_t m_clock; + u32 m_clock; }; @@ -108,7 +108,7 @@ public: static void static_set_option_default_bios(device_t &device, const char *option, const char *default_bios) { static_option(device, option)->m_default_bios = default_bios; } static void static_set_option_machine_config(device_t &device, const char *option, const machine_config_constructor machine_config) { static_option(device, option)->m_machine_config = machine_config; } static void static_set_option_device_input_defaults(device_t &device, const char *option, const input_device_default *default_input) { static_option(device, option)->m_input_device_defaults = default_input; } - static void static_set_option_clock(device_t &device, const char *option, uint32_t default_clock) { static_option(device, option)->m_clock = default_clock; } + static void static_set_option_clock(device_t &device, const char *option, u32 default_clock) { static_option(device, option)->m_clock = default_clock; } bool fixed() const { return m_fixed; } const char *default_option() const { return m_default_option; } const std::unordered_map> &option_list() const { return m_options; } @@ -137,4 +137,4 @@ public: virtual ~device_slot_card_interface(); }; -#endif /* __DISLOT_H__ */ +#endif /* MAME_EMU_DISLOT_H */ diff --git a/src/emu/disound.cpp b/src/emu/disound.cpp index 1450d1a56c4..2cf4748530f 100644 --- a/src/emu/disound.cpp +++ b/src/emu/disound.cpp @@ -42,7 +42,7 @@ device_sound_interface::~device_sound_interface() // a new route to the device //------------------------------------------------- -void device_sound_interface::static_add_route(device_t &device, uint32_t output, const char *target, double gain, uint32_t input, uint32_t mixoutput) +void device_sound_interface::static_add_route(device_t &device, u32 output, const char *target, double gain, u32 input, u32 mixoutput) { // find our sound interface device_sound_interface *sound; @@ -357,7 +357,7 @@ void device_sound_interface::interface_pre_reset() // sound_route - constructor //------------------------------------------------- -device_sound_interface::sound_route::sound_route(int output, int input, float gain, const char *target, uint32_t mixoutput) +device_sound_interface::sound_route::sound_route(int output, int input, float gain, const char *target, u32 mixoutput) : m_output(output), m_input(input), m_mixoutput(mixoutput), @@ -461,7 +461,7 @@ void device_mixer_interface::sound_stream_update(sound_stream &stream, stream_sa memset(outputs[output], 0, samples * sizeof(outputs[0][0])); // loop over samples - const uint8_t *outmap = &m_outputmap[0]; + const u8 *outmap = &m_outputmap[0]; for (int pos = 0; pos < samples; pos++) { // for each input, add it to the appropriate output diff --git a/src/emu/disound.h b/src/emu/disound.h index a47ce6ba919..d5684fed1c5 100644 --- a/src/emu/disound.h +++ b/src/emu/disound.h @@ -14,16 +14,16 @@ #error Dont include this file directly; include emu.h instead. #endif -#ifndef __DISOUND_H__ -#define __DISOUND_H__ +#ifndef MAME_EMU_DISOUND_H +#define MAME_EMU_DISOUND_H //************************************************************************** // CONSTANTS //************************************************************************** -const int ALL_OUTPUTS = 65535; // special value indicating all outputs for the current chip -const int AUTO_ALLOC_INPUT = 65535; +constexpr int ALL_OUTPUTS = 65535; // special value indicating all outputs for the current chip +constexpr int AUTO_ALLOC_INPUT = 65535; @@ -68,13 +68,13 @@ public: class sound_route { public: - sound_route(int output, int input, float gain, const char *target, uint32_t mixoutput); + sound_route(int output, int input, float gain, const char *target, u32 mixoutput); - uint32_t m_output; // output index, or ALL_OUTPUTS - uint32_t m_input; // target input index - uint32_t m_mixoutput; // target mixer output - float m_gain; // gain - std::string m_target; // target tag + u32 m_output; // output index, or ALL_OUTPUTS + u32 m_input; // target input index + u32 m_mixoutput; // target mixer output + float m_gain; // gain + std::string m_target; // target tag }; // construction/destruction @@ -87,7 +87,7 @@ public: const std::vector> &routes() const { return m_route_list; } // static inline configuration helpers - static void static_add_route(device_t &device, uint32_t output, const char *target, double gain, uint32_t input = AUTO_ALLOC_INPUT, uint32_t mixoutput = 0); + static void static_add_route(device_t &device, u32 output, const char *target, double gain, u32 input = AUTO_ALLOC_INPUT, u32 mixoutput = 0); static void static_reset_routes(device_t &device); // sound stream update overrides @@ -141,8 +141,8 @@ protected: virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override; // internal state - uint8_t m_outputs; // number of outputs - std::vector m_outputmap; // map of inputs to outputs + u8 m_outputs; // number of outputs + std::vector m_outputmap; // map of inputs to outputs sound_stream * m_mixer_stream; // mixing stream }; @@ -150,4 +150,4 @@ protected: typedef device_interface_iterator mixer_interface_iterator; -#endif /* __DISOUND_H__ */ +#endif /* MAME_EMU_DISOUND_H */ diff --git a/src/emu/dispatch.cpp b/src/emu/dispatch.cpp index 61a786e5cb6..b82fb85daf8 100644 --- a/src/emu/dispatch.cpp +++ b/src/emu/dispatch.cpp @@ -9,31 +9,31 @@ const device_type DEVCB_LINE_DISPATCH_4 = &device_creator >; const device_type DEVCB_LINE_DISPATCH_6 = &device_creator >; -template<> devcb_line_dispatch_device<2>::devcb_line_dispatch_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : +template<> devcb_line_dispatch_device<2>::devcb_line_dispatch_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, DEVCB_LINE_DISPATCH_2, "Line dispatcher (2 slots)", tag, owner, clock, "devcb_line_dispatch", __FILE__) { init_fwd(); } -template<> devcb_line_dispatch_device<3>::devcb_line_dispatch_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : +template<> devcb_line_dispatch_device<3>::devcb_line_dispatch_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, DEVCB_LINE_DISPATCH_3, "Line dispatcher (3 slots)", tag, owner, clock, "devcb_line_dispatch", __FILE__) { init_fwd(); } -template<> devcb_line_dispatch_device<4>::devcb_line_dispatch_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : +template<> devcb_line_dispatch_device<4>::devcb_line_dispatch_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, DEVCB_LINE_DISPATCH_4, "Line dispatcher (4 slots)", tag, owner, clock, "devcb_line_dispatch", __FILE__) { init_fwd(); } -template<> devcb_line_dispatch_device<5>::devcb_line_dispatch_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : +template<> devcb_line_dispatch_device<5>::devcb_line_dispatch_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, DEVCB_LINE_DISPATCH_5, "Line dispatcher (5 slots)", tag, owner, clock, "devcb_line_dispatch", __FILE__) { init_fwd(); } -template<> devcb_line_dispatch_device<6>::devcb_line_dispatch_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : +template<> devcb_line_dispatch_device<6>::devcb_line_dispatch_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, DEVCB_LINE_DISPATCH_6, "Line dispatcher (6 slots)", tag, owner, clock, "devcb_line_dispatch", __FILE__) { init_fwd(); diff --git a/src/emu/dispatch.h b/src/emu/dispatch.h index e6409373295..26be42e345e 100644 --- a/src/emu/dispatch.h +++ b/src/emu/dispatch.h @@ -14,8 +14,8 @@ #error Dont include this file directly; include emu.h instead. #endif -#ifndef __DISPATCH_H__ -#define __DISPATCH_H__ +#ifndef MAME_EMU_DISPATCH_H +#define MAME_EMU_DISPATCH_H #define MCFG_LINE_DISPATCH_ADD(_tag, _count) \ MCFG_DEVICE_ADD(_tag, DEVCB_LINE_DISPATCH_ ## _count, 0) @@ -31,7 +31,7 @@ extern const device_type DEVCB_LINE_DISPATCH_6; template class devcb_line_dispatch_device : public device_t { public: - devcb_line_dispatch_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + devcb_line_dispatch_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, DEVCB_LINE_DISPATCH_2, "DEVCB_LINE_DISPATCH_2", tag, owner, clock, "devcb_line_dispatch_2", __FILE__) { } void init_fwd() { @@ -61,4 +61,4 @@ private: devcb_write_line *fwd_cb[N]; }; -#endif +#endif // MAME_EMU_DISPATCH_H diff --git a/src/emu/distate.cpp b/src/emu/distate.cpp index 29730ec427b..6f10487e238 100644 --- a/src/emu/distate.cpp +++ b/src/emu/distate.cpp @@ -15,28 +15,28 @@ // GLOBAL VARIABLES //************************************************************************** -const uint64_t device_state_entry::k_decimal_divisor[] = +const u64 device_state_entry::k_decimal_divisor[] = { - 1, - 10, - 100, - 1000, - 10000, - 100000, - 1000000, - 10000000, - 100000000, - 1000000000, - U64(10000000000), - U64(100000000000), - U64(1000000000000), - U64(10000000000000), - U64(100000000000000), - U64(1000000000000000), - U64(10000000000000000), - U64(100000000000000000), - U64(1000000000000000000), - U64(10000000000000000000) + 1U, + 10U, + 100U, + 1000U, + 10000U, + 100000U, + 1000000U, + 10000000U, + 100000000U, + 1000000000U, + 10000000000U, + 100000000000U, + 1000000000000U, + 10000000000000U, + 100000000000000U, + 1000000000000000U, + 10000000000000000U, + 100000000000000000U, + 1000000000000000000U, + 10000000000000000000U }; @@ -49,7 +49,7 @@ const uint64_t device_state_entry::k_decimal_divisor[] = // device_state_entry - constructor //------------------------------------------------- -device_state_entry::device_state_entry(int index, const char *symbol, void *dataptr, uint8_t size, device_state_interface *dev) +device_state_entry::device_state_entry(int index, const char *symbol, void *dataptr, u8 size, device_state_interface *dev) : m_device_state(dev), m_index(index), m_dataptr(dataptr), @@ -69,7 +69,7 @@ device_state_entry::device_state_entry(int index, const char *symbol, void *data else if (size == 4) m_sizemask = 0xffffffff; else - m_sizemask = ~U64(0); + m_sizemask = ~u64(0); // default the data mask to the same m_datamask = m_sizemask; @@ -128,20 +128,20 @@ void device_state_entry::format_from_mask() // make up a format based on the mask int width = 0; - for (uint64_t tempmask = m_datamask; tempmask != 0; tempmask >>= 4) + for (u64 tempmask = m_datamask; tempmask != 0; tempmask >>= 4) width++; m_format = string_format("%%0%dX", width); } //------------------------------------------------- -// value - return the current value as a uint64_t +// value - return the current value as a u64 //------------------------------------------------- -uint64_t device_state_entry::value() const +u64 device_state_entry::value() const { // pick up the value - uint64_t result; + u64 result; switch (m_datasize) { default: @@ -162,7 +162,7 @@ uint64_t device_state_entry::value() const std::string device_state_entry::format(const char *string, bool maxout) const { std::string dest; - uint64_t result = value(); + u64 result = value(); // parse the format bool leadzero = false; @@ -344,10 +344,10 @@ std::string device_state_entry::format(const char *string, bool maxout) const //------------------------------------------------- -// set_value - set the value from a uint64_t +// set_value - set the value from a u64 //------------------------------------------------- -void device_state_entry::set_value(uint64_t value) const +void device_state_entry::set_value(u64 value) const { // apply the mask value &= m_datamask; @@ -408,10 +408,10 @@ device_state_interface::~device_state_interface() //------------------------------------------------- // state_int - return the value of the given piece -// of indexed state as a uint64_t +// of indexed state as a u64 //------------------------------------------------- -uint64_t device_state_interface::state_int(int index) +u64 device_state_interface::state_int(int index) { // nullptr or out-of-range entry returns 0 const device_state_entry *entry = state_find_entry(index); @@ -468,10 +468,10 @@ int device_state_interface::state_string_max_length(int index) //------------------------------------------------- // set_state_int - set the value of the given -// piece of indexed state from a uint64_t +// piece of indexed state from a u64 //------------------------------------------------- -void device_state_interface::set_state_int(int index, uint64_t value) +void device_state_interface::set_state_int(int index, u64 value) { // nullptr or out-of-range entry is a no-op const device_state_entry *entry = state_find_entry(index); @@ -510,10 +510,10 @@ void device_state_interface::set_state_string(int index, const char *string) //------------------------------------------------- // state_add - return the value of the given -// pieces of indexed state as a uint64_t +// pieces of indexed state as a u64 //------------------------------------------------- -device_state_entry &device_state_interface::state_add(int index, const char *symbol, void *data, uint8_t size) +device_state_entry &device_state_interface::state_add(int index, const char *symbol, void *data, u8 size) { // assert validity of incoming parameters assert(size == 1 || size == 2 || size == 4 || size == 8); diff --git a/src/emu/distate.h b/src/emu/distate.h index 67c706b390a..503b76c5832 100644 --- a/src/emu/distate.h +++ b/src/emu/distate.h @@ -14,8 +14,8 @@ #error Dont include this file directly; include emu.h instead. #endif -#ifndef __DISTATE_H__ -#define __DISTATE_H__ +#ifndef MAME_EMU_DISTATE_H +#define MAME_EMU_DISTATE_H //************************************************************************** @@ -46,13 +46,13 @@ class device_state_entry friend class device_state_interface; public: // construction/destruction - device_state_entry(int index, const char *symbol, void *dataptr, uint8_t size, device_state_interface *dev); + device_state_entry(int index, const char *symbol, void *dataptr, u8 size, device_state_interface *dev); device_state_entry(int index, device_state_interface *dev); public: // post-construction modifiers - device_state_entry &mask(uint64_t _mask) { m_datamask = _mask; format_from_mask(); return *this; } - device_state_entry &signed_mask(uint64_t _mask) { m_datamask = _mask; m_flags |= DSF_IMPORT_SEXT; format_from_mask(); return *this; } + device_state_entry &mask(u64 _mask) { m_datamask = _mask; format_from_mask(); return *this; } + device_state_entry &signed_mask(u64 _mask) { m_datamask = _mask; m_flags |= DSF_IMPORT_SEXT; format_from_mask(); return *this; } device_state_entry &formatstr(const char *_format); device_state_entry &callimport() { m_flags |= DSF_IMPORT; return *this; } device_state_entry &callexport() { m_flags |= DSF_EXPORT; return *this; } @@ -68,12 +68,12 @@ public: protected: // device state flags - static const uint8_t DSF_NOSHOW = 0x01; // don't display this entry in the registers view - static const uint8_t DSF_IMPORT = 0x02; // call the import function after writing new data - static const uint8_t DSF_IMPORT_SEXT = 0x04; // sign-extend the data when writing new data - static const uint8_t DSF_EXPORT = 0x08; // call the export function prior to fetching the data - static const uint8_t DSF_CUSTOM_STRING = 0x10; // set if the format has a custom string - static const uint8_t DSF_DIVIDER = 0x20; // set if this is a divider entry + static constexpr u8 DSF_NOSHOW = 0x01; // don't display this entry in the registers view + static constexpr u8 DSF_IMPORT = 0x02; // call the import function after writing new data + static constexpr u8 DSF_IMPORT_SEXT = 0x04; // sign-extend the data when writing new data + static constexpr u8 DSF_EXPORT = 0x08; // call the export function prior to fetching the data + static constexpr u8 DSF_CUSTOM_STRING = 0x10; // set if the format has a custom string + static constexpr u8 DSF_DIVIDER = 0x20; // set if this is a divider entry // helpers bool needs_custom_string() const { return ((m_flags & DSF_CUSTOM_STRING) != 0); } @@ -81,28 +81,28 @@ protected: // return the current value -- only for our friends who handle export bool needs_export() const { return ((m_flags & DSF_EXPORT) != 0); } - uint64_t value() const; + u64 value() const; std::string format(const char *string, bool maxout = false) const; // set the current value -- only for our friends who handle import bool needs_import() const { return ((m_flags & DSF_IMPORT) != 0); } - void set_value(uint64_t value) const; + void set_value(u64 value) const; void set_value(const char *string) const; // statics - static const uint64_t k_decimal_divisor[20]; // divisors for outputting decimal values + static const u64 k_decimal_divisor[20]; // divisors for outputting decimal values // public state description device_state_interface *m_device_state; // link to parent device state - uint32_t m_index; // index by which this item is referred + u32 m_index; // index by which this item is referred generic_ptr m_dataptr; // pointer to where the data lives - uint64_t m_datamask; // mask that applies to the data - uint8_t m_datasize; // size of the data - uint8_t m_flags; // flags for this data + u64 m_datamask; // mask that applies to the data + u8 m_datasize; // size of the data + u8 m_flags; // flags for this data std::string m_symbol; // symbol for display; all lower-case version for expressions std::string m_format; // supported formats bool m_default_format; // true if we are still using default format - uint64_t m_sizemask; // mask derived from the data size + u64 m_sizemask; // mask derived from the data size }; @@ -121,16 +121,16 @@ public: const std::vector> &state_entries() const { return m_state_list; } // state getters - uint64_t state_int(int index); + u64 state_int(int index); std::string state_string(int index) const; int state_string_max_length(int index); offs_t pc() { return state_int(STATE_GENPC); } offs_t pcbase() { return state_int(STATE_GENPCBASE); } offs_t sp() { return state_int(STATE_GENSP); } - uint64_t flags() { return state_int(STATE_GENFLAGS); } + u64 flags() { return state_int(STATE_GENFLAGS); } // state setters - void set_state_int(int index, uint64_t value); + void set_state_int(int index, u64 value); void set_state_string(int index, const char *string); void set_pc(offs_t pc) { set_state_int(STATE_GENPC, pc); } @@ -147,7 +147,7 @@ public: // protected eventually { return state_add(index, symbol, &data, sizeof(data)); } - device_state_entry &state_add(int index, const char *symbol, void *data, uint8_t size); + device_state_entry &state_add(int index, const char *symbol, void *data, u8 size); // add a new divider entry device_state_entry &state_add_divider(int index); @@ -166,8 +166,8 @@ protected: const device_state_entry *state_find_entry(int index) const; // constants - static const int FAST_STATE_MIN = -4; // range for fast state - static const int FAST_STATE_MAX = 256; // lookups + static constexpr int FAST_STATE_MIN = -4; // range for fast state + static constexpr int FAST_STATE_MAX = 256; // lookups // state std::vector> m_state_list; // head of state list @@ -206,4 +206,4 @@ inline offs_t device_t::safe_pcbase() const } -#endif /* __DISTATE_H__ */ +#endif /* MAME_EMU_DISTATE_H */ diff --git a/src/emu/divideo.h b/src/emu/divideo.h index e50a1b5df08..8c449b9bddc 100644 --- a/src/emu/divideo.h +++ b/src/emu/divideo.h @@ -14,8 +14,8 @@ #error Dont include this file directly; include emu.h instead. #endif -#ifndef __DIVIDEO_H__ -#define __DIVIDEO_H__ +#ifndef MAME_EMU_DIVIDEO_H +#define MAME_EMU_DIVIDEO_H //************************************************************************** @@ -65,4 +65,4 @@ protected: typedef device_interface_iterator video_interface_iterator; -#endif /* __DIVIDEO_H__ */ +#endif /* MAME_EMU_DIVIDEO_H */ diff --git a/src/emu/divtlb.cpp b/src/emu/divtlb.cpp index 2a3cad48bf3..b629ec81007 100644 --- a/src/emu/divtlb.cpp +++ b/src/emu/divtlb.cpp @@ -250,7 +250,7 @@ void device_vtlb_interface::vtlb_load(int entrynum, int numpages, offs_t address // vtlb_dynload - load a dynamic VTLB entry //------------------------------------------------- -void device_vtlb_interface::vtlb_dynload(uint32_t index, offs_t address, vtlb_entry value) +void device_vtlb_interface::vtlb_dynload(u32 index, offs_t address, vtlb_entry value) { vtlb_entry entry = m_table[index]; diff --git a/src/emu/divtlb.h b/src/emu/divtlb.h index 46746f91d60..d8614e593db 100644 --- a/src/emu/divtlb.h +++ b/src/emu/divtlb.h @@ -10,8 +10,8 @@ #pragma once -#ifndef __DIVTLB_H__ -#define __DIVTLB_H__ +#ifndef MAME_EMU_DIVTLB_H +#define MAME_EMU_DIVTLB_H @@ -19,16 +19,16 @@ CONSTANTS ***************************************************************************/ -#define VTLB_FLAGS_MASK 0xff +constexpr u32 VTLB_FLAGS_MASK = 0xff; -#define VTLB_READ_ALLOWED 0x01 /* (1 << TRANSLATE_READ) */ -#define VTLB_WRITE_ALLOWED 0x02 /* (1 << TRANSLATE_WRITE) */ -#define VTLB_FETCH_ALLOWED 0x04 /* (1 << TRANSLATE_FETCH) */ -#define VTLB_FLAG_VALID 0x08 -#define VTLB_USER_READ_ALLOWED 0x10 /* (1 << TRANSLATE_READ_USER) */ -#define VTLB_USER_WRITE_ALLOWED 0x20 /* (1 << TRANSLATE_WRITE_USER) */ -#define VTLB_USER_FETCH_ALLOWED 0x40 /* (1 << TRANSLATE_FETCH_USER) */ -#define VTLB_FLAG_FIXED 0x80 +constexpr u32 VTLB_READ_ALLOWED = 0x01; /* (1 << TRANSLATE_READ) */ +constexpr u32 VTLB_WRITE_ALLOWED = 0x02; /* (1 << TRANSLATE_WRITE) */ +constexpr u32 VTLB_FETCH_ALLOWED = 0x04; /* (1 << TRANSLATE_FETCH) */ +constexpr u32 VTLB_FLAG_VALID = 0x08; +constexpr u32 VTLB_USER_READ_ALLOWED = 0x10; /* (1 << TRANSLATE_READ_USER) */ +constexpr u32 VTLB_USER_WRITE_ALLOWED = 0x20; /* (1 << TRANSLATE_WRITE_USER) */ +constexpr u32 VTLB_USER_FETCH_ALLOWED = 0x40; /* (1 << TRANSLATE_FETCH_USER) */ +constexpr u32 VTLB_FLAG_FIXED = 0x80; @@ -37,7 +37,7 @@ ***************************************************************************/ /* represents an entry in the VTLB */ -typedef uint32_t vtlb_entry; +typedef u32 vtlb_entry; // ======================> device_vtlb_interface @@ -56,7 +56,7 @@ public: // filling bool vtlb_fill(offs_t address, int intention); void vtlb_load(int entrynum, int numpages, offs_t address, vtlb_entry value); - void vtlb_dynload(uint32_t index, offs_t address, vtlb_entry value); + void vtlb_dynload(u32 index, offs_t address, vtlb_entry value); // flushing void vtlb_flush_dynamic(); @@ -81,10 +81,10 @@ private: int m_pageshift; // bits to shift to get page index int m_addrwidth; // logical address bus width std::vector m_live; // array of live entries by table index - std::vector m_fixedpages; // number of pages each fixed entry covers + std::vector m_fixedpages; // number of pages each fixed entry covers std::vector m_table; // table of entries by address vtlb_entry *m_table_base; // pointer to m_table[0] }; -#endif /* __VTLB_H__ */ +#endif /* MAME_EMU_DIVTLB_H */ diff --git a/src/emu/drawgfx.cpp b/src/emu/drawgfx.cpp index bca40bb769b..b22576c59da 100644 --- a/src/emu/drawgfx.cpp +++ b/src/emu/drawgfx.cpp @@ -16,7 +16,7 @@ ***************************************************************************/ // if this line errors during compile, the size of NO_PRIORITY is wrong and I need to use something else -uint8_t no_priority_size_is_wrong[2 * (sizeof(NO_PRIORITY) == 3) - 1]; +u8 no_priority_size_is_wrong[2 * (sizeof(NO_PRIORITY) == 3) - 1]; bitmap_ind8 drawgfx_dummy_priority_bitmap; @@ -31,7 +31,7 @@ bitmap_ind8 drawgfx_dummy_priority_bitmap; offset -------------------------------------------------*/ -static inline int readbit(const uint8_t *src, unsigned int bitnum) +static inline int readbit(const u8 *src, unsigned int bitnum) { return src[bitnum / 8] & (0x80 >> (bitnum % 8)); } @@ -43,7 +43,7 @@ static inline int readbit(const uint8_t *src, unsigned int bitnum) than the width -------------------------------------------------*/ -static inline int32_t normalize_xscroll(const bitmap_t &bitmap, int32_t xscroll) +static inline s32 normalize_xscroll(const bitmap_t &bitmap, s32 xscroll) { return (xscroll >= 0) ? xscroll % bitmap.width() : (bitmap.width() - (-xscroll) % bitmap.width()); } @@ -55,7 +55,7 @@ static inline int32_t normalize_xscroll(const bitmap_t &bitmap, int32_t xscroll) than the height -------------------------------------------------*/ -static inline int32_t normalize_yscroll(const bitmap_t &bitmap, int32_t yscroll) +static inline s32 normalize_yscroll(const bitmap_t &bitmap, s32 yscroll) { return (yscroll >= 0) ? yscroll % bitmap.height() : (bitmap.height() - (-yscroll) % bitmap.height()); } @@ -68,7 +68,7 @@ static inline int32_t normalize_yscroll(const bitmap_t &bitmap, int32_t yscroll) const device_type GFXDECODE = &device_creator; -gfxdecode_device::gfxdecode_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : +gfxdecode_device::gfxdecode_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, GFXDECODE, "gfxdecode", tag, owner, clock, "gfxdecode", __FILE__), device_gfx_interface(mconfig, *this) { @@ -86,7 +86,7 @@ gfxdecode_device::gfxdecode_device(const machine_config &mconfig, const char *ta // gfx_element - constructor //------------------------------------------------- -gfx_element::gfx_element(palette_device &palette, uint8_t *base, uint16_t width, uint16_t height, uint32_t rowbytes, uint32_t total_colors, uint32_t color_base, uint32_t color_granularity) +gfx_element::gfx_element(palette_device &palette, u8 *base, u16 width, u16 height, u32 rowbytes, u32 total_colors, u32 color_base, u32 color_granularity) : m_palette(&palette), m_width(width), m_height(height), @@ -111,7 +111,7 @@ gfx_element::gfx_element(palette_device &palette, uint8_t *base, uint16_t width, { } -gfx_element::gfx_element(palette_device &palette, const gfx_layout &gl, const uint8_t *srcdata, uint32_t xormask, uint32_t total_colors, uint32_t color_base) +gfx_element::gfx_element(palette_device &palette, const gfx_layout &gl, const u8 *srcdata, u32 xormask, u32 total_colors, u32 color_base) : m_palette(&palette), m_width(0), m_height(0), @@ -143,7 +143,7 @@ gfx_element::gfx_element(palette_device &palette, const gfx_layout &gl, const ui // set_layout - set the layout for a gfx_element //------------------------------------------------- -void gfx_element::set_layout(const gfx_layout &gl, const uint8_t *srcdata) +void gfx_element::set_layout(const gfx_layout &gl, const u8 *srcdata) { m_srcdata = srcdata; @@ -174,7 +174,7 @@ void gfx_element::set_layout(const gfx_layout &gl, const uint8_t *srcdata) // RAW graphics must have a pointer up front assert(srcdata != nullptr); - m_gfxdata = const_cast(srcdata); + m_gfxdata = const_cast(srcdata); } // decoded graphics case @@ -217,7 +217,7 @@ void gfx_element::set_layout(const gfx_layout &gl, const uint8_t *srcdata) // set_raw_layout - set the layout for a gfx_element //------------------------------------------------- -void gfx_element::set_raw_layout(const uint8_t *srcdata, uint32_t width, uint32_t height, uint32_t total, uint32_t linemod, uint32_t charmod) +void gfx_element::set_raw_layout(const u8 *srcdata, u32 width, u32 height, u32 total, u32 linemod, u32 charmod) { gfx_layout layout = { 0 }; layout.width = width; @@ -235,11 +235,11 @@ void gfx_element::set_raw_layout(const uint8_t *srcdata, uint32_t width, uint32_ // set_source - set the source data for a gfx_element //------------------------------------------------- -void gfx_element::set_source(const uint8_t *source) +void gfx_element::set_source(const u8 *source) { m_srcdata = source; memset(&m_dirty[0], 1, elements()); - if (m_layout_is_raw) m_gfxdata = const_cast(source); + if (m_layout_is_raw) m_gfxdata = const_cast(source); } @@ -248,7 +248,7 @@ void gfx_element::set_source(const uint8_t *source) // and total elements for a gfx_element //------------------------------------------------- -void gfx_element::set_source_and_total(const uint8_t *source, uint32_t total) +void gfx_element::set_source_and_total(const u8 *source, u32 total) { m_srcdata = source; m_total_elements = total; @@ -263,7 +263,7 @@ void gfx_element::set_source_and_total(const uint8_t *source, uint32_t total) if (m_layout_is_raw) { - m_gfxdata = const_cast(source); + m_gfxdata = const_cast(source); } else { @@ -278,7 +278,7 @@ void gfx_element::set_source_and_total(const uint8_t *source, uint32_t total) // set_source_clip - set a source clipping rect //------------------------------------------------- -void gfx_element::set_source_clip(uint32_t xoffs, uint32_t width, uint32_t yoffs, uint32_t height) +void gfx_element::set_source_clip(u32 xoffs, u32 width, u32 yoffs, u32 height) { assert(xoffs < m_origwidth); assert(yoffs < m_origheight); @@ -296,13 +296,13 @@ void gfx_element::set_source_clip(uint32_t xoffs, uint32_t width, uint32_t yoffs // decode - decode a single character //------------------------------------------------- -void gfx_element::decode(uint32_t code) +void gfx_element::decode(u32 code) { // don't decode GFX_RAW if (!m_layout_is_raw) { // zap the data to 0 - uint8_t *decode_base = m_gfxdata + code * m_char_modulo; + u8 *decode_base = m_gfxdata + code * m_char_modulo; memset(decode_base, 0, m_char_modulo); // iterate over planes @@ -317,7 +317,7 @@ void gfx_element::decode(uint32_t code) for (int y = 0; y < m_origheight; y++) { int yoffs = planeoffs + m_layout_yoffset[y]; - uint8_t *dp = decode_base + y * m_line_modulo; + u8 *dp = decode_base + y * m_line_modulo; // iterate over columns for (int x = 0; x < m_origwidth; x++) @@ -331,8 +331,8 @@ void gfx_element::decode(uint32_t code) if (code < m_pen_usage.size()) { // iterate over data, creating a bitmask of live pens - const uint8_t *dp = m_gfxdata + code * m_char_modulo; - uint32_t usage = 0; + const u8 *dp = m_gfxdata + code * m_char_modulo; + u32 usage = 0; for (int y = 0; y < m_origheight; y++) { for (int x = 0; x < m_origwidth; x++) @@ -360,21 +360,21 @@ void gfx_element::decode(uint32_t code) -------------------------------------------------*/ void gfx_element::opaque(bitmap_ind16 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty) { color = colorbase() + granularity() * (color % colors()); code %= elements(); DECLARE_NO_PRIORITY; - DRAWGFX_CORE(uint16_t, PIXEL_OP_REBASE_OPAQUE, NO_PRIORITY); + DRAWGFX_CORE(u16, PIXEL_OP_REBASE_OPAQUE, NO_PRIORITY); } void gfx_element::opaque(bitmap_rgb32 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty) { const pen_t *paldata = m_palette->pens() + colorbase() + granularity() * (color % colors()); code %= elements(); DECLARE_NO_PRIORITY; - DRAWGFX_CORE(uint32_t, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY); + DRAWGFX_CORE(u32, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY); } @@ -384,8 +384,8 @@ void gfx_element::opaque(bitmap_rgb32 &dest, const rectangle &cliprect, -------------------------------------------------*/ void gfx_element::transpen(bitmap_ind16 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - uint32_t trans_pen) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + u32 trans_pen) { // special case invalid pens to opaque if (trans_pen > 0xff) @@ -396,7 +396,7 @@ void gfx_element::transpen(bitmap_ind16 &dest, const rectangle &cliprect, if (has_pen_usage()) { // fully transparent; do nothing - uint32_t usage = pen_usage(code); + u32 usage = pen_usage(code); if ((usage & ~(1 << trans_pen)) == 0) return; @@ -408,12 +408,12 @@ void gfx_element::transpen(bitmap_ind16 &dest, const rectangle &cliprect, // render color = colorbase() + granularity() * (color % colors()); DECLARE_NO_PRIORITY; - DRAWGFX_CORE(uint16_t, PIXEL_OP_REBASE_TRANSPEN, NO_PRIORITY); + DRAWGFX_CORE(u16, PIXEL_OP_REBASE_TRANSPEN, NO_PRIORITY); } void gfx_element::transpen(bitmap_rgb32 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - uint32_t trans_pen) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + u32 trans_pen) { // special case invalid pens to opaque if (trans_pen > 0xff) @@ -424,7 +424,7 @@ void gfx_element::transpen(bitmap_rgb32 &dest, const rectangle &cliprect, if (has_pen_usage()) { // fully transparent; do nothing - uint32_t usage = pen_usage(code); + u32 usage = pen_usage(code); if ((usage & ~(1 << trans_pen)) == 0) return; @@ -436,7 +436,7 @@ void gfx_element::transpen(bitmap_rgb32 &dest, const rectangle &cliprect, // render const pen_t *paldata = m_palette->pens() + colorbase() + granularity() * (color % colors()); DECLARE_NO_PRIORITY; - DRAWGFX_CORE(uint32_t, PIXEL_OP_REMAP_TRANSPEN, NO_PRIORITY); + DRAWGFX_CORE(u32, PIXEL_OP_REMAP_TRANSPEN, NO_PRIORITY); } @@ -447,8 +447,8 @@ void gfx_element::transpen(bitmap_rgb32 &dest, const rectangle &cliprect, -------------------------------------------------*/ void gfx_element::transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - uint32_t trans_pen) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + u32 trans_pen) { // early out if completely transparent code %= elements(); @@ -457,12 +457,12 @@ void gfx_element::transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, // render DECLARE_NO_PRIORITY; - DRAWGFX_CORE(uint16_t, PIXEL_OP_REBASE_TRANSPEN, NO_PRIORITY); + DRAWGFX_CORE(u16, PIXEL_OP_REBASE_TRANSPEN, NO_PRIORITY); } void gfx_element::transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - uint32_t trans_pen) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + u32 trans_pen) { // early out if completely transparent code %= elements(); @@ -471,7 +471,7 @@ void gfx_element::transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, // render DECLARE_NO_PRIORITY; - DRAWGFX_CORE(uint32_t, PIXEL_OP_REBASE_TRANSPEN, NO_PRIORITY); + DRAWGFX_CORE(u32, PIXEL_OP_REBASE_TRANSPEN, NO_PRIORITY); } @@ -482,8 +482,8 @@ void gfx_element::transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, -------------------------------------------------*/ void gfx_element::transmask(bitmap_ind16 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - uint32_t trans_mask) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + u32 trans_mask) { // special case 0 mask to opaque if (trans_mask == 0) @@ -494,7 +494,7 @@ void gfx_element::transmask(bitmap_ind16 &dest, const rectangle &cliprect, if (has_pen_usage()) { // fully transparent; do nothing - uint32_t usage = pen_usage(code); + u32 usage = pen_usage(code); if ((usage & ~trans_mask) == 0) return; @@ -506,12 +506,12 @@ void gfx_element::transmask(bitmap_ind16 &dest, const rectangle &cliprect, // render color = colorbase() + granularity() * (color % colors()); DECLARE_NO_PRIORITY; - DRAWGFX_CORE(uint16_t, PIXEL_OP_REBASE_TRANSMASK, NO_PRIORITY); + DRAWGFX_CORE(u16, PIXEL_OP_REBASE_TRANSMASK, NO_PRIORITY); } void gfx_element::transmask(bitmap_rgb32 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - uint32_t trans_mask) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + u32 trans_mask) { // special case 0 mask to opaque if (trans_mask == 0) @@ -522,7 +522,7 @@ void gfx_element::transmask(bitmap_rgb32 &dest, const rectangle &cliprect, if (has_pen_usage()) { // fully transparent; do nothing - uint32_t usage = pen_usage(code); + u32 usage = pen_usage(code); if ((usage & ~trans_mask) == 0) return; @@ -534,7 +534,7 @@ void gfx_element::transmask(bitmap_rgb32 &dest, const rectangle &cliprect, // render const pen_t *paldata = m_palette->pens() + colorbase() + granularity() * (color % colors()); DECLARE_NO_PRIORITY; - DRAWGFX_CORE(uint32_t, PIXEL_OP_REMAP_TRANSMASK, NO_PRIORITY); + DRAWGFX_CORE(u32, PIXEL_OP_REMAP_TRANSMASK, NO_PRIORITY); } @@ -545,8 +545,8 @@ void gfx_element::transmask(bitmap_rgb32 &dest, const rectangle &cliprect, -------------------------------------------------*/ void gfx_element::transtable(bitmap_ind16 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - const uint8_t *pentable) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + const u8 *pentable) { assert(pentable != nullptr); @@ -555,12 +555,12 @@ void gfx_element::transtable(bitmap_ind16 &dest, const rectangle &cliprect, const pen_t *shadowtable = m_palette->shadow_table(); code %= elements(); DECLARE_NO_PRIORITY; - DRAWGFX_CORE(uint16_t, PIXEL_OP_REBASE_TRANSTABLE16, NO_PRIORITY); + DRAWGFX_CORE(u16, PIXEL_OP_REBASE_TRANSTABLE16, NO_PRIORITY); } void gfx_element::transtable(bitmap_rgb32 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - const uint8_t *pentable) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + const u8 *pentable) { assert(pentable != nullptr); @@ -569,7 +569,7 @@ void gfx_element::transtable(bitmap_rgb32 &dest, const rectangle &cliprect, const pen_t *shadowtable = m_palette->shadow_table(); code %= elements(); DECLARE_NO_PRIORITY; - DRAWGFX_CORE(uint32_t, PIXEL_OP_REMAP_TRANSTABLE32, NO_PRIORITY); + DRAWGFX_CORE(u32, PIXEL_OP_REMAP_TRANSTABLE32, NO_PRIORITY); } @@ -580,8 +580,8 @@ void gfx_element::transtable(bitmap_rgb32 &dest, const rectangle &cliprect, -------------------------------------------------*/ void gfx_element::alpha(bitmap_rgb32 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - uint32_t trans_pen, uint8_t alpha_val) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + u32 trans_pen, u8 alpha_val) { // special case alpha = 0xff if (alpha_val == 0xff) @@ -595,7 +595,7 @@ void gfx_element::alpha(bitmap_rgb32 &dest, const rectangle &cliprect, // get final code and color, and grab lookup tables const pen_t *paldata = m_palette->pens() + colorbase() + granularity() * (color % colors()); DECLARE_NO_PRIORITY; - DRAWGFX_CORE(uint32_t, PIXEL_OP_REMAP_TRANSPEN_ALPHA32, NO_PRIORITY); + DRAWGFX_CORE(u32, PIXEL_OP_REMAP_TRANSPEN_ALPHA32, NO_PRIORITY); } @@ -610,8 +610,8 @@ void gfx_element::alpha(bitmap_rgb32 &dest, const rectangle &cliprect, -------------------------------------------------*/ void gfx_element::zoom_opaque(bitmap_ind16 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - uint32_t scalex, uint32_t scaley) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + u32 scalex, u32 scaley) { // non-zoom case if (scalex == 0x10000 && scaley == 0x10000) @@ -621,12 +621,12 @@ void gfx_element::zoom_opaque(bitmap_ind16 &dest, const rectangle &cliprect, color = colorbase() + granularity() * (color % colors()); code %= elements(); DECLARE_NO_PRIORITY; - DRAWGFXZOOM_CORE(uint16_t, PIXEL_OP_REBASE_OPAQUE, NO_PRIORITY); + DRAWGFXZOOM_CORE(u16, PIXEL_OP_REBASE_OPAQUE, NO_PRIORITY); } void gfx_element::zoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - uint32_t scalex, uint32_t scaley) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + u32 scalex, u32 scaley) { // non-zoom case if (scalex == 0x10000 && scaley == 0x10000) @@ -636,7 +636,7 @@ void gfx_element::zoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, const pen_t *paldata = m_palette->pens() + colorbase() + granularity() * (color % colors()); code %= elements(); DECLARE_NO_PRIORITY; - DRAWGFXZOOM_CORE(uint32_t, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY); + DRAWGFXZOOM_CORE(u32, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY); } @@ -646,8 +646,8 @@ void gfx_element::zoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, -------------------------------------------------*/ void gfx_element::zoom_transpen(bitmap_ind16 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - uint32_t scalex, uint32_t scaley, uint32_t trans_pen) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + u32 scalex, u32 scaley, u32 trans_pen) { // non-zoom case if (scalex == 0x10000 && scaley == 0x10000) @@ -662,7 +662,7 @@ void gfx_element::zoom_transpen(bitmap_ind16 &dest, const rectangle &cliprect, if (has_pen_usage()) { // fully transparent; do nothing - uint32_t usage = pen_usage(code); + u32 usage = pen_usage(code); if ((usage & ~(1 << trans_pen)) == 0) return; @@ -674,12 +674,12 @@ void gfx_element::zoom_transpen(bitmap_ind16 &dest, const rectangle &cliprect, // render color = colorbase() + granularity() * (color % colors()); DECLARE_NO_PRIORITY; - DRAWGFXZOOM_CORE(uint16_t, PIXEL_OP_REBASE_TRANSPEN, NO_PRIORITY); + DRAWGFXZOOM_CORE(u16, PIXEL_OP_REBASE_TRANSPEN, NO_PRIORITY); } void gfx_element::zoom_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - uint32_t scalex, uint32_t scaley, uint32_t trans_pen) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + u32 scalex, u32 scaley, u32 trans_pen) { // non-zoom case if (scalex == 0x10000 && scaley == 0x10000) @@ -694,7 +694,7 @@ void gfx_element::zoom_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, if (has_pen_usage()) { // fully transparent; do nothing - uint32_t usage = pen_usage(code); + u32 usage = pen_usage(code); if ((usage & ~(1 << trans_pen)) == 0) return; @@ -706,7 +706,7 @@ void gfx_element::zoom_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, // render const pen_t *paldata = m_palette->pens() + colorbase() + granularity() * (color % colors()); DECLARE_NO_PRIORITY; - DRAWGFXZOOM_CORE(uint32_t, PIXEL_OP_REMAP_TRANSPEN, NO_PRIORITY); + DRAWGFXZOOM_CORE(u32, PIXEL_OP_REMAP_TRANSPEN, NO_PRIORITY); } @@ -717,8 +717,8 @@ void gfx_element::zoom_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, -------------------------------------------------*/ void gfx_element::zoom_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - uint32_t scalex, uint32_t scaley, uint32_t trans_pen) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + u32 scalex, u32 scaley, u32 trans_pen) { // non-zoom case if (scalex == 0x10000 && scaley == 0x10000) @@ -731,12 +731,12 @@ void gfx_element::zoom_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprec // render DECLARE_NO_PRIORITY; - DRAWGFXZOOM_CORE(uint16_t, PIXEL_OP_REBASE_TRANSPEN, NO_PRIORITY); + DRAWGFXZOOM_CORE(u16, PIXEL_OP_REBASE_TRANSPEN, NO_PRIORITY); } void gfx_element::zoom_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - uint32_t scalex, uint32_t scaley, uint32_t trans_pen) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + u32 scalex, u32 scaley, u32 trans_pen) { // non-zoom case if (scalex == 0x10000 && scaley == 0x10000) @@ -749,7 +749,7 @@ void gfx_element::zoom_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprec // render DECLARE_NO_PRIORITY; - DRAWGFXZOOM_CORE(uint32_t, PIXEL_OP_REBASE_TRANSPEN, NO_PRIORITY); + DRAWGFXZOOM_CORE(u32, PIXEL_OP_REBASE_TRANSPEN, NO_PRIORITY); } @@ -760,8 +760,8 @@ void gfx_element::zoom_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprec -------------------------------------------------*/ void gfx_element::zoom_transmask(bitmap_ind16 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - uint32_t scalex, uint32_t scaley, uint32_t trans_mask) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + u32 scalex, u32 scaley, u32 trans_mask) { // non-zoom case if (scalex == 0x10000 && scaley == 0x10000) @@ -776,7 +776,7 @@ void gfx_element::zoom_transmask(bitmap_ind16 &dest, const rectangle &cliprect, if (has_pen_usage()) { // fully transparent; do nothing - uint32_t usage = pen_usage(code); + u32 usage = pen_usage(code); if ((usage & ~trans_mask) == 0) return; @@ -788,12 +788,12 @@ void gfx_element::zoom_transmask(bitmap_ind16 &dest, const rectangle &cliprect, // render color = colorbase() + granularity() * (color % colors()); DECLARE_NO_PRIORITY; - DRAWGFXZOOM_CORE(uint16_t, PIXEL_OP_REBASE_TRANSMASK, NO_PRIORITY); + DRAWGFXZOOM_CORE(u16, PIXEL_OP_REBASE_TRANSMASK, NO_PRIORITY); } void gfx_element::zoom_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - uint32_t scalex, uint32_t scaley, uint32_t trans_mask) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + u32 scalex, u32 scaley, u32 trans_mask) { // non-zoom case if (scalex == 0x10000 && scaley == 0x10000) @@ -808,7 +808,7 @@ void gfx_element::zoom_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, if (has_pen_usage()) { // fully transparent; do nothing - uint32_t usage = pen_usage(code); + u32 usage = pen_usage(code); if ((usage & ~trans_mask) == 0) return; @@ -820,7 +820,7 @@ void gfx_element::zoom_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, // render const pen_t *paldata = m_palette->pens() + colorbase() + granularity() * (color % colors()); DECLARE_NO_PRIORITY; - DRAWGFXZOOM_CORE(uint32_t, PIXEL_OP_REMAP_TRANSMASK, NO_PRIORITY); + DRAWGFXZOOM_CORE(u32, PIXEL_OP_REMAP_TRANSMASK, NO_PRIORITY); } @@ -831,8 +831,8 @@ void gfx_element::zoom_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, -------------------------------------------------*/ void gfx_element::zoom_transtable(bitmap_ind16 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - uint32_t scalex, uint32_t scaley, const uint8_t *pentable) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + u32 scalex, u32 scaley, const u8 *pentable) { assert(pentable != nullptr); @@ -845,12 +845,12 @@ void gfx_element::zoom_transtable(bitmap_ind16 &dest, const rectangle &cliprect, const pen_t *shadowtable = m_palette->shadow_table(); code %= elements(); DECLARE_NO_PRIORITY; - DRAWGFXZOOM_CORE(uint16_t, PIXEL_OP_REBASE_TRANSTABLE16, NO_PRIORITY); + DRAWGFXZOOM_CORE(u16, PIXEL_OP_REBASE_TRANSTABLE16, NO_PRIORITY); } void gfx_element::zoom_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - uint32_t scalex, uint32_t scaley, const uint8_t *pentable) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + u32 scalex, u32 scaley, const u8 *pentable) { assert(pentable != nullptr); @@ -863,7 +863,7 @@ void gfx_element::zoom_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, const pen_t *shadowtable = m_palette->shadow_table(); code %= elements(); DECLARE_NO_PRIORITY; - DRAWGFXZOOM_CORE(uint32_t, PIXEL_OP_REMAP_TRANSTABLE32, NO_PRIORITY); + DRAWGFXZOOM_CORE(u32, PIXEL_OP_REMAP_TRANSTABLE32, NO_PRIORITY); } @@ -874,8 +874,8 @@ void gfx_element::zoom_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, -------------------------------------------------*/ void gfx_element::zoom_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - uint32_t scalex, uint32_t scaley, uint32_t trans_pen, uint8_t alpha_val) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + u32 scalex, u32 scaley, u32 trans_pen, u8 alpha_val) { // non-zoom case if (scalex == 0x10000 && scaley == 0x10000) @@ -893,7 +893,7 @@ void gfx_element::zoom_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, // render const pen_t *paldata = m_palette->pens() + colorbase() + granularity() * (color % colors()); DECLARE_NO_PRIORITY; - DRAWGFXZOOM_CORE(uint32_t, PIXEL_OP_REMAP_TRANSPEN_ALPHA32, NO_PRIORITY); + DRAWGFXZOOM_CORE(u32, PIXEL_OP_REMAP_TRANSPEN_ALPHA32, NO_PRIORITY); } @@ -909,8 +909,8 @@ void gfx_element::zoom_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, -------------------------------------------------*/ void gfx_element::prio_opaque(bitmap_ind16 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - bitmap_ind8 &priority, uint32_t pmask) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + bitmap_ind8 &priority, u32 pmask) { // high bit of the mask is implicitly on pmask |= 1 << 31; @@ -918,12 +918,12 @@ void gfx_element::prio_opaque(bitmap_ind16 &dest, const rectangle &cliprect, // render color = colorbase() + granularity() * (color % colors()); code %= elements(); - DRAWGFX_CORE(uint16_t, PIXEL_OP_REBASE_OPAQUE_PRIORITY, uint8_t); + DRAWGFX_CORE(u16, PIXEL_OP_REBASE_OPAQUE_PRIORITY, u8); } void gfx_element::prio_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - bitmap_ind8 &priority, uint32_t pmask) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + bitmap_ind8 &priority, u32 pmask) { // high bit of the mask is implicitly on pmask |= 1 << 31; @@ -931,7 +931,7 @@ void gfx_element::prio_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, // render const pen_t *paldata = m_palette->pens() + colorbase() + granularity() * (color % colors()); code %= elements(); - DRAWGFX_CORE(uint32_t, PIXEL_OP_REMAP_OPAQUE_PRIORITY, uint8_t); + DRAWGFX_CORE(u32, PIXEL_OP_REMAP_OPAQUE_PRIORITY, u8); } @@ -942,8 +942,8 @@ void gfx_element::prio_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, -------------------------------------------------*/ void gfx_element::prio_transpen(bitmap_ind16 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - bitmap_ind8 &priority, uint32_t pmask, uint32_t trans_pen) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + bitmap_ind8 &priority, u32 pmask, u32 trans_pen) { // special case invalid pens to opaque if (trans_pen > 0xff) @@ -954,7 +954,7 @@ void gfx_element::prio_transpen(bitmap_ind16 &dest, const rectangle &cliprect, if (has_pen_usage()) { // fully transparent; do nothing - uint32_t usage = pen_usage(code); + u32 usage = pen_usage(code); if ((usage & ~(1 << trans_pen)) == 0) return; @@ -968,12 +968,12 @@ void gfx_element::prio_transpen(bitmap_ind16 &dest, const rectangle &cliprect, // render color = colorbase() + granularity() * (color % colors()); - DRAWGFX_CORE(uint16_t, PIXEL_OP_REBASE_TRANSPEN_PRIORITY, uint8_t); + DRAWGFX_CORE(u16, PIXEL_OP_REBASE_TRANSPEN_PRIORITY, u8); } void gfx_element::prio_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - bitmap_ind8 &priority, uint32_t pmask, uint32_t trans_pen) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + bitmap_ind8 &priority, u32 pmask, u32 trans_pen) { // special case invalid pens to opaque if (trans_pen > 0xff) @@ -984,7 +984,7 @@ void gfx_element::prio_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, if (has_pen_usage()) { // fully transparent; do nothing - uint32_t usage = pen_usage(code); + u32 usage = pen_usage(code); if ((usage & ~(1 << trans_pen)) == 0) return; @@ -998,7 +998,7 @@ void gfx_element::prio_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, // render const pen_t *paldata = m_palette->pens() + colorbase() + granularity() * (color % colors()); - DRAWGFX_CORE(uint32_t, PIXEL_OP_REMAP_TRANSPEN_PRIORITY, uint8_t); + DRAWGFX_CORE(u32, PIXEL_OP_REMAP_TRANSPEN_PRIORITY, u8); } @@ -1009,8 +1009,8 @@ void gfx_element::prio_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, -------------------------------------------------*/ void gfx_element::prio_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - bitmap_ind8 &priority, uint32_t pmask, uint32_t trans_pen) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + bitmap_ind8 &priority, u32 pmask, u32 trans_pen) { // early out if completely transparent code %= elements(); @@ -1021,12 +1021,12 @@ void gfx_element::prio_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprec pmask |= 1 << 31; // render - DRAWGFX_CORE(uint16_t, PIXEL_OP_REBASE_TRANSPEN_PRIORITY, uint8_t); + DRAWGFX_CORE(u16, PIXEL_OP_REBASE_TRANSPEN_PRIORITY, u8); } void gfx_element::prio_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - bitmap_ind8 &priority, uint32_t pmask, uint32_t trans_pen) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + bitmap_ind8 &priority, u32 pmask, u32 trans_pen) { // early out if completely transparent code %= elements(); @@ -1037,7 +1037,7 @@ void gfx_element::prio_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprec pmask |= 1 << 31; // render - DRAWGFX_CORE(uint32_t, PIXEL_OP_REBASE_TRANSPEN_PRIORITY, uint8_t); + DRAWGFX_CORE(u32, PIXEL_OP_REBASE_TRANSPEN_PRIORITY, u8); } @@ -1048,8 +1048,8 @@ void gfx_element::prio_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprec -------------------------------------------------*/ void gfx_element::prio_transmask(bitmap_ind16 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - bitmap_ind8 &priority, uint32_t pmask, uint32_t trans_mask) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + bitmap_ind8 &priority, u32 pmask, u32 trans_mask) { // special case 0 mask to opaque if (trans_mask == 0) @@ -1060,7 +1060,7 @@ void gfx_element::prio_transmask(bitmap_ind16 &dest, const rectangle &cliprect, if (has_pen_usage()) { // fully transparent; do nothing - uint32_t usage = pen_usage(code); + u32 usage = pen_usage(code); if ((usage & ~trans_mask) == 0) return; @@ -1074,12 +1074,12 @@ void gfx_element::prio_transmask(bitmap_ind16 &dest, const rectangle &cliprect, // render color = colorbase() + granularity() * (color % colors()); - DRAWGFX_CORE(uint16_t, PIXEL_OP_REBASE_TRANSMASK_PRIORITY, uint8_t); + DRAWGFX_CORE(u16, PIXEL_OP_REBASE_TRANSMASK_PRIORITY, u8); } void gfx_element::prio_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - bitmap_ind8 &priority, uint32_t pmask, uint32_t trans_mask) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + bitmap_ind8 &priority, u32 pmask, u32 trans_mask) { // special case 0 mask to opaque if (trans_mask == 0) @@ -1090,7 +1090,7 @@ void gfx_element::prio_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, if (has_pen_usage()) { // fully transparent; do nothing - uint32_t usage = pen_usage(code); + u32 usage = pen_usage(code); if ((usage & ~trans_mask) == 0) return; @@ -1104,7 +1104,7 @@ void gfx_element::prio_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, // render const pen_t *paldata = m_palette->pens() + colorbase() + granularity() * (color % colors()); - DRAWGFX_CORE(uint32_t, PIXEL_OP_REMAP_TRANSMASK_PRIORITY, uint8_t); + DRAWGFX_CORE(u32, PIXEL_OP_REMAP_TRANSMASK_PRIORITY, u8); } @@ -1116,8 +1116,8 @@ void gfx_element::prio_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, -------------------------------------------------*/ void gfx_element::prio_transtable(bitmap_ind16 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - bitmap_ind8 &priority, uint32_t pmask, const uint8_t *pentable) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + bitmap_ind8 &priority, u32 pmask, const u8 *pentable) { assert(pentable != nullptr); @@ -1128,12 +1128,12 @@ void gfx_element::prio_transtable(bitmap_ind16 &dest, const rectangle &cliprect, color = colorbase() + granularity() * (color % colors()); const pen_t *shadowtable = m_palette->shadow_table(); code %= elements(); - DRAWGFX_CORE(uint16_t, PIXEL_OP_REBASE_TRANSTABLE16_PRIORITY, uint8_t); + DRAWGFX_CORE(u16, PIXEL_OP_REBASE_TRANSTABLE16_PRIORITY, u8); } void gfx_element::prio_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - bitmap_ind8 &priority, uint32_t pmask, const uint8_t *pentable) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + bitmap_ind8 &priority, u32 pmask, const u8 *pentable) { assert(pentable != nullptr); @@ -1144,7 +1144,7 @@ void gfx_element::prio_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, const pen_t *paldata = m_palette->pens() + colorbase() + granularity() * (color % colors()); const pen_t *shadowtable = m_palette->shadow_table(); code %= elements(); - DRAWGFX_CORE(uint32_t, PIXEL_OP_REMAP_TRANSTABLE32_PRIORITY, uint8_t); + DRAWGFX_CORE(u32, PIXEL_OP_REMAP_TRANSTABLE32_PRIORITY, u8); } @@ -1156,8 +1156,8 @@ void gfx_element::prio_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, -------------------------------------------------*/ void gfx_element::prio_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - bitmap_ind8 &priority, uint32_t pmask, uint32_t trans_pen, uint8_t alpha_val) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + bitmap_ind8 &priority, u32 pmask, u32 trans_pen, u8 alpha_val) { // special case alpha = 0xff if (alpha_val == 0xff) @@ -1173,7 +1173,7 @@ void gfx_element::prio_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, // render const pen_t *paldata = m_palette->pens() + colorbase() + granularity() * (color % colors()); - DRAWGFX_CORE(uint32_t, PIXEL_OP_REMAP_TRANSPEN_ALPHA32_PRIORITY, uint8_t); + DRAWGFX_CORE(u32, PIXEL_OP_REMAP_TRANSPEN_ALPHA32_PRIORITY, u8); } @@ -1189,8 +1189,8 @@ void gfx_element::prio_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, -------------------------------------------------*/ void gfx_element::prio_zoom_opaque(bitmap_ind16 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - uint32_t scalex, uint32_t scaley, bitmap_ind8 &priority, uint32_t pmask) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + u32 scalex, u32 scaley, bitmap_ind8 &priority, u32 pmask) { // non-zoom case if (scalex == 0x10000 && scaley == 0x10000) @@ -1202,12 +1202,12 @@ void gfx_element::prio_zoom_opaque(bitmap_ind16 &dest, const rectangle &cliprect // render color = colorbase() + granularity() * (color % colors()); code %= elements(); - DRAWGFXZOOM_CORE(uint16_t, PIXEL_OP_REBASE_OPAQUE_PRIORITY, uint8_t); + DRAWGFXZOOM_CORE(u16, PIXEL_OP_REBASE_OPAQUE_PRIORITY, u8); } void gfx_element::prio_zoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - uint32_t scalex, uint32_t scaley, bitmap_ind8 &priority, uint32_t pmask) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + u32 scalex, u32 scaley, bitmap_ind8 &priority, u32 pmask) { // non-zoom case if (scalex == 0x10000 && scaley == 0x10000) @@ -1219,7 +1219,7 @@ void gfx_element::prio_zoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect // render const pen_t *paldata = m_palette->pens() + colorbase() + granularity() * (color % colors()); code %= elements(); - DRAWGFXZOOM_CORE(uint32_t, PIXEL_OP_REMAP_OPAQUE_PRIORITY, uint8_t); + DRAWGFXZOOM_CORE(u32, PIXEL_OP_REMAP_OPAQUE_PRIORITY, u8); } @@ -1230,9 +1230,9 @@ void gfx_element::prio_zoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect -------------------------------------------------*/ void gfx_element::prio_zoom_transpen(bitmap_ind16 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - uint32_t scalex, uint32_t scaley, bitmap_ind8 &priority, uint32_t pmask, - uint32_t trans_pen) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + u32 scalex, u32 scaley, bitmap_ind8 &priority, u32 pmask, + u32 trans_pen) { // non-zoom case if (scalex == 0x10000 && scaley == 0x10000) @@ -1247,7 +1247,7 @@ void gfx_element::prio_zoom_transpen(bitmap_ind16 &dest, const rectangle &clipre if (has_pen_usage()) { // fully transparent; do nothing - uint32_t usage = pen_usage(code); + u32 usage = pen_usage(code); if ((usage & ~(1 << trans_pen)) == 0) return; @@ -1261,13 +1261,13 @@ void gfx_element::prio_zoom_transpen(bitmap_ind16 &dest, const rectangle &clipre // render color = colorbase() + granularity() * (color % colors()); - DRAWGFXZOOM_CORE(uint16_t, PIXEL_OP_REBASE_TRANSPEN_PRIORITY, uint8_t); + DRAWGFXZOOM_CORE(u16, PIXEL_OP_REBASE_TRANSPEN_PRIORITY, u8); } void gfx_element::prio_zoom_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - uint32_t scalex, uint32_t scaley, bitmap_ind8 &priority, uint32_t pmask, - uint32_t trans_pen) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + u32 scalex, u32 scaley, bitmap_ind8 &priority, u32 pmask, + u32 trans_pen) { // non-zoom case if (scalex == 0x10000 && scaley == 0x10000) @@ -1282,7 +1282,7 @@ void gfx_element::prio_zoom_transpen(bitmap_rgb32 &dest, const rectangle &clipre if (has_pen_usage()) { // fully transparent; do nothing - uint32_t usage = pen_usage(code); + u32 usage = pen_usage(code); if ((usage & ~(1 << trans_pen)) == 0) return; @@ -1296,7 +1296,7 @@ void gfx_element::prio_zoom_transpen(bitmap_rgb32 &dest, const rectangle &clipre // render const pen_t *paldata = m_palette->pens() + colorbase() + granularity() * (color % colors()); - DRAWGFXZOOM_CORE(uint32_t, PIXEL_OP_REMAP_TRANSPEN_PRIORITY, uint8_t); + DRAWGFXZOOM_CORE(u32, PIXEL_OP_REMAP_TRANSPEN_PRIORITY, u8); } @@ -1308,9 +1308,9 @@ void gfx_element::prio_zoom_transpen(bitmap_rgb32 &dest, const rectangle &clipre -------------------------------------------------*/ void gfx_element::prio_zoom_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - uint32_t scalex, uint32_t scaley, bitmap_ind8 &priority, uint32_t pmask, - uint32_t trans_pen) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + u32 scalex, u32 scaley, bitmap_ind8 &priority, u32 pmask, + u32 trans_pen) { // non-zoom case if (scalex == 0x10000 && scaley == 0x10000) @@ -1325,13 +1325,13 @@ void gfx_element::prio_zoom_transpen_raw(bitmap_ind16 &dest, const rectangle &cl pmask |= 1 << 31; // render - DRAWGFXZOOM_CORE(uint16_t, PIXEL_OP_REBASE_TRANSPEN_PRIORITY, uint8_t); + DRAWGFXZOOM_CORE(u16, PIXEL_OP_REBASE_TRANSPEN_PRIORITY, u8); } void gfx_element::prio_zoom_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - uint32_t scalex, uint32_t scaley, bitmap_ind8 &priority, uint32_t pmask, - uint32_t trans_pen) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + u32 scalex, u32 scaley, bitmap_ind8 &priority, u32 pmask, + u32 trans_pen) { // non-zoom case if (scalex == 0x10000 && scaley == 0x10000) @@ -1346,7 +1346,7 @@ void gfx_element::prio_zoom_transpen_raw(bitmap_rgb32 &dest, const rectangle &cl pmask |= 1 << 31; // render - DRAWGFXZOOM_CORE(uint32_t, PIXEL_OP_REBASE_TRANSPEN_PRIORITY, uint8_t); + DRAWGFXZOOM_CORE(u32, PIXEL_OP_REBASE_TRANSPEN_PRIORITY, u8); } @@ -1358,9 +1358,9 @@ void gfx_element::prio_zoom_transpen_raw(bitmap_rgb32 &dest, const rectangle &cl -------------------------------------------------*/ void gfx_element::prio_zoom_transmask(bitmap_ind16 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - uint32_t scalex, uint32_t scaley, bitmap_ind8 &priority, uint32_t pmask, - uint32_t trans_mask) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + u32 scalex, u32 scaley, bitmap_ind8 &priority, u32 pmask, + u32 trans_mask) { // non-zoom case if (scalex == 0x10000 && scaley == 0x10000) @@ -1375,7 +1375,7 @@ void gfx_element::prio_zoom_transmask(bitmap_ind16 &dest, const rectangle &clipr if (has_pen_usage()) { // fully transparent; do nothing - uint32_t usage = pen_usage(code); + u32 usage = pen_usage(code); if ((usage & ~trans_mask) == 0) return; @@ -1389,13 +1389,13 @@ void gfx_element::prio_zoom_transmask(bitmap_ind16 &dest, const rectangle &clipr // render color = colorbase() + granularity() * (color % colors()); - DRAWGFXZOOM_CORE(uint16_t, PIXEL_OP_REBASE_TRANSMASK_PRIORITY, uint8_t); + DRAWGFXZOOM_CORE(u16, PIXEL_OP_REBASE_TRANSMASK_PRIORITY, u8); } void gfx_element::prio_zoom_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - uint32_t scalex, uint32_t scaley, bitmap_ind8 &priority, uint32_t pmask, - uint32_t trans_mask) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + u32 scalex, u32 scaley, bitmap_ind8 &priority, u32 pmask, + u32 trans_mask) { // non-zoom case if (scalex == 0x10000 && scaley == 0x10000) @@ -1410,7 +1410,7 @@ void gfx_element::prio_zoom_transmask(bitmap_rgb32 &dest, const rectangle &clipr if (has_pen_usage()) { // fully transparent; do nothing - uint32_t usage = pen_usage(code); + u32 usage = pen_usage(code); if ((usage & ~trans_mask) == 0) return; @@ -1424,7 +1424,7 @@ void gfx_element::prio_zoom_transmask(bitmap_rgb32 &dest, const rectangle &clipr // render const pen_t *paldata = m_palette->pens() + colorbase() + granularity() * (color % colors()); - DRAWGFXZOOM_CORE(uint32_t, PIXEL_OP_REMAP_TRANSMASK_PRIORITY, uint8_t); + DRAWGFXZOOM_CORE(u32, PIXEL_OP_REMAP_TRANSMASK_PRIORITY, u8); } @@ -1436,9 +1436,9 @@ void gfx_element::prio_zoom_transmask(bitmap_rgb32 &dest, const rectangle &clipr -------------------------------------------------*/ void gfx_element::prio_zoom_transtable(bitmap_ind16 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - uint32_t scalex, uint32_t scaley, bitmap_ind8 &priority, uint32_t pmask, - const uint8_t *pentable) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + u32 scalex, u32 scaley, bitmap_ind8 &priority, u32 pmask, + const u8 *pentable) { assert(pentable != nullptr); @@ -1453,13 +1453,13 @@ void gfx_element::prio_zoom_transtable(bitmap_ind16 &dest, const rectangle &clip color = colorbase() + granularity() * (color % colors()); const pen_t *shadowtable = m_palette->shadow_table(); code %= elements(); - DRAWGFXZOOM_CORE(uint16_t, PIXEL_OP_REBASE_TRANSTABLE16_PRIORITY, uint8_t); + DRAWGFXZOOM_CORE(u16, PIXEL_OP_REBASE_TRANSTABLE16_PRIORITY, u8); } void gfx_element::prio_zoom_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - uint32_t scalex, uint32_t scaley, bitmap_ind8 &priority, uint32_t pmask, - const uint8_t *pentable) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + u32 scalex, u32 scaley, bitmap_ind8 &priority, u32 pmask, + const u8 *pentable) { assert(pentable != nullptr); @@ -1474,7 +1474,7 @@ void gfx_element::prio_zoom_transtable(bitmap_rgb32 &dest, const rectangle &clip const pen_t *paldata = m_palette->pens() + colorbase() + granularity() * (color % colors()); const pen_t *shadowtable = m_palette->shadow_table(); code %= elements(); - DRAWGFXZOOM_CORE(uint32_t, PIXEL_OP_REMAP_TRANSTABLE32_PRIORITY, uint8_t); + DRAWGFXZOOM_CORE(u32, PIXEL_OP_REMAP_TRANSTABLE32_PRIORITY, u8); } @@ -1487,9 +1487,9 @@ void gfx_element::prio_zoom_transtable(bitmap_rgb32 &dest, const rectangle &clip -------------------------------------------------*/ void gfx_element::prio_zoom_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - uint32_t scalex, uint32_t scaley, bitmap_ind8 &priority, uint32_t pmask, - uint32_t trans_pen, uint8_t alpha_val) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + u32 scalex, u32 scaley, bitmap_ind8 &priority, u32 pmask, + u32 trans_pen, u8 alpha_val) { // non-zoom case if (scalex == 0x10000 && scaley == 0x10000) @@ -1509,21 +1509,21 @@ void gfx_element::prio_zoom_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, // render const pen_t *paldata = m_palette->pens() + colorbase() + granularity() * (color % colors()); - DRAWGFXZOOM_CORE(uint32_t, PIXEL_OP_REMAP_TRANSPEN_ALPHA32_PRIORITY, uint8_t); + DRAWGFXZOOM_CORE(u32, PIXEL_OP_REMAP_TRANSPEN_ALPHA32_PRIORITY, u8); } -#define PIXEL_OP_REMAP_TRANSPEN_PRIORITY_ADDIIVE32(DEST, PRIORITY, SOURCE) \ +#define PIXEL_OP_REMAP_TRANSPEN_PRIORITY_ADDIIVE32(DEST, PRIORITY, SOURCE) \ do \ { \ - uint32_t srcdata = (SOURCE); \ - if (srcdata != trans_pen) \ + u32 srcdata = (SOURCE); \ + if (srcdata != trans_pen) \ { \ if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ { \ - uint32_t srcdata2 = paldata[srcdata]; \ + u32 srcdata2 = paldata[srcdata]; \ \ - uint32_t add; \ + u32 add; \ add = (srcdata2 & 0x00ff0000) + (DEST & 0x00ff0000); \ if (add & 0x01000000) DEST = (DEST & 0xff00ffff) | (0x00ff0000); \ else DEST = (DEST & 0xff00ffff) | (add & 0x00ff0000); \ @@ -1540,8 +1540,8 @@ do while (0) void gfx_element::prio_transpen_additive(bitmap_rgb32 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - bitmap_ind8 &priority, uint32_t pmask, uint32_t trans_pen) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + bitmap_ind8 &priority, u32 pmask, u32 trans_pen) { const pen_t *paldata; @@ -1556,7 +1556,7 @@ void gfx_element::prio_transpen_additive(bitmap_rgb32 &dest, const rectangle &cl /* use pen usage to optimize */ if (has_pen_usage()) { - uint32_t usage = pen_usage(code); + u32 usage = pen_usage(code); /* fully transparent; do nothing */ if ((usage & ~(1 << trans_pen)) == 0) @@ -1567,14 +1567,14 @@ void gfx_element::prio_transpen_additive(bitmap_rgb32 &dest, const rectangle &cl pmask |= 1 << 31; /* render based on dest bitmap depth */ - DRAWGFX_CORE(uint32_t, PIXEL_OP_REMAP_TRANSPEN_PRIORITY_ADDIIVE32, uint8_t); + DRAWGFX_CORE(u32, PIXEL_OP_REMAP_TRANSPEN_PRIORITY_ADDIIVE32, u8); } void gfx_element::prio_zoom_transpen_additive(bitmap_rgb32 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - uint32_t scalex, uint32_t scaley, bitmap_ind8 &priority, uint32_t pmask, - uint32_t trans_pen) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + u32 scalex, u32 scaley, bitmap_ind8 &priority, u32 pmask, + u32 trans_pen) { const pen_t *paldata; @@ -1597,7 +1597,7 @@ void gfx_element::prio_zoom_transpen_additive(bitmap_rgb32 &dest, const rectangl /* use pen usage to optimize */ if (has_pen_usage()) { - uint32_t usage = pen_usage(code); + u32 usage = pen_usage(code); /* fully transparent; do nothing */ if ((usage & ~(1 << trans_pen)) == 0) @@ -1607,7 +1607,7 @@ void gfx_element::prio_zoom_transpen_additive(bitmap_rgb32 &dest, const rectangl /* high bit of the mask is implicitly on */ pmask |= 1 << 31; - DRAWGFXZOOM_CORE(uint32_t, PIXEL_OP_REMAP_TRANSPEN_PRIORITY_ADDIIVE32, uint8_t); + DRAWGFXZOOM_CORE(u32, PIXEL_OP_REMAP_TRANSPEN_PRIORITY_ADDIIVE32, u8); } //#define MAKE_ARGB_RGB(a, rgb) rgb_t(a, rgb.r(), rgb.g(), rgb.b()) @@ -1617,7 +1617,7 @@ void gfx_element::prio_zoom_transpen_additive(bitmap_rgb32 &dest, const rectangl #define PIXEL_OP_REMAP_TRANS0_ALPHASTORE32(DEST, PRIORITY, SOURCE) \ do \ { \ - uint32_t srcdata = (SOURCE); \ + u32 srcdata = (SOURCE); \ if (srcdata != 0) \ (DEST) = MAKE_ARGB_RGB(alpha,paldata[srcdata]); \ } \ @@ -1626,7 +1626,7 @@ while (0) #define PIXEL_OP_REMAP_TRANS0_ALPHATABLESTORE32(DEST, PRIORITY, SOURCE) \ do \ { \ - uint32_t srcdata = (SOURCE); \ + u32 srcdata = (SOURCE); \ if (srcdata != 0) \ (DEST) = MAKE_ARGB_RGB(alphatable[srcdata], paldata[srcdata]); \ } \ @@ -1635,7 +1635,7 @@ while (0) #define PIXEL_OP_REMAP_TRANS0_ALPHATABLE32(DEST, PRIORITY, SOURCE) \ do \ { \ - uint32_t srcdata = (SOURCE); \ + u32 srcdata = (SOURCE); \ if (srcdata != 0) \ (DEST) = alpha_blend_r32((DEST), paldata[srcdata], alphatable[srcdata]); \ } \ @@ -1647,8 +1647,8 @@ while (0) in alpha field of ARGB32, negative alpha implies alphatable -------------------------------------------------*/ void gfx_element::alphastore(bitmap_rgb32 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - int fixedalpha, uint8_t *alphatable) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + int fixedalpha, u8 *alphatable) { DECLARE_NO_PRIORITY; const pen_t *paldata; @@ -1673,12 +1673,12 @@ void gfx_element::alphastore(bitmap_rgb32 &dest, const rectangle &cliprect, if (fixedalpha >= 0) { - uint8_t alpha = fixedalpha; - DRAWGFX_CORE(uint32_t, PIXEL_OP_REMAP_TRANS0_ALPHASTORE32, NO_PRIORITY); + u8 alpha = fixedalpha; + DRAWGFX_CORE(u32, PIXEL_OP_REMAP_TRANS0_ALPHASTORE32, NO_PRIORITY); } else { - DRAWGFX_CORE(uint32_t, PIXEL_OP_REMAP_TRANS0_ALPHATABLESTORE32, NO_PRIORITY); + DRAWGFX_CORE(u32, PIXEL_OP_REMAP_TRANS0_ALPHATABLESTORE32, NO_PRIORITY); } } @@ -1688,8 +1688,8 @@ void gfx_element::alphastore(bitmap_rgb32 &dest, const rectangle &cliprect, the per-pen alphatable[] array -------------------------------------------------*/ void gfx_element::alphatable(bitmap_rgb32 &dest, const rectangle &cliprect, - uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, - int fixedalpha ,uint8_t *alphatable) + u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, + int fixedalpha ,u8 *alphatable) { DECLARE_NO_PRIORITY; @@ -1714,7 +1714,7 @@ void gfx_element::alphatable(bitmap_rgb32 &dest, const rectangle &cliprect, if (has_pen_usage() && (pen_usage(code) & ~(1 << 0)) == 0) return; - DRAWGFX_CORE(uint32_t, PIXEL_OP_REMAP_TRANS0_ALPHATABLE32, NO_PRIORITY); + DRAWGFX_CORE(u32, PIXEL_OP_REMAP_TRANS0_ALPHATABLE32, NO_PRIORITY); } @@ -1727,30 +1727,30 @@ void gfx_element::alphatable(bitmap_rgb32 &dest, const rectangle &cliprect, buffer to a single scanline of a bitmap -------------------------------------------------*/ -void draw_scanline8(bitmap_ind16 &bitmap, int32_t destx, int32_t desty, int32_t length, const uint8_t *srcptr, const pen_t *paldata) +void draw_scanline8(bitmap_ind16 &bitmap, s32 destx, s32 desty, s32 length, const u8 *srcptr, const pen_t *paldata) { DECLARE_NO_PRIORITY; // palette lookup case if (paldata != nullptr) - DRAWSCANLINE_CORE(uint16_t, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY); + DRAWSCANLINE_CORE(u16, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY); // raw copy case else - DRAWSCANLINE_CORE(uint16_t, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); + DRAWSCANLINE_CORE(u16, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); } -void draw_scanline8(bitmap_rgb32 &bitmap, int32_t destx, int32_t desty, int32_t length, const uint8_t *srcptr, const pen_t *paldata) +void draw_scanline8(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 length, const u8 *srcptr, const pen_t *paldata) { DECLARE_NO_PRIORITY; // palette lookup case if (paldata != nullptr) - DRAWSCANLINE_CORE(uint32_t, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY); + DRAWSCANLINE_CORE(u32, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY); // raw copy case else - DRAWSCANLINE_CORE(uint32_t, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); + DRAWSCANLINE_CORE(u32, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); } @@ -1759,30 +1759,30 @@ void draw_scanline8(bitmap_rgb32 &bitmap, int32_t destx, int32_t desty, int32_t buffer to a single scanline of a bitmap -------------------------------------------------*/ -void draw_scanline16(bitmap_ind16 &bitmap, int32_t destx, int32_t desty, int32_t length, const uint16_t *srcptr, const pen_t *paldata) +void draw_scanline16(bitmap_ind16 &bitmap, s32 destx, s32 desty, s32 length, const u16 *srcptr, const pen_t *paldata) { DECLARE_NO_PRIORITY; // palette lookup case if (paldata != nullptr) - DRAWSCANLINE_CORE(uint16_t, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY); + DRAWSCANLINE_CORE(u16, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY); // raw copy case else - DRAWSCANLINE_CORE(uint16_t, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); + DRAWSCANLINE_CORE(u16, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); } -void draw_scanline16(bitmap_rgb32 &bitmap, int32_t destx, int32_t desty, int32_t length, const uint16_t *srcptr, const pen_t *paldata) +void draw_scanline16(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 length, const u16 *srcptr, const pen_t *paldata) { DECLARE_NO_PRIORITY; // palette lookup case if (paldata != nullptr) - DRAWSCANLINE_CORE(uint32_t, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY); + DRAWSCANLINE_CORE(u32, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY); // raw copy case else - DRAWSCANLINE_CORE(uint32_t, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); + DRAWSCANLINE_CORE(u32, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); } @@ -1791,30 +1791,30 @@ void draw_scanline16(bitmap_rgb32 &bitmap, int32_t destx, int32_t desty, int32_t buffer to a single scanline of a bitmap -------------------------------------------------*/ -void draw_scanline32(bitmap_ind16 &bitmap, int32_t destx, int32_t desty, int32_t length, const uint32_t *srcptr, const pen_t *paldata) +void draw_scanline32(bitmap_ind16 &bitmap, s32 destx, s32 desty, s32 length, const u32 *srcptr, const pen_t *paldata) { DECLARE_NO_PRIORITY; // palette lookup case if (paldata != nullptr) - DRAWSCANLINE_CORE(uint16_t, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY); + DRAWSCANLINE_CORE(u16, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY); // raw copy case else - DRAWSCANLINE_CORE(uint16_t, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); + DRAWSCANLINE_CORE(u16, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); } -void draw_scanline32(bitmap_rgb32 &bitmap, int32_t destx, int32_t desty, int32_t length, const uint32_t *srcptr, const pen_t *paldata) +void draw_scanline32(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 length, const u32 *srcptr, const pen_t *paldata) { DECLARE_NO_PRIORITY; // palette lookup case if (paldata != nullptr) - DRAWSCANLINE_CORE(uint32_t, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY); + DRAWSCANLINE_CORE(u32, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY); // raw copy case else - DRAWSCANLINE_CORE(uint32_t, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); + DRAWSCANLINE_CORE(u32, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); } @@ -1828,14 +1828,14 @@ void draw_scanline32(bitmap_rgb32 &bitmap, int32_t destx, int32_t desty, int32_t scanline of a bitmap to an 8bpp buffer -------------------------------------------------*/ -void extract_scanline8(const bitmap_ind16 &bitmap, int32_t srcx, int32_t srcy, int32_t length, uint8_t *destptr) +void extract_scanline8(const bitmap_ind16 &bitmap, s32 srcx, s32 srcy, s32 length, u8 *destptr) { - EXTRACTSCANLINE_CORE(uint16_t); + EXTRACTSCANLINE_CORE(u16); } -void extract_scanline8(const bitmap_rgb32 &bitmap, int32_t srcx, int32_t srcy, int32_t length, uint8_t *destptr) +void extract_scanline8(const bitmap_rgb32 &bitmap, s32 srcx, s32 srcy, s32 length, u8 *destptr) { - EXTRACTSCANLINE_CORE(uint32_t); + EXTRACTSCANLINE_CORE(u32); } @@ -1844,14 +1844,14 @@ void extract_scanline8(const bitmap_rgb32 &bitmap, int32_t srcx, int32_t srcy, i scanline of a bitmap to a 16bpp buffer -------------------------------------------------*/ -void extract_scanline16(const bitmap_ind16 &bitmap, int32_t srcx, int32_t srcy, int32_t length, uint16_t *destptr) +void extract_scanline16(const bitmap_ind16 &bitmap, s32 srcx, s32 srcy, s32 length, u16 *destptr) { - EXTRACTSCANLINE_CORE(uint16_t); + EXTRACTSCANLINE_CORE(u16); } -void extract_scanline16(const bitmap_rgb32 &bitmap, int32_t srcx, int32_t srcy, int32_t length, uint16_t *destptr) +void extract_scanline16(const bitmap_rgb32 &bitmap, s32 srcx, s32 srcy, s32 length, u16 *destptr) { - EXTRACTSCANLINE_CORE(uint32_t); + EXTRACTSCANLINE_CORE(u32); } @@ -1860,14 +1860,14 @@ void extract_scanline16(const bitmap_rgb32 &bitmap, int32_t srcx, int32_t srcy, scanline of a bitmap to a 32bpp buffer -------------------------------------------------*/ -void extract_scanline32(const bitmap_ind16 &bitmap, int32_t srcx, int32_t srcy, int32_t length, uint32_t *destptr) +void extract_scanline32(const bitmap_ind16 &bitmap, s32 srcx, s32 srcy, s32 length, u32 *destptr) { - EXTRACTSCANLINE_CORE(uint16_t); + EXTRACTSCANLINE_CORE(u16); } -void extract_scanline32(const bitmap_rgb32 &bitmap, int32_t srcx, int32_t srcy, int32_t length, uint32_t *destptr) +void extract_scanline32(const bitmap_rgb32 &bitmap, s32 srcx, s32 srcy, s32 length, u32 *destptr) { - EXTRACTSCANLINE_CORE(uint32_t); + EXTRACTSCANLINE_CORE(u32); } @@ -1881,16 +1881,16 @@ void extract_scanline32(const bitmap_rgb32 &bitmap, int32_t srcx, int32_t srcy, copying all unclipped pixels -------------------------------------------------*/ -void copybitmap(bitmap_ind16 &dest, const bitmap_ind16 &src, int flipx, int flipy, int32_t destx, int32_t desty, const rectangle &cliprect) +void copybitmap(bitmap_ind16 &dest, const bitmap_ind16 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect) { DECLARE_NO_PRIORITY; - COPYBITMAP_CORE(uint16_t, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); + COPYBITMAP_CORE(u16, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); } -void copybitmap(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, int flipy, int32_t destx, int32_t desty, const rectangle &cliprect) +void copybitmap(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect) { DECLARE_NO_PRIORITY; - COPYBITMAP_CORE(uint32_t, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); + COPYBITMAP_CORE(u32, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); } @@ -1900,22 +1900,22 @@ void copybitmap(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, int flip those that match transpen -------------------------------------------------*/ -void copybitmap_trans(bitmap_ind16 &dest, const bitmap_ind16 &src, int flipx, int flipy, int32_t destx, int32_t desty, const rectangle &cliprect, uint32_t trans_pen) +void copybitmap_trans(bitmap_ind16 &dest, const bitmap_ind16 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect, u32 trans_pen) { DECLARE_NO_PRIORITY; if (trans_pen > 0xffff) copybitmap(dest, src, flipx, flipy, destx, desty, cliprect); else - COPYBITMAP_CORE(uint16_t, PIXEL_OP_COPY_TRANSPEN, NO_PRIORITY); + COPYBITMAP_CORE(u16, PIXEL_OP_COPY_TRANSPEN, NO_PRIORITY); } -void copybitmap_trans(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, int flipy, int32_t destx, int32_t desty, const rectangle &cliprect, uint32_t trans_pen) +void copybitmap_trans(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect, u32 trans_pen) { DECLARE_NO_PRIORITY; if (trans_pen == 0xffffffff) copybitmap(dest, src, flipx, flipy, destx, desty, cliprect); else - COPYBITMAP_CORE(uint32_t, PIXEL_OP_COPY_TRANSPEN, NO_PRIORITY); + COPYBITMAP_CORE(u32, PIXEL_OP_COPY_TRANSPEN, NO_PRIORITY); } @@ -1930,14 +1930,14 @@ void copybitmap_trans(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, in applying scrolling to one or more rows/columns -------------------------------------------------*/ -void copyscrollbitmap(bitmap_ind16 &dest, const bitmap_ind16 &src, uint32_t numrows, const int32_t *rowscroll, uint32_t numcols, const int32_t *colscroll, const rectangle &cliprect) +void copyscrollbitmap(bitmap_ind16 &dest, const bitmap_ind16 &src, u32 numrows, const s32 *rowscroll, u32 numcols, const s32 *colscroll, const rectangle &cliprect) { // just call through to the transparent case as the underlying copybitmap will // optimize for pen == 0xffffffff copyscrollbitmap_trans(dest, src, numrows, rowscroll, numcols, colscroll, cliprect, 0xffffffff); } -void copyscrollbitmap(bitmap_rgb32 &dest, const bitmap_rgb32 &src, uint32_t numrows, const int32_t *rowscroll, uint32_t numcols, const int32_t *colscroll, const rectangle &cliprect) +void copyscrollbitmap(bitmap_rgb32 &dest, const bitmap_rgb32 &src, u32 numrows, const s32 *rowscroll, u32 numcols, const s32 *colscroll, const rectangle &cliprect) { // just call through to the transparent case as the underlying copybitmap will // optimize for pen == 0xffffffff @@ -1953,7 +1953,7 @@ void copyscrollbitmap(bitmap_rgb32 &dest, const bitmap_rgb32 &src, uint32_t numr -------------------------------------------------*/ template -static inline void copyscrollbitmap_trans_common(_BitmapClass &dest, const _BitmapClass &src, uint32_t numrows, const int32_t *rowscroll, uint32_t numcols, const int32_t *colscroll, const rectangle &cliprect, uint32_t trans_pen) +static inline void copyscrollbitmap_trans_common(_BitmapClass &dest, const _BitmapClass &src, u32 numrows, const s32 *rowscroll, u32 numcols, const s32 *colscroll, const rectangle &cliprect, u32 trans_pen) { // no rowscroll and no colscroll means no scroll if (numrows == 0 && numcols == 0) @@ -1967,19 +1967,19 @@ static inline void copyscrollbitmap_trans_common(_BitmapClass &dest, const _Bitm // fully scrolling X,Y playfield if (numrows <= 1 && numcols <= 1) { - int32_t xscroll = normalize_xscroll(src, (numrows == 0) ? 0 : rowscroll[0]); - int32_t yscroll = normalize_yscroll(src, (numcols == 0) ? 0 : colscroll[0]); + s32 xscroll = normalize_xscroll(src, (numrows == 0) ? 0 : rowscroll[0]); + s32 yscroll = normalize_yscroll(src, (numcols == 0) ? 0 : colscroll[0]); // iterate over all portions of the scroll that overlap the destination - for (int32_t sx = xscroll - src.width(); sx < dest.width(); sx += src.width()) - for (int32_t sy = yscroll - src.height(); sy < dest.height(); sy += src.height()) + for (s32 sx = xscroll - src.width(); sx < dest.width(); sx += src.width()) + for (s32 sy = yscroll - src.height(); sy < dest.height(); sy += src.height()) copybitmap_trans(dest, src, 0, 0, sx, sy, cliprect, trans_pen); } // scrolling columns plus horizontal scroll else if (numrows <= 1) { - int32_t xscroll = normalize_xscroll(src, (numrows == 0) ? 0 : rowscroll[0]); + s32 xscroll = normalize_xscroll(src, (numrows == 0) ? 0 : rowscroll[0]); rectangle subclip = cliprect; // determine width of each column @@ -1990,7 +1990,7 @@ static inline void copyscrollbitmap_trans_common(_BitmapClass &dest, const _Bitm int groupcols; for (int col = 0; col < numcols; col += groupcols) { - int32_t yscroll = colscroll[col]; + s32 yscroll = colscroll[col]; // count consecutive columns scrolled by the same amount for (groupcols = 1; col + groupcols < numcols; groupcols++) @@ -1999,7 +1999,7 @@ static inline void copyscrollbitmap_trans_common(_BitmapClass &dest, const _Bitm // iterate over reps of the columns in question yscroll = normalize_yscroll(src, yscroll); - for (int32_t sx = xscroll - src.width(); sx < dest.width(); sx += src.width()) + for (s32 sx = xscroll - src.width(); sx < dest.width(); sx += src.width()) { // compute the cliprect for this group subclip.min_x = col * colwidth + sx; @@ -2007,7 +2007,7 @@ static inline void copyscrollbitmap_trans_common(_BitmapClass &dest, const _Bitm subclip &= cliprect; // iterate over all portions of the scroll that overlap the destination - for (int32_t sy = yscroll - src.height(); sy < dest.height(); sy += src.height()) + for (s32 sy = yscroll - src.height(); sy < dest.height(); sy += src.height()) copybitmap_trans(dest, src, 0, 0, sx, sy, subclip, trans_pen); } } @@ -2016,7 +2016,7 @@ static inline void copyscrollbitmap_trans_common(_BitmapClass &dest, const _Bitm // scrolling rows plus vertical scroll else if (numcols <= 1) { - int32_t yscroll = normalize_yscroll(src, (numcols == 0) ? 0 : colscroll[0]); + s32 yscroll = normalize_yscroll(src, (numcols == 0) ? 0 : colscroll[0]); rectangle subclip = cliprect; // determine width of each rows @@ -2027,7 +2027,7 @@ static inline void copyscrollbitmap_trans_common(_BitmapClass &dest, const _Bitm int grouprows; for (int row = 0; row < numrows; row += grouprows) { - int32_t xscroll = rowscroll[row]; + s32 xscroll = rowscroll[row]; // count consecutive rows scrolled by the same amount for (grouprows = 1; row + grouprows < numrows; grouprows++) @@ -2036,7 +2036,7 @@ static inline void copyscrollbitmap_trans_common(_BitmapClass &dest, const _Bitm // iterate over reps of the rows in question xscroll = normalize_xscroll(src, xscroll); - for (int32_t sy = yscroll - src.height(); sy < dest.height(); sy += src.height()) + for (s32 sy = yscroll - src.height(); sy < dest.height(); sy += src.height()) { // compute the cliprect for this group subclip.min_y = row * rowheight + sy; @@ -2044,17 +2044,17 @@ static inline void copyscrollbitmap_trans_common(_BitmapClass &dest, const _Bitm subclip &= cliprect; // iterate over all portions of the scroll that overlap the destination - for (int32_t sx = xscroll - src.width(); sx < dest.width(); sx += src.width()) + for (s32 sx = xscroll - src.width(); sx < dest.width(); sx += src.width()) copybitmap_trans(dest, src, 0, 0, sx, sy, subclip, trans_pen); } } } } -void copyscrollbitmap_trans(bitmap_ind16 &dest, const bitmap_ind16 &src, uint32_t numrows, const int32_t *rowscroll, uint32_t numcols, const int32_t *colscroll, const rectangle &cliprect, uint32_t trans_pen) +void copyscrollbitmap_trans(bitmap_ind16 &dest, const bitmap_ind16 &src, u32 numrows, const s32 *rowscroll, u32 numcols, const s32 *colscroll, const rectangle &cliprect, u32 trans_pen) { copyscrollbitmap_trans_common(dest, src, numrows, rowscroll, numcols, colscroll, cliprect, trans_pen); } -void copyscrollbitmap_trans(bitmap_rgb32 &dest, const bitmap_rgb32 &src, uint32_t numrows, const int32_t *rowscroll, uint32_t numcols, const int32_t *colscroll, const rectangle &cliprect, uint32_t trans_pen) +void copyscrollbitmap_trans(bitmap_rgb32 &dest, const bitmap_rgb32 &src, u32 numrows, const s32 *rowscroll, u32 numcols, const s32 *colscroll, const rectangle &cliprect, u32 trans_pen) { copyscrollbitmap_trans_common(dest, src, numrows, rowscroll, numcols, colscroll, cliprect, trans_pen); } @@ -2069,16 +2069,16 @@ void copyscrollbitmap_trans(bitmap_rgb32 &dest, const bitmap_rgb32 &src, uint32_ pixels -------------------------------------------------*/ -void copyrozbitmap(bitmap_ind16 &dest, const rectangle &cliprect, const bitmap_ind16 &src, int32_t startx, int32_t starty, int32_t incxx, int32_t incxy, int32_t incyx, int32_t incyy, int wraparound) +void copyrozbitmap(bitmap_ind16 &dest, const rectangle &cliprect, const bitmap_ind16 &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound) { DECLARE_NO_PRIORITY; - COPYROZBITMAP_CORE(uint16_t, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); + COPYROZBITMAP_CORE(u16, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); } -void copyrozbitmap(bitmap_rgb32 &dest, const rectangle &cliprect, const bitmap_rgb32 &src, int32_t startx, int32_t starty, int32_t incxx, int32_t incxy, int32_t incyx, int32_t incyy, int wraparound) +void copyrozbitmap(bitmap_rgb32 &dest, const rectangle &cliprect, const bitmap_rgb32 &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound) { DECLARE_NO_PRIORITY; - COPYROZBITMAP_CORE(uint32_t, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); + COPYROZBITMAP_CORE(u32, PIXEL_OP_COPY_OPAQUE, NO_PRIORITY); } @@ -2089,16 +2089,16 @@ void copyrozbitmap(bitmap_rgb32 &dest, const rectangle &cliprect, const bitmap_r transpen -------------------------------------------------*/ -void copyrozbitmap_trans(bitmap_ind16 &dest, const rectangle &cliprect, const bitmap_ind16 &src, int32_t startx, int32_t starty, int32_t incxx, int32_t incxy, int32_t incyx, int32_t incyy, int wraparound, uint32_t trans_pen) +void copyrozbitmap_trans(bitmap_ind16 &dest, const rectangle &cliprect, const bitmap_ind16 &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound, u32 trans_pen) { DECLARE_NO_PRIORITY; - COPYROZBITMAP_CORE(uint16_t, PIXEL_OP_COPY_TRANSPEN, NO_PRIORITY); + COPYROZBITMAP_CORE(u16, PIXEL_OP_COPY_TRANSPEN, NO_PRIORITY); } -void copyrozbitmap_trans(bitmap_rgb32 &dest, const rectangle &cliprect, const bitmap_rgb32 &src, int32_t startx, int32_t starty, int32_t incxx, int32_t incxy, int32_t incyx, int32_t incyy, int wraparound, uint32_t trans_pen) +void copyrozbitmap_trans(bitmap_rgb32 &dest, const rectangle &cliprect, const bitmap_rgb32 &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound, u32 trans_pen) { DECLARE_NO_PRIORITY; - COPYROZBITMAP_CORE(uint32_t, PIXEL_OP_COPY_TRANSPEN, NO_PRIORITY); + COPYROZBITMAP_CORE(u32, PIXEL_OP_COPY_TRANSPEN, NO_PRIORITY); } GFXDECODE_START( empty ) diff --git a/src/emu/drawgfx.h b/src/emu/drawgfx.h index 762025b48c8..ca628114c3a 100644 --- a/src/emu/drawgfx.h +++ b/src/emu/drawgfx.h @@ -32,7 +32,7 @@ For example, to draw a sprite that appears over tilemap1, but under opaque pixels of tilemap2, tilemap3, and tilemap4: - uint32_t pmask = GFX_PMASK_2 | GFX_PMASK_4 | GFX_PMASK_8; + u32 pmask = GFX_PMASK_2 | GFX_PMASK_4 | GFX_PMASK_8; gfx->prio_transpen(bitmap, cliprect, code, color, flipx, flipy, @@ -74,7 +74,7 @@ a sprite over the first four tilemaps but under the higher numbered ones: - uint32_t pmask = (~1) << 4; + u32 pmask = (~1) << 4; gfx->prio_transpen(bitmap, cliprect, code, color, flipx, flipy, @@ -116,8 +116,8 @@ #error Dont include this file directly; include emu.h instead. #endif -#ifndef __DRAWGFX_H__ -#define __DRAWGFX_H__ +#ifndef MAME_EMU_DRAWGFX_H +#define MAME_EMU_DRAWGFX_H /*************************************************************************** @@ -151,48 +151,48 @@ public: #ifdef UNUSED_FUNCTION gfx_element(); #endif - gfx_element(palette_device &palette, const gfx_layout &gl, const uint8_t *srcdata, uint32_t xormask, uint32_t total_colors, uint32_t color_base); - gfx_element(palette_device &palette, uint8_t *base, uint16_t width, uint16_t height, uint32_t rowbytes, uint32_t total_colors, uint32_t color_base, uint32_t color_granularity); + gfx_element(palette_device &palette, const gfx_layout &gl, const u8 *srcdata, u32 xormask, u32 total_colors, u32 color_base); + gfx_element(palette_device &palette, u8 *base, u16 width, u16 height, u32 rowbytes, u32 total_colors, u32 color_base, u32 color_granularity); // getters palette_device &palette() const { return *m_palette; } - uint16_t width() const { return m_width; } - uint16_t height() const { return m_height; } - uint32_t elements() const { return m_total_elements; } - uint32_t colorbase() const { return m_color_base; } - uint16_t depth() const { return m_color_depth; } - uint16_t granularity() const { return m_color_granularity; } - uint32_t colors() const { return m_total_colors; } - uint32_t rowbytes() const { return m_line_modulo; } + u16 width() const { return m_width; } + u16 height() const { return m_height; } + u32 elements() const { return m_total_elements; } + u32 colorbase() const { return m_color_base; } + u16 depth() const { return m_color_depth; } + u16 granularity() const { return m_color_granularity; } + u32 colors() const { return m_total_colors; } + u32 rowbytes() const { return m_line_modulo; } bool has_pen_usage() const { return !m_pen_usage.empty(); } // used by tilemaps - uint32_t dirtyseq() const { return m_dirtyseq; } + u32 dirtyseq() const { return m_dirtyseq; } // setters - void set_layout(const gfx_layout &gl, const uint8_t *srcdata); - void set_raw_layout(const uint8_t *srcdata, uint32_t width, uint32_t height, uint32_t total, uint32_t linemod, uint32_t charmod); - void set_source(const uint8_t *source); - void set_source_and_total(const uint8_t *source, uint32_t total); - void set_xormask(uint32_t xormask) { m_layout_xormask = xormask; } + void set_layout(const gfx_layout &gl, const u8 *srcdata); + void set_raw_layout(const u8 *srcdata, u32 width, u32 height, u32 total, u32 linemod, u32 charmod); + void set_source(const u8 *source); + void set_source_and_total(const u8 *source, u32 total); + void set_xormask(u32 xormask) { m_layout_xormask = xormask; } void set_palette(palette_device &palette) { m_palette = &palette; } - void set_colors(uint32_t colors) { m_total_colors = colors; } - void set_colorbase(uint16_t colorbase) { m_color_base = colorbase; } - void set_granularity(uint16_t granularity) { m_color_granularity = granularity; } - void set_source_clip(uint32_t xoffs, uint32_t width, uint32_t yoffs, uint32_t height); + void set_colors(u32 colors) { m_total_colors = colors; } + void set_colorbase(u16 colorbase) { m_color_base = colorbase; } + void set_granularity(u16 granularity) { m_color_granularity = granularity; } + void set_source_clip(u32 xoffs, u32 width, u32 yoffs, u32 height); // operations - void mark_dirty(uint32_t code) { if (code < elements()) { m_dirty[code] = 1; m_dirtyseq++; } } + void mark_dirty(u32 code) { if (code < elements()) { m_dirty[code] = 1; m_dirtyseq++; } } void mark_all_dirty() { memset(&m_dirty[0], 1, elements()); } - const uint8_t *get_data(uint32_t code) + const u8 *get_data(u32 code) { assert(code < elements()); if (code < m_dirty.size() && m_dirty[code]) decode(code); return m_gfxdata + code * m_char_modulo + m_starty * m_line_modulo + m_startx; } - uint32_t pen_usage(uint32_t code) + u32 pen_usage(u32 code) { assert(code < m_pen_usage.size()); if (m_dirty[code]) decode(code); @@ -202,106 +202,106 @@ public: // ----- core graphics drawing ----- // specific drawgfx implementations for each transparency type - void opaque(bitmap_ind16 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty); - void opaque(bitmap_rgb32 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty); - void transpen(bitmap_ind16 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, uint32_t transpen); - void transpen(bitmap_rgb32 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, uint32_t transpen); - void transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, uint32_t transpen); - void transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, uint32_t transpen); - void transmask(bitmap_ind16 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, uint32_t transmask); - void transmask(bitmap_rgb32 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, uint32_t transmask); - void transtable(bitmap_ind16 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, const uint8_t *pentable); - void transtable(bitmap_rgb32 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, const uint8_t *pentable); - void alpha(bitmap_rgb32 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, uint32_t transpen, uint8_t alpha); + void opaque(bitmap_ind16 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty); + void opaque(bitmap_rgb32 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty); + void transpen(bitmap_ind16 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, u32 transpen); + void transpen(bitmap_rgb32 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, u32 transpen); + void transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, u32 transpen); + void transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, u32 transpen); + void transmask(bitmap_ind16 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, u32 transmask); + void transmask(bitmap_rgb32 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, u32 transmask); + void transtable(bitmap_ind16 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, const u8 *pentable); + void transtable(bitmap_rgb32 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, const u8 *pentable); + void alpha(bitmap_rgb32 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, u32 transpen, u8 alpha); // ----- zoomed graphics drawing ----- // specific zoom implementations for each transparency type - void zoom_opaque(bitmap_ind16 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, uint32_t scalex, uint32_t scaley); - void zoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, uint32_t scalex, uint32_t scaley); - void zoom_transpen(bitmap_ind16 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, uint32_t scalex, uint32_t scaley, uint32_t transpen); - void zoom_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, uint32_t scalex, uint32_t scaley, uint32_t transpen); - void zoom_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, uint32_t scalex, uint32_t scaley, uint32_t transpen); - void zoom_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, uint32_t scalex, uint32_t scaley, uint32_t transpen); - void zoom_transmask(bitmap_ind16 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, uint32_t scalex, uint32_t scaley, uint32_t transmask); - void zoom_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, uint32_t scalex, uint32_t scaley, uint32_t transmask); - void zoom_transtable(bitmap_ind16 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, uint32_t scalex, uint32_t scaley, const uint8_t *pentable); - void zoom_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, uint32_t scalex, uint32_t scaley, const uint8_t *pentable); - void zoom_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, uint32_t scalex, uint32_t scaley, uint32_t transpen, uint8_t alpha); + void zoom_opaque(bitmap_ind16 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, u32 scalex, u32 scaley); + void zoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, u32 scalex, u32 scaley); + void zoom_transpen(bitmap_ind16 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, u32 scalex, u32 scaley, u32 transpen); + void zoom_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, u32 scalex, u32 scaley, u32 transpen); + void zoom_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, u32 scalex, u32 scaley, u32 transpen); + void zoom_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, u32 scalex, u32 scaley, u32 transpen); + void zoom_transmask(bitmap_ind16 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, u32 scalex, u32 scaley, u32 transmask); + void zoom_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, u32 scalex, u32 scaley, u32 transmask); + void zoom_transtable(bitmap_ind16 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, u32 scalex, u32 scaley, const u8 *pentable); + void zoom_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, u32 scalex, u32 scaley, const u8 *pentable); + void zoom_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, u32 scalex, u32 scaley, u32 transpen, u8 alpha); // ----- priority masked graphics drawing ----- // specific prio implementations for each transparency type - void prio_opaque(bitmap_ind16 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, bitmap_ind8 &priority, uint32_t pmask); - void prio_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, bitmap_ind8 &priority, uint32_t pmask); - void prio_transpen(bitmap_ind16 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, bitmap_ind8 &priority, uint32_t pmask, uint32_t transpen); - void prio_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, bitmap_ind8 &priority, uint32_t pmask, uint32_t transpen); - void prio_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, bitmap_ind8 &priority, uint32_t pmask, uint32_t transpen); - void prio_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, bitmap_ind8 &priority, uint32_t pmask, uint32_t transpen); - void prio_transmask(bitmap_ind16 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, bitmap_ind8 &priority, uint32_t pmask, uint32_t transmask); - void prio_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, bitmap_ind8 &priority, uint32_t pmask, uint32_t transmask); - void prio_transtable(bitmap_ind16 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, bitmap_ind8 &priority, uint32_t pmask, const uint8_t *pentable); - void prio_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, bitmap_ind8 &priority, uint32_t pmask, const uint8_t *pentable); - void prio_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, bitmap_ind8 &priority, uint32_t pmask, uint32_t transpen, uint8_t alpha); + void prio_opaque(bitmap_ind16 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, bitmap_ind8 &priority, u32 pmask); + void prio_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, bitmap_ind8 &priority, u32 pmask); + void prio_transpen(bitmap_ind16 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, bitmap_ind8 &priority, u32 pmask, u32 transpen); + void prio_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, bitmap_ind8 &priority, u32 pmask, u32 transpen); + void prio_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, bitmap_ind8 &priority, u32 pmask, u32 transpen); + void prio_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, bitmap_ind8 &priority, u32 pmask, u32 transpen); + void prio_transmask(bitmap_ind16 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, bitmap_ind8 &priority, u32 pmask, u32 transmask); + void prio_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, bitmap_ind8 &priority, u32 pmask, u32 transmask); + void prio_transtable(bitmap_ind16 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, bitmap_ind8 &priority, u32 pmask, const u8 *pentable); + void prio_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, bitmap_ind8 &priority, u32 pmask, const u8 *pentable); + void prio_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, bitmap_ind8 &priority, u32 pmask, u32 transpen, u8 alpha); // ----- priority masked zoomed graphics drawing ----- // specific prio_zoom implementations for each transparency type - void prio_zoom_opaque(bitmap_ind16 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, uint32_t scalex, uint32_t scaley, bitmap_ind8 &priority, uint32_t pmask); - void prio_zoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, uint32_t scalex, uint32_t scaley, bitmap_ind8 &priority, uint32_t pmask); - void prio_zoom_transpen(bitmap_ind16 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, uint32_t scalex, uint32_t scaley, bitmap_ind8 &priority, uint32_t pmask, uint32_t transpen); - void prio_zoom_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, uint32_t scalex, uint32_t scaley, bitmap_ind8 &priority, uint32_t pmask, uint32_t transpen); - void prio_zoom_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, uint32_t scalex, uint32_t scaley, bitmap_ind8 &priority, uint32_t pmask, uint32_t transpen); - void prio_zoom_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, uint32_t scalex, uint32_t scaley, bitmap_ind8 &priority, uint32_t pmask, uint32_t transpen); - void prio_zoom_transmask(bitmap_ind16 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, uint32_t scalex, uint32_t scaley, bitmap_ind8 &priority, uint32_t pmask, uint32_t transmask); - void prio_zoom_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, uint32_t scalex, uint32_t scaley, bitmap_ind8 &priority, uint32_t pmask, uint32_t transmask); - void prio_zoom_transtable(bitmap_ind16 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, uint32_t scalex, uint32_t scaley, bitmap_ind8 &priority, uint32_t pmask, const uint8_t *pentable); - void prio_zoom_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, uint32_t scalex, uint32_t scaley, bitmap_ind8 &priority, uint32_t pmask, const uint8_t *pentable); - void prio_zoom_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, uint32_t scalex, uint32_t scaley, bitmap_ind8 &priority, uint32_t pmask, uint32_t transpen, uint8_t alpha); + void prio_zoom_opaque(bitmap_ind16 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, u32 scalex, u32 scaley, bitmap_ind8 &priority, u32 pmask); + void prio_zoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, u32 scalex, u32 scaley, bitmap_ind8 &priority, u32 pmask); + void prio_zoom_transpen(bitmap_ind16 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, u32 scalex, u32 scaley, bitmap_ind8 &priority, u32 pmask, u32 transpen); + void prio_zoom_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, u32 scalex, u32 scaley, bitmap_ind8 &priority, u32 pmask, u32 transpen); + void prio_zoom_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, u32 scalex, u32 scaley, bitmap_ind8 &priority, u32 pmask, u32 transpen); + void prio_zoom_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, u32 scalex, u32 scaley, bitmap_ind8 &priority, u32 pmask, u32 transpen); + void prio_zoom_transmask(bitmap_ind16 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, u32 scalex, u32 scaley, bitmap_ind8 &priority, u32 pmask, u32 transmask); + void prio_zoom_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, u32 scalex, u32 scaley, bitmap_ind8 &priority, u32 pmask, u32 transmask); + void prio_zoom_transtable(bitmap_ind16 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, u32 scalex, u32 scaley, bitmap_ind8 &priority, u32 pmask, const u8 *pentable); + void prio_zoom_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, u32 scalex, u32 scaley, bitmap_ind8 &priority, u32 pmask, const u8 *pentable); + void prio_zoom_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, u32 scalex, u32 scaley, bitmap_ind8 &priority, u32 pmask, u32 transpen, u8 alpha); // implementations moved here from specific drivers - void prio_transpen_additive(bitmap_rgb32 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, bitmap_ind8 &priority, uint32_t pmask, uint32_t trans_pen); - void prio_zoom_transpen_additive(bitmap_rgb32 &dest, const rectangle &cliprect,uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty,uint32_t scalex, uint32_t scaley, bitmap_ind8 &priority, uint32_t pmask,uint32_t trans_pen); - void alphastore(bitmap_rgb32 &dest, const rectangle &cliprect,uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty,int fixedalpha, uint8_t *alphatable); - void alphatable(bitmap_rgb32 &dest, const rectangle &cliprect, uint32_t code, uint32_t color, int flipx, int flipy, int32_t destx, int32_t desty, int fixedalpha ,uint8_t *alphatable); + void prio_transpen_additive(bitmap_rgb32 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, bitmap_ind8 &priority, u32 pmask, u32 trans_pen); + void prio_zoom_transpen_additive(bitmap_rgb32 &dest, const rectangle &cliprect,u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty,u32 scalex, u32 scaley, bitmap_ind8 &priority, u32 pmask,u32 trans_pen); + void alphastore(bitmap_rgb32 &dest, const rectangle &cliprect,u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty,int fixedalpha, u8 *alphatable); + void alphatable(bitmap_rgb32 &dest, const rectangle &cliprect, u32 code, u32 color, int flipx, int flipy, s32 destx, s32 desty, int fixedalpha ,u8 *alphatable); private: // internal helpers - void decode(uint32_t code); + void decode(u32 code); // internal state palette_device *m_palette; // palette used for drawing - uint16_t m_width; // current pixel width of each element (changeable with source clipping) - uint16_t m_height; // current pixel height of each element (changeable with source clipping) - uint16_t m_startx; // current source clip X offset - uint16_t m_starty; // current source clip Y offset + u16 m_width; // current pixel width of each element (changeable with source clipping) + u16 m_height; // current pixel height of each element (changeable with source clipping) + u16 m_startx; // current source clip X offset + u16 m_starty; // current source clip Y offset - uint16_t m_origwidth; // starting pixel width of each element - uint16_t m_origheight; // staring pixel height of each element - uint32_t m_total_elements; // total number of decoded elements + u16 m_origwidth; // starting pixel width of each element + u16 m_origheight; // staring pixel height of each element + u32 m_total_elements; // total number of decoded elements - uint32_t m_color_base; // base color for rendering - uint16_t m_color_depth; // number of colors each pixel can represent - uint16_t m_color_granularity; // number of colors for each color code - uint32_t m_total_colors; // number of color codes + u32 m_color_base; // base color for rendering + u16 m_color_depth; // number of colors each pixel can represent + u16 m_color_granularity; // number of colors for each color code + u32 m_total_colors; // number of color codes - uint32_t m_line_modulo; // bytes between each row of data - uint32_t m_char_modulo; // bytes between each element - const uint8_t * m_srcdata; // pointer to the source data for decoding - uint32_t m_dirtyseq; // sequence number; incremented each time a tile is dirtied + u32 m_line_modulo; // bytes between each row of data + u32 m_char_modulo; // bytes between each element + const u8 * m_srcdata; // pointer to the source data for decoding + u32 m_dirtyseq; // sequence number; incremented each time a tile is dirtied - uint8_t * m_gfxdata; // pointer to decoded pixel data, 8bpp - std::vector m_gfxdata_allocated; // allocated decoded pixel data, 8bpp - std::vector m_dirty; // dirty array for detecting chars that need decoding - std::vector m_pen_usage; // bitmask of pens that are used (pens 0-31 only) + u8 * m_gfxdata; // pointer to decoded pixel data, 8bpp + std::vector m_gfxdata_allocated; // allocated decoded pixel data, 8bpp + std::vector m_dirty; // dirty array for detecting chars that need decoding + std::vector m_pen_usage; // bitmask of pens that are used (pens 0-31 only) bool m_layout_is_raw; // raw layout? - uint8_t m_layout_planes; // bit planes in the layout - uint32_t m_layout_xormask; // xor mask applied to each bit offset - uint32_t m_layout_charincrement; // per-character increment in source data - std::vector m_layout_planeoffset;// plane offsets - std::vector m_layout_xoffset; // X offsets - std::vector m_layout_yoffset; // Y offsets + u8 m_layout_planes; // bit planes in the layout + u32 m_layout_xormask; // xor mask applied to each bit offset + u32 m_layout_charincrement; // per-character increment in source data + std::vector m_layout_planeoffset;// plane offsets + std::vector m_layout_xoffset; // X offsets + std::vector m_layout_yoffset; // Y offsets }; @@ -312,44 +312,44 @@ private: // ----- scanline copying ----- // copy pixels from an 8bpp buffer to a single scanline of a bitmap -void draw_scanline8(bitmap_ind16 &bitmap, int32_t destx, int32_t desty, int32_t length, const uint8_t *srcptr, const pen_t *paldata); -void draw_scanline8(bitmap_rgb32 &bitmap, int32_t destx, int32_t desty, int32_t length, const uint8_t *srcptr, const pen_t *paldata); +void draw_scanline8(bitmap_ind16 &bitmap, s32 destx, s32 desty, s32 length, const u8 *srcptr, const pen_t *paldata); +void draw_scanline8(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 length, const u8 *srcptr, const pen_t *paldata); // copy pixels from a 16bpp buffer to a single scanline of a bitmap -void draw_scanline16(bitmap_ind16 &bitmap, int32_t destx, int32_t desty, int32_t length, const uint16_t *srcptr, const pen_t *paldata); -void draw_scanline16(bitmap_rgb32 &bitmap, int32_t destx, int32_t desty, int32_t length, const uint16_t *srcptr, const pen_t *paldata); +void draw_scanline16(bitmap_ind16 &bitmap, s32 destx, s32 desty, s32 length, const u16 *srcptr, const pen_t *paldata); +void draw_scanline16(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 length, const u16 *srcptr, const pen_t *paldata); // copy pixels from a 32bpp buffer to a single scanline of a bitmap -void draw_scanline32(bitmap_ind16 &bitmap, int32_t destx, int32_t desty, int32_t length, const uint32_t *srcptr, const pen_t *paldata); -void draw_scanline32(bitmap_rgb32 &bitmap, int32_t destx, int32_t desty, int32_t length, const uint32_t *srcptr, const pen_t *paldata); +void draw_scanline32(bitmap_ind16 &bitmap, s32 destx, s32 desty, s32 length, const u32 *srcptr, const pen_t *paldata); +void draw_scanline32(bitmap_rgb32 &bitmap, s32 destx, s32 desty, s32 length, const u32 *srcptr, const pen_t *paldata); // ----- scanline extraction ----- // copy pixels from a single scanline of a bitmap to an 8bpp buffer -void extract_scanline8(const bitmap_ind16 &bitmap, int32_t srcx, int32_t srcy, int32_t length, uint8_t *destptr); -void extract_scanline8(const bitmap_rgb32 &bitmap, int32_t srcx, int32_t srcy, int32_t length, uint8_t *destptr); +void extract_scanline8(const bitmap_ind16 &bitmap, s32 srcx, s32 srcy, s32 length, u8 *destptr); +void extract_scanline8(const bitmap_rgb32 &bitmap, s32 srcx, s32 srcy, s32 length, u8 *destptr); // copy pixels from a single scanline of a bitmap to a 16bpp buffer -void extract_scanline16(const bitmap_ind16 &bitmap, int32_t srcx, int32_t srcy, int32_t length, uint16_t *destptr); -void extract_scanline16(const bitmap_rgb32 &bitmap, int32_t srcx, int32_t srcy, int32_t length, uint16_t *destptr); +void extract_scanline16(const bitmap_ind16 &bitmap, s32 srcx, s32 srcy, s32 length, u16 *destptr); +void extract_scanline16(const bitmap_rgb32 &bitmap, s32 srcx, s32 srcy, s32 length, u16 *destptr); // copy pixels from a single scanline of a bitmap to a 32bpp buffer -void extract_scanline32(const bitmap_ind16 &bitmap, int32_t srcx, int32_t srcy, int32_t length, uint32_t *destptr); -void extract_scanline32(const bitmap_rgb32 &bitmap, int32_t srcx, int32_t srcy, int32_t length, uint32_t *destptr); +void extract_scanline32(const bitmap_ind16 &bitmap, s32 srcx, s32 srcy, s32 length, u32 *destptr); +void extract_scanline32(const bitmap_rgb32 &bitmap, s32 srcx, s32 srcy, s32 length, u32 *destptr); // ----- bitmap copying ----- // copy from one bitmap to another, copying all unclipped pixels -void copybitmap(bitmap_ind16 &dest, const bitmap_ind16 &src, int flipx, int flipy, int32_t destx, int32_t desty, const rectangle &cliprect); -void copybitmap(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, int flipy, int32_t destx, int32_t desty, const rectangle &cliprect); +void copybitmap(bitmap_ind16 &dest, const bitmap_ind16 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect); +void copybitmap(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect); // copy from one bitmap to another, copying all unclipped pixels except those that match transpen -void copybitmap_trans(bitmap_ind16 &dest, const bitmap_ind16 &src, int flipx, int flipy, int32_t destx, int32_t desty, const rectangle &cliprect, uint32_t transpen); -void copybitmap_trans(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, int flipy, int32_t destx, int32_t desty, const rectangle &cliprect, uint32_t transpen); +void copybitmap_trans(bitmap_ind16 &dest, const bitmap_ind16 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect, u32 transpen); +void copybitmap_trans(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, int flipy, s32 destx, s32 desty, const rectangle &cliprect, u32 transpen); /* Copy a bitmap onto another with scroll and wraparound. @@ -364,12 +364,12 @@ void copybitmap_trans(bitmap_rgb32 &dest, const bitmap_rgb32 &src, int flipx, in */ // copy from one bitmap to another, copying all unclipped pixels, and applying scrolling to one or more rows/columns -void copyscrollbitmap(bitmap_ind16 &dest, const bitmap_ind16 &src, uint32_t numrows, const int32_t *rowscroll, uint32_t numcols, const int32_t *colscroll, const rectangle &cliprect); -void copyscrollbitmap(bitmap_rgb32 &dest, const bitmap_rgb32 &src, uint32_t numrows, const int32_t *rowscroll, uint32_t numcols, const int32_t *colscroll, const rectangle &cliprect); +void copyscrollbitmap(bitmap_ind16 &dest, const bitmap_ind16 &src, u32 numrows, const s32 *rowscroll, u32 numcols, const s32 *colscroll, const rectangle &cliprect); +void copyscrollbitmap(bitmap_rgb32 &dest, const bitmap_rgb32 &src, u32 numrows, const s32 *rowscroll, u32 numcols, const s32 *colscroll, const rectangle &cliprect); // copy from one bitmap to another, copying all unclipped pixels except those that match transpen, and applying scrolling to one or more rows/columns -void copyscrollbitmap_trans(bitmap_ind16 &dest, const bitmap_ind16 &src, uint32_t numrows, const int32_t *rowscroll, uint32_t numcols, const int32_t *colscroll, const rectangle &cliprect, uint32_t transpen); -void copyscrollbitmap_trans(bitmap_rgb32 &dest, const bitmap_rgb32 &src, uint32_t numrows, const int32_t *rowscroll, uint32_t numcols, const int32_t *colscroll, const rectangle &cliprect, uint32_t transpen); +void copyscrollbitmap_trans(bitmap_ind16 &dest, const bitmap_ind16 &src, u32 numrows, const s32 *rowscroll, u32 numcols, const s32 *colscroll, const rectangle &cliprect, u32 transpen); +void copyscrollbitmap_trans(bitmap_rgb32 &dest, const bitmap_rgb32 &src, u32 numrows, const s32 *rowscroll, u32 numcols, const s32 *colscroll, const rectangle &cliprect, u32 transpen); /* Copy a bitmap applying rotation, zooming, and arbitrary distortion. @@ -401,12 +401,12 @@ void copyscrollbitmap_trans(bitmap_rgb32 &dest, const bitmap_rgb32 &src, uint32_ */ // copy from one bitmap to another, with zoom and rotation, copying all unclipped pixels -void copyrozbitmap(bitmap_ind16 &dest, const rectangle &cliprect, const bitmap_ind16 &src, int32_t startx, int32_t starty, int32_t incxx, int32_t incxy, int32_t incyx, int32_t incyy, int wraparound); -void copyrozbitmap(bitmap_rgb32 &dest, const rectangle &cliprect, const bitmap_rgb32 &src, int32_t startx, int32_t starty, int32_t incxx, int32_t incxy, int32_t incyx, int32_t incyy, int wraparound); +void copyrozbitmap(bitmap_ind16 &dest, const rectangle &cliprect, const bitmap_ind16 &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound); +void copyrozbitmap(bitmap_rgb32 &dest, const rectangle &cliprect, const bitmap_rgb32 &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound); // copy from one bitmap to another, with zoom and rotation, copying all unclipped pixels whose values do not match transpen -void copyrozbitmap_trans(bitmap_ind16 &dest, const rectangle &cliprect, const bitmap_ind16 &src, int32_t startx, int32_t starty, int32_t incxx, int32_t incxy, int32_t incyx, int32_t incyy, int wraparound, uint32_t transparent_color); -void copyrozbitmap_trans(bitmap_rgb32 &dest, const rectangle &cliprect, const bitmap_rgb32 &src, int32_t startx, int32_t starty, int32_t incxx, int32_t incxy, int32_t incyx, int32_t incyy, int wraparound, uint32_t transparent_color); +void copyrozbitmap_trans(bitmap_ind16 &dest, const rectangle &cliprect, const bitmap_ind16 &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound, u32 transparent_color); +void copyrozbitmap_trans(bitmap_rgb32 &dest, const rectangle &cliprect, const bitmap_rgb32 &src, s32 startx, s32 starty, s32 incxx, s32 incxy, s32 incyx, s32 incyy, int wraparound, u32 transparent_color); @@ -419,12 +419,11 @@ void copyrozbitmap_trans(bitmap_rgb32 &dest, const rectangle &cliprect, const bi // 5-5-5 RGB pixels //------------------------------------------------- -inline uint32_t alpha_blend_r16(uint32_t d, uint32_t s, uint8_t level) +constexpr u32 alpha_blend_r16(u32 d, u32 s, u8 level) { - int alphad = 256 - level; - return ((((s & 0x001f) * level + (d & 0x001f) * alphad) >> 8)) | - ((((s & 0x03e0) * level + (d & 0x03e0) * alphad) >> 8) & 0x03e0) | - ((((s & 0x7c00) * level + (d & 0x7c00) * alphad) >> 8) & 0x7c00); + return ((((s & 0x001f) * level + (d & 0x001f) * int(256 - level)) >> 8)) | + ((((s & 0x03e0) * level + (d & 0x03e0) * int(256 - level)) >> 8) & 0x03e0) | + ((((s & 0x7c00) * level + (d & 0x7c00) * int(256 - level)) >> 8) & 0x7c00); } @@ -433,12 +432,11 @@ inline uint32_t alpha_blend_r16(uint32_t d, uint32_t s, uint8_t level) // 8-8-8 RGB pixels //------------------------------------------------- -inline uint32_t alpha_blend_r32(uint32_t d, uint32_t s, uint8_t level) +constexpr u32 alpha_blend_r32(u32 d, u32 s, u8 level) { - int alphad = 256 - level; - return ((((s & 0x0000ff) * level + (d & 0x0000ff) * alphad) >> 8)) | - ((((s & 0x00ff00) * level + (d & 0x00ff00) * alphad) >> 8) & 0x00ff00) | - ((((s & 0xff0000) * level + (d & 0xff0000) * alphad) >> 8) & 0xff0000); + return ((((s & 0x0000ff) * level + (d & 0x0000ff) * int(256 - level)) >> 8)) | + ((((s & 0x00ff00) * level + (d & 0x00ff00) * int(256 - level)) >> 8) & 0x00ff00) | + ((((s & 0xff0000) * level + (d & 0xff0000) * int(256 - level)) >> 8) & 0xff0000); } //************************************************************************** @@ -454,7 +452,7 @@ class gfxdecode_device : public device_t, public device_gfx_interface { public: // construction/destruction - gfxdecode_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + gfxdecode_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); protected: virtual void device_start() override {}; @@ -462,4 +460,4 @@ protected: GFXDECODE_EXTERN(empty); -#endif // __DRAWGFX_H__ +#endif // MAME_EMU_DRAWGFX_H diff --git a/src/emu/drawgfxm.h b/src/emu/drawgfxm.h index 16af0e821b5..325ce0e974c 100644 --- a/src/emu/drawgfxm.h +++ b/src/emu/drawgfxm.h @@ -18,8 +18,8 @@ The second set of macros represents the core gfx/bitmap walking and rendering code. These macros generally take the target pixel - type (uint8_t, uint16_t, uint32_t), one of the PIXEL_OP* macros, - and a priority bitmap pixel type (uint8_t, uint16_t, uint32_t, or the + type (u8, u16, u32), one of the PIXEL_OP* macros, + and a priority bitmap pixel type (u8, u16, u32, or the special type NO_PRIORITY). Although the code may look inefficient at first, the compiler is @@ -88,7 +88,7 @@ while (0) #define PIXEL_OP_COPY_TRANSPEN(DEST, PRIORITY, SOURCE) \ do \ { \ - uint32_t srcdata = (SOURCE); \ + u32 srcdata = (SOURCE); \ if (srcdata != trans_pen) \ (DEST) = SOURCE; \ } \ @@ -145,7 +145,7 @@ while (0) #define PIXEL_OP_REMAP_TRANSPEN(DEST, PRIORITY, SOURCE) \ do \ { \ - uint32_t srcdata = (SOURCE); \ + u32 srcdata = (SOURCE); \ if (srcdata != trans_pen) \ (DEST) = paldata[srcdata]; \ } \ @@ -153,7 +153,7 @@ while (0) #define PIXEL_OP_REMAP_TRANSPEN_PRIORITY(DEST, PRIORITY, SOURCE) \ do \ { \ - uint32_t srcdata = (SOURCE); \ + u32 srcdata = (SOURCE); \ if (srcdata != trans_pen) \ { \ if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ @@ -172,7 +172,7 @@ while (0) #define PIXEL_OP_REBASE_TRANSPEN(DEST, PRIORITY, SOURCE) \ do \ { \ - uint32_t srcdata = (SOURCE); \ + u32 srcdata = (SOURCE); \ if (srcdata != trans_pen) \ (DEST) = color + srcdata; \ } \ @@ -180,7 +180,7 @@ while (0) #define PIXEL_OP_REBASE_TRANSPEN_PRIORITY(DEST, PRIORITY, SOURCE) \ do \ { \ - uint32_t srcdata = (SOURCE); \ + u32 srcdata = (SOURCE); \ if (srcdata != trans_pen) \ { \ if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ @@ -199,7 +199,7 @@ while (0) #define PIXEL_OP_REMAP_TRANSMASK(DEST, PRIORITY, SOURCE) \ do \ { \ - uint32_t srcdata = (SOURCE); \ + u32 srcdata = (SOURCE); \ if (((trans_mask >> srcdata) & 1) == 0) \ (DEST) = paldata[srcdata]; \ } \ @@ -207,7 +207,7 @@ while (0) #define PIXEL_OP_REMAP_TRANSMASK_PRIORITY(DEST, PRIORITY, SOURCE) \ do \ { \ - uint32_t srcdata = (SOURCE); \ + u32 srcdata = (SOURCE); \ if (((trans_mask >> srcdata) & 1) == 0) \ { \ if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ @@ -226,7 +226,7 @@ while (0) #define PIXEL_OP_REBASE_TRANSMASK(DEST, PRIORITY, SOURCE) \ do \ { \ - uint32_t srcdata = (SOURCE); \ + u32 srcdata = (SOURCE); \ if (((trans_mask >> srcdata) & 1) == 0) \ (DEST) = color + srcdata; \ } \ @@ -234,7 +234,7 @@ while (0) #define PIXEL_OP_REBASE_TRANSMASK_PRIORITY(DEST, PRIORITY, SOURCE) \ do \ { \ - uint32_t srcdata = (SOURCE); \ + u32 srcdata = (SOURCE); \ if (((trans_mask >> srcdata) & 1) == 0) \ { \ if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ @@ -263,8 +263,8 @@ while (0) #define PIXEL_OP_REBASE_TRANSTABLE16(DEST, PRIORITY, SOURCE) \ do \ { \ - uint32_t srcdata = (SOURCE); \ - uint32_t entry = pentable[srcdata]; \ + u32 srcdata = (SOURCE); \ + u32 entry = pentable[srcdata]; \ if (entry != DRAWMODE_NONE) \ { \ if (entry == DRAWMODE_SOURCE) \ @@ -277,8 +277,8 @@ while (0) #define PIXEL_OP_REMAP_TRANSTABLE32(DEST, PRIORITY, SOURCE) \ do \ { \ - uint32_t srcdata = (SOURCE); \ - uint32_t entry = pentable[srcdata]; \ + u32 srcdata = (SOURCE); \ + u32 entry = pentable[srcdata]; \ if (entry != DRAWMODE_NONE) \ { \ if (entry == DRAWMODE_SOURCE) \ @@ -291,11 +291,11 @@ while (0) #define PIXEL_OP_REBASE_TRANSTABLE16_PRIORITY(DEST, PRIORITY, SOURCE) \ do \ { \ - uint32_t srcdata = (SOURCE); \ - uint32_t entry = pentable[srcdata]; \ + u32 srcdata = (SOURCE); \ + u32 entry = pentable[srcdata]; \ if (entry != DRAWMODE_NONE) \ { \ - uint8_t pridata = (PRIORITY); \ + u8 pridata = (PRIORITY); \ if (entry == DRAWMODE_SOURCE) \ { \ if (((1 << (pridata & 0x1f)) & pmask) == 0) \ @@ -313,11 +313,11 @@ while (0) #define PIXEL_OP_REMAP_TRANSTABLE32_PRIORITY(DEST, PRIORITY, SOURCE) \ do \ { \ - uint32_t srcdata = (SOURCE); \ - uint32_t entry = pentable[srcdata]; \ + u32 srcdata = (SOURCE); \ + u32 entry = pentable[srcdata]; \ if (entry != DRAWMODE_NONE) \ { \ - uint8_t pridata = (PRIORITY); \ + u8 pridata = (PRIORITY); \ if (entry == DRAWMODE_SOURCE) \ { \ if (((1 << (pridata & 0x1f)) & pmask) == 0) \ @@ -344,7 +344,7 @@ while (0) #define PIXEL_OP_REMAP_TRANSPEN_ALPHA32(DEST, PRIORITY, SOURCE) \ do \ { \ - uint32_t srcdata = (SOURCE); \ + u32 srcdata = (SOURCE); \ if (srcdata != trans_pen) \ (DEST) = alpha_blend_r32((DEST), paldata[srcdata], alpha_val); \ } \ @@ -352,7 +352,7 @@ while (0) #define PIXEL_OP_REMAP_TRANSPEN_ALPHA32_PRIORITY(DEST, PRIORITY, SOURCE) \ do \ { \ - uint32_t srcdata = (SOURCE); \ + u32 srcdata = (SOURCE); \ if (srcdata != trans_pen) \ { \ if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ @@ -373,90 +373,90 @@ while (0) bitmap_t &dest - the bitmap to render to const rectangle &cliprect - a clipping rectangle (assumed to be clipped to the size of 'dest') gfx_element *gfx - pointer to the gfx_element to render - uint32_t code - index of the entry within gfx_element - uint32_t color - index of the color within gfx_element + u32 code - index of the entry within gfx_element + u32 color - index of the color within gfx_element int flipx - non-zero means render right-to-left instead of left-to-right int flipy - non-zero means render bottom-to-top instead of top-to-bottom - int32_t destx - the top-left X coordinate to render to - int32_t desty - the top-left Y coordinate to render to + s32 destx - the top-left X coordinate to render to + s32 desty - the top-left Y coordinate to render to bitmap_t &priority - the priority bitmap (even if PRIORITY_TYPE is NO_PRIORITY, at least needs a dummy) */ -#define DRAWGFX_CORE(PIXEL_TYPE, PIXEL_OP, PRIORITY_TYPE) \ -do { \ - g_profiler.start(PROFILER_DRAWGFX); \ - do { \ - const uint8_t *srcdata; \ - int32_t destendx, destendy; \ - int32_t srcx, srcy; \ - int32_t curx, cury; \ - int32_t dy; \ - \ - assert(dest.valid()); \ - assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority.valid()); \ - assert(dest.cliprect().contains(cliprect)); \ - assert(code < elements()); \ - \ - /* ignore empty/invalid cliprects */ \ - if (cliprect.empty()) \ - break; \ - \ - /* compute final pixel in X and exit if we are entirely clipped */ \ - destendx = destx + width() - 1; \ - if (destx > cliprect.max_x || destendx < cliprect.min_x) \ - break; \ - \ - /* apply left clip */ \ - srcx = 0; \ - if (destx < cliprect.min_x) \ - { \ - srcx = cliprect.min_x - destx; \ - destx = cliprect.min_x; \ - } \ - \ - /* apply right clip */ \ - if (destendx > cliprect.max_x) \ - destendx = cliprect.max_x; \ - \ - /* compute final pixel in Y and exit if we are entirely clipped */ \ - destendy = desty + height() - 1; \ - if (desty > cliprect.max_y || destendy < cliprect.min_y) \ - break; \ - \ - /* apply top clip */ \ - srcy = 0; \ - if (desty < cliprect.min_y) \ - { \ - srcy = cliprect.min_y - desty; \ - desty = cliprect.min_y; \ - } \ - \ - /* apply bottom clip */ \ - if (destendy > cliprect.max_y) \ - destendy = cliprect.max_y; \ - \ - /* apply X flipping */ \ - if (flipx) \ - srcx = width() - 1 - srcx; \ - \ - /* apply Y flipping */ \ - dy = rowbytes(); \ - if (flipy) \ - { \ - srcy = height() - 1 - srcy; \ - dy = -dy; \ - } \ - \ - /* fetch the source data */ \ - srcdata = get_data(code); \ - \ +#define DRAWGFX_CORE(PIXEL_TYPE, PIXEL_OP, PRIORITY_TYPE) \ +do { \ + g_profiler.start(PROFILER_DRAWGFX); \ + do { \ + const u8 *srcdata; \ + s32 destendx, destendy; \ + s32 srcx, srcy; \ + s32 curx, cury; \ + s32 dy; \ + \ + assert(dest.valid()); \ + assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority.valid()); \ + assert(dest.cliprect().contains(cliprect)); \ + assert(code < elements()); \ + \ + /* ignore empty/invalid cliprects */ \ + if (cliprect.empty()) \ + break; \ + \ + /* compute final pixel in X and exit if we are entirely clipped */ \ + destendx = destx + width() - 1; \ + if (destx > cliprect.max_x || destendx < cliprect.min_x) \ + break; \ + \ + /* apply left clip */ \ + srcx = 0; \ + if (destx < cliprect.min_x) \ + { \ + srcx = cliprect.min_x - destx; \ + destx = cliprect.min_x; \ + } \ + \ + /* apply right clip */ \ + if (destendx > cliprect.max_x) \ + destendx = cliprect.max_x; \ + \ + /* compute final pixel in Y and exit if we are entirely clipped */ \ + destendy = desty + height() - 1; \ + if (desty > cliprect.max_y || destendy < cliprect.min_y) \ + break; \ + \ + /* apply top clip */ \ + srcy = 0; \ + if (desty < cliprect.min_y) \ + { \ + srcy = cliprect.min_y - desty; \ + desty = cliprect.min_y; \ + } \ + \ + /* apply bottom clip */ \ + if (destendy > cliprect.max_y) \ + destendy = cliprect.max_y; \ + \ + /* apply X flipping */ \ + if (flipx) \ + srcx = width() - 1 - srcx; \ + \ + /* apply Y flipping */ \ + dy = rowbytes(); \ + if (flipy) \ + { \ + srcy = height() - 1 - srcy; \ + dy = -dy; \ + } \ + \ + /* fetch the source data */ \ + srcdata = get_data(code); \ + \ /* compute how many blocks of 4 pixels we have */ \ - uint32_t numblocks = (destendx + 1 - destx) / 4; \ - uint32_t leftovers = (destendx + 1 - destx) - 4 * numblocks; \ + u32 numblocks = (destendx + 1 - destx) / 4; \ + u32 leftovers = (destendx + 1 - destx) - 4 * numblocks; \ \ /* adjust srcdata to point to the first source pixel of the row */ \ - srcdata += srcy * rowbytes() + srcx; \ + srcdata += srcy * rowbytes() + srcx; \ \ /* non-flipped 8bpp case */ \ if (!flipx) \ @@ -466,7 +466,7 @@ do { { \ PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, destx); \ PIXEL_TYPE *destptr = &dest.pixt(cury, destx); \ - const uint8_t *srcptr = srcdata; \ + const u8 *srcptr = srcdata; \ srcdata += dy; \ \ /* iterate over unrolled blocks of 4 */ \ @@ -501,7 +501,7 @@ do { { \ PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, destx); \ PIXEL_TYPE *destptr = &dest.pixt(cury, destx); \ - const uint8_t *srcptr = srcdata; \ + const u8 *srcptr = srcdata; \ srcdata += dy; \ \ /* iterate over unrolled blocks of 4 */ \ @@ -527,8 +527,8 @@ do { } \ } \ } \ - } while (0); \ - g_profiler.stop(); \ + } while (0); \ + g_profiler.stop(); \ } while (0) @@ -543,112 +543,112 @@ do { bitmap_t &dest - the bitmap to render to const rectangle &cliprect - a clipping rectangle (assumed to be clipped to the size of 'dest') gfx_element *gfx - pointer to the gfx_element to render - uint32_t code - index of the entry within gfx_element - uint32_t color - index of the color within gfx_element + u32 code - index of the entry within gfx_element + u32 color - index of the color within gfx_element int flipx - non-zero means render right-to-left instead of left-to-right int flipy - non-zero means render bottom-to-top instead of top-to-bottom - int32_t destx - the top-left X coordinate to render to - int32_t desty - the top-left Y coordinate to render to - uint32_t scalex - the 16.16 scale factor in the X dimension - uint32_t scaley - the 16.16 scale factor in the Y dimension + s32 destx - the top-left X coordinate to render to + s32 desty - the top-left Y coordinate to render to + u32 scalex - the 16.16 scale factor in the X dimension + u32 scaley - the 16.16 scale factor in the Y dimension bitmap_t &priority - the priority bitmap (even if PRIORITY_TYPE is NO_PRIORITY, at least needs a dummy) */ -#define DRAWGFXZOOM_CORE(PIXEL_TYPE, PIXEL_OP, PRIORITY_TYPE) \ -do { \ - g_profiler.start(PROFILER_DRAWGFX); \ - do { \ - const uint8_t *srcdata; \ - uint32_t dstwidth, dstheight; \ - int32_t destendx, destendy; \ - int32_t srcx, srcy; \ - int32_t curx, cury; \ - int32_t dx, dy; \ - \ - assert(dest.valid()); \ - assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority.valid()); \ - assert(dest.cliprect().contains(cliprect)); \ - \ - /* ignore empty/invalid cliprects */ \ - if (cliprect.empty()) \ - break; \ - \ - /* compute scaled size */ \ - dstwidth = (scalex * width() + 0x8000) >> 16; \ - dstheight = (scaley * height() + 0x8000) >> 16; \ - if (dstwidth < 1 || dstheight < 1) \ - break; \ - \ - /* compute 16.16 source steps in dx and dy */ \ - dx = (width() << 16) / dstwidth; \ - dy = (height() << 16) / dstheight; \ - \ - /* compute final pixel in X and exit if we are entirely clipped */ \ - destendx = destx + dstwidth - 1; \ - if (destx > cliprect.max_x || destendx < cliprect.min_x) \ - break; \ - \ - /* apply left clip */ \ - srcx = 0; \ +#define DRAWGFXZOOM_CORE(PIXEL_TYPE, PIXEL_OP, PRIORITY_TYPE) \ +do { \ + g_profiler.start(PROFILER_DRAWGFX); \ + do { \ + const u8 *srcdata; \ + u32 dstwidth, dstheight; \ + s32 destendx, destendy; \ + s32 srcx, srcy; \ + s32 curx, cury; \ + s32 dx, dy; \ + \ + assert(dest.valid()); \ + assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority.valid()); \ + assert(dest.cliprect().contains(cliprect)); \ + \ + /* ignore empty/invalid cliprects */ \ + if (cliprect.empty()) \ + break; \ + \ + /* compute scaled size */ \ + dstwidth = (scalex * width() + 0x8000) >> 16; \ + dstheight = (scaley * height() + 0x8000) >> 16; \ + if (dstwidth < 1 || dstheight < 1) \ + break; \ + \ + /* compute 16.16 source steps in dx and dy */ \ + dx = (width() << 16) / dstwidth; \ + dy = (height() << 16) / dstheight; \ + \ + /* compute final pixel in X and exit if we are entirely clipped */ \ + destendx = destx + dstwidth - 1; \ + if (destx > cliprect.max_x || destendx < cliprect.min_x) \ + break; \ + \ + /* apply left clip */ \ + srcx = 0; \ if (destx < cliprect.min_x) \ - { \ - srcx = (cliprect.min_x - destx) * dx; \ + { \ + srcx = (cliprect.min_x - destx) * dx; \ destx = cliprect.min_x; \ - } \ - \ - /* apply right clip */ \ - if (destendx > cliprect.max_x) \ - destendx = cliprect.max_x; \ - \ - /* compute final pixel in Y and exit if we are entirely clipped */ \ - destendy = desty + dstheight - 1; \ - if (desty > cliprect.max_y || destendy < cliprect.min_y) \ - { \ - g_profiler.stop(); \ - return; \ - } \ - \ - /* apply top clip */ \ - srcy = 0; \ + } \ + \ + /* apply right clip */ \ + if (destendx > cliprect.max_x) \ + destendx = cliprect.max_x; \ + \ + /* compute final pixel in Y and exit if we are entirely clipped */ \ + destendy = desty + dstheight - 1; \ + if (desty > cliprect.max_y || destendy < cliprect.min_y) \ + { \ + g_profiler.stop(); \ + return; \ + } \ + \ + /* apply top clip */ \ + srcy = 0; \ if (desty < cliprect.min_y) \ - { \ - srcy = (cliprect.min_y - desty) * dy; \ + { \ + srcy = (cliprect.min_y - desty) * dy; \ desty = cliprect.min_y; \ - } \ - \ - /* apply bottom clip */ \ - if (destendy > cliprect.max_y) \ - destendy = cliprect.max_y; \ - \ - /* apply X flipping */ \ - if (flipx) \ - { \ - srcx = (dstwidth - 1) * dx - srcx; \ - dx = -dx; \ - } \ - \ - /* apply Y flipping */ \ - if (flipy) \ - { \ - srcy = (dstheight - 1) * dy - srcy; \ - dy = -dy; \ - } \ - \ - /* fetch the source data */ \ - srcdata = get_data(code); \ - \ + } \ + \ + /* apply bottom clip */ \ + if (destendy > cliprect.max_y) \ + destendy = cliprect.max_y; \ + \ + /* apply X flipping */ \ + if (flipx) \ + { \ + srcx = (dstwidth - 1) * dx - srcx; \ + dx = -dx; \ + } \ + \ + /* apply Y flipping */ \ + if (flipy) \ + { \ + srcy = (dstheight - 1) * dy - srcy; \ + dy = -dy; \ + } \ + \ + /* fetch the source data */ \ + srcdata = get_data(code); \ + \ /* compute how many blocks of 4 pixels we have */ \ - uint32_t numblocks = (destendx + 1 - destx) / 4; \ - uint32_t leftovers = (destendx + 1 - destx) - 4 * numblocks; \ + u32 numblocks = (destendx + 1 - destx) / 4; \ + u32 leftovers = (destendx + 1 - destx) - 4 * numblocks; \ \ /* iterate over pixels in Y */ \ for (cury = desty; cury <= destendy; cury++) \ { \ PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, destx); \ PIXEL_TYPE *destptr = &dest.pixt(cury, destx); \ - const uint8_t *srcptr = srcdata + (srcy >> 16) * rowbytes(); \ - int32_t cursrcx = srcx; \ + const u8 *srcptr = srcdata + (srcy >> 16) * rowbytes(); \ + s32 cursrcx = srcx; \ srcy += dy; \ \ /* iterate over unrolled blocks of 4 */ \ @@ -676,8 +676,8 @@ do { PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ } \ } \ - } while (0); \ - g_profiler.stop(); \ + } while (0); \ + g_profiler.stop(); \ } while (0) @@ -694,161 +694,161 @@ do { const rectangle &cliprect - a clipping rectangle (assumed to be clipped to the size of 'dest') int flipx - non-zero means render right-to-left instead of left-to-right int flipy - non-zero means render bottom-to-top instead of top-to-bottom - int32_t destx - the top-left X coordinate to copy to - int32_t desty - the top-left Y coordinate to copy to + s32 destx - the top-left X coordinate to copy to + s32 desty - the top-left Y coordinate to copy to bitmap_t &priority - the priority bitmap (even if PRIORITY_TYPE is NO_PRIORITY, at least needs a dummy) */ -#define COPYBITMAP_CORE(PIXEL_TYPE, PIXEL_OP, PRIORITY_TYPE) \ -do { \ - g_profiler.start(PROFILER_COPYBITMAP); \ - do { \ - const PIXEL_TYPE *srcdata; \ - uint32_t numblocks, leftovers; \ - int32_t destendx, destendy; \ - int32_t srcx, srcy; \ - int32_t curx, cury; \ - int32_t dx, dy; \ - \ - assert(dest.valid()); \ - assert(src.valid()); \ - assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority.valid()); \ - assert(dest.cliprect().contains(cliprect)); \ - \ - /* ignore empty/invalid cliprects */ \ - if (cliprect.empty()) \ - break; \ - \ - /* standard setup; dx counts bytes in X, dy counts pixels in Y */ \ - dx = 1; \ - dy = src.rowpixels(); \ - \ - /* compute final pixel in X and exit if we are entirely clipped */ \ +#define COPYBITMAP_CORE(PIXEL_TYPE, PIXEL_OP, PRIORITY_TYPE) \ +do { \ + g_profiler.start(PROFILER_COPYBITMAP); \ + do { \ + const PIXEL_TYPE *srcdata; \ + u32 numblocks, leftovers; \ + s32 destendx, destendy; \ + s32 srcx, srcy; \ + s32 curx, cury; \ + s32 dx, dy; \ + \ + assert(dest.valid()); \ + assert(src.valid()); \ + assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority.valid()); \ + assert(dest.cliprect().contains(cliprect)); \ + \ + /* ignore empty/invalid cliprects */ \ + if (cliprect.empty()) \ + break; \ + \ + /* standard setup; dx counts bytes in X, dy counts pixels in Y */ \ + dx = 1; \ + dy = src.rowpixels(); \ + \ + /* compute final pixel in X and exit if we are entirely clipped */ \ destendx = destx + src.width() - 1; \ - if (destx > cliprect.max_x || destendx < cliprect.min_x) \ - break; \ - \ - /* apply left clip */ \ - srcx = 0; \ + if (destx > cliprect.max_x || destendx < cliprect.min_x) \ + break; \ + \ + /* apply left clip */ \ + srcx = 0; \ if (destx < cliprect.min_x) \ - { \ - srcx = cliprect.min_x - destx; \ + { \ + srcx = cliprect.min_x - destx; \ destx = cliprect.min_x; \ - } \ - \ - /* apply right clip */ \ - if (destendx > cliprect.max_x) \ - destendx = cliprect.max_x; \ - \ - /* compute final pixel in Y and exit if we are entirely clipped */ \ - destendy = desty + src.height() - 1; \ - if (desty > cliprect.max_y || destendy < cliprect.min_y) \ - break; \ - \ - /* apply top clip */ \ - srcy = 0; \ + } \ + \ + /* apply right clip */ \ + if (destendx > cliprect.max_x) \ + destendx = cliprect.max_x; \ + \ + /* compute final pixel in Y and exit if we are entirely clipped */ \ + destendy = desty + src.height() - 1; \ + if (desty > cliprect.max_y || destendy < cliprect.min_y) \ + break; \ + \ + /* apply top clip */ \ + srcy = 0; \ if (desty < cliprect.min_y) \ - { \ - srcy = cliprect.min_y - desty; \ + { \ + srcy = cliprect.min_y - desty; \ desty = cliprect.min_y; \ - } \ - \ - /* apply bottom clip */ \ - if (destendy > cliprect.max_y) \ - destendy = cliprect.max_y; \ - \ - /* apply X flipping */ \ - if (flipx) \ - { \ - srcx = src.width() - 1 - srcx; \ - dx = -dx; \ - } \ - \ - /* apply Y flipping */ \ - if (flipy) \ - { \ - srcy = src.height() - 1 - srcy; \ - dy = -dy; \ - } \ - \ - /* compute how many blocks of 4 pixels we have */ \ - numblocks = (destendx + 1 - destx) / 4; \ - leftovers = (destendx + 1 - destx) - 4 * numblocks; \ - \ - /* compute the address of the first source pixel of the first row */ \ - srcdata = &src.pixt(srcy, srcx); \ - \ - /* non-flipped case */ \ - if (!flipx) \ - { \ - /* iterate over pixels in Y */ \ - for (cury = desty; cury <= destendy; cury++) \ - { \ + } \ + \ + /* apply bottom clip */ \ + if (destendy > cliprect.max_y) \ + destendy = cliprect.max_y; \ + \ + /* apply X flipping */ \ + if (flipx) \ + { \ + srcx = src.width() - 1 - srcx; \ + dx = -dx; \ + } \ + \ + /* apply Y flipping */ \ + if (flipy) \ + { \ + srcy = src.height() - 1 - srcy; \ + dy = -dy; \ + } \ + \ + /* compute how many blocks of 4 pixels we have */ \ + numblocks = (destendx + 1 - destx) / 4; \ + leftovers = (destendx + 1 - destx) - 4 * numblocks; \ + \ + /* compute the address of the first source pixel of the first row */ \ + srcdata = &src.pixt(srcy, srcx); \ + \ + /* non-flipped case */ \ + if (!flipx) \ + { \ + /* iterate over pixels in Y */ \ + for (cury = desty; cury <= destendy; cury++) \ + { \ PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, destx); \ - PIXEL_TYPE *destptr = &dest.pixt(cury, destx); \ - const PIXEL_TYPE *srcptr = srcdata; \ - srcdata += dy; \ - \ - /* iterate over unrolled blocks of 4 */ \ - for (curx = 0; curx < numblocks; curx++) \ - { \ - PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ - PIXEL_OP(destptr[1], priptr[1], srcptr[1]); \ - PIXEL_OP(destptr[2], priptr[2], srcptr[2]); \ - PIXEL_OP(destptr[3], priptr[3], srcptr[3]); \ - \ - srcptr += 4; \ - destptr += 4; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ - } \ - \ - /* iterate over leftover pixels */ \ - for (curx = 0; curx < leftovers; curx++) \ - { \ - PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ - srcptr++; \ - destptr++; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ - } \ - } \ - } \ - \ - /* flipped case */ \ - else \ - { \ - /* iterate over pixels in Y */ \ - for (cury = desty; cury <= destendy; cury++) \ - { \ + PIXEL_TYPE *destptr = &dest.pixt(cury, destx); \ + const PIXEL_TYPE *srcptr = srcdata; \ + srcdata += dy; \ + \ + /* iterate over unrolled blocks of 4 */ \ + for (curx = 0; curx < numblocks; curx++) \ + { \ + PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ + PIXEL_OP(destptr[1], priptr[1], srcptr[1]); \ + PIXEL_OP(destptr[2], priptr[2], srcptr[2]); \ + PIXEL_OP(destptr[3], priptr[3], srcptr[3]); \ + \ + srcptr += 4; \ + destptr += 4; \ + PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ + } \ + \ + /* iterate over leftover pixels */ \ + for (curx = 0; curx < leftovers; curx++) \ + { \ + PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ + srcptr++; \ + destptr++; \ + PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ + } \ + } \ + } \ + \ + /* flipped case */ \ + else \ + { \ + /* iterate over pixels in Y */ \ + for (cury = desty; cury <= destendy; cury++) \ + { \ PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, destx); \ - PIXEL_TYPE *destptr = &dest.pixt(cury, destx); \ - const PIXEL_TYPE *srcptr = srcdata; \ - srcdata += dy; \ - \ - /* iterate over unrolled blocks of 4 */ \ - for (curx = 0; curx < numblocks; curx++) \ - { \ - PIXEL_OP(destptr[0], priptr[0], srcptr[ 0]); \ - PIXEL_OP(destptr[1], priptr[1], srcptr[-1]); \ - PIXEL_OP(destptr[2], priptr[2], srcptr[-2]); \ - PIXEL_OP(destptr[3], priptr[3], srcptr[-3]); \ - \ - srcptr -= 4; \ - destptr += 4; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ - } \ - \ - /* iterate over leftover pixels */ \ - for (curx = 0; curx < leftovers; curx++) \ - { \ - PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ - srcptr--; \ - destptr++; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ - } \ - } \ - } \ - } while (0); \ - g_profiler.stop(); \ + PIXEL_TYPE *destptr = &dest.pixt(cury, destx); \ + const PIXEL_TYPE *srcptr = srcdata; \ + srcdata += dy; \ + \ + /* iterate over unrolled blocks of 4 */ \ + for (curx = 0; curx < numblocks; curx++) \ + { \ + PIXEL_OP(destptr[0], priptr[0], srcptr[ 0]); \ + PIXEL_OP(destptr[1], priptr[1], srcptr[-1]); \ + PIXEL_OP(destptr[2], priptr[2], srcptr[-2]); \ + PIXEL_OP(destptr[3], priptr[3], srcptr[-3]); \ + \ + srcptr -= 4; \ + destptr += 4; \ + PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ + } \ + \ + /* iterate over leftover pixels */ \ + for (curx = 0; curx < leftovers; curx++) \ + { \ + PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ + srcptr--; \ + destptr++; \ + PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ + } \ + } \ + } \ + } while (0); \ + g_profiler.stop(); \ } while (0) @@ -863,21 +863,21 @@ do { bitmap_t &dest - the bitmap to copy to bitmap_t &src - the bitmap to copy from (must be same bpp as dest) const rectangle &cliprect - a clipping rectangle (assumed to be clipped to the size of 'dest') - int32_t destx - the 16.16 source X position at destination pixel (0,0) - int32_t desty - the 16.16 source Y position at destination pixel (0,0) - int32_t incxx - the 16.16 amount to increment in source X for each destination X pixel - int32_t incyx - the 16.16 amount to increment in source Y for each destination X pixel - int32_t incxy - the 16.16 amount to increment in source X for each destination Y pixel - int32_t incyy - the 16.16 amount to increment in source Y for each destination Y pixel + s32 destx - the 16.16 source X position at destination pixel (0,0) + s32 desty - the 16.16 source Y position at destination pixel (0,0) + s32 incxx - the 16.16 amount to increment in source X for each destination X pixel + s32 incyx - the 16.16 amount to increment in source Y for each destination X pixel + s32 incxy - the 16.16 amount to increment in source X for each destination Y pixel + s32 incyy - the 16.16 amount to increment in source Y for each destination Y pixel int wraparound - non-zero means wrap when hitting the edges of the source bitmap_t &priority - the priority bitmap (even if PRIORITY_TYPE is NO_PRIORITY, at least needs a dummy) */ #define COPYROZBITMAP_CORE(PIXEL_TYPE, PIXEL_OP, PRIORITY_TYPE) \ do { \ - uint32_t srcfixwidth, srcfixheight; \ - uint32_t numblocks, leftovers; \ - int32_t curx, cury; \ + u32 srcfixwidth, srcfixheight; \ + u32 numblocks, leftovers; \ + s32 curx, cury; \ \ g_profiler.start(PROFILER_COPYBITMAP); \ \ @@ -911,37 +911,37 @@ do { if (!wraparound) \ { \ /* iterate over pixels in Y */ \ - for (cury = cliprect.min_y; cury <= cliprect.max_y; cury++) \ + for (cury = cliprect.min_y; cury <= cliprect.max_y; cury++) \ { \ PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, cliprect.min_x); \ PIXEL_TYPE *destptr = &dest.pixt(cury, cliprect.min_x); \ const PIXEL_TYPE *srcptr; \ - int32_t srcx = startx; \ - int32_t srcy = starty; \ + s32 srcx = startx; \ + s32 srcy = starty; \ \ starty += incyy; \ \ /* check srcy for the whole row at once */ \ - if ((uint32_t)srcy < srcfixheight) \ + if ((u32)srcy < srcfixheight) \ { \ srcptr = &src.pixt(srcy >> 16); \ \ /* iterate over unrolled blocks of 4 */ \ for (curx = 0; curx < numblocks; curx++) \ { \ - if ((uint32_t)srcx < srcfixwidth) \ + if (u32(srcx) < srcfixwidth) \ PIXEL_OP(destptr[0], priptr[0], srcptr[srcx >> 16]); \ srcx += incxx; \ \ - if ((uint32_t)srcx < srcfixwidth) \ + if (u32(srcx) < srcfixwidth) \ PIXEL_OP(destptr[1], priptr[1], srcptr[srcx >> 16]); \ srcx += incxx; \ \ - if ((uint32_t)srcx < srcfixwidth) \ + if (u32(srcx) < srcfixwidth) \ PIXEL_OP(destptr[2], priptr[2], srcptr[srcx >> 16]); \ srcx += incxx; \ \ - if ((uint32_t)srcx < srcfixwidth) \ + if (u32(srcx) < srcfixwidth) \ PIXEL_OP(destptr[3], priptr[3], srcptr[srcx >> 16]); \ srcx += incxx; \ \ @@ -952,7 +952,7 @@ do { /* iterate over leftover pixels */ \ for (curx = 0; curx < leftovers; curx++) \ { \ - if ((uint32_t)srcx < srcfixwidth) \ + if (u32(srcx) < srcfixwidth) \ PIXEL_OP(destptr[0], priptr[0], srcptr[srcx >> 16]); \ srcx += incxx; \ destptr++; \ @@ -972,12 +972,12 @@ do { starty &= srcfixheight; \ \ /* iterate over pixels in Y */ \ - for (cury = cliprect.min_y; cury <= cliprect.max_y; cury++) \ + for (cury = cliprect.min_y; cury <= cliprect.max_y; cury++) \ { \ PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, cliprect.min_x); \ PIXEL_TYPE *destptr = &dest.pixt(cury, cliprect.min_x); \ const PIXEL_TYPE *srcptr = &src.pixt(starty >> 16); \ - int32_t srcx = startx; \ + s32 srcx = startx; \ \ starty = (starty + incyy) & srcfixheight; \ \ @@ -1019,13 +1019,13 @@ do { if (!wraparound) \ { \ /* iterate over pixels in Y */ \ - for (cury = cliprect.min_y; cury <= cliprect.max_y; cury++) \ + for (cury = cliprect.min_y; cury <= cliprect.max_y; cury++) \ { \ PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, cliprect.min_x); \ PIXEL_TYPE *destptr = &dest.pixt(cury, cliprect.min_x); \ const PIXEL_TYPE *srcptr; \ - int32_t srcx = startx; \ - int32_t srcy = starty; \ + s32 srcx = startx; \ + s32 srcy = starty; \ \ startx += incyx; \ starty += incyy; \ @@ -1033,7 +1033,7 @@ do { /* iterate over unrolled blocks of 4 */ \ for (curx = 0; curx < numblocks; curx++) \ { \ - if ((uint32_t)srcx < srcfixwidth && (uint32_t)srcy < srcfixheight) \ + if (u32(srcx) < srcfixwidth && (u32)srcy < srcfixheight) \ { \ srcptr = &src.pixt(srcy >> 16, srcx >> 16); \ PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ @@ -1041,7 +1041,7 @@ do { srcx += incxx; \ srcy += incxy; \ \ - if ((uint32_t)srcx < srcfixwidth && (uint32_t)srcy < srcfixheight) \ + if (u32(srcx) < srcfixwidth && u32(srcy) < srcfixheight) \ { \ srcptr = &src.pixt(srcy >> 16, srcx >> 16); \ PIXEL_OP(destptr[1], priptr[1], srcptr[0]); \ @@ -1049,7 +1049,7 @@ do { srcx += incxx; \ srcy += incxy; \ \ - if ((uint32_t)srcx < srcfixwidth && (uint32_t)srcy < srcfixheight) \ + if (u32(srcx) < srcfixwidth && u32(srcy) < srcfixheight) \ { \ srcptr = &src.pixt(srcy >> 16, srcx >> 16); \ PIXEL_OP(destptr[2], priptr[2], srcptr[0]); \ @@ -1057,7 +1057,7 @@ do { srcx += incxx; \ srcy += incxy; \ \ - if ((uint32_t)srcx < srcfixwidth && (uint32_t)srcy < srcfixheight) \ + if (u32(srcx) < srcfixwidth && u32(srcy) < srcfixheight) \ { \ srcptr = &src.pixt(srcy >> 16, srcx >> 16); \ PIXEL_OP(destptr[3], priptr[3], srcptr[0]); \ @@ -1072,7 +1072,7 @@ do { /* iterate over leftover pixels */ \ for (curx = 0; curx < leftovers; curx++) \ { \ - if ((uint32_t)srcx < srcfixwidth && (uint32_t)srcy < srcfixheight) \ + if (u32(srcx) < srcfixwidth && u32(srcy) < srcfixheight) \ { \ srcptr = &src.pixt(srcy >> 16, srcx >> 16); \ PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ @@ -1095,13 +1095,13 @@ do { starty &= srcfixheight; \ \ /* iterate over pixels in Y */ \ - for (cury = cliprect.min_y; cury <= cliprect.max_y; cury++) \ + for (cury = cliprect.min_y; cury <= cliprect.max_y; cury++) \ { \ PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, cliprect.min_x); \ PIXEL_TYPE *destptr = &dest.pixt(cury, cliprect.min_x); \ const PIXEL_TYPE *srcptr; \ - int32_t srcx = startx; \ - int32_t srcy = starty; \ + s32 srcx = startx; \ + s32 srcy = starty; \ \ startx = (startx + incyx) & srcfixwidth; \ starty = (starty + incyy) & srcfixheight; \ @@ -1146,7 +1146,7 @@ do { } \ } \ } \ - g_profiler.stop(); \ + g_profiler.stop(); \ } while (0) @@ -1159,9 +1159,9 @@ do { Assumed input parameters or local variables: bitmap_t &bitmap - the bitmap to copy to - int32_t destx - the X coordinate to copy to - int32_t desty - the Y coordinate to copy to - int32_t length - the total number of pixels to copy + s32 destx - the X coordinate to copy to + s32 desty - the Y coordinate to copy to + s32 length - the total number of pixels to copy const UINTx *srcptr - pointer to memory containing the source pixels bitmap_t &priority - the priority bitmap (even if PRIORITY_TYPE is NO_PRIORITY, at least needs a dummy) */ @@ -1172,8 +1172,8 @@ do { assert(destx >= 0); \ assert(destx + length <= bitmap.width()); \ assert(desty >= 0); \ - assert(desty < bitmap.height()); \ - assert(srcptr != nullptr); \ + assert(desty < bitmap.height()); \ + assert(srcptr != nullptr); \ assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority.valid()); \ \ { \ @@ -1215,9 +1215,9 @@ do { Assumed input parameters: bitmap_t &bitmap - the bitmap to extract from - int32_t srcx - the X coordinate to begin extraction - int32_t srcy - the Y coordinate to begin extraction - int32_t length - the total number of pixels to extract + s32 srcx - the X coordinate to begin extraction + s32 srcy - the Y coordinate to begin extraction + s32 length - the total number of pixels to extract UINTx *destptr - pointer to memory to receive the extracted pixels */ @@ -1227,8 +1227,8 @@ do { assert(srcx >= 0); \ assert(srcx + length <= bitmap.width()); \ assert(srcy >= 0); \ - assert(srcy < bitmap.height()); \ - assert(destptr != nullptr); \ + assert(srcy < bitmap.height()); \ + assert(destptr != nullptr); \ \ { \ const PIXEL_TYPE *srcptr = &bitmap.pixt(srcy, srcx); \ diff --git a/src/emu/drivenum.cpp b/src/emu/drivenum.cpp index 4f111d35f0f..a23db4c54bc 100644 --- a/src/emu/drivenum.cpp +++ b/src/emu/drivenum.cpp @@ -92,7 +92,7 @@ int driver_list::penalty_compare(const char *source, const char *target) for ( ; *source && *target; target++) { // do a case insensitive match - bool match = (tolower((uint8_t)*source) == tolower((uint8_t)*target)); + bool const match(tolower(u8(*source)) == tolower(u8(*target))); // if we matched, advance the source if (match) diff --git a/src/emu/driver.cpp b/src/emu/driver.cpp index a954738a557..51b6b629544 100644 --- a/src/emu/driver.cpp +++ b/src/emu/driver.cpp @@ -257,7 +257,7 @@ void driver_device::device_reset_after_children() // irq_pulse_clear - clear a "pulsed" IRQ line //------------------------------------------------- -void driver_device::irq_pulse_clear(void *ptr, int32_t param) +void driver_device::irq_pulse_clear(void *ptr, s32 param) { device_execute_interface *exec = reinterpret_cast(ptr); int irqline = param; @@ -366,7 +366,7 @@ void driver_device::updateflip() // flip_screen_set - set global flip //------------------------------------------------- -void driver_device::flip_screen_set(uint32_t on) +void driver_device::flip_screen_set(u32 on) { // normalize to all 1 if (on) @@ -386,7 +386,7 @@ void driver_device::flip_screen_set(uint32_t on) // do not call updateflip. //------------------------------------------------- -void driver_device::flip_screen_set_no_update(uint32_t on) +void driver_device::flip_screen_set_no_update(u32 on) { // flip_screen_y is not updated on purpose // this function is for drivers which @@ -402,7 +402,7 @@ void driver_device::flip_screen_set_no_update(uint32_t on) // flip_screen_x_set - set global horizontal flip //------------------------------------------------- -void driver_device::flip_screen_x_set(uint32_t on) +void driver_device::flip_screen_x_set(u32 on) { // normalize to all 1 if (on) @@ -421,7 +421,7 @@ void driver_device::flip_screen_x_set(uint32_t on) // flip_screen_y_set - set global vertical flip //------------------------------------------------- -void driver_device::flip_screen_y_set(uint32_t on) +void driver_device::flip_screen_y_set(u32 on) { // normalize to all 1 if (on) diff --git a/src/emu/driver.h b/src/emu/driver.h index 74205f57af3..f130b74d6bd 100644 --- a/src/emu/driver.h +++ b/src/emu/driver.h @@ -14,8 +14,8 @@ #error Dont include this file directly; include emu.h instead. #endif -#ifndef __DRIVER_H__ -#define __DRIVER_H__ +#ifndef MAME_EMU_DRIVER_H +#define MAME_EMU_DRIVER_H //************************************************************************** @@ -180,13 +180,13 @@ public: // generic video - void flip_screen_set(uint32_t on); - void flip_screen_set_no_update(uint32_t on); - void flip_screen_x_set(uint32_t on); - void flip_screen_y_set(uint32_t on); - uint32_t flip_screen() const { return m_flip_screen_x; } - uint32_t flip_screen_x() const { return m_flip_screen_x; } - uint32_t flip_screen_y() const { return m_flip_screen_y; } + void flip_screen_set(u32 on); + void flip_screen_set_no_update(u32 on); + void flip_screen_x_set(u32 on); + void flip_screen_y_set(u32 on); + u32 flip_screen() const { return m_flip_screen_x; } + u32 flip_screen_x() const { return m_flip_screen_x; } + u32 flip_screen_y() const { return m_flip_screen_y; } // generic input port helpers DECLARE_CUSTOM_INPUT_MEMBER( custom_port_read ); @@ -212,22 +212,22 @@ protected: private: // helpers - void irq_pulse_clear(void *ptr, int32_t param); + void irq_pulse_clear(void *ptr, s32 param); void updateflip(); // internal state - const game_driver * m_system; // pointer to the game driver - driver_callback_delegate m_callbacks[CB_COUNT]; // start/reset callbacks + const game_driver * m_system; // pointer to the game driver + driver_callback_delegate m_callbacks[CB_COUNT]; // start/reset callbacks // generic video - uint8_t m_flip_screen_x; - uint8_t m_flip_screen_y; + u8 m_flip_screen_x; + u8 m_flip_screen_y; }; // this template function creates a stub which constructs a device template -device_t *driver_device_creator(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +device_t *driver_device_creator(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) { assert(owner == nullptr); assert(clock == 0); @@ -235,4 +235,4 @@ device_t *driver_device_creator(const machine_config &mconfig, const char *tag, } -#endif /* __DRIVER_H__ */ +#endif /* MAME_EMU_DRIVER_H */ diff --git a/src/emu/drivers/empty.cpp b/src/emu/drivers/empty.cpp index 65e0821a8fa..074171074ce 100644 --- a/src/emu/drivers/empty.cpp +++ b/src/emu/drivers/empty.cpp @@ -30,7 +30,7 @@ public: emulator_info::display_ui_chooser(machine()); } - uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) + u32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { bitmap.fill(rgb_t::black(), cliprect); return 0; diff --git a/src/emu/drivers/testcpu.cpp b/src/emu/drivers/testcpu.cpp index c52222f6e1a..963ce923fbb 100644 --- a/src/emu/drivers/testcpu.cpp +++ b/src/emu/drivers/testcpu.cpp @@ -40,7 +40,7 @@ public: // timer callback; used to wrest control of the system virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override { - static const uint32_t sample_instructions[] = + static const u32 sample_instructions[] = { 0x3d40f900, // li r10,0xf9000000 0x394af000, // addi r10,r10,-0x1000 @@ -108,7 +108,7 @@ public: void dump_state(bool disassemble) { char buffer[256]; - uint8_t instruction[32]; + u8 instruction[32]; buffer[0] = 0; int bytes = 0; if (disassemble) @@ -123,7 +123,7 @@ public: } // output the registers - printf("PC : %08X", uint32_t(m_cpu->state_int(PPC_PC))); + printf("PC : %08X", u32(m_cpu->state_int(PPC_PC))); if (disassemble && bytes > 0) { printf(" => "); @@ -134,12 +134,12 @@ public: printf("\n"); for (int regnum = 0; regnum < 32; regnum++) { - printf("R%-2d: %08X ", regnum, uint32_t(m_cpu->state_int(PPC_R0 + regnum))); + printf("R%-2d: %08X ", regnum, u32(m_cpu->state_int(PPC_R0 + regnum))); if (regnum % 4 == 3) printf("\n"); } printf("CR : %08X LR : %08X CTR: %08X XER: %08X\n", - uint32_t(m_cpu->state_int(PPC_CR)), uint32_t(m_cpu->state_int(PPC_LR)), - uint32_t(m_cpu->state_int(PPC_CTR)), uint32_t(m_cpu->state_int(PPC_XER))); + u32(m_cpu->state_int(PPC_CR)), u32(m_cpu->state_int(PPC_LR)), + u32(m_cpu->state_int(PPC_CTR)), u32(m_cpu->state_int(PPC_XER))); for (int regnum = 0; regnum < 32; regnum++) { printf("F%-2d: %10g ", regnum, u2d(m_cpu->state_int(PPC_F0 + regnum))); @@ -150,8 +150,8 @@ public: // report reads from anywhere READ64_MEMBER( general_r ) { - uint64_t fulloffs = offset; - uint64_t result = fulloffs + (fulloffs << 8) + (fulloffs << 16) + (fulloffs << 24) + (fulloffs << 32); + u64 fulloffs = offset; + u64 result = fulloffs + (fulloffs << 8) + (fulloffs << 16) + (fulloffs << 24) + (fulloffs << 32); printf("Read from %08X & %08X%08X = %08X%08X\n", offset * 8, (int)((mem_mask&0xffffffff00000000LL) >> 32) , (int)(mem_mask&0xffffffff), (int)((result&0xffffffff00000000LL) >> 32), (int)(result&0xffffffff)); return result; } @@ -165,7 +165,7 @@ public: private: // internal state required_device m_cpu; - required_shared_ptr m_ram; + required_shared_ptr m_ram; address_space *m_space; }; diff --git a/src/emu/drivers/xtal.h b/src/emu/drivers/xtal.h index 01c232cf2fa..4f370d315cd 100644 --- a/src/emu/drivers/xtal.h +++ b/src/emu/drivers/xtal.h @@ -39,6 +39,11 @@ **************************************************************************/ +#ifndef MAME_EMU_DRIVERS_XTAL_H +#define MAME_EMU_DRIVERS_XTAL_H + +#pragma once + enum { /* @@ -618,3 +623,5 @@ reveals the following shipping frequencies as of 1/1/2008: 100.00MHz */ + +#endif // MAME_EMU_DRIVERS_XTAL_H diff --git a/src/emu/emualloc.cpp b/src/emu/emualloc.cpp index 7d87dad0a28..3993121e9bc 100644 --- a/src/emu/emualloc.cpp +++ b/src/emu/emualloc.cpp @@ -23,7 +23,7 @@ // GLOBALS //************************************************************************** -uint64_t resource_pool::s_id = 0; +osd::u64 resource_pool::s_id = 0; @@ -75,7 +75,7 @@ void resource_pool::add(resource_pool_item &item, size_t size, const char *type) // before, so if we don't find it, check 4 bytes ahead item.m_id = ++s_id; if (LOG_ALLOCS) - fprintf(stderr, "#%06d, add %s, %d bytes\n", (uint32_t)item.m_id, type, uint32_t(size)); + fprintf(stderr, "#%06d, add %s, %d bytes\n", u32(item.m_id), type, u32(size)); // find the entry to insert after resource_pool_item *insert_after; @@ -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", (uint32_t)deleteme->m_id, static_cast(deleteme->m_size)); + fprintf(stderr, "#%06d, delete %d bytes\n", u32(deleteme->m_id), u32(deleteme->m_size)); global_free(deleteme); break; } @@ -177,8 +177,8 @@ resource_pool_item *resource_pool::find(void *ptr) bool resource_pool::contains(void *_ptrstart, void *_ptrend) { - uint8_t *ptrstart = reinterpret_cast(_ptrstart); - uint8_t *ptrend = reinterpret_cast(_ptrend); + u8 *ptrstart = reinterpret_cast(_ptrstart); + u8 *ptrend = reinterpret_cast(_ptrend); // search for the item std::lock_guard lock(m_listlock); @@ -186,8 +186,8 @@ bool resource_pool::contains(void *_ptrstart, void *_ptrend) resource_pool_item *item = nullptr; for (item = m_ordered_head; item != nullptr; item = item->m_ordered_next) { - uint8_t *objstart = reinterpret_cast(item->m_ptr); - uint8_t *objend = objstart + item->m_size; + u8 *objstart = reinterpret_cast(item->m_ptr); + u8 *objend = objstart + item->m_size; if (ptrstart >= objstart && ptrend <= objend) return true; } diff --git a/src/emu/emualloc.h b/src/emu/emualloc.h index 44e39e199ad..77fcd92c1b1 100644 --- a/src/emu/emualloc.h +++ b/src/emu/emualloc.h @@ -10,8 +10,8 @@ #pragma once -#ifndef __EMUALLOC_H__ -#define __EMUALLOC_H__ +#ifndef MAME_EMU_EMUALLOC_H +#define MAME_EMU_EMUALLOC_H #include #include @@ -49,7 +49,7 @@ public: m_ordered_prev(nullptr), m_ptr(ptr), m_size(size), - m_id(~(uint64_t)0) { } + m_id(~osd::u64(0)) { } virtual ~resource_pool_item() { } resource_pool_item * m_next; @@ -57,7 +57,7 @@ public: resource_pool_item * m_ordered_prev; void * m_ptr; size_t m_size; - uint64_t m_id; + osd::u64 m_id; }; @@ -129,8 +129,8 @@ private: std::vector m_hash; resource_pool_item * m_ordered_head; resource_pool_item * m_ordered_tail; - static uint64_t s_id; + static osd::u64 s_id; }; -#endif /* __EMUALLOC_H__ */ +#endif /* MAME_EMU_EMUALLOC_H */ diff --git a/src/emu/emucore.h b/src/emu/emucore.h index b3c4bebfbba..dbf03f98f09 100644 --- a/src/emu/emucore.h +++ b/src/emu/emucore.h @@ -55,14 +55,24 @@ // FUNDAMENTAL TYPES //************************************************************************** +// explicitly sized integers +using osd::u8; +using osd::u16; +using osd::u32; +using osd::u64; +using osd::s8; +using osd::s16; +using osd::s32; +using osd::s64; + // genf is a generic function pointer; cast function pointers to this instead of void * typedef void genf(void); // pen_t is used to represent pixel values in bitmaps -typedef uint32_t pen_t; +typedef u32 pen_t; // stream_sample_t is used to represent a single sample in a sound stream -typedef int32_t stream_sample_t; +typedef s32 stream_sample_t; // running_machine is core to pretty much everything class running_machine; @@ -77,15 +87,15 @@ class running_machine; union generic_ptr { generic_ptr(void *value) { v = value; } - void * v; - int8_t * i8; - uint8_t * u8; - int16_t * i16; - uint16_t * u16; - int32_t * i32; - uint32_t * u32; - int64_t * i64; - uint64_t * u64; + void * v; + s8 * i8; + u8 * u8; + s16 * i16; + u16 * u16; + s32 * i32; + u32 * u32; + s64 * i64; + u64 * u64; }; @@ -93,18 +103,18 @@ union generic_ptr union PAIR { #ifdef LSB_FIRST - struct { uint8_t l,h,h2,h3; } b; - struct { uint16_t l,h; } w; - struct { int8_t l,h,h2,h3; } sb; - struct { int16_t l,h; } sw; + struct { u8 l,h,h2,h3; } b; + struct { u16 l,h; } w; + struct { s8 l,h,h2,h3; } sb; + struct { s16 l,h; } sw; #else - struct { uint8_t h3,h2,h,l; } b; - struct { int8_t h3,h2,h,l; } sb; - struct { uint16_t h,l; } w; - struct { int16_t h,l; } sw; + struct { u8 h3,h2,h,l; } b; + struct { s8 h3,h2,h,l; } sb; + struct { u16 h,l; } w; + struct { s16 h,l; } sw; #endif - uint32_t d; - int32_t sd; + u32 d; + s32 sd; }; @@ -112,14 +122,14 @@ union PAIR union PAIR16 { #ifdef LSB_FIRST - struct { uint8_t l,h; } b; - struct { int8_t l,h; } sb; + struct { u8 l,h; } b; + struct { s8 l,h; } sb; #else - struct { uint8_t h,l; } b; - struct { int8_t h,l; } sb; + struct { u8 h,l; } b; + struct { s8 h,l; } sb; #endif - uint16_t w; - int16_t sw; + u16 w; + s16 sw; }; @@ -127,22 +137,22 @@ union PAIR16 union PAIR64 { #ifdef LSB_FIRST - struct { uint8_t l,h,h2,h3,h4,h5,h6,h7; } b; - struct { uint16_t l,h,h2,h3; } w; - struct { uint32_t l,h; } d; - struct { int8_t l,h,h2,h3,h4,h5,h6,h7; } sb; - struct { int16_t l,h,h2,h3; } sw; - struct { int32_t l,h; } sd; + struct { u8 l,h,h2,h3,h4,h5,h6,h7; } b; + struct { u16 l,h,h2,h3; } w; + struct { u32 l,h; } d; + struct { s8 l,h,h2,h3,h4,h5,h6,h7; } sb; + struct { s16 l,h,h2,h3; } sw; + struct { s32 l,h; } sd; #else - struct { uint8_t h7,h6,h5,h4,h3,h2,h,l; } b; - struct { uint16_t h3,h2,h,l; } w; - struct { uint32_t h,l; } d; - struct { int8_t h7,h6,h5,h4,h3,h2,h,l; } sb; - struct { int16_t h3,h2,h,l; } sw; - struct { int32_t h,l; } sd; + struct { u8 h7,h6,h5,h4,h3,h2,h,l; } b; + struct { u16 h3,h2,h,l; } w; + struct { u32 h,l; } d; + struct { s8 h7,h6,h5,h4,h3,h2,h,l; } sb; + struct { s16 h3,h2,h,l; } sw; + struct { s32 h,l; } sd; #endif - uint64_t q; - int64_t sq; + u64 q; + s64 sq; }; @@ -380,7 +390,7 @@ enum_value(T value) noexcept // population count #if !defined(__NetBSD__) -inline int popcount(uint32_t val) +inline int popcount(u32 val) { int count; @@ -392,11 +402,11 @@ inline int popcount(uint32_t val) // convert a series of 32 bits into a float -inline float u2f(uint32_t v) +inline float u2f(u32 v) { union { float ff; - uint32_t vv; + u32 vv; } u; u.vv = v; return u.ff; @@ -404,11 +414,11 @@ inline float u2f(uint32_t v) // convert a float into a series of 32 bits -inline uint32_t f2u(float f) +inline u32 f2u(float f) { union { float ff; - uint32_t vv; + u32 vv; } u; u.ff = f; return u.vv; @@ -416,11 +426,11 @@ inline uint32_t f2u(float f) // convert a series of 64 bits into a double -inline double u2d(uint64_t v) +inline double u2d(u64 v) { union { double dd; - uint64_t vv; + u64 vv; } u; u.vv = v; return u.dd; @@ -428,11 +438,11 @@ inline double u2d(uint64_t v) // convert a double into a series of 64 bits -inline uint64_t d2u(double d) +inline u64 d2u(double d) { union { double dd; - uint64_t vv; + u64 vv; } u; u.dd = d; return u.vv; diff --git a/src/emu/emumem.cpp b/src/emu/emumem.cpp index 0deab9d74a4..af4b1f8883d 100644 --- a/src/emu/emumem.cpp +++ b/src/emu/emumem.cpp @@ -198,14 +198,14 @@ core_i64_hex_format - i64 format printf helper -------------------------------------------------*/ -static char *core_i64_hex_format(uint64_t value, uint8_t mindigits) +static char *core_i64_hex_format(u64 value, u8 mindigits) { static char buffer[16][64]; // TODO: this can overflow - e.g. when a lot of unmapped writes are logged static int index; char *bufbase = &buffer[index++ % 16][0]; char *bufptr = bufbase; - int8_t curdigit; + s8 curdigit; for (curdigit = 15; curdigit >= 0; curdigit--) { @@ -263,7 +263,7 @@ class handler_entry protected: // construction/destruction - handler_entry(uint8_t width, endianness_t endianness, uint8_t **rambaseptr); + handler_entry(u8 width, endianness_t endianness, u8 **rambaseptr); virtual ~handler_entry(); public: @@ -282,7 +282,7 @@ public: offs_t byteoffset(offs_t byteaddress) const { return (byteaddress - m_bytestart) & m_bytemask; } // return a pointer to the backing RAM at the given offset - uint8_t *ramptr(offs_t offset = 0) const { return *m_rambaseptr + offset; } + u8 *ramptr(offs_t offset = 0) const { return *m_rambaseptr + offset; } // see if we are an exact match to the given parameters bool matches_exactly(offs_t bytestart, offs_t byteend, offs_t bytemask) const @@ -328,36 +328,36 @@ public: // apply a global mask void apply_mask(offs_t bytemask) { m_bytemask &= bytemask; } - void clear_conflicting_subunits(uint64_t handlermask); - bool overriden_by_mask(uint64_t handlermask); + void clear_conflicting_subunits(u64 handlermask); + bool overriden_by_mask(u64 handlermask); protected: // Subunit description information struct subunit_info { offs_t m_bytemask; // bytemask for this subunit - uint32_t m_mask; // mask (ff, ffff or ffffffff) - int32_t m_offset; // offset to add to the address - uint32_t m_multiplier; // multiplier to the pre-split address - uint8_t m_size; // size (8, 16 or 32) - uint8_t m_shift; // shift of the subunit + u32 m_mask; // mask (ff, ffff or ffffffff) + s32 m_offset; // offset to add to the address + u32 m_multiplier; // multiplier to the pre-split address + u8 m_size; // size (8, 16 or 32) + u8 m_shift; // shift of the subunit }; // internal helpers - void configure_subunits(uint64_t handlermask, int handlerbits, int &start_slot, int &end_slot); + void configure_subunits(u64 handlermask, int handlerbits, int &start_slot, int &end_slot); virtual void remove_subunit(int entry) = 0; // internal state bool m_populated; // populated? - uint8_t m_datawidth; + u8 m_datawidth; endianness_t m_endianness; offs_t m_bytestart; // byte-adjusted start address for handler offs_t m_byteend; // byte-adjusted end address for handler offs_t m_bytemask; // byte-adjusted mask against the final address - uint8_t ** m_rambaseptr; // pointer to the bank base - uint8_t m_subunits; // for width stubs, the number of subunits + u8 ** m_rambaseptr; // pointer to the bank base + u8 m_subunits; // for width stubs, the number of subunits subunit_info m_subunit_infos[8]; // for width stubs, the associated subunit info - uint64_t m_invsubmask; // inverted mask of the populated subunits + u64 m_invsubmask; // inverted mask of the populated subunits }; @@ -377,7 +377,7 @@ public: }; // construction/destruction - handler_entry_read(uint8_t width, endianness_t endianness, uint8_t **rambaseptr) + handler_entry_read(u8 width, endianness_t endianness, u8 **rambaseptr) : handler_entry(width, endianness, rambaseptr), m_ioport(nullptr) { @@ -390,25 +390,25 @@ public: virtual const char *subunit_name(int entry) const override; // configure delegate callbacks - void set_delegate(read8_delegate delegate, uint64_t mask = 0); - void set_delegate(read16_delegate delegate, uint64_t mask = 0); - void set_delegate(read32_delegate delegate, uint64_t mask = 0); - void set_delegate(read64_delegate delegate, uint64_t mask = 0); + void set_delegate(read8_delegate delegate, u64 mask = 0); + void set_delegate(read16_delegate delegate, u64 mask = 0); + void set_delegate(read32_delegate delegate, u64 mask = 0); + void set_delegate(read64_delegate delegate, u64 mask = 0); // configure I/O port access void set_ioport(ioport_port &ioport); // read via the underlying delegates - uint8_t read8(address_space &space, offs_t offset, uint8_t mask) const { return m_read.r8(space, offset, mask); } - uint16_t read16(address_space &space, offs_t offset, uint16_t mask) const { return m_read.r16(space, offset, mask); } - uint32_t read32(address_space &space, offs_t offset, uint32_t mask) const { return m_read.r32(space, offset, mask); } - uint64_t read64(address_space &space, offs_t offset, uint64_t mask) const { return m_read.r64(space, offset, mask); } + u8 read8(address_space &space, offs_t offset, u8 mask) const { return m_read.r8(space, offset, mask); } + u16 read16(address_space &space, offs_t offset, u16 mask) const { return m_read.r16(space, offset, mask); } + u32 read32(address_space &space, offs_t offset, u32 mask) const { return m_read.r32(space, offset, mask); } + u64 read64(address_space &space, offs_t offset, u64 mask) const { return m_read.r64(space, offset, mask); } private: // stubs for converting between address sizes - uint16_t read_stub_16(address_space &space, offs_t offset, uint16_t mask); - uint32_t read_stub_32(address_space &space, offs_t offset, uint32_t mask); - uint64_t read_stub_64(address_space &space, offs_t offset, uint64_t mask); + u16 read_stub_16(address_space &space, offs_t offset, u16 mask); + u32 read_stub_32(address_space &space, offs_t offset, u32 mask); + u64 read_stub_64(address_space &space, offs_t offset, u64 mask); // stubs for reading I/O ports template @@ -440,7 +440,7 @@ public: }; // construction/destruction - handler_entry_write(uint8_t width, endianness_t endianness, uint8_t **rambaseptr) + handler_entry_write(u8 width, endianness_t endianness, u8 **rambaseptr) : handler_entry(width, endianness, rambaseptr), m_ioport(nullptr) { @@ -453,25 +453,25 @@ public: virtual const char *subunit_name(int entry) const override; // configure delegate callbacks - void set_delegate(write8_delegate delegate, uint64_t mask = 0); - void set_delegate(write16_delegate delegate, uint64_t mask = 0); - void set_delegate(write32_delegate delegate, uint64_t mask = 0); - void set_delegate(write64_delegate delegate, uint64_t mask = 0); + void set_delegate(write8_delegate delegate, u64 mask = 0); + void set_delegate(write16_delegate delegate, u64 mask = 0); + void set_delegate(write32_delegate delegate, u64 mask = 0); + void set_delegate(write64_delegate delegate, u64 mask = 0); // configure I/O port access void set_ioport(ioport_port &ioport); // write via the underlying delegates - void write8(address_space &space, offs_t offset, uint8_t data, uint8_t mask) const { m_write.w8(space, offset, data, mask); } - void write16(address_space &space, offs_t offset, uint16_t data, uint16_t mask) const { m_write.w16(space, offset, data, mask); } - void write32(address_space &space, offs_t offset, uint32_t data, uint32_t mask) const { m_write.w32(space, offset, data, mask); } - void write64(address_space &space, offs_t offset, uint64_t data, uint64_t mask) const { m_write.w64(space, offset, data, mask); } + void write8(address_space &space, offs_t offset, u8 data, u8 mask) const { m_write.w8(space, offset, data, mask); } + void write16(address_space &space, offs_t offset, u16 data, u16 mask) const { m_write.w16(space, offset, data, mask); } + void write32(address_space &space, offs_t offset, u32 data, u32 mask) const { m_write.w32(space, offset, data, mask); } + void write64(address_space &space, offs_t offset, u64 data, u64 mask) const { m_write.w64(space, offset, data, mask); } private: // stubs for converting between address sizes - void write_stub_16(address_space &space, offs_t offset, uint16_t data, uint16_t mask); - void write_stub_32(address_space &space, offs_t offset, uint32_t data, uint32_t mask); - void write_stub_64(address_space &space, offs_t offset, uint64_t data, uint64_t mask); + void write_stub_16(address_space &space, offs_t offset, u16 data, u16 mask); + void write_stub_32(address_space &space, offs_t offset, u32 data, u32 mask); + void write_stub_64(address_space &space, offs_t offset, u64 data, u64 mask); // stubs for writing I/O ports template @@ -505,7 +505,7 @@ public: void setoffset(address_space &space, offs_t offset) const { if (m_setoffset.has_object()) m_setoffset(space, offset); } // configure delegate callbacks - void set_delegate(setoffset_delegate delegate, uint64_t mask = 0) { m_setoffset = delegate; } + void set_delegate(setoffset_delegate delegate, u64 mask = 0) { m_setoffset = delegate; } private: setoffset_delegate m_setoffset; @@ -522,7 +522,7 @@ template class handler_entry_proxy { public: - handler_entry_proxy(std::list<_HandlerEntry *> _handlers, uint64_t _mask) : handlers(std::move(_handlers)), mask(_mask) {} + handler_entry_proxy(std::list<_HandlerEntry *> _handlers, u64 _mask) : handlers(std::move(_handlers)), mask(_mask) {} handler_entry_proxy(const handler_entry_proxy<_HandlerEntry> &hep) : handlers(hep.handlers), mask(hep.mask) {} // forward delegate callbacks configuration @@ -539,7 +539,7 @@ public: private: std::list<_HandlerEntry *> handlers; - uint64_t mask; + u64 mask; }; @@ -564,35 +564,35 @@ public: virtual ~address_table(); // getters - virtual handler_entry &handler(uint32_t index) const = 0; + virtual handler_entry &handler(u32 index) const = 0; bool watchpoints_enabled() const { return (m_live_lookup == s_watchpoint_table); } // address lookups - uint32_t lookup_live(offs_t byteaddress) const { return m_large ? lookup_live_large(byteaddress) : lookup_live_small(byteaddress); } - uint32_t lookup_live_small(offs_t byteaddress) const { return m_live_lookup[byteaddress]; } + u32 lookup_live(offs_t byteaddress) const { return m_large ? lookup_live_large(byteaddress) : lookup_live_small(byteaddress); } + u32 lookup_live_small(offs_t byteaddress) const { return m_live_lookup[byteaddress]; } - uint32_t lookup_live_large(offs_t byteaddress) const + u32 lookup_live_large(offs_t byteaddress) const { - uint32_t entry = m_live_lookup[level1_index_large(byteaddress)]; + u32 entry = m_live_lookup[level1_index_large(byteaddress)]; if (entry >= SUBTABLE_BASE) entry = m_live_lookup[level2_index_large(entry, byteaddress)]; return entry; } - uint32_t lookup_live_nowp(offs_t byteaddress) const { return m_large ? lookup_live_large_nowp(byteaddress) : lookup_live_small_nowp(byteaddress); } - uint32_t lookup_live_small_nowp(offs_t byteaddress) const { return m_table[byteaddress]; } + u32 lookup_live_nowp(offs_t byteaddress) const { return m_large ? lookup_live_large_nowp(byteaddress) : lookup_live_small_nowp(byteaddress); } + u32 lookup_live_small_nowp(offs_t byteaddress) const { return m_table[byteaddress]; } - uint32_t lookup_live_large_nowp(offs_t byteaddress) const + u32 lookup_live_large_nowp(offs_t byteaddress) const { - uint32_t entry = m_table[level1_index_large(byteaddress)]; + u32 entry = m_table[level1_index_large(byteaddress)]; if (entry >= SUBTABLE_BASE) entry = m_table[level2_index_large(entry, byteaddress)]; return entry; } - uint32_t lookup(offs_t byteaddress) const + u32 lookup(offs_t byteaddress) const { - uint32_t entry = m_live_lookup[level1_index(byteaddress)]; + u32 entry = m_live_lookup[level1_index(byteaddress)]; if (entry >= SUBTABLE_BASE) entry = m_live_lookup[level2_index(entry, byteaddress)]; return entry; @@ -602,37 +602,37 @@ public: void enable_watchpoints(bool enable = true) { m_live_lookup = enable ? s_watchpoint_table : &m_table[0]; } // table mapping helpers - void map_range(offs_t bytestart, offs_t byteend, offs_t bytemask, offs_t bytemirror, uint16_t staticentry); - void setup_range(offs_t bytestart, offs_t byteend, offs_t bytemask, offs_t bytemirror, uint64_t mask, std::list &entries); - uint16_t derive_range(offs_t byteaddress, offs_t &bytestart, offs_t &byteend) const; + void map_range(offs_t bytestart, offs_t byteend, offs_t bytemask, offs_t bytemirror, u16 staticentry); + void setup_range(offs_t bytestart, offs_t byteend, offs_t bytemask, offs_t bytemirror, u64 mask, std::list &entries); + u16 derive_range(offs_t byteaddress, offs_t &bytestart, offs_t &byteend) const; // misc helpers void mask_all_handlers(offs_t mask); - const char *handler_name(uint16_t entry) const; + const char *handler_name(u16 entry) const; protected: // determine table indexes based on the address - uint32_t level1_index_large(offs_t address) const { return address >> LEVEL2_BITS; } - uint32_t level2_index_large(uint16_t l1entry, offs_t address) const { return (1 << LEVEL1_BITS) + ((l1entry - SUBTABLE_BASE) << LEVEL2_BITS) + (address & ((1 << LEVEL2_BITS) - 1)); } - uint32_t level1_index(offs_t address) const { return m_large ? level1_index_large(address) : address; } - uint32_t level2_index(uint16_t l1entry, offs_t address) const { return m_large ? level2_index_large(l1entry, address) : 0; } + u32 level1_index_large(offs_t address) const { return address >> LEVEL2_BITS; } + u32 level2_index_large(u16 l1entry, offs_t address) const { return (1 << LEVEL1_BITS) + ((l1entry - SUBTABLE_BASE) << LEVEL2_BITS) + (address & ((1 << LEVEL2_BITS) - 1)); } + u32 level1_index(offs_t address) const { return m_large ? level1_index_large(address) : address; } + u32 level2_index(u16 l1entry, offs_t address) const { return m_large ? level2_index_large(l1entry, address) : 0; } // table population/depopulation - void populate_range_mirrored(offs_t bytestart, offs_t byteend, offs_t bytemirror, uint16_t handler); - void populate_range(offs_t bytestart, offs_t byteend, uint16_t handler); + void populate_range_mirrored(offs_t bytestart, offs_t byteend, offs_t bytemirror, u16 handler); + void populate_range(offs_t bytestart, offs_t byteend, u16 handler); // subtable management - uint16_t subtable_alloc(); - void subtable_realloc(uint16_t subentry); + u16 subtable_alloc(); + void subtable_realloc(u16 subentry); int subtable_merge(); - void subtable_release(uint16_t subentry); - uint16_t *subtable_open(offs_t l1index); + void subtable_release(u16 subentry); + u16 *subtable_open(offs_t l1index); void subtable_close(offs_t l1index); - uint16_t *subtable_ptr(uint16_t entry) { return &m_table[level2_index(entry, 0)]; } + u16 *subtable_ptr(u16 entry) { return &m_table[level2_index(entry, 0)]; } // internal state - std::vector m_table; // pointer to base of table - uint16_t * m_live_lookup; // current lookup + std::vector m_table; // pointer to base of table + u16 * m_live_lookup; // current lookup address_space & m_space; // pointer back to the space bool m_large; // large memory model? @@ -646,32 +646,32 @@ protected: m_usecount(0) { } bool m_checksum_valid; // is the checksum valid - uint32_t m_checksum; // checksum over all the bytes - uint32_t m_usecount; // number of times this has been used + u32 m_checksum; // checksum over all the bytes + u32 m_usecount; // number of times this has been used }; std::vector m_subtable; // info about each subtable - uint16_t m_subtable_alloc; // number of subtables allocated + u16 m_subtable_alloc; // number of subtables allocated // static global read-only watchpoint table - static uint16_t s_watchpoint_table[1 << LEVEL1_BITS]; + static u16 s_watchpoint_table[1 << LEVEL1_BITS]; private: int handler_refcount[SUBTABLE_BASE-STATIC_COUNT]; - uint16_t handler_next_free[SUBTABLE_BASE-STATIC_COUNT]; - uint16_t handler_free; - uint16_t get_free_handler(); + u16 handler_next_free[SUBTABLE_BASE-STATIC_COUNT]; + u16 handler_free; + u16 get_free_handler(); void verify_reference_counts(); - void setup_range_solid(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, std::list &entries); - void setup_range_masked(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, uint64_t mask, std::list &entries); + void setup_range_solid(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, std::list &entries); + void setup_range_masked(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, u64 mask, std::list &entries); - void handler_ref(uint16_t entry, int count) + void handler_ref(u16 entry, int count) { assert(entry < SUBTABLE_BASE); if (entry >= STATIC_COUNT) handler_refcount[entry - STATIC_COUNT] += count; } - void handler_unref(uint16_t entry) + void handler_unref(u16 entry) { assert(entry < SUBTABLE_BASE); if (entry >= STATIC_COUNT) @@ -696,15 +696,15 @@ public: virtual ~address_table_read(); // getters - virtual handler_entry &handler(uint32_t index) const override; - handler_entry_read &handler_read(uint32_t index) const { assert(index < ARRAY_LENGTH(m_handlers)); return *m_handlers[index]; } + virtual handler_entry &handler(u32 index) const override; + handler_entry_read &handler_read(u32 index) const { assert(index < ARRAY_LENGTH(m_handlers)); return *m_handlers[index]; } // range getter - handler_entry_proxy handler_map_range(offs_t bytestart, offs_t byteend, offs_t bytemask, offs_t bytemirror, uint64_t mask = 0) { - std::list entries; + handler_entry_proxy handler_map_range(offs_t bytestart, offs_t byteend, offs_t bytemask, offs_t bytemirror, u64 mask = 0) { + std::list entries; setup_range(bytestart, byteend, bytemask, bytemirror, mask, entries); std::list handlers; - for (std::list::const_iterator i = entries.begin(); i != entries.end(); ++i) + for (std::list::const_iterator i = entries.begin(); i != entries.end(); ++i) handlers.push_back(&handler_read(*i)); return handler_entry_proxy(handlers, mask); } @@ -740,7 +740,7 @@ private: { m_space.device().debug()->memory_read_hook(m_space, offset * sizeof(_UintType), mask); - uint16_t *oldtable = m_live_lookup; + u16 *oldtable = m_live_lookup; m_live_lookup = &m_table[0]; _UintType result; if (sizeof(_UintType) == 1) result = m_space.read_byte(offset); @@ -767,15 +767,15 @@ public: virtual ~address_table_write(); // getters - virtual handler_entry &handler(uint32_t index) const override; - handler_entry_write &handler_write(uint32_t index) const { assert(index < ARRAY_LENGTH(m_handlers)); return *m_handlers[index]; } + virtual handler_entry &handler(u32 index) const override; + handler_entry_write &handler_write(u32 index) const { assert(index < ARRAY_LENGTH(m_handlers)); return *m_handlers[index]; } // range getter - handler_entry_proxy handler_map_range(offs_t bytestart, offs_t byteend, offs_t bytemask, offs_t bytemirror, uint64_t mask = 0) { - std::list entries; + handler_entry_proxy handler_map_range(offs_t bytestart, offs_t byteend, offs_t bytemask, offs_t bytemirror, u64 mask = 0) { + std::list entries; setup_range(bytestart, byteend, bytemask, bytemirror, mask, entries); std::list handlers; - for (std::list::const_iterator i = entries.begin(); i != entries.end(); ++i) + for (std::list::const_iterator i = entries.begin(); i != entries.end(); ++i) handlers.push_back(&handler_write(*i)); return handler_entry_proxy(handlers, mask); } @@ -808,7 +808,7 @@ private: { m_space.device().debug()->memory_write_hook(m_space, offset * sizeof(_UintType), data, mask); - uint16_t *oldtable = m_live_lookup; + u16 *oldtable = m_live_lookup; m_live_lookup = &m_table[0]; if (sizeof(_UintType) == 1) m_space.write_byte(offset, data); if (sizeof(_UintType) == 2) m_space.write_word(offset << 1, data, mask); @@ -843,15 +843,15 @@ public: { } - handler_entry &handler(uint32_t index) const override { assert(index < ARRAY_LENGTH(m_handlers)); return *m_handlers[index]; } - handler_entry_setoffset &handler_setoffset(uint32_t index) const { assert(index < ARRAY_LENGTH(m_handlers)); return *m_handlers[index]; } + handler_entry &handler(u32 index) const override { assert(index < ARRAY_LENGTH(m_handlers)); return *m_handlers[index]; } + handler_entry_setoffset &handler_setoffset(u32 index) const { assert(index < ARRAY_LENGTH(m_handlers)); return *m_handlers[index]; } // range getter - handler_entry_proxy handler_map_range(offs_t bytestart, offs_t byteend, offs_t bytemask, offs_t bytemirror, uint64_t mask = 0) { - std::list entries; + handler_entry_proxy handler_map_range(offs_t bytestart, offs_t byteend, offs_t bytemask, offs_t bytemirror, u64 mask = 0) { + std::list entries; setup_range(bytestart, byteend, bytemask, bytemirror, mask, entries); std::list handlers; - for (std::list::const_iterator i = entries.begin(); i != entries.end(); ++i) + for (std::list::const_iterator i = entries.begin(); i != entries.end(); ++i) handlers.push_back(&handler_setoffset(*i)); return handler_entry_proxy(handlers, mask); } @@ -881,14 +881,14 @@ class address_space_specific : public address_space typedef address_space_specific<_NativeType, _Endian, _Large> this_type; // constants describing the native size - static const uint32_t NATIVE_BYTES = sizeof(_NativeType); - static const uint32_t NATIVE_MASK = NATIVE_BYTES - 1; - static const uint32_t NATIVE_BITS = 8 * NATIVE_BYTES; + static const u32 NATIVE_BYTES = sizeof(_NativeType); + static const u32 NATIVE_MASK = NATIVE_BYTES - 1; + static const u32 NATIVE_BITS = 8 * NATIVE_BYTES; // helpers to simplify core code - uint32_t read_lookup(offs_t byteaddress) const { return _Large ? m_read.lookup_live_large(byteaddress) : m_read.lookup_live_small(byteaddress); } - uint32_t write_lookup(offs_t byteaddress) const { return _Large ? m_write.lookup_live_large(byteaddress) : m_write.lookup_live_small(byteaddress); } - uint32_t setoffset_lookup(offs_t byteaddress) const { return _Large ? m_setoffset.lookup_live_large(byteaddress) : m_setoffset.lookup_live_small(byteaddress); } + u32 read_lookup(offs_t byteaddress) const { return _Large ? m_read.lookup_live_large(byteaddress) : m_read.lookup_live_small(byteaddress); } + u32 write_lookup(offs_t byteaddress) const { return _Large ? m_write.lookup_live_large(byteaddress) : m_write.lookup_live_small(byteaddress); } + u32 setoffset_lookup(offs_t byteaddress) const { return _Large ? m_setoffset.lookup_live_large(byteaddress) : m_setoffset.lookup_live_small(byteaddress); } public: // construction/destruction @@ -903,7 +903,7 @@ public: // and returning the correct results // install some dummy RAM for the first 16 bytes with well-known values - uint8_t buffer[16]; + u8 buffer[16]; for (int index = 0; index < 16; index++) buffer[index ^ ((_Endian == ENDIANNESS_NATIVE) ? 0 : (data_width()/8 - 1))] = index * 0x11; install_ram_generic(0x00, 0x0f, 0x0f, 0, ROW_READWRITE, buffer); @@ -913,22 +913,22 @@ public: for (int address = 0; address < 8; address++) { // determine expected values - uint64_t expected64 = ((uint64_t)((address + ((_Endian == ENDIANNESS_LITTLE) ? 7 : 0)) * 0x11) << 56) | - ((uint64_t)((address + ((_Endian == ENDIANNESS_LITTLE) ? 6 : 1)) * 0x11) << 48) | - ((uint64_t)((address + ((_Endian == ENDIANNESS_LITTLE) ? 5 : 2)) * 0x11) << 40) | - ((uint64_t)((address + ((_Endian == ENDIANNESS_LITTLE) ? 4 : 3)) * 0x11) << 32) | - ((uint64_t)((address + ((_Endian == ENDIANNESS_LITTLE) ? 3 : 4)) * 0x11) << 24) | - ((uint64_t)((address + ((_Endian == ENDIANNESS_LITTLE) ? 2 : 5)) * 0x11) << 16) | - ((uint64_t)((address + ((_Endian == ENDIANNESS_LITTLE) ? 1 : 6)) * 0x11) << 8) | - ((uint64_t)((address + ((_Endian == ENDIANNESS_LITTLE) ? 0 : 7)) * 0x11) << 0); - uint32_t expected32 = (_Endian == ENDIANNESS_LITTLE) ? expected64 : (expected64 >> 32); - uint16_t expected16 = (_Endian == ENDIANNESS_LITTLE) ? expected32 : (expected32 >> 16); - uint8_t expected8 = (_Endian == ENDIANNESS_LITTLE) ? expected16 : (expected16 >> 8); + u64 expected64 = (u64((address + ((_Endian == ENDIANNESS_LITTLE) ? 7 : 0)) * 0x11) << 56) | + (u64((address + ((_Endian == ENDIANNESS_LITTLE) ? 6 : 1)) * 0x11) << 48) | + (u64((address + ((_Endian == ENDIANNESS_LITTLE) ? 5 : 2)) * 0x11) << 40) | + (u64((address + ((_Endian == ENDIANNESS_LITTLE) ? 4 : 3)) * 0x11) << 32) | + (u64((address + ((_Endian == ENDIANNESS_LITTLE) ? 3 : 4)) * 0x11) << 24) | + (u64((address + ((_Endian == ENDIANNESS_LITTLE) ? 2 : 5)) * 0x11) << 16) | + (u64((address + ((_Endian == ENDIANNESS_LITTLE) ? 1 : 6)) * 0x11) << 8) | + (u64((address + ((_Endian == ENDIANNESS_LITTLE) ? 0 : 7)) * 0x11) << 0); + u32 expected32 = (_Endian == ENDIANNESS_LITTLE) ? expected64 : (expected64 >> 32); + u16 expected16 = (_Endian == ENDIANNESS_LITTLE) ? expected32 : (expected32 >> 16); + u8 expected8 = (_Endian == ENDIANNESS_LITTLE) ? expected16 : (expected16 >> 8); - uint64_t result64; - uint32_t result32; - uint16_t result16; - uint8_t result8; + u64 result64; + u32 result32; + u16 result16; + u8 result8; // validate byte accesses printf("\nAddress %d\n", address); @@ -968,69 +968,69 @@ public: // validate qword acceses (if aligned) if (QWORD_ALIGNED(address)) { printf(" read_qword = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address), 16)); assert(result64 == expected64); } - if (QWORD_ALIGNED(address)) { printf(" read_qword (0xff00000000000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0xff00000000000000)), 16)); assert((result64 & U64(0xff00000000000000)) == (expected64 & U64(0xff00000000000000))); } - if (QWORD_ALIGNED(address)) { printf(" (0x00ff000000000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x00ff000000000000)), 16)); assert((result64 & U64(0x00ff000000000000)) == (expected64 & U64(0x00ff000000000000))); } - if (QWORD_ALIGNED(address)) { printf(" (0x0000ff0000000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x0000ff0000000000)), 16)); assert((result64 & U64(0x0000ff0000000000)) == (expected64 & U64(0x0000ff0000000000))); } - if (QWORD_ALIGNED(address)) { printf(" (0x000000ff00000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x000000ff00000000)), 16)); assert((result64 & U64(0x000000ff00000000)) == (expected64 & U64(0x000000ff00000000))); } - if (QWORD_ALIGNED(address)) { printf(" (0x00000000ff000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x00000000ff000000)), 16)); assert((result64 & U64(0x00000000ff000000)) == (expected64 & U64(0x00000000ff000000))); } - if (QWORD_ALIGNED(address)) { printf(" (0x0000000000ff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x0000000000ff0000)), 16)); assert((result64 & U64(0x0000000000ff0000)) == (expected64 & U64(0x0000000000ff0000))); } - if (QWORD_ALIGNED(address)) { printf(" (0x000000000000ff00) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x000000000000ff00)), 16)); assert((result64 & U64(0x000000000000ff00)) == (expected64 & U64(0x000000000000ff00))); } - if (QWORD_ALIGNED(address)) { printf(" (0x00000000000000ff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x00000000000000ff)), 16)); assert((result64 & U64(0x00000000000000ff)) == (expected64 & U64(0x00000000000000ff))); } - if (QWORD_ALIGNED(address)) { printf(" (0xffff000000000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0xffff000000000000)), 16)); assert((result64 & U64(0xffff000000000000)) == (expected64 & U64(0xffff000000000000))); } - if (QWORD_ALIGNED(address)) { printf(" (0x0000ffff00000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x0000ffff00000000)), 16)); assert((result64 & U64(0x0000ffff00000000)) == (expected64 & U64(0x0000ffff00000000))); } - if (QWORD_ALIGNED(address)) { printf(" (0x00000000ffff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x00000000ffff0000)), 16)); assert((result64 & U64(0x00000000ffff0000)) == (expected64 & U64(0x00000000ffff0000))); } - if (QWORD_ALIGNED(address)) { printf(" (0x000000000000ffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x000000000000ffff)), 16)); assert((result64 & U64(0x000000000000ffff)) == (expected64 & U64(0x000000000000ffff))); } - if (QWORD_ALIGNED(address)) { printf(" (0xffffff0000000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0xffffff0000000000)), 16)); assert((result64 & U64(0xffffff0000000000)) == (expected64 & U64(0xffffff0000000000))); } - if (QWORD_ALIGNED(address)) { printf(" (0x0000ffffff000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x0000ffffff000000)), 16)); assert((result64 & U64(0x0000ffffff000000)) == (expected64 & U64(0x0000ffffff000000))); } - if (QWORD_ALIGNED(address)) { printf(" (0x000000ffffff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x000000ffffff0000)), 16)); assert((result64 & U64(0x000000ffffff0000)) == (expected64 & U64(0x000000ffffff0000))); } - if (QWORD_ALIGNED(address)) { printf(" (0x0000000000ffffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x0000000000ffffff)), 16)); assert((result64 & U64(0x0000000000ffffff)) == (expected64 & U64(0x0000000000ffffff))); } - if (QWORD_ALIGNED(address)) { printf(" (0xffffffff00000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0xffffffff00000000)), 16)); assert((result64 & U64(0xffffffff00000000)) == (expected64 & U64(0xffffffff00000000))); } - if (QWORD_ALIGNED(address)) { printf(" (0x00ffffffff000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x00ffffffff000000)), 16)); assert((result64 & U64(0x00ffffffff000000)) == (expected64 & U64(0x00ffffffff000000))); } - if (QWORD_ALIGNED(address)) { printf(" (0x0000ffffffff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x0000ffffffff0000)), 16)); assert((result64 & U64(0x0000ffffffff0000)) == (expected64 & U64(0x0000ffffffff0000))); } - if (QWORD_ALIGNED(address)) { printf(" (0x000000ffffffff00) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x000000ffffffff00)), 16)); assert((result64 & U64(0x000000ffffffff00)) == (expected64 & U64(0x000000ffffffff00))); } - if (QWORD_ALIGNED(address)) { printf(" (0x00000000ffffffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x00000000ffffffff)), 16)); assert((result64 & U64(0x00000000ffffffff)) == (expected64 & U64(0x00000000ffffffff))); } - if (QWORD_ALIGNED(address)) { printf(" (0xffffffffff000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0xffffffffff000000)), 16)); assert((result64 & U64(0xffffffffff000000)) == (expected64 & U64(0xffffffffff000000))); } - if (QWORD_ALIGNED(address)) { printf(" (0x00ffffffffff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x00ffffffffff0000)), 16)); assert((result64 & U64(0x00ffffffffff0000)) == (expected64 & U64(0x00ffffffffff0000))); } - if (QWORD_ALIGNED(address)) { printf(" (0x0000ffffffffff00) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x0000ffffffffff00)), 16)); assert((result64 & U64(0x0000ffffffffff00)) == (expected64 & U64(0x0000ffffffffff00))); } - if (QWORD_ALIGNED(address)) { printf(" (0x000000ffffffffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x000000ffffffffff)), 16)); assert((result64 & U64(0x000000ffffffffff)) == (expected64 & U64(0x000000ffffffffff))); } - if (QWORD_ALIGNED(address)) { printf(" (0xffffffffffff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0xffffffffffff0000)), 16)); assert((result64 & U64(0xffffffffffff0000)) == (expected64 & U64(0xffffffffffff0000))); } - if (QWORD_ALIGNED(address)) { printf(" (0x00ffffffffffff00) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x00ffffffffffff00)), 16)); assert((result64 & U64(0x00ffffffffffff00)) == (expected64 & U64(0x00ffffffffffff00))); } - if (QWORD_ALIGNED(address)) { printf(" (0x0000ffffffffffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x0000ffffffffffff)), 16)); assert((result64 & U64(0x0000ffffffffffff)) == (expected64 & U64(0x0000ffffffffffff))); } - if (QWORD_ALIGNED(address)) { printf(" (0xffffffffffffff00) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0xffffffffffffff00)), 16)); assert((result64 & U64(0xffffffffffffff00)) == (expected64 & U64(0xffffffffffffff00))); } - if (QWORD_ALIGNED(address)) { printf(" (0x00ffffffffffffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, U64(0x00ffffffffffffff)), 16)); assert((result64 & U64(0x00ffffffffffffff)) == (expected64 & U64(0x00ffffffffffffff))); } + if (QWORD_ALIGNED(address)) { printf(" read_qword (0xff00000000000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, 0xff00000000000000U), 16)); assert((result64 & 0xff00000000000000U) == (expected64 & 0xff00000000000000U)); } + if (QWORD_ALIGNED(address)) { printf(" (0x00ff000000000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, 0x00ff000000000000U), 16)); assert((result64 & 0x00ff000000000000U) == (expected64 & 0x00ff000000000000U)); } + if (QWORD_ALIGNED(address)) { printf(" (0x0000ff0000000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, 0x0000ff0000000000U), 16)); assert((result64 & 0x0000ff0000000000U) == (expected64 & 0x0000ff0000000000U)); } + if (QWORD_ALIGNED(address)) { printf(" (0x000000ff00000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, 0x000000ff00000000U), 16)); assert((result64 & 0x000000ff00000000U) == (expected64 & 0x000000ff00000000U)); } + if (QWORD_ALIGNED(address)) { printf(" (0x00000000ff000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, 0x00000000ff000000U), 16)); assert((result64 & 0x00000000ff000000U) == (expected64 & 0x00000000ff000000U)); } + if (QWORD_ALIGNED(address)) { printf(" (0x0000000000ff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, 0x0000000000ff0000U), 16)); assert((result64 & 0x0000000000ff0000U) == (expected64 & 0x0000000000ff0000U)); } + if (QWORD_ALIGNED(address)) { printf(" (0x000000000000ff00) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, 0x000000000000ff00U), 16)); assert((result64 & 0x000000000000ff00U) == (expected64 & 0x000000000000ff00U)); } + if (QWORD_ALIGNED(address)) { printf(" (0x00000000000000ff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, 0x00000000000000ffU), 16)); assert((result64 & 0x00000000000000ffU) == (expected64 & 0x00000000000000ffU)); } + if (QWORD_ALIGNED(address)) { printf(" (0xffff000000000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, 0xffff000000000000U), 16)); assert((result64 & 0xffff000000000000U) == (expected64 & 0xffff000000000000U)); } + if (QWORD_ALIGNED(address)) { printf(" (0x0000ffff00000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, 0x0000ffff00000000U), 16)); assert((result64 & 0x0000ffff00000000U) == (expected64 & 0x0000ffff00000000U)); } + if (QWORD_ALIGNED(address)) { printf(" (0x00000000ffff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, 0x00000000ffff0000U), 16)); assert((result64 & 0x00000000ffff0000U) == (expected64 & 0x00000000ffff0000U)); } + if (QWORD_ALIGNED(address)) { printf(" (0x000000000000ffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, 0x000000000000ffffU), 16)); assert((result64 & 0x000000000000ffffU) == (expected64 & 0x000000000000ffffU)); } + if (QWORD_ALIGNED(address)) { printf(" (0xffffff0000000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, 0xffffff0000000000U), 16)); assert((result64 & 0xffffff0000000000U) == (expected64 & 0xffffff0000000000U)); } + if (QWORD_ALIGNED(address)) { printf(" (0x0000ffffff000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, 0x0000ffffff000000U), 16)); assert((result64 & 0x0000ffffff000000U) == (expected64 & 0x0000ffffff000000U)); } + if (QWORD_ALIGNED(address)) { printf(" (0x000000ffffff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, 0x000000ffffff0000U), 16)); assert((result64 & 0x000000ffffff0000U) == (expected64 & 0x000000ffffff0000U)); } + if (QWORD_ALIGNED(address)) { printf(" (0x0000000000ffffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, 0x0000000000ffffffU), 16)); assert((result64 & 0x0000000000ffffffU) == (expected64 & 0x0000000000ffffffU)); } + if (QWORD_ALIGNED(address)) { printf(" (0xffffffff00000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, 0xffffffff00000000U), 16)); assert((result64 & 0xffffffff00000000U) == (expected64 & 0xffffffff00000000U)); } + if (QWORD_ALIGNED(address)) { printf(" (0x00ffffffff000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, 0x00ffffffff000000U), 16)); assert((result64 & 0x00ffffffff000000U) == (expected64 & 0x00ffffffff000000U)); } + if (QWORD_ALIGNED(address)) { printf(" (0x0000ffffffff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, 0x0000ffffffff0000U), 16)); assert((result64 & 0x0000ffffffff0000U) == (expected64 & 0x0000ffffffff0000U)); } + if (QWORD_ALIGNED(address)) { printf(" (0x000000ffffffff00) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, 0x000000ffffffff00U), 16)); assert((result64 & 0x000000ffffffff00U) == (expected64 & 0x000000ffffffff00U)); } + if (QWORD_ALIGNED(address)) { printf(" (0x00000000ffffffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, 0x00000000ffffffffU), 16)); assert((result64 & 0x00000000ffffffffU) == (expected64 & 0x00000000ffffffffU)); } + if (QWORD_ALIGNED(address)) { printf(" (0xffffffffff000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, 0xffffffffff000000U), 16)); assert((result64 & 0xffffffffff000000U) == (expected64 & 0xffffffffff000000U)); } + if (QWORD_ALIGNED(address)) { printf(" (0x00ffffffffff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, 0x00ffffffffff0000U), 16)); assert((result64 & 0x00ffffffffff0000U) == (expected64 & 0x00ffffffffff0000U)); } + if (QWORD_ALIGNED(address)) { printf(" (0x0000ffffffffff00) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, 0x0000ffffffffff00U), 16)); assert((result64 & 0x0000ffffffffff00U) == (expected64 & 0x0000ffffffffff00U)); } + if (QWORD_ALIGNED(address)) { printf(" (0x000000ffffffffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, 0x000000ffffffffffU), 16)); assert((result64 & 0x000000ffffffffffU) == (expected64 & 0x000000ffffffffffU)); } + if (QWORD_ALIGNED(address)) { printf(" (0xffffffffffff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, 0xffffffffffff0000U), 16)); assert((result64 & 0xffffffffffff0000U) == (expected64 & 0xffffffffffff0000U)); } + if (QWORD_ALIGNED(address)) { printf(" (0x00ffffffffffff00) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, 0x00ffffffffffff00U), 16)); assert((result64 & 0x00ffffffffffff00U) == (expected64 & 0x00ffffffffffff00U)); } + if (QWORD_ALIGNED(address)) { printf(" (0x0000ffffffffffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, 0x0000ffffffffffffU), 16)); assert((result64 & 0x0000ffffffffffffU) == (expected64 & 0x0000ffffffffffffU)); } + if (QWORD_ALIGNED(address)) { printf(" (0xffffffffffffff00) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, 0xffffffffffffff00U), 16)); assert((result64 & 0xffffffffffffff00U) == (expected64 & 0xffffffffffffff00U)); } + if (QWORD_ALIGNED(address)) { printf(" (0x00ffffffffffffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword(address, 0x00ffffffffffffffU), 16)); assert((result64 & 0x00ffffffffffffffU) == (expected64 & 0x00ffffffffffffffU)); } // validate unaligned qword accesses printf(" read_qword_unaligned = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address), 16)); assert(result64 == expected64); - printf(" read_qword_unaligned (0xff00000000000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0xff00000000000000)), 16)); assert((result64 & U64(0xff00000000000000)) == (expected64 & U64(0xff00000000000000))); - printf(" (0x00ff000000000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x00ff000000000000)), 16)); assert((result64 & U64(0x00ff000000000000)) == (expected64 & U64(0x00ff000000000000))); - printf(" (0x0000ff0000000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x0000ff0000000000)), 16)); assert((result64 & U64(0x0000ff0000000000)) == (expected64 & U64(0x0000ff0000000000))); - printf(" (0x000000ff00000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x000000ff00000000)), 16)); assert((result64 & U64(0x000000ff00000000)) == (expected64 & U64(0x000000ff00000000))); - printf(" (0x00000000ff000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x00000000ff000000)), 16)); assert((result64 & U64(0x00000000ff000000)) == (expected64 & U64(0x00000000ff000000))); - printf(" (0x0000000000ff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x0000000000ff0000)), 16)); assert((result64 & U64(0x0000000000ff0000)) == (expected64 & U64(0x0000000000ff0000))); - printf(" (0x000000000000ff00) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x000000000000ff00)), 16)); assert((result64 & U64(0x000000000000ff00)) == (expected64 & U64(0x000000000000ff00))); - printf(" (0x00000000000000ff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x00000000000000ff)), 16)); assert((result64 & U64(0x00000000000000ff)) == (expected64 & U64(0x00000000000000ff))); - printf(" (0xffff000000000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0xffff000000000000)), 16)); assert((result64 & U64(0xffff000000000000)) == (expected64 & U64(0xffff000000000000))); - printf(" (0x0000ffff00000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x0000ffff00000000)), 16)); assert((result64 & U64(0x0000ffff00000000)) == (expected64 & U64(0x0000ffff00000000))); - printf(" (0x00000000ffff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x00000000ffff0000)), 16)); assert((result64 & U64(0x00000000ffff0000)) == (expected64 & U64(0x00000000ffff0000))); - printf(" (0x000000000000ffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x000000000000ffff)), 16)); assert((result64 & U64(0x000000000000ffff)) == (expected64 & U64(0x000000000000ffff))); - printf(" (0xffffff0000000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0xffffff0000000000)), 16)); assert((result64 & U64(0xffffff0000000000)) == (expected64 & U64(0xffffff0000000000))); - printf(" (0x0000ffffff000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x0000ffffff000000)), 16)); assert((result64 & U64(0x0000ffffff000000)) == (expected64 & U64(0x0000ffffff000000))); - printf(" (0x000000ffffff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x000000ffffff0000)), 16)); assert((result64 & U64(0x000000ffffff0000)) == (expected64 & U64(0x000000ffffff0000))); - printf(" (0x0000000000ffffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x0000000000ffffff)), 16)); assert((result64 & U64(0x0000000000ffffff)) == (expected64 & U64(0x0000000000ffffff))); - printf(" (0xffffffff00000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0xffffffff00000000)), 16)); assert((result64 & U64(0xffffffff00000000)) == (expected64 & U64(0xffffffff00000000))); - printf(" (0x00ffffffff000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x00ffffffff000000)), 16)); assert((result64 & U64(0x00ffffffff000000)) == (expected64 & U64(0x00ffffffff000000))); - printf(" (0x0000ffffffff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x0000ffffffff0000)), 16)); assert((result64 & U64(0x0000ffffffff0000)) == (expected64 & U64(0x0000ffffffff0000))); - printf(" (0x000000ffffffff00) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x000000ffffffff00)), 16)); assert((result64 & U64(0x000000ffffffff00)) == (expected64 & U64(0x000000ffffffff00))); - printf(" (0x00000000ffffffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x00000000ffffffff)), 16)); assert((result64 & U64(0x00000000ffffffff)) == (expected64 & U64(0x00000000ffffffff))); - printf(" (0xffffffffff000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0xffffffffff000000)), 16)); assert((result64 & U64(0xffffffffff000000)) == (expected64 & U64(0xffffffffff000000))); - printf(" (0x00ffffffffff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x00ffffffffff0000)), 16)); assert((result64 & U64(0x00ffffffffff0000)) == (expected64 & U64(0x00ffffffffff0000))); - printf(" (0x0000ffffffffff00) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x0000ffffffffff00)), 16)); assert((result64 & U64(0x0000ffffffffff00)) == (expected64 & U64(0x0000ffffffffff00))); - printf(" (0x000000ffffffffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x000000ffffffffff)), 16)); assert((result64 & U64(0x000000ffffffffff)) == (expected64 & U64(0x000000ffffffffff))); - printf(" (0xffffffffffff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0xffffffffffff0000)), 16)); assert((result64 & U64(0xffffffffffff0000)) == (expected64 & U64(0xffffffffffff0000))); - printf(" (0x00ffffffffffff00) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x00ffffffffffff00)), 16)); assert((result64 & U64(0x00ffffffffffff00)) == (expected64 & U64(0x00ffffffffffff00))); - printf(" (0x0000ffffffffffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x0000ffffffffffff)), 16)); assert((result64 & U64(0x0000ffffffffffff)) == (expected64 & U64(0x0000ffffffffffff))); - printf(" (0xffffffffffffff00) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0xffffffffffffff00)), 16)); assert((result64 & U64(0xffffffffffffff00)) == (expected64 & U64(0xffffffffffffff00))); - printf(" (0x00ffffffffffffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, U64(0x00ffffffffffffff)), 16)); assert((result64 & U64(0x00ffffffffffffff)) == (expected64 & U64(0x00ffffffffffffff))); + printf(" read_qword_unaligned (0xff00000000000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, 0xff00000000000000U), 16)); assert((result64 & 0xff00000000000000U) == (expected64 & 0xff00000000000000U)); + printf(" (0x00ff000000000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, 0x00ff000000000000U), 16)); assert((result64 & 0x00ff000000000000U) == (expected64 & 0x00ff000000000000U)); + printf(" (0x0000ff0000000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, 0x0000ff0000000000U), 16)); assert((result64 & 0x0000ff0000000000U) == (expected64 & 0x0000ff0000000000U)); + printf(" (0x000000ff00000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, 0x000000ff00000000U), 16)); assert((result64 & 0x000000ff00000000U) == (expected64 & 0x000000ff00000000U)); + printf(" (0x00000000ff000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, 0x00000000ff000000U), 16)); assert((result64 & 0x00000000ff000000U) == (expected64 & 0x00000000ff000000U)); + printf(" (0x0000000000ff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, 0x0000000000ff0000U), 16)); assert((result64 & 0x0000000000ff0000U) == (expected64 & 0x0000000000ff0000U)); + printf(" (0x000000000000ff00) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, 0x000000000000ff00U), 16)); assert((result64 & 0x000000000000ff00U) == (expected64 & 0x000000000000ff00U)); + printf(" (0x00000000000000ff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, 0x00000000000000ffU), 16)); assert((result64 & 0x00000000000000ffU) == (expected64 & 0x00000000000000ffU)); + printf(" (0xffff000000000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, 0xffff000000000000U), 16)); assert((result64 & 0xffff000000000000U) == (expected64 & 0xffff000000000000U)); + printf(" (0x0000ffff00000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, 0x0000ffff00000000U), 16)); assert((result64 & 0x0000ffff00000000U) == (expected64 & 0x0000ffff00000000U)); + printf(" (0x00000000ffff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, 0x00000000ffff0000U), 16)); assert((result64 & 0x00000000ffff0000U) == (expected64 & 0x00000000ffff0000U)); + printf(" (0x000000000000ffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, 0x000000000000ffffU), 16)); assert((result64 & 0x000000000000ffffU) == (expected64 & 0x000000000000ffffU)); + printf(" (0xffffff0000000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, 0xffffff0000000000U), 16)); assert((result64 & 0xffffff0000000000U) == (expected64 & 0xffffff0000000000U)); + printf(" (0x0000ffffff000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, 0x0000ffffff000000U), 16)); assert((result64 & 0x0000ffffff000000U) == (expected64 & 0x0000ffffff000000U)); + printf(" (0x000000ffffff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, 0x000000ffffff0000U), 16)); assert((result64 & 0x000000ffffff0000U) == (expected64 & 0x000000ffffff0000U)); + printf(" (0x0000000000ffffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, 0x0000000000ffffffU), 16)); assert((result64 & 0x0000000000ffffffU) == (expected64 & 0x0000000000ffffffU)); + printf(" (0xffffffff00000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, 0xffffffff00000000U), 16)); assert((result64 & 0xffffffff00000000U) == (expected64 & 0xffffffff00000000U)); + printf(" (0x00ffffffff000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, 0x00ffffffff000000U), 16)); assert((result64 & 0x00ffffffff000000U) == (expected64 & 0x00ffffffff000000U)); + printf(" (0x0000ffffffff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, 0x0000ffffffff0000U), 16)); assert((result64 & 0x0000ffffffff0000U) == (expected64 & 0x0000ffffffff0000U)); + printf(" (0x000000ffffffff00) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, 0x000000ffffffff00U), 16)); assert((result64 & 0x000000ffffffff00U) == (expected64 & 0x000000ffffffff00U)); + printf(" (0x00000000ffffffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, 0x00000000ffffffffU), 16)); assert((result64 & 0x00000000ffffffffU) == (expected64 & 0x00000000ffffffffU)); + printf(" (0xffffffffff000000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, 0xffffffffff000000U), 16)); assert((result64 & 0xffffffffff000000U) == (expected64 & 0xffffffffff000000U)); + printf(" (0x00ffffffffff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, 0x00ffffffffff0000U), 16)); assert((result64 & 0x00ffffffffff0000U) == (expected64 & 0x00ffffffffff0000U)); + printf(" (0x0000ffffffffff00) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, 0x0000ffffffffff00U), 16)); assert((result64 & 0x0000ffffffffff00U) == (expected64 & 0x0000ffffffffff00U)); + printf(" (0x000000ffffffffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, 0x000000ffffffffffU), 16)); assert((result64 & 0x000000ffffffffffU) == (expected64 & 0x000000ffffffffffU)); + printf(" (0xffffffffffff0000) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, 0xffffffffffff0000U), 16)); assert((result64 & 0xffffffffffff0000U) == (expected64 & 0xffffffffffff0000U)); + printf(" (0x00ffffffffffff00) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, 0x00ffffffffffff00U), 16)); assert((result64 & 0x00ffffffffffff00U) == (expected64 & 0x00ffffffffffff00U)); + printf(" (0x0000ffffffffffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, 0x0000ffffffffffffU), 16)); assert((result64 & 0x0000ffffffffffffU) == (expected64 & 0x0000ffffffffffffU)); + printf(" (0xffffffffffffff00) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, 0xffffffffffffff00U), 16)); assert((result64 & 0xffffffffffffff00U) == (expected64 & 0xffffffffffffff00U)); + printf(" (0x00ffffffffffffff) = "); printf("%s\n", core_i64_hex_format(result64 = read_qword_unaligned(address, 0x00ffffffffffffffU), 16)); assert((result64 & 0x00ffffffffffffffU) == (expected64 & 0x00ffffffffffffffU)); } #endif } @@ -1047,20 +1047,20 @@ public: // generate accessor table virtual void accessors(data_accessors &accessors) const override { - accessors.read_byte = reinterpret_cast(&read_byte_static); - accessors.read_word = reinterpret_cast(&read_word_static); - accessors.read_word_masked = reinterpret_cast(&read_word_masked_static); - accessors.read_dword = reinterpret_cast(&read_dword_static); - accessors.read_dword_masked = reinterpret_cast(&read_dword_masked_static); - accessors.read_qword = reinterpret_cast(&read_qword_static); - accessors.read_qword_masked = reinterpret_cast(&read_qword_masked_static); - accessors.write_byte = reinterpret_cast(&write_byte_static); - accessors.write_word = reinterpret_cast(&write_word_static); - accessors.write_word_masked = reinterpret_cast(&write_word_masked_static); - accessors.write_dword = reinterpret_cast(&write_dword_static); - accessors.write_dword_masked = reinterpret_cast(&write_dword_masked_static); - accessors.write_qword = reinterpret_cast(&write_qword_static); - accessors.write_qword_masked = reinterpret_cast(&write_qword_masked_static); + accessors.read_byte = reinterpret_cast(&read_byte_static); + accessors.read_word = reinterpret_cast(&read_word_static); + accessors.read_word_masked = reinterpret_cast(&read_word_masked_static); + accessors.read_dword = reinterpret_cast(&read_dword_static); + accessors.read_dword_masked = reinterpret_cast(&read_dword_masked_static); + accessors.read_qword = reinterpret_cast(&read_qword_static); + accessors.read_qword_masked = reinterpret_cast(&read_qword_masked_static); + accessors.write_byte = reinterpret_cast(&write_byte_static); + accessors.write_word = reinterpret_cast(&write_word_static); + accessors.write_word_masked = reinterpret_cast(&write_word_masked_static); + accessors.write_dword = reinterpret_cast(&write_dword_static); + accessors.write_dword_masked = reinterpret_cast(&write_dword_masked_static); + accessors.write_qword = reinterpret_cast(&write_qword_static); + accessors.write_qword_masked = reinterpret_cast(&write_qword_masked_static); } // return a pointer to the read bank, or nullptr if none @@ -1068,7 +1068,7 @@ public: { // perform the lookup byteaddress &= m_bytemask; - uint32_t entry = read_lookup(byteaddress); + u32 entry = read_lookup(byteaddress); const handler_entry_read &handler = m_read.handler_read(entry); // 8-bit case: RAM/ROM @@ -1082,7 +1082,7 @@ public: { // perform the lookup byteaddress &= m_bytemask; - uint32_t entry = write_lookup(byteaddress); + u32 entry = write_lookup(byteaddress); const handler_entry_write &handler = m_write.handler_write(entry); // 8-bit case: RAM/ROM @@ -1100,7 +1100,7 @@ public: // look up the handler offs_t byteaddress = offset & m_bytemask; - uint32_t entry = read_lookup(byteaddress); + u32 entry = read_lookup(byteaddress); const handler_entry_read &handler = m_read.handler_read(entry); // either read directly from RAM, or call the delegate @@ -1125,7 +1125,7 @@ public: // look up the handler offs_t byteaddress = offset & m_bytemask; - uint32_t entry = read_lookup(byteaddress); + u32 entry = read_lookup(byteaddress); const handler_entry_read &handler = m_read.handler_read(entry); // either read directly from RAM, or call the delegate @@ -1135,7 +1135,7 @@ public: else if (sizeof(_NativeType) == 1) result = handler.read8(*this, offset, 0xff); else if (sizeof(_NativeType) == 2) result = handler.read16(*this, offset >> 1, 0xffff); else if (sizeof(_NativeType) == 4) result = handler.read32(*this, offset >> 2, 0xffffffff); - else if (sizeof(_NativeType) == 8) result = handler.read64(*this, offset >> 3, U64(0xffffffffffffffff)); + else if (sizeof(_NativeType) == 8) result = handler.read64(*this, offset >> 3, 0xffffffffffffffffU); g_profiler.stop(); return result; @@ -1148,7 +1148,7 @@ public: // look up the handler offs_t byteaddress = offset & m_bytemask; - uint32_t entry = write_lookup(byteaddress); + u32 entry = write_lookup(byteaddress); const handler_entry_write &handler = m_write.handler_write(entry); // either write directly to RAM, or call the delegate @@ -1173,7 +1173,7 @@ public: // look up the handler offs_t byteaddress = offset & m_bytemask; - uint32_t entry = write_lookup(byteaddress); + u32 entry = write_lookup(byteaddress); const handler_entry_write &handler = m_write.handler_write(entry); // either write directly to RAM, or call the delegate @@ -1182,7 +1182,7 @@ public: else if (sizeof(_NativeType) == 1) handler.write8(*this, offset, data, 0xff); else if (sizeof(_NativeType) == 2) handler.write16(*this, offset >> 1, data, 0xffff); else if (sizeof(_NativeType) == 4) handler.write32(*this, offset >> 2, data, 0xffffffff); - else if (sizeof(_NativeType) == 8) handler.write64(*this, offset >> 3, data, U64(0xffffffffffffffff)); + else if (sizeof(_NativeType) == 8) handler.write64(*this, offset >> 3, data, 0xffffffffffffffffU); g_profiler.stop(); } @@ -1191,8 +1191,8 @@ public: template _TargetType read_direct(offs_t address, _TargetType mask) { - const uint32_t TARGET_BYTES = sizeof(_TargetType); - const uint32_t TARGET_BITS = 8 * TARGET_BYTES; + const u32 TARGET_BYTES = sizeof(_TargetType); + const u32 TARGET_BITS = 8 * TARGET_BYTES; // equal to native size and aligned; simple pass-through to the native reader if (NATIVE_BYTES == TARGET_BYTES && (_Aligned || (address & NATIVE_MASK) == 0)) @@ -1201,7 +1201,7 @@ public: // if native size is larger, see if we can do a single masked read (guaranteed if we're aligned) if (NATIVE_BYTES > TARGET_BYTES) { - uint32_t offsbits = 8 * (address & (NATIVE_BYTES - (_Aligned ? TARGET_BYTES : 1))); + u32 offsbits = 8 * (address & (NATIVE_BYTES - (_Aligned ? TARGET_BYTES : 1))); if (_Aligned || (offsbits + TARGET_BITS <= NATIVE_BITS)) { if (_Endian != ENDIANNESS_LITTLE) offsbits = NATIVE_BITS - TARGET_BITS - offsbits; @@ -1210,7 +1210,7 @@ public: } // determine our alignment against the native boundaries, and mask the address - uint32_t offsbits = 8 * (address & (NATIVE_BYTES - 1)); + u32 offsbits = 8 * (address & (NATIVE_BYTES - 1)); address &= ~NATIVE_MASK; // if we're here, and native size is larger or equal to the target, we need exactly 2 reads @@ -1235,7 +1235,7 @@ public: else { // left-justify the mask to the target type - const uint32_t LEFT_JUSTIFY_TARGET_TO_NATIVE_SHIFT = ((NATIVE_BITS >= TARGET_BITS) ? (NATIVE_BITS - TARGET_BITS) : 0); + const u32 LEFT_JUSTIFY_TARGET_TO_NATIVE_SHIFT = ((NATIVE_BITS >= TARGET_BITS) ? (NATIVE_BITS - TARGET_BITS) : 0); _NativeType result = 0; _NativeType ljmask = (_NativeType)mask << LEFT_JUSTIFY_TARGET_TO_NATIVE_SHIFT; _NativeType curmask = ljmask >> offsbits; @@ -1258,7 +1258,7 @@ public: { // compute the maximum number of loops; we do it this way so that there are // a fixed number of loops for the compiler to unroll if it desires - const uint32_t MAX_SPLITS_MINUS_ONE = TARGET_BYTES / NATIVE_BYTES - 1; + const u32 MAX_SPLITS_MINUS_ONE = TARGET_BYTES / NATIVE_BYTES - 1; _TargetType result = 0; // little-endian case @@ -1270,7 +1270,7 @@ public: // read middle bits from subsequent addresses offsbits = NATIVE_BITS - offsbits; - for (uint32_t index = 0; index < MAX_SPLITS_MINUS_ONE; index++) + for (u32 index = 0; index < MAX_SPLITS_MINUS_ONE; index++) { address += NATIVE_BYTES; curmask = mask >> offsbits; @@ -1295,7 +1295,7 @@ public: if (curmask != 0) result = (_TargetType)read_native(address, curmask) << offsbits; // read middle bits from subsequent addresses - for (uint32_t index = 0; index < MAX_SPLITS_MINUS_ONE; index++) + for (u32 index = 0; index < MAX_SPLITS_MINUS_ONE; index++) { offsbits -= NATIVE_BITS; address += NATIVE_BYTES; @@ -1319,8 +1319,8 @@ public: template void write_direct(offs_t address, _TargetType data, _TargetType mask) { - const uint32_t TARGET_BYTES = sizeof(_TargetType); - const uint32_t TARGET_BITS = 8 * TARGET_BYTES; + const u32 TARGET_BYTES = sizeof(_TargetType); + const u32 TARGET_BITS = 8 * TARGET_BYTES; // equal to native size and aligned; simple pass-through to the native writer if (NATIVE_BYTES == TARGET_BYTES && (_Aligned || (address & NATIVE_MASK) == 0)) @@ -1329,7 +1329,7 @@ public: // if native size is larger, see if we can do a single masked write (guaranteed if we're aligned) if (NATIVE_BYTES > TARGET_BYTES) { - uint32_t offsbits = 8 * (address & (NATIVE_BYTES - (_Aligned ? TARGET_BYTES : 1))); + u32 offsbits = 8 * (address & (NATIVE_BYTES - (_Aligned ? TARGET_BYTES : 1))); if (_Aligned || (offsbits + TARGET_BITS <= NATIVE_BITS)) { if (_Endian != ENDIANNESS_LITTLE) offsbits = NATIVE_BITS - TARGET_BITS - offsbits; @@ -1338,7 +1338,7 @@ public: } // determine our alignment against the native boundaries, and mask the address - uint32_t offsbits = 8 * (address & (NATIVE_BYTES - 1)); + u32 offsbits = 8 * (address & (NATIVE_BYTES - 1)); address &= ~NATIVE_MASK; // if we're here, and native size is larger or equal to the target, we need exactly 2 writes @@ -1361,7 +1361,7 @@ public: else { // left-justify the mask and data to the target type - const uint32_t LEFT_JUSTIFY_TARGET_TO_NATIVE_SHIFT = ((NATIVE_BITS >= TARGET_BITS) ? (NATIVE_BITS - TARGET_BITS) : 0); + const u32 LEFT_JUSTIFY_TARGET_TO_NATIVE_SHIFT = ((NATIVE_BITS >= TARGET_BITS) ? (NATIVE_BITS - TARGET_BITS) : 0); _NativeType ljdata = (_NativeType)data << LEFT_JUSTIFY_TARGET_TO_NATIVE_SHIFT; _NativeType ljmask = (_NativeType)mask << LEFT_JUSTIFY_TARGET_TO_NATIVE_SHIFT; @@ -1381,7 +1381,7 @@ public: { // compute the maximum number of loops; we do it this way so that there are // a fixed number of loops for the compiler to unroll if it desires - const uint32_t MAX_SPLITS_MINUS_ONE = TARGET_BYTES / NATIVE_BYTES - 1; + const u32 MAX_SPLITS_MINUS_ONE = TARGET_BYTES / NATIVE_BYTES - 1; // little-endian case if (_Endian == ENDIANNESS_LITTLE) @@ -1392,7 +1392,7 @@ public: // write middle bits to subsequent addresses offsbits = NATIVE_BITS - offsbits; - for (uint32_t index = 0; index < MAX_SPLITS_MINUS_ONE; index++) + for (u32 index = 0; index < MAX_SPLITS_MINUS_ONE; index++) { address += NATIVE_BYTES; curmask = mask >> offsbits; @@ -1417,7 +1417,7 @@ public: if (curmask != 0) write_native(address, data >> offsbits, curmask); // write middle bits to subsequent addresses - for (uint32_t index = 0; index < MAX_SPLITS_MINUS_ONE; index++) + for (u32 index = 0; index < MAX_SPLITS_MINUS_ONE; index++) { offsbits -= NATIVE_BITS; address += NATIVE_BYTES; @@ -1442,7 +1442,7 @@ public: void set_address(offs_t address) override { offs_t byteaddress = address & m_bytemask; - uint32_t entry = setoffset_lookup(byteaddress); + u32 entry = setoffset_lookup(byteaddress); const handler_entry_setoffset &handler = m_setoffset.handler_setoffset(entry); offs_t offset = handler.byteoffset(byteaddress); @@ -1450,72 +1450,72 @@ public: } // virtual access to these functions - uint8_t read_byte(offs_t address) override { return (NATIVE_BITS == 8) ? read_native(address & ~NATIVE_MASK) : read_direct(address, 0xff); } - uint16_t read_word(offs_t address) override { return (NATIVE_BITS == 16) ? read_native(address & ~NATIVE_MASK) : read_direct(address, 0xffff); } - uint16_t read_word(offs_t address, uint16_t mask) override { return read_direct(address, mask); } - uint16_t read_word_unaligned(offs_t address) override { return read_direct(address, 0xffff); } - uint16_t read_word_unaligned(offs_t address, uint16_t mask) override { return read_direct(address, mask); } - uint32_t read_dword(offs_t address) override { return (NATIVE_BITS == 32) ? read_native(address & ~NATIVE_MASK) : read_direct(address, 0xffffffff); } - uint32_t read_dword(offs_t address, uint32_t mask) override { return read_direct(address, mask); } - uint32_t read_dword_unaligned(offs_t address) override { return read_direct(address, 0xffffffff); } - uint32_t read_dword_unaligned(offs_t address, uint32_t mask) override { return read_direct(address, mask); } - uint64_t read_qword(offs_t address) override { return (NATIVE_BITS == 64) ? read_native(address & ~NATIVE_MASK) : read_direct(address, U64(0xffffffffffffffff)); } - uint64_t read_qword(offs_t address, uint64_t mask) override { return read_direct(address, mask); } - uint64_t read_qword_unaligned(offs_t address) override { return read_direct(address, U64(0xffffffffffffffff)); } - uint64_t read_qword_unaligned(offs_t address, uint64_t mask) override { return read_direct(address, mask); } + u8 read_byte(offs_t address) override { return (NATIVE_BITS == 8) ? read_native(address & ~NATIVE_MASK) : read_direct(address, 0xff); } + u16 read_word(offs_t address) override { return (NATIVE_BITS == 16) ? read_native(address & ~NATIVE_MASK) : read_direct(address, 0xffff); } + u16 read_word(offs_t address, u16 mask) override { return read_direct(address, mask); } + u16 read_word_unaligned(offs_t address) override { return read_direct(address, 0xffff); } + u16 read_word_unaligned(offs_t address, u16 mask) override { return read_direct(address, mask); } + u32 read_dword(offs_t address) override { return (NATIVE_BITS == 32) ? read_native(address & ~NATIVE_MASK) : read_direct(address, 0xffffffff); } + u32 read_dword(offs_t address, u32 mask) override { return read_direct(address, mask); } + u32 read_dword_unaligned(offs_t address) override { return read_direct(address, 0xffffffff); } + u32 read_dword_unaligned(offs_t address, u32 mask) override { return read_direct(address, mask); } + u64 read_qword(offs_t address) override { return (NATIVE_BITS == 64) ? read_native(address & ~NATIVE_MASK) : read_direct(address, 0xffffffffffffffffU); } + u64 read_qword(offs_t address, u64 mask) override { return read_direct(address, mask); } + u64 read_qword_unaligned(offs_t address) override { return read_direct(address, 0xffffffffffffffffU); } + u64 read_qword_unaligned(offs_t address, u64 mask) override { return read_direct(address, mask); } - void write_byte(offs_t address, uint8_t data) override { if (NATIVE_BITS == 8) write_native(address & ~NATIVE_MASK, data); else write_direct(address, data, 0xff); } - void write_word(offs_t address, uint16_t data) override { if (NATIVE_BITS == 16) write_native(address & ~NATIVE_MASK, data); else write_direct(address, data, 0xffff); } - void write_word(offs_t address, uint16_t data, uint16_t mask) override { write_direct(address, data, mask); } - void write_word_unaligned(offs_t address, uint16_t data) override { write_direct(address, data, 0xffff); } - void write_word_unaligned(offs_t address, uint16_t data, uint16_t mask) override { write_direct(address, data, mask); } - void write_dword(offs_t address, uint32_t data) override { if (NATIVE_BITS == 32) write_native(address & ~NATIVE_MASK, data); else write_direct(address, data, 0xffffffff); } - void write_dword(offs_t address, uint32_t data, uint32_t mask) override { write_direct(address, data, mask); } - void write_dword_unaligned(offs_t address, uint32_t data) override { write_direct(address, data, 0xffffffff); } - void write_dword_unaligned(offs_t address, uint32_t data, uint32_t mask) override { write_direct(address, data, mask); } - void write_qword(offs_t address, uint64_t data) override { if (NATIVE_BITS == 64) write_native(address & ~NATIVE_MASK, data); else write_direct(address, data, U64(0xffffffffffffffff)); } - void write_qword(offs_t address, uint64_t data, uint64_t mask) override { write_direct(address, data, mask); } - void write_qword_unaligned(offs_t address, uint64_t data) override { write_direct(address, data, U64(0xffffffffffffffff)); } - void write_qword_unaligned(offs_t address, uint64_t data, uint64_t mask) override { write_direct(address, data, mask); } + void write_byte(offs_t address, u8 data) override { if (NATIVE_BITS == 8) write_native(address & ~NATIVE_MASK, data); else write_direct(address, data, 0xff); } + void write_word(offs_t address, u16 data) override { if (NATIVE_BITS == 16) write_native(address & ~NATIVE_MASK, data); else write_direct(address, data, 0xffff); } + void write_word(offs_t address, u16 data, u16 mask) override { write_direct(address, data, mask); } + void write_word_unaligned(offs_t address, u16 data) override { write_direct(address, data, 0xffff); } + void write_word_unaligned(offs_t address, u16 data, u16 mask) override { write_direct(address, data, mask); } + void write_dword(offs_t address, u32 data) override { if (NATIVE_BITS == 32) write_native(address & ~NATIVE_MASK, data); else write_direct(address, data, 0xffffffff); } + void write_dword(offs_t address, u32 data, u32 mask) override { write_direct(address, data, mask); } + void write_dword_unaligned(offs_t address, u32 data) override { write_direct(address, data, 0xffffffff); } + void write_dword_unaligned(offs_t address, u32 data, u32 mask) override { write_direct(address, data, mask); } + void write_qword(offs_t address, u64 data) override { if (NATIVE_BITS == 64) write_native(address & ~NATIVE_MASK, data); else write_direct(address, data, 0xffffffffffffffffU); } + void write_qword(offs_t address, u64 data, u64 mask) override { write_direct(address, data, mask); } + void write_qword_unaligned(offs_t address, u64 data) override { write_direct(address, data, 0xffffffffffffffffU); } + void write_qword_unaligned(offs_t address, u64 data, u64 mask) override { write_direct(address, data, mask); } // static access to these functions - static uint8_t read_byte_static(this_type &space, offs_t address) { return (NATIVE_BITS == 8) ? space.read_native(address & ~NATIVE_MASK) : space.read_direct(address, 0xff); } - static uint16_t read_word_static(this_type &space, offs_t address) { return (NATIVE_BITS == 16) ? space.read_native(address & ~NATIVE_MASK) : space.read_direct(address, 0xffff); } - static uint16_t read_word_masked_static(this_type &space, offs_t address, uint16_t mask) { return space.read_direct(address, mask); } - static uint32_t read_dword_static(this_type &space, offs_t address) { return (NATIVE_BITS == 32) ? space.read_native(address & ~NATIVE_MASK) : space.read_direct(address, 0xffffffff); } - static uint32_t read_dword_masked_static(this_type &space, offs_t address, uint32_t mask) { return space.read_direct(address, mask); } - static uint64_t read_qword_static(this_type &space, offs_t address) { return (NATIVE_BITS == 64) ? space.read_native(address & ~NATIVE_MASK) : space.read_direct(address, U64(0xffffffffffffffff)); } - static uint64_t read_qword_masked_static(this_type &space, offs_t address, uint64_t mask) { return space.read_direct(address, mask); } - static void write_byte_static(this_type &space, offs_t address, uint8_t data) { if (NATIVE_BITS == 8) space.write_native(address & ~NATIVE_MASK, data); else space.write_direct(address, data, 0xff); } - static void write_word_static(this_type &space, offs_t address, uint16_t data) { if (NATIVE_BITS == 16) space.write_native(address & ~NATIVE_MASK, data); else space.write_direct(address, data, 0xffff); } - static void write_word_masked_static(this_type &space, offs_t address, uint16_t data, uint16_t mask) { space.write_direct(address, data, mask); } - static void write_dword_static(this_type &space, offs_t address, uint32_t data) { if (NATIVE_BITS == 32) space.write_native(address & ~NATIVE_MASK, data); else space.write_direct(address, data, 0xffffffff); } - static void write_dword_masked_static(this_type &space, offs_t address, uint32_t data, uint32_t mask) { space.write_direct(address, data, mask); } - static void write_qword_static(this_type &space, offs_t address, uint64_t data) { if (NATIVE_BITS == 64) space.write_native(address & ~NATIVE_MASK, data); else space.write_direct(address, data, U64(0xffffffffffffffff)); } - static void write_qword_masked_static(this_type &space, offs_t address, uint64_t data, uint64_t mask) { space.write_direct(address, data, mask); } + static u8 read_byte_static(this_type &space, offs_t address) { return (NATIVE_BITS == 8) ? space.read_native(address & ~NATIVE_MASK) : space.read_direct(address, 0xff); } + static u16 read_word_static(this_type &space, offs_t address) { return (NATIVE_BITS == 16) ? space.read_native(address & ~NATIVE_MASK) : space.read_direct(address, 0xffff); } + static u16 read_word_masked_static(this_type &space, offs_t address, u16 mask) { return space.read_direct(address, mask); } + static u32 read_dword_static(this_type &space, offs_t address) { return (NATIVE_BITS == 32) ? space.read_native(address & ~NATIVE_MASK) : space.read_direct(address, 0xffffffff); } + static u32 read_dword_masked_static(this_type &space, offs_t address, u32 mask) { return space.read_direct(address, mask); } + static u64 read_qword_static(this_type &space, offs_t address) { return (NATIVE_BITS == 64) ? space.read_native(address & ~NATIVE_MASK) : space.read_direct(address, 0xffffffffffffffffU); } + static u64 read_qword_masked_static(this_type &space, offs_t address, u64 mask) { return space.read_direct(address, mask); } + static void write_byte_static(this_type &space, offs_t address, u8 data) { if (NATIVE_BITS == 8) space.write_native(address & ~NATIVE_MASK, data); else space.write_direct(address, data, 0xff); } + static void write_word_static(this_type &space, offs_t address, u16 data) { if (NATIVE_BITS == 16) space.write_native(address & ~NATIVE_MASK, data); else space.write_direct(address, data, 0xffff); } + static void write_word_masked_static(this_type &space, offs_t address, u16 data, u16 mask) { space.write_direct(address, data, mask); } + static void write_dword_static(this_type &space, offs_t address, u32 data) { if (NATIVE_BITS == 32) space.write_native(address & ~NATIVE_MASK, data); else space.write_direct(address, data, 0xffffffff); } + static void write_dword_masked_static(this_type &space, offs_t address, u32 data, u32 mask) { space.write_direct(address, data, mask); } + static void write_qword_static(this_type &space, offs_t address, u64 data) { if (NATIVE_BITS == 64) space.write_native(address & ~NATIVE_MASK, data); else space.write_direct(address, data, 0xffffffffffffffffU); } + static void write_qword_masked_static(this_type &space, offs_t address, u64 data, u64 mask) { space.write_direct(address, data, mask); } address_table_read m_read; // memory read lookup table address_table_write m_write; // memory write lookup table address_table_setoffset m_setoffset; // memory setoffset lookup table }; -typedef address_space_specific address_space_8le_small; -typedef address_space_specific address_space_8be_small; -typedef address_space_specific address_space_16le_small; -typedef address_space_specific address_space_16be_small; -typedef address_space_specific address_space_32le_small; -typedef address_space_specific address_space_32be_small; -typedef address_space_specific address_space_64le_small; -typedef address_space_specific address_space_64be_small; +typedef address_space_specific address_space_8le_small; +typedef address_space_specific address_space_8be_small; +typedef address_space_specific address_space_16le_small; +typedef address_space_specific address_space_16be_small; +typedef address_space_specific address_space_32le_small; +typedef address_space_specific address_space_32be_small; +typedef address_space_specific address_space_64le_small; +typedef address_space_specific address_space_64be_small; -typedef address_space_specific address_space_8le_large; -typedef address_space_specific address_space_8be_large; -typedef address_space_specific address_space_16le_large; -typedef address_space_specific address_space_16be_large; -typedef address_space_specific address_space_32le_large; -typedef address_space_specific address_space_32be_large; -typedef address_space_specific address_space_64le_large; -typedef address_space_specific address_space_64be_large; +typedef address_space_specific address_space_8le_large; +typedef address_space_specific address_space_8be_large; +typedef address_space_specific address_space_16le_large; +typedef address_space_specific address_space_16be_large; +typedef address_space_specific address_space_32le_large; +typedef address_space_specific address_space_32be_large; +typedef address_space_specific address_space_64le_large; +typedef address_space_specific address_space_64be_large; @@ -1524,7 +1524,7 @@ typedef address_space_specific address_space_ //************************************************************************** // global watchpoint table -uint16_t address_table::s_watchpoint_table[1 << LEVEL1_BITS]; +u16 address_table::s_watchpoint_table[1 << LEVEL1_BITS]; @@ -1648,7 +1648,7 @@ void memory_manager::dump(FILE *file) // region_alloc - allocates memory for a region //------------------------------------------------- -memory_region *memory_manager::region_alloc(const char *name, uint32_t length, uint8_t width, endianness_t endian) +memory_region *memory_manager::region_alloc(const char *name, u32 length, u8 width, endianness_t endian) { osd_printf_verbose("Region '%s' created\n", name); // make sure we don't have a region of the same name; also find the end of the list @@ -1678,7 +1678,7 @@ void memory_manager::region_free(const char *name) memory_region *memory_manager::region_containing(const void *memory, offs_t bytes) const { - const uint8_t *data = reinterpret_cast(memory); + const u8 *data = reinterpret_cast(memory); // look through the region list and return the first match for (auto ®ion : m_regionlist) @@ -2005,7 +2005,7 @@ void address_space::check_address(const char *function, offs_t addrstart, offs_t void address_space::prepare_map() { memory_region *devregion = (m_spacenum == AS_0) ? machine().root_device().memregion(m_device.tag()) : nullptr; - uint32_t devregionsize = (devregion != nullptr) ? devregion->bytes() : 0; + u32 devregionsize = (devregion != nullptr) ? devregion->bytes() : 0; // allocate the address map m_map = std::make_unique(m_device, m_spacenum); @@ -2304,7 +2304,7 @@ void address_space::locate_memory() // intersecting blocks and assign their pointers //------------------------------------------------- -address_map_entry *address_space::block_assign_intersecting(offs_t bytestart, offs_t byteend, uint8_t *base) +address_map_entry *address_space::block_assign_intersecting(offs_t bytestart, offs_t byteend, u8 *base) { address_map_entry *unassigned = nullptr; @@ -2388,7 +2388,7 @@ void address_space::dump_map(FILE *file, read_or_write readorwrite) offs_t bytestart, byteend; for (offs_t byteaddress = 0; byteaddress <= m_bytemask; byteaddress = byteend) { - uint16_t entry = table.derive_range(byteaddress, bytestart, byteend); + u16 entry = table.derive_range(byteaddress, bytestart, byteend); fprintf(file, "%08X-%08X = %02X: %s [offset=%08X]\n", bytestart, byteend, entry, table.handler_name(entry), table.handler(entry).bytestart()); if (++byteend == 0) @@ -2431,7 +2431,7 @@ void address_space::unmap_generic(offs_t addrstart, offs_t addrend, offs_t addrm // of a live device into this address space //------------------------------------------------- -void address_space::install_device_delegate(offs_t addrstart, offs_t addrend, device_t &device, address_map_delegate &delegate, int bits, uint64_t unitmask) +void address_space::install_device_delegate(offs_t addrstart, offs_t addrend, device_t &device, address_map_delegate &delegate, int bits, u64 unitmask) { check_address("install_device_delegate", addrstart, addrend); address_map map(*this, addrstart, addrend, bits, unitmask, m_device, delegate); @@ -2630,7 +2630,7 @@ void address_space::install_ram_generic(offs_t addrstart, offs_t addrend, offs_t // delegate handlers for the space //------------------------------------------------- -void address_space::install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8_delegate handler, uint64_t unitmask) +void address_space::install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8_delegate handler, u64 unitmask) { VPRINTF(("address_space::install_read_handler(%s-%s mask=%s mirror=%s, %s, %s)\n", core_i64_hex_format(addrstart, m_addrchars), core_i64_hex_format(addrend, m_addrchars), @@ -2644,7 +2644,7 @@ void address_space::install_read_handler(offs_t addrstart, offs_t addrend, offs_ generate_memdump(machine()); } -void address_space::install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8_delegate handler, uint64_t unitmask) +void address_space::install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8_delegate handler, u64 unitmask) { VPRINTF(("address_space::install_write_handler(%s-%s mask=%s mirror=%s, %s, %s)\n", core_i64_hex_format(addrstart, m_addrchars), core_i64_hex_format(addrend, m_addrchars), @@ -2658,7 +2658,7 @@ void address_space::install_write_handler(offs_t addrstart, offs_t addrend, offs generate_memdump(machine()); } -void address_space::install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8_delegate rhandler, write8_delegate whandler, uint64_t unitmask) +void address_space::install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8_delegate rhandler, write8_delegate whandler, u64 unitmask) { install_read_handler(addrstart, addrend, addrmask, addrmirror, addrselect, rhandler, unitmask); install_write_handler(addrstart, addrend, addrmask, addrmirror, addrselect, whandler, unitmask); @@ -2670,7 +2670,7 @@ void address_space::install_readwrite_handler(offs_t addrstart, offs_t addrend, // delegate handlers for the space //------------------------------------------------- -void address_space::install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16_delegate handler, uint64_t unitmask) +void address_space::install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16_delegate handler, u64 unitmask) { offs_t nstart, nend, nmask, nmirror; check_optimize_all("install_read_handler", addrstart, addrend, addrmask, addrmirror, addrselect, nstart, nend, nmask, nmirror); @@ -2678,7 +2678,7 @@ void address_space::install_read_handler(offs_t addrstart, offs_t addrend, offs_ generate_memdump(machine()); } -void address_space::install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16_delegate handler, uint64_t unitmask) +void address_space::install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16_delegate handler, u64 unitmask) { offs_t nstart, nend, nmask, nmirror; check_optimize_all("install_write_handler", addrstart, addrend, addrmask, addrmirror, addrselect, nstart, nend, nmask, nmirror); @@ -2686,7 +2686,7 @@ void address_space::install_write_handler(offs_t addrstart, offs_t addrend, offs generate_memdump(machine()); } -void address_space::install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16_delegate rhandler, write16_delegate whandler, uint64_t unitmask) +void address_space::install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16_delegate rhandler, write16_delegate whandler, u64 unitmask) { install_read_handler(addrstart, addrend, addrmask, addrmirror, addrselect, rhandler, unitmask); install_write_handler(addrstart, addrend, addrmask, addrmirror, addrselect, whandler, unitmask); @@ -2698,7 +2698,7 @@ void address_space::install_readwrite_handler(offs_t addrstart, offs_t addrend, // delegate handlers for the space //------------------------------------------------- -void address_space::install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32_delegate handler, uint64_t unitmask) +void address_space::install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32_delegate handler, u64 unitmask) { offs_t nstart, nend, nmask, nmirror; check_optimize_all("install_read_handler", addrstart, addrend, addrmask, addrmirror, addrselect, nstart, nend, nmask, nmirror); @@ -2706,7 +2706,7 @@ void address_space::install_read_handler(offs_t addrstart, offs_t addrend, offs_ generate_memdump(machine()); } -void address_space::install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32_delegate handler, uint64_t unitmask) +void address_space::install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32_delegate handler, u64 unitmask) { offs_t nstart, nend, nmask, nmirror; check_optimize_all("install_write_handler", addrstart, addrend, addrmask, addrmirror, addrselect, nstart, nend, nmask, nmirror); @@ -2714,7 +2714,7 @@ void address_space::install_write_handler(offs_t addrstart, offs_t addrend, offs generate_memdump(machine()); } -void address_space::install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32_delegate rhandler, write32_delegate whandler, uint64_t unitmask) +void address_space::install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32_delegate rhandler, write32_delegate whandler, u64 unitmask) { install_read_handler(addrstart, addrend, addrmask, addrmirror, addrselect, rhandler, unitmask); install_write_handler(addrstart, addrend, addrmask, addrmirror, addrselect, whandler, unitmask); @@ -2726,7 +2726,7 @@ void address_space::install_readwrite_handler(offs_t addrstart, offs_t addrend, // delegate handlers for the space //------------------------------------------------- -void address_space::install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64_delegate handler, uint64_t unitmask) +void address_space::install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64_delegate handler, u64 unitmask) { offs_t nstart, nend, nmask, nmirror; check_optimize_all("install_read_handler", addrstart, addrend, addrmask, addrmirror, addrselect, nstart, nend, nmask, nmirror); @@ -2734,7 +2734,7 @@ void address_space::install_read_handler(offs_t addrstart, offs_t addrend, offs_ generate_memdump(machine()); } -void address_space::install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64_delegate handler, uint64_t unitmask) +void address_space::install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64_delegate handler, u64 unitmask) { offs_t nstart, nend, nmask, nmirror; check_optimize_all("install_write_handler", addrstart, addrend, addrmask, addrmirror, addrselect, nstart, nend, nmask, nmirror); @@ -2742,7 +2742,7 @@ void address_space::install_write_handler(offs_t addrstart, offs_t addrend, offs generate_memdump(machine()); } -void address_space::install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64_delegate rhandler, write64_delegate whandler, uint64_t unitmask) +void address_space::install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64_delegate rhandler, write64_delegate whandler, u64 unitmask) { install_read_handler(addrstart, addrend, addrmask, addrmirror, addrselect, rhandler, unitmask); install_write_handler(addrstart, addrend, addrmask, addrmirror, addrselect, whandler, unitmask); @@ -2753,7 +2753,7 @@ void address_space::install_readwrite_handler(offs_t addrstart, offs_t addrend, // install_setoffset_handler - install set_offset delegate handlers for the space //----------------------------------------------------------------------- -void address_space::install_setoffset_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, setoffset_delegate handler, uint64_t unitmask) +void address_space::install_setoffset_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, setoffset_delegate handler, u64 unitmask) { VPRINTF(("address_space::install_setoffset_handler(%s-%s mask=%s mirror=%s, %s, %s)\n", core_i64_hex_format(addrstart, m_addrchars), core_i64_hex_format(addrend, m_addrchars), @@ -2792,8 +2792,8 @@ void *address_space::find_backing_memory(offs_t addrstart, offs_t addrend) offs_t maskend = byteend & entry.m_bytemask; if (entry.m_memory != nullptr && maskstart >= entry.m_bytestart && maskend <= entry.m_byteend) { - VPRINTF(("found in entry %08X-%08X [%p]\n", entry.m_addrstart, entry.m_addrend, (uint8_t *)entry.m_memory + (maskstart - entry.m_bytestart))); - return (uint8_t *)entry.m_memory + (maskstart - entry.m_bytestart); + VPRINTF(("found in entry %08X-%08X [%p]\n", entry.m_addrstart, entry.m_addrend, (u8 *)entry.m_memory + (maskstart - entry.m_bytestart))); + return (u8 *)entry.m_memory + (maskstart - entry.m_bytestart); } } @@ -2970,7 +2970,7 @@ address_table::~address_table() // map //------------------------------------------------- -void address_table::map_range(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, uint16_t entry) +void address_table::map_range(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, u16 entry) { // convert addresses to bytes offs_t bytestart = addrstart; @@ -2998,12 +2998,12 @@ void address_table::map_range(offs_t addrstart, offs_t addrend, offs_t addrmask, // verify_reference_counts(); } -uint16_t address_table::get_free_handler() +u16 address_table::get_free_handler() { if (handler_free == STATIC_INVALID) throw emu_fatalerror("Out of handler entries in address table"); - uint16_t handler = handler_free; + u16 handler = handler_free; handler_free = handler_next_free[handler - STATIC_COUNT]; return handler; } @@ -3015,10 +3015,10 @@ uint16_t address_table::get_free_handler() // it //------------------------------------------------- -void address_table::setup_range(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, uint64_t mask, std::list &entries) +void address_table::setup_range(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, u64 mask, std::list &entries) { // Careful, you can't shift by 64 or more - uint64_t testmask = (1ULL << (m_space.data_width()-1) << 1) - 1; + u64 testmask = (1ULL << (m_space.data_width()-1) << 1) - 1; if((mask & testmask) == 0 || (mask & testmask) == testmask) setup_range_solid(addrstart, addrend, addrmask, addrmirror, entries); @@ -3032,10 +3032,10 @@ void address_table::setup_range(offs_t addrstart, offs_t addrend, offs_t addrmas // it. Replace what's there. //------------------------------------------------- -void address_table::setup_range_solid(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, std::list &entries) +void address_table::setup_range_solid(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, std::list &entries) { // Grab a free entry - uint16_t entry = get_free_handler(); + u16 entry = get_free_handler(); // Add it in the "to be setup" list entries.push_back(entry); @@ -3057,7 +3057,7 @@ namespace { }; } -void address_table::setup_range_masked(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, uint64_t mask, std::list &entries) +void address_table::setup_range_masked(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, u64 mask, std::list &entries) { // convert addresses to bytes offs_t bytestart = addrstart; @@ -3073,7 +3073,7 @@ void address_table::setup_range_masked(offs_t addrstart, offs_t addrend, offs_t // Scan the memory to see what has to be done std::list range_override; - std::map > range_partial; + std::map > range_partial; offs_t base_mirror = 0; do @@ -3084,8 +3084,8 @@ void address_table::setup_range_masked(offs_t addrstart, offs_t addrend, offs_t do { offs_t range_start, range_end; - uint16_t entry = derive_range(base_address, range_start, range_end); - uint32_t stop_address = range_end > end_address ? end_address : range_end; + u16 entry = derive_range(base_address, range_start, range_end); + u32 stop_address = range_end > end_address ? end_address : range_end; if (entry < STATIC_COUNT || handler(entry).overriden_by_mask(mask)) range_override.push_back(subrange(base_address, stop_address)); @@ -3105,7 +3105,7 @@ void address_table::setup_range_masked(offs_t addrstart, offs_t addrend, offs_t if (!range_override.empty()) { // Grab a free entry - uint16_t entry = get_free_handler(); + u16 entry = get_free_handler(); // configure the entry to our parameters handler_entry &curentry = handler(entry); @@ -3125,7 +3125,7 @@ void address_table::setup_range_masked(offs_t addrstart, offs_t addrend, offs_t // Ranges in range_partial must be duplicated then partially changed if (!range_partial.empty()) { - for (std::map >::const_iterator i = range_partial.begin(); i != range_partial.end(); ++i) + for (std::map >::const_iterator i = range_partial.begin(); i != range_partial.end(); ++i) { // Theorically, if the handler to change matches the // characteristics of ours, we can directly change it. In @@ -3141,7 +3141,7 @@ void address_table::setup_range_masked(offs_t addrstart, offs_t addrend, offs_t offs_t previous_bytemask = base_entry->bytemask(); // Grab a new handler and copy it there - uint16_t entry = get_free_handler(); + u16 entry = get_free_handler(); handler_entry &curentry = handler(entry); curentry.copy(base_entry); @@ -3184,7 +3184,7 @@ void address_table::verify_reference_counts() for (int level1 = 0; level1 != 1 << LEVEL1_BITS; level1++) { - uint16_t l1_entry = m_table[level1]; + u16 l1_entry = m_table[level1]; if (l1_entry >= SUBTABLE_BASE) { assert(m_large); @@ -3192,10 +3192,10 @@ void address_table::verify_reference_counts() continue; subtable_seen[l1_entry - SUBTABLE_BASE] = true; - const uint16_t *subtable = subtable_ptr(l1_entry); + const u16 *subtable = subtable_ptr(l1_entry); for (int level2 = 0; level2 != 1 << LEVEL2_BITS; level2++) { - uint16_t l2_entry = subtable[level2]; + u16 l2_entry = subtable[level2]; assert(l2_entry < SUBTABLE_BASE); if (l2_entry >= STATIC_COUNT) actual_refcounts[l2_entry - STATIC_COUNT]++; @@ -3220,7 +3220,7 @@ void address_table::verify_reference_counts() // range of addresses //------------------------------------------------- -void address_table::populate_range(offs_t bytestart, offs_t byteend, uint16_t handlerindex) +void address_table::populate_range(offs_t bytestart, offs_t byteend, u16 handlerindex) { offs_t l2mask = (1 << level2_bits()) - 1; offs_t l1start = bytestart >> level2_bits(); @@ -3235,7 +3235,7 @@ void address_table::populate_range(offs_t bytestart, offs_t byteend, uint16_t ha // handle the starting edge if it's not on a block boundary if (l2start != 0) { - uint16_t *subtable = subtable_open(l1start); + u16 *subtable = subtable_open(l1start); // if the start and stop end within the same block, handle that if (l1start == l1stop) @@ -3265,7 +3265,7 @@ void address_table::populate_range(offs_t bytestart, offs_t byteend, uint16_t ha // handle the trailing edge if it's not on a block boundary if (l2stop != l2mask) { - uint16_t *subtable = subtable_open(l1stop); + u16 *subtable = subtable_open(l1stop); // fill from the beginning handler_ref(handlerindex, l2stop+1); @@ -3287,7 +3287,7 @@ void address_table::populate_range(offs_t bytestart, offs_t byteend, uint16_t ha handler_ref(handlerindex, l1stop - l1start + 1); for (offs_t l1index = l1start; l1index <= l1stop; l1index++) { - uint16_t subindex = m_table[l1index]; + u16 subindex = m_table[l1index]; // if we have a subtable here, release it if (subindex >= SUBTABLE_BASE) @@ -3305,7 +3305,7 @@ void address_table::populate_range(offs_t bytestart, offs_t byteend, uint16_t ha // mirrors //------------------------------------------------- -void address_table::populate_range_mirrored(offs_t bytestart, offs_t byteend, offs_t bytemirror, uint16_t handlerindex) +void address_table::populate_range_mirrored(offs_t bytestart, offs_t byteend, offs_t bytemirror, u16 handlerindex) { // determine the mirror bits offs_t lmirrorbits = 0; @@ -3321,7 +3321,7 @@ void address_table::populate_range_mirrored(offs_t bytestart, offs_t byteend, of hmirrorbit[hmirrorbits++] = 1 << bit; // loop over mirrors in the level 2 table - uint16_t prev_entry = STATIC_INVALID; + u16 prev_entry = STATIC_INVALID; int prev_index = 0; for (offs_t hmirrorcount = 0; hmirrorcount < (1 << hmirrorbits); hmirrorcount++) { @@ -3394,11 +3394,11 @@ void address_table::populate_range_mirrored(offs_t bytestart, offs_t byteend, of // range based on the lookup tables //------------------------------------------------- -uint16_t address_table::derive_range(offs_t byteaddress, offs_t &bytestart, offs_t &byteend) const +u16 address_table::derive_range(offs_t byteaddress, offs_t &bytestart, offs_t &byteend) const { // look up the initial address to get the entry we care about - uint16_t l1entry; - uint16_t entry = l1entry = m_table[level1_index(byteaddress)]; + u16 l1entry; + u16 entry = l1entry = m_table[level1_index(byteaddress)]; if (l1entry >= SUBTABLE_BASE) entry = m_table[level2_index(l1entry, byteaddress)]; @@ -3407,16 +3407,16 @@ uint16_t address_table::derive_range(offs_t byteaddress, offs_t &bytestart, offs handler(entry).mirrored_start_end(byteaddress, minscan, maxscan); // first scan backwards to find the start address - uint16_t curl1entry = l1entry; - uint16_t curentry = entry; + u16 curl1entry = l1entry; + u16 curentry = entry; bytestart = byteaddress; while (1) { // if we need to scan the subtable, do it if (curentry != curl1entry) { - uint32_t minindex = level2_index(curl1entry, 0); - uint32_t index; + u32 minindex = level2_index(curl1entry, 0); + u32 index; // scan backwards from the current address, until the previous entry doesn't match for (index = level2_index(curl1entry, bytestart); index > minindex; index--, bytestart -= 1) @@ -3453,8 +3453,8 @@ uint16_t address_table::derive_range(offs_t byteaddress, offs_t &bytestart, offs // if we need to scan the subtable, do it if (curentry != curl1entry) { - uint32_t maxindex = level2_index(curl1entry, ~0); - uint32_t index; + u32 maxindex = level2_index(curl1entry, ~0); + u32 index; // scan forwards from the current address, until the next entry doesn't match for (index = level2_index(curl1entry, byteend); index < maxindex; index++, byteend += 1) @@ -3509,20 +3509,20 @@ void address_table::mask_all_handlers(offs_t mask) // and set its usecount to 1 //------------------------------------------------- -uint16_t address_table::subtable_alloc() +u16 address_table::subtable_alloc() { // loop while (1) { // find a subtable with a usecount of 0 - for (uint16_t subindex = 0; subindex < SUBTABLE_COUNT; subindex++) + for (u16 subindex = 0; subindex < SUBTABLE_COUNT; subindex++) if (m_subtable[subindex].m_usecount == 0) { // if this is past our allocation budget, allocate some more if (subindex >= m_subtable_alloc) { m_subtable_alloc += SUBTABLE_ALLOC; - uint32_t newsize = (1 << LEVEL1_BITS) + (m_subtable_alloc << level2_bits()); + u32 newsize = (1 << LEVEL1_BITS) + (m_subtable_alloc << level2_bits()); bool was_live = (m_live_lookup == &m_table[0]); int oldsize = m_table.size(); @@ -3548,9 +3548,9 @@ uint16_t address_table::subtable_alloc() // a subtable //------------------------------------------------- -void address_table::subtable_realloc(uint16_t subentry) +void address_table::subtable_realloc(u16 subentry) { - uint16_t subindex = subentry - SUBTABLE_BASE; + u16 subindex = subentry - SUBTABLE_BASE; // sanity check if (m_subtable[subindex].m_usecount <= 0) @@ -3569,7 +3569,7 @@ void address_table::subtable_realloc(uint16_t subentry) int address_table::subtable_merge() { int merged = 0; - uint16_t subindex; + u16 subindex; VPRINTF(("Merging subtables....\n")); @@ -3577,8 +3577,8 @@ int address_table::subtable_merge() for (subindex = 0; subindex < SUBTABLE_COUNT; subindex++) if (!m_subtable[subindex].m_checksum_valid && m_subtable[subindex].m_usecount != 0) { - uint32_t *subtable = reinterpret_cast(subtable_ptr(subindex + SUBTABLE_BASE)); - uint32_t checksum = 0; + u32 *subtable = reinterpret_cast(subtable_ptr(subindex + SUBTABLE_BASE)); + u32 checksum = 0; // update the checksum for (int l2index = 0; l2index < (1 << level2_bits())/4; l2index++) @@ -3591,9 +3591,9 @@ int address_table::subtable_merge() for (subindex = 0; subindex < SUBTABLE_COUNT; subindex++) if (m_subtable[subindex].m_usecount != 0) { - uint16_t *subtable = subtable_ptr(subindex + SUBTABLE_BASE); - uint32_t checksum = m_subtable[subindex].m_checksum; - uint16_t sumindex; + u16 *subtable = subtable_ptr(subindex + SUBTABLE_BASE); + u32 checksum = m_subtable[subindex].m_checksum; + u16 sumindex; for (sumindex = subindex + 1; sumindex < SUBTABLE_COUNT; sumindex++) if (m_subtable[sumindex].m_usecount != 0 && @@ -3625,9 +3625,9 @@ int address_table::subtable_merge() // a subtable and free it if we're done //------------------------------------------------- -void address_table::subtable_release(uint16_t subentry) +void address_table::subtable_release(u16 subentry) { - uint16_t subindex = subentry - SUBTABLE_BASE; + u16 subindex = subentry - SUBTABLE_BASE; // sanity check if (m_subtable[subindex].m_usecount <= 0) fatalerror("Called subtable_release on a table with a usecount of 0\n"); @@ -3638,7 +3638,7 @@ void address_table::subtable_release(uint16_t subentry) if (m_subtable[subindex].m_usecount == 0) { m_subtable[subindex].m_checksum = 0; - uint16_t *subtable = subtable_ptr(subentry); + u16 *subtable = subtable_ptr(subentry); for (int i = 0; i < (1 << LEVEL2_BITS); i++) handler_unref(subtable[i]); } @@ -3650,21 +3650,21 @@ void address_table::subtable_release(uint16_t subentry) // modification //------------------------------------------------- -uint16_t *address_table::subtable_open(offs_t l1index) +u16 *address_table::subtable_open(offs_t l1index) { - uint16_t subentry = m_table[l1index]; + u16 subentry = m_table[l1index]; // if we don't have a subtable yet, allocate a new one if (subentry < SUBTABLE_BASE) { int size = 1 << level2_bits(); - uint16_t newentry = subtable_alloc(); + u16 newentry = subtable_alloc(); handler_ref(subentry, size-1); - uint16_t *subptr = subtable_ptr(newentry); + u16 *subptr = subtable_ptr(newentry); for (int i=0; i 1) { - uint16_t newentry = subtable_alloc(); + u16 newentry = subtable_alloc(); // allocate may cause some additional merging -- look up the subentry again // when we're done; it should still require a split @@ -3681,7 +3681,7 @@ uint16_t *address_table::subtable_open(offs_t l1index) assert(m_subtable[subentry - SUBTABLE_BASE].m_usecount > 1); int size = 1 << level2_bits(); - uint16_t *src = subtable_ptr(subentry); + u16 *src = subtable_ptr(subentry); for(int i=0; i != size; i++) handler_ref(src[i], 1); @@ -3715,7 +3715,7 @@ void address_table::subtable_close(offs_t l1index) // description of a handler //------------------------------------------------- -const char *address_table::handler_name(uint16_t entry) const +const char *address_table::handler_name(u16 entry) const { // banks have names if (entry >= STATIC_BANK1 && entry <= STATIC_BANKMAX) @@ -3747,7 +3747,7 @@ address_table_read::address_table_read(address_space &space, bool large) // allocate handlers for each entry, prepopulating the bankptrs for banks for (int entrynum = 0; entrynum < ARRAY_LENGTH(m_handlers); entrynum++) { - uint8_t **bankptr = (entrynum >= STATIC_BANK1 && entrynum <= STATIC_BANKMAX) ? space.manager().bank_pointer_addr(entrynum) : nullptr; + u8 **bankptr = (entrynum >= STATIC_BANK1 && entrynum <= STATIC_BANKMAX) ? space.manager().bank_pointer_addr(entrynum) : nullptr; m_handlers[entrynum] = std::make_unique(space.data_width(), space.endianness(), bankptr); } @@ -3756,30 +3756,30 @@ address_table_read::address_table_read(address_space &space, bool large) { // 8-bit case case 8: - m_handlers[STATIC_UNMAP]->set_delegate(read8_delegate(FUNC(address_table_read::unmap_r), this)); - m_handlers[STATIC_NOP]->set_delegate(read8_delegate(FUNC(address_table_read::nop_r), this)); - m_handlers[STATIC_WATCHPOINT]->set_delegate(read8_delegate(FUNC(address_table_read::watchpoint_r), this)); + m_handlers[STATIC_UNMAP]->set_delegate(read8_delegate(FUNC(address_table_read::unmap_r), this)); + m_handlers[STATIC_NOP]->set_delegate(read8_delegate(FUNC(address_table_read::nop_r), this)); + m_handlers[STATIC_WATCHPOINT]->set_delegate(read8_delegate(FUNC(address_table_read::watchpoint_r), this)); break; // 16-bit case case 16: - m_handlers[STATIC_UNMAP]->set_delegate(read16_delegate(FUNC(address_table_read::unmap_r), this)); - m_handlers[STATIC_NOP]->set_delegate(read16_delegate(FUNC(address_table_read::nop_r), this)); - m_handlers[STATIC_WATCHPOINT]->set_delegate(read16_delegate(FUNC(address_table_read::watchpoint_r), this)); + m_handlers[STATIC_UNMAP]->set_delegate(read16_delegate(FUNC(address_table_read::unmap_r), this)); + m_handlers[STATIC_NOP]->set_delegate(read16_delegate(FUNC(address_table_read::nop_r), this)); + m_handlers[STATIC_WATCHPOINT]->set_delegate(read16_delegate(FUNC(address_table_read::watchpoint_r), this)); break; // 32-bit case case 32: - m_handlers[STATIC_UNMAP]->set_delegate(read32_delegate(FUNC(address_table_read::unmap_r), this)); - m_handlers[STATIC_NOP]->set_delegate(read32_delegate(FUNC(address_table_read::nop_r), this)); - m_handlers[STATIC_WATCHPOINT]->set_delegate(read32_delegate(FUNC(address_table_read::watchpoint_r), this)); + m_handlers[STATIC_UNMAP]->set_delegate(read32_delegate(FUNC(address_table_read::unmap_r), this)); + m_handlers[STATIC_NOP]->set_delegate(read32_delegate(FUNC(address_table_read::nop_r), this)); + m_handlers[STATIC_WATCHPOINT]->set_delegate(read32_delegate(FUNC(address_table_read::watchpoint_r), this)); break; // 64-bit case case 64: - m_handlers[STATIC_UNMAP]->set_delegate(read64_delegate(FUNC(address_table_read::unmap_r), this)); - m_handlers[STATIC_NOP]->set_delegate(read64_delegate(FUNC(address_table_read::nop_r), this)); - m_handlers[STATIC_WATCHPOINT]->set_delegate(read64_delegate(FUNC(address_table_read::watchpoint_r), this)); + m_handlers[STATIC_UNMAP]->set_delegate(read64_delegate(FUNC(address_table_read::unmap_r), this)); + m_handlers[STATIC_NOP]->set_delegate(read64_delegate(FUNC(address_table_read::nop_r), this)); + m_handlers[STATIC_WATCHPOINT]->set_delegate(read64_delegate(FUNC(address_table_read::watchpoint_r), this)); break; } @@ -3804,7 +3804,7 @@ address_table_read::~address_table_read() // this index //------------------------------------------------- -handler_entry &address_table_read::handler(uint32_t index) const +handler_entry &address_table_read::handler(u32 index) const { assert(index < ARRAY_LENGTH(m_handlers)); return *m_handlers[index]; @@ -3821,7 +3821,7 @@ address_table_write::address_table_write(address_space &space, bool large) // allocate handlers for each entry, prepopulating the bankptrs for banks for (int entrynum = 0; entrynum < ARRAY_LENGTH(m_handlers); entrynum++) { - uint8_t **bankptr = (entrynum >= STATIC_BANK1 && entrynum <= STATIC_BANKMAX) ? space.manager().bank_pointer_addr(entrynum) : nullptr; + u8 **bankptr = (entrynum >= STATIC_BANK1 && entrynum <= STATIC_BANKMAX) ? space.manager().bank_pointer_addr(entrynum) : nullptr; m_handlers[entrynum] = std::make_unique(space.data_width(), space.endianness(), bankptr); } @@ -3830,30 +3830,30 @@ address_table_write::address_table_write(address_space &space, bool large) { // 8-bit case case 8: - m_handlers[STATIC_UNMAP]->set_delegate(write8_delegate(FUNC(address_table_write::unmap_w), this)); - m_handlers[STATIC_NOP]->set_delegate(write8_delegate(FUNC(address_table_write::nop_w), this)); - m_handlers[STATIC_WATCHPOINT]->set_delegate(write8_delegate(FUNC(address_table_write::watchpoint_w), this)); + m_handlers[STATIC_UNMAP]->set_delegate(write8_delegate(FUNC(address_table_write::unmap_w), this)); + m_handlers[STATIC_NOP]->set_delegate(write8_delegate(FUNC(address_table_write::nop_w), this)); + m_handlers[STATIC_WATCHPOINT]->set_delegate(write8_delegate(FUNC(address_table_write::watchpoint_w), this)); break; // 16-bit case case 16: - m_handlers[STATIC_UNMAP]->set_delegate(write16_delegate(FUNC(address_table_write::unmap_w), this)); - m_handlers[STATIC_NOP]->set_delegate(write16_delegate(FUNC(address_table_write::nop_w), this)); - m_handlers[STATIC_WATCHPOINT]->set_delegate(write16_delegate(FUNC(address_table_write::watchpoint_w), this)); + m_handlers[STATIC_UNMAP]->set_delegate(write16_delegate(FUNC(address_table_write::unmap_w), this)); + m_handlers[STATIC_NOP]->set_delegate(write16_delegate(FUNC(address_table_write::nop_w), this)); + m_handlers[STATIC_WATCHPOINT]->set_delegate(write16_delegate(FUNC(address_table_write::watchpoint_w), this)); break; // 32-bit case case 32: - m_handlers[STATIC_UNMAP]->set_delegate(write32_delegate(FUNC(address_table_write::unmap_w), this)); - m_handlers[STATIC_NOP]->set_delegate(write32_delegate(FUNC(address_table_write::nop_w), this)); - m_handlers[STATIC_WATCHPOINT]->set_delegate(write32_delegate(FUNC(address_table_write::watchpoint_w), this)); + m_handlers[STATIC_UNMAP]->set_delegate(write32_delegate(FUNC(address_table_write::unmap_w), this)); + m_handlers[STATIC_NOP]->set_delegate(write32_delegate(FUNC(address_table_write::nop_w), this)); + m_handlers[STATIC_WATCHPOINT]->set_delegate(write32_delegate(FUNC(address_table_write::watchpoint_w), this)); break; // 64-bit case case 64: - m_handlers[STATIC_UNMAP]->set_delegate(write64_delegate(FUNC(address_table_write::unmap_w), this)); - m_handlers[STATIC_NOP]->set_delegate(write64_delegate(FUNC(address_table_write::nop_w), this)); - m_handlers[STATIC_WATCHPOINT]->set_delegate(write64_delegate(FUNC(address_table_write::watchpoint_w), this)); + m_handlers[STATIC_UNMAP]->set_delegate(write64_delegate(FUNC(address_table_write::unmap_w), this)); + m_handlers[STATIC_NOP]->set_delegate(write64_delegate(FUNC(address_table_write::nop_w), this)); + m_handlers[STATIC_WATCHPOINT]->set_delegate(write64_delegate(FUNC(address_table_write::watchpoint_w), this)); break; } @@ -3878,7 +3878,7 @@ address_table_write::~address_table_write() // this index //------------------------------------------------- -handler_entry &address_table_write::handler(uint32_t index) const +handler_entry &address_table_write::handler(u32 index) const { assert(index < ARRAY_LENGTH(m_handlers)); return *m_handlers[index]; @@ -3944,7 +3944,7 @@ bool direct_read_data::set_direct_region(offs_t &byteaddress) return false; } - uint8_t *base = *m_space.manager().bank_pointer_addr(m_entry); + u8 *base = *m_space.manager().bank_pointer_addr(m_entry); // compute the adjusted base offs_t maskedbits = overrideaddress & ~m_space.bytemask(); @@ -3961,7 +3961,7 @@ bool direct_read_data::set_direct_region(offs_t &byteaddress) // find_range - find a byte address in a range //------------------------------------------------- -direct_read_data::direct_range *direct_read_data::find_range(offs_t byteaddress, uint16_t &entry) +direct_read_data::direct_range *direct_read_data::find_range(offs_t byteaddress, u16 &entry) { // determine which entry byteaddress &= m_space.m_bytemask; @@ -4028,7 +4028,7 @@ void direct_read_data::explicit_configure(offs_t bytestart, offs_t byteend, offs m_bytestart = bytestart; m_byteend = byteend; m_bytemask = bytemask; - m_ptr = reinterpret_cast(ptr) - (bytestart & bytemask); + m_ptr = reinterpret_cast(ptr) - (bytestart & bytemask); } @@ -4046,7 +4046,7 @@ memory_block::memory_block(address_space &space, offs_t bytestart, offs_t byteen m_space(space), m_bytestart(bytestart), m_byteend(byteend), - m_data(reinterpret_cast(memory)) + m_data(reinterpret_cast(memory)) { offs_t const length = byteend + 1 - bytestart; VPRINTF(("block_allocate('%s',%s,%08X,%08X,%p)\n", space.device().tag(), space.name(), bytestart, byteend, memory)); @@ -4064,7 +4064,7 @@ memory_block::memory_block(address_space &space, offs_t bytestart, offs_t byteen { m_allocated.resize(length + 0xfff); memset(&m_allocated[0], 0, length + 0xfff); - m_data = reinterpret_cast((reinterpret_cast(&m_allocated[0]) + 0xfff) & ~0xfff); + m_data = reinterpret_cast((reinterpret_cast(&m_allocated[0]) + 0xfff) & ~0xfff); } } @@ -4075,7 +4075,7 @@ memory_block::memory_block(address_space &space, offs_t bytestart, offs_t byteen { int bytes_per_element = space.data_width() / 8; std::string name = string_format("%08x-%08x", bytestart, byteend); - space.machine().save().save_memory(nullptr, "memory", space.device().tag(), space.spacenum(), name.c_str(), m_data, bytes_per_element, (uint32_t)length / bytes_per_element); + space.machine().save().save_memory(nullptr, "memory", space.device().tag(), space.spacenum(), name.c_str(), m_data, bytes_per_element, (u32)length / bytes_per_element); } } @@ -4186,7 +4186,7 @@ void memory_bank::set_base(void *base) throw emu_fatalerror("memory_bank::set_base called nullptr base"); // set the base and invalidate any referencing spaces - *m_baseptr = reinterpret_cast(base); + *m_baseptr = reinterpret_cast(base); invalidate_references(); } @@ -4243,7 +4243,7 @@ void memory_bank::configure_entry(int entrynum, void *base) expand_entries(entrynum); // set the entry - m_entry[entrynum].m_ptr = reinterpret_cast(base); + m_entry[entrynum].m_ptr = reinterpret_cast(base); // if the bank base is not configured, and we're the first entry, set us up if (*m_baseptr == nullptr && entrynum == 0) @@ -4259,7 +4259,7 @@ void memory_bank::configure_entries(int startentry, int numentries, void *base, { // fill in the requested bank entries (backwards to improve allocation) for (int entrynum = startentry + numentries - 1; entrynum >= startentry; entrynum--) - configure_entry(entrynum, reinterpret_cast(base) + (entrynum - startentry) * stride); + configure_entry(entrynum, reinterpret_cast(base) + (entrynum - startentry) * stride); } @@ -4271,7 +4271,7 @@ void memory_bank::configure_entries(int startentry, int numentries, void *base, // memory_region - constructor //------------------------------------------------- -memory_region::memory_region(running_machine &machine, const char *name, uint32_t length, uint8_t width, endianness_t endian) +memory_region::memory_region(running_machine &machine, const char *name, u32 length, u8 width, endianness_t endian) : m_machine(machine), m_name(name), m_buffer(length), @@ -4292,7 +4292,7 @@ memory_region::memory_region(running_machine &machine, const char *name, uint32_ // handler_entry - constructor //------------------------------------------------- -handler_entry::handler_entry(uint8_t width, endianness_t endianness, uint8_t **rambaseptr) +handler_entry::handler_entry(u8 width, endianness_t endianness, u8 **rambaseptr) : m_populated(false), m_datawidth(width), m_endianness(endianness), @@ -4347,7 +4347,7 @@ void handler_entry::copy(handler_entry *entry) //------------------------------------------------- void handler_entry::reconfigure_subunits(offs_t bytestart) { - int32_t delta = bytestart - m_bytestart; + s32 delta = bytestart - m_bytestart; for (int i=0; i != m_subunits; i++) m_subunit_infos[i].m_offset += delta / (m_subunit_infos[i].m_size / 8); } @@ -4359,9 +4359,9 @@ void handler_entry::reconfigure_subunits(offs_t bytestart) // mask //------------------------------------------------- -void handler_entry::configure_subunits(uint64_t handlermask, int handlerbits, int &start_slot, int &end_slot) +void handler_entry::configure_subunits(u64 handlermask, int handlerbits, int &start_slot, int &end_slot) { - uint64_t unitmask = ((uint64_t)1 << handlerbits) - 1; + u64 unitmask = ((u64)1 << handlerbits) - 1; assert(handlermask != 0); // compute the maximum possible subunits @@ -4375,8 +4375,8 @@ void handler_entry::configure_subunits(uint64_t handlermask, int handlerbits, in int count = 0; for (int unitnum = 0; unitnum < maxunits; unitnum++) { - uint32_t shift = unitnum * handlerbits; - uint32_t scanmask = handlermask >> shift; + u32 shift = unitnum * handlerbits; + u32 scanmask = handlermask >> shift; assert((scanmask & unitmask) == 0 || (scanmask & unitmask) == unitmask); if ((scanmask & unitmask) != 0) count++; @@ -4387,7 +4387,7 @@ void handler_entry::configure_subunits(uint64_t handlermask, int handlerbits, in start_slot = m_subunits; for (int unitnum = 0; unitnum < maxunits; unitnum++) { - uint32_t shift = (unitnum^shift_xor_mask) * handlerbits; + u32 shift = (unitnum^shift_xor_mask) * handlerbits; if (((handlermask >> shift) & unitmask) != 0) { m_subunit_infos[m_subunits].m_bytemask = m_bytemask; @@ -4405,7 +4405,7 @@ void handler_entry::configure_subunits(uint64_t handlermask, int handlerbits, in // compute the inverse mask m_invsubmask = 0; for (int i = 0; i < m_subunits; i++) - m_invsubmask |= uint64_t(m_subunit_infos[i].m_mask) << m_subunit_infos[i].m_shift; + m_invsubmask |= u64(m_subunit_infos[i].m_mask) << m_subunit_infos[i].m_shift; m_invsubmask = ~m_invsubmask; } @@ -4415,7 +4415,7 @@ void handler_entry::configure_subunits(uint64_t handlermask, int handlerbits, in // conflicting with the provided mask //------------------------------------------------- -void handler_entry::clear_conflicting_subunits(uint64_t handlermask) +void handler_entry::clear_conflicting_subunits(u64 handlermask) { // A mask of 0 is in fact an alternative way of saying ~0 if (!handlermask) @@ -4436,7 +4436,7 @@ void handler_entry::clear_conflicting_subunits(uint64_t handlermask) // compute the inverse mask m_invsubmask = 0; for (int i = 0; i < m_subunits; i++) - m_invsubmask |= uint64_t(m_subunit_infos[i].m_mask) << m_subunit_infos[i].m_shift; + m_invsubmask |= u64(m_subunit_infos[i].m_mask) << m_subunit_infos[i].m_shift; m_invsubmask = ~m_invsubmask; } @@ -4447,7 +4447,7 @@ void handler_entry::clear_conflicting_subunits(uint64_t handlermask) // that's currently present //------------------------------------------------- -bool handler_entry::overriden_by_mask(uint64_t handlermask) +bool handler_entry::overriden_by_mask(u64 handlermask) { // A mask of 0 is in fact an alternative way of saying ~0 if (!handlermask) @@ -4580,7 +4580,7 @@ void handler_entry_read::remove_subunit(int entry) // configure a stub if necessary //------------------------------------------------- -void handler_entry_read::set_delegate(read8_delegate delegate, uint64_t mask) +void handler_entry_read::set_delegate(read8_delegate delegate, u64 mask) { // error if no object if (!delegate.has_object()) @@ -4617,7 +4617,7 @@ void handler_entry_read::set_delegate(read8_delegate delegate, uint64_t mask) // configure a stub if necessary //------------------------------------------------- -void handler_entry_read::set_delegate(read16_delegate delegate, uint64_t mask) +void handler_entry_read::set_delegate(read16_delegate delegate, u64 mask) { // error if no object if (!delegate.has_object()) @@ -4652,7 +4652,7 @@ void handler_entry_read::set_delegate(read16_delegate delegate, uint64_t mask) // configure a stub if necessary //------------------------------------------------- -void handler_entry_read::set_delegate(read32_delegate delegate, uint64_t mask) +void handler_entry_read::set_delegate(read32_delegate delegate, u64 mask) { // error if no object if (!delegate.has_object()) @@ -4684,7 +4684,7 @@ void handler_entry_read::set_delegate(read32_delegate delegate, uint64_t mask) // set_delegate - set a 64-bit delegate //------------------------------------------------- -void handler_entry_read::set_delegate(read64_delegate delegate, uint64_t mask) +void handler_entry_read::set_delegate(read64_delegate delegate, u64 mask) { // error if no object if (!delegate.has_object()) @@ -4705,13 +4705,13 @@ void handler_entry_read::set_ioport(ioport_port &ioport) { m_ioport = &ioport; if (m_datawidth == 8) - set_delegate(read8_delegate(&handler_entry_read::read_stub_ioport, ioport.tag(), this)); + set_delegate(read8_delegate(&handler_entry_read::read_stub_ioport, ioport.tag(), this)); else if (m_datawidth == 16) - set_delegate(read16_delegate(&handler_entry_read::read_stub_ioport, ioport.tag(), this)); + set_delegate(read16_delegate(&handler_entry_read::read_stub_ioport, ioport.tag(), this)); else if (m_datawidth == 32) - set_delegate(read32_delegate(&handler_entry_read::read_stub_ioport, ioport.tag(), this)); + set_delegate(read32_delegate(&handler_entry_read::read_stub_ioport, ioport.tag(), this)); else if (m_datawidth == 64) - set_delegate(read64_delegate(&handler_entry_read::read_stub_ioport, ioport.tag(), this)); + set_delegate(read64_delegate(&handler_entry_read::read_stub_ioport, ioport.tag(), this)); } @@ -4720,17 +4720,17 @@ void handler_entry_read::set_ioport(ioport_port &ioport) // 8-bit sources //------------------------------------------------- -uint16_t handler_entry_read::read_stub_16(address_space &space, offs_t offset, uint16_t mask) +u16 handler_entry_read::read_stub_16(address_space &space, offs_t offset, u16 mask) { - uint16_t result = space.unmap() & m_invsubmask; + u16 result = space.unmap() & m_invsubmask; for (int index = 0; index < m_subunits; index++) { const subunit_info &si = m_subunit_infos[index]; - uint32_t submask = (mask >> si.m_shift) & si.m_mask; + u32 submask = (mask >> si.m_shift) & si.m_mask; if (submask) { offs_t aoffset = offset * si.m_multiplier + si.m_offset; - uint8_t val; + u8 val; val = m_subread[index].r8(space, aoffset & si.m_bytemask, submask); result |= val << si.m_shift; } @@ -4744,17 +4744,17 @@ uint16_t handler_entry_read::read_stub_16(address_space &space, offs_t offset, u // 8-bit and 16-bit sources //------------------------------------------------- -uint32_t handler_entry_read::read_stub_32(address_space &space, offs_t offset, uint32_t mask) +u32 handler_entry_read::read_stub_32(address_space &space, offs_t offset, u32 mask) { - uint32_t result = space.unmap() & m_invsubmask; + u32 result = space.unmap() & m_invsubmask; for (int index = 0; index < m_subunits; index++) { const subunit_info &si = m_subunit_infos[index]; - uint32_t submask = (mask >> si.m_shift) & si.m_mask; + u32 submask = (mask >> si.m_shift) & si.m_mask; if (submask) { offs_t aoffset = offset * si.m_multiplier + si.m_offset; - uint16_t val = 0; + u16 val = 0; switch (si.m_size) { case 8: @@ -4776,17 +4776,17 @@ uint32_t handler_entry_read::read_stub_32(address_space &space, offs_t offset, u // 8-bit, 16-bit and 32-bit sources //------------------------------------------------- -uint64_t handler_entry_read::read_stub_64(address_space &space, offs_t offset, uint64_t mask) +u64 handler_entry_read::read_stub_64(address_space &space, offs_t offset, u64 mask) { - uint64_t result = space.unmap() & m_invsubmask; + u64 result = space.unmap() & m_invsubmask; for (int index = 0; index < m_subunits; index++) { const subunit_info &si = m_subunit_infos[index]; - uint32_t submask = (mask >> si.m_shift) & si.m_mask; + u32 submask = (mask >> si.m_shift) & si.m_mask; if (submask) { offs_t aoffset = offset * si.m_multiplier + si.m_offset; - uint32_t val = 0; + u32 val = 0; switch (si.m_size) { case 8: @@ -4799,7 +4799,7 @@ uint64_t handler_entry_read::read_stub_64(address_space &space, offs_t offset, u val = m_subread[index].r32(space, aoffset & si.m_bytemask, submask); break; } - result |= uint64_t(val) << si.m_shift; + result |= u64(val) << si.m_shift; } } return result; @@ -4894,7 +4894,7 @@ void handler_entry_write::remove_subunit(int entry) // configure a stub if necessary //------------------------------------------------- -void handler_entry_write::set_delegate(write8_delegate delegate, uint64_t mask) +void handler_entry_write::set_delegate(write8_delegate delegate, u64 mask) { assert(m_datawidth >= 8); @@ -4926,7 +4926,7 @@ void handler_entry_write::set_delegate(write8_delegate delegate, uint64_t mask) // configure a stub if necessary //------------------------------------------------- -void handler_entry_write::set_delegate(write16_delegate delegate, uint64_t mask) +void handler_entry_write::set_delegate(write16_delegate delegate, u64 mask) { assert(m_datawidth >= 16); @@ -4956,7 +4956,7 @@ void handler_entry_write::set_delegate(write16_delegate delegate, uint64_t mask) // configure a stub if necessary //------------------------------------------------- -void handler_entry_write::set_delegate(write32_delegate delegate, uint64_t mask) +void handler_entry_write::set_delegate(write32_delegate delegate, u64 mask) { assert(m_datawidth >= 32); @@ -4983,7 +4983,7 @@ void handler_entry_write::set_delegate(write32_delegate delegate, uint64_t mask) // set_delegate - set a 64-bit delegate //------------------------------------------------- -void handler_entry_write::set_delegate(write64_delegate delegate, uint64_t mask) +void handler_entry_write::set_delegate(write64_delegate delegate, u64 mask) { assert(m_datawidth >= 64); m_write.w64 = delegate; @@ -4999,13 +4999,13 @@ void handler_entry_write::set_ioport(ioport_port &ioport) { m_ioport = &ioport; if (m_datawidth == 8) - set_delegate(write8_delegate(&handler_entry_write::write_stub_ioport, ioport.tag(), this)); + set_delegate(write8_delegate(&handler_entry_write::write_stub_ioport, ioport.tag(), this)); else if (m_datawidth == 16) - set_delegate(write16_delegate(&handler_entry_write::write_stub_ioport, ioport.tag(), this)); + set_delegate(write16_delegate(&handler_entry_write::write_stub_ioport, ioport.tag(), this)); else if (m_datawidth == 32) - set_delegate(write32_delegate(&handler_entry_write::write_stub_ioport, ioport.tag(), this)); + set_delegate(write32_delegate(&handler_entry_write::write_stub_ioport, ioport.tag(), this)); else if (m_datawidth == 64) - set_delegate(write64_delegate(&handler_entry_write::write_stub_ioport, ioport.tag(), this)); + set_delegate(write64_delegate(&handler_entry_write::write_stub_ioport, ioport.tag(), this)); } @@ -5014,16 +5014,16 @@ void handler_entry_write::set_ioport(ioport_port &ioport) // 8-bit sources //------------------------------------------------- -void handler_entry_write::write_stub_16(address_space &space, offs_t offset, uint16_t data, uint16_t mask) +void handler_entry_write::write_stub_16(address_space &space, offs_t offset, u16 data, u16 mask) { for (int index = 0; index < m_subunits; index++) { const subunit_info &si = m_subunit_infos[index]; - uint32_t submask = (mask >> si.m_shift) & si.m_mask; + u32 submask = (mask >> si.m_shift) & si.m_mask; if (submask) { offs_t aoffset = offset * si.m_multiplier + si.m_offset; - uint8_t adata = data >> si.m_shift; + u8 adata = data >> si.m_shift; m_subwrite[index].w8(space, aoffset & si.m_bytemask, adata, submask); } } @@ -5035,16 +5035,16 @@ void handler_entry_write::write_stub_16(address_space &space, offs_t offset, uin // 8-bit and 16-bit sources //------------------------------------------------- -void handler_entry_write::write_stub_32(address_space &space, offs_t offset, uint32_t data, uint32_t mask) +void handler_entry_write::write_stub_32(address_space &space, offs_t offset, u32 data, u32 mask) { for (int index = 0; index < m_subunits; index++) { const subunit_info &si = m_subunit_infos[index]; - uint32_t submask = (mask >> si.m_shift) & si.m_mask; + u32 submask = (mask >> si.m_shift) & si.m_mask; if (submask) { offs_t aoffset = offset * si.m_multiplier + si.m_offset; - uint16_t adata = data >> si.m_shift; + u16 adata = data >> si.m_shift; switch (si.m_size) { case 8: @@ -5064,16 +5064,16 @@ void handler_entry_write::write_stub_32(address_space &space, offs_t offset, uin // 8-bit, 16-bit and 32-bit sources //------------------------------------------------- -void handler_entry_write::write_stub_64(address_space &space, offs_t offset, uint64_t data, uint64_t mask) +void handler_entry_write::write_stub_64(address_space &space, offs_t offset, u64 data, u64 mask) { for (int index = 0; index < m_subunits; index++) { const subunit_info &si = m_subunit_infos[index]; - uint32_t submask = (mask >> si.m_shift) & si.m_mask; + u32 submask = (mask >> si.m_shift) & si.m_mask; if (submask) { offs_t aoffset = offset * si.m_multiplier + si.m_offset; - uint32_t adata = data >> si.m_shift; + u32 adata = data >> si.m_shift; switch (si.m_size) { case 8: diff --git a/src/emu/emumem.h b/src/emu/emumem.h index ccdc6c28335..6112bbdd5f5 100644 --- a/src/emu/emumem.h +++ b/src/emu/emumem.h @@ -14,8 +14,8 @@ #error Dont include this file directly; include emu.h instead. #endif -#ifndef __EMUMEM_H__ -#define __EMUMEM_H__ +#ifndef MAME_EMU_EMUMEM_H +#define MAME_EMU_EMUMEM_H @@ -77,7 +77,7 @@ class address_table_setoffset; // offsets and addresses are 32-bit (for now...) -typedef uint32_t offs_t; +typedef u32 offs_t; // address map constructors are functions that build up an address_map typedef void (*address_map_constructor)(address_map &map); @@ -88,21 +88,21 @@ typedef named_delegate address_map_delegate; // struct with function pointers for accessors; use is generally discouraged unless necessary struct data_accessors { - uint8_t (*read_byte)(address_space &space, offs_t byteaddress); - uint16_t (*read_word)(address_space &space, offs_t byteaddress); - uint16_t (*read_word_masked)(address_space &space, offs_t byteaddress, uint16_t mask); - uint32_t (*read_dword)(address_space &space, offs_t byteaddress); - uint32_t (*read_dword_masked)(address_space &space, offs_t byteaddress, uint32_t mask); - uint64_t (*read_qword)(address_space &space, offs_t byteaddress); - uint64_t (*read_qword_masked)(address_space &space, offs_t byteaddress, uint64_t mask); + u8 (*read_byte)(address_space &space, offs_t byteaddress); + u16 (*read_word)(address_space &space, offs_t byteaddress); + u16 (*read_word_masked)(address_space &space, offs_t byteaddress, u16 mask); + u32 (*read_dword)(address_space &space, offs_t byteaddress); + u32 (*read_dword_masked)(address_space &space, offs_t byteaddress, u32 mask); + u64 (*read_qword)(address_space &space, offs_t byteaddress); + u64 (*read_qword_masked)(address_space &space, offs_t byteaddress, u64 mask); - void (*write_byte)(address_space &space, offs_t byteaddress, uint8_t data); - void (*write_word)(address_space &space, offs_t byteaddress, uint16_t data); - void (*write_word_masked)(address_space &space, offs_t byteaddress, uint16_t data, uint16_t mask); - void (*write_dword)(address_space &space, offs_t byteaddress, uint32_t data); - void (*write_dword_masked)(address_space &space, offs_t byteaddress, uint32_t data, uint32_t mask); - void (*write_qword)(address_space &space, offs_t byteaddress, uint64_t data); - void (*write_qword_masked)(address_space &space, offs_t byteaddress, uint64_t data, uint64_t mask); + void (*write_byte)(address_space &space, offs_t byteaddress, u8 data); + void (*write_word)(address_space &space, offs_t byteaddress, u16 data); + void (*write_word_masked)(address_space &space, offs_t byteaddress, u16 data, u16 mask); + void (*write_dword)(address_space &space, offs_t byteaddress, u32 data); + void (*write_dword_masked)(address_space &space, offs_t byteaddress, u32 data, u32 mask); + void (*write_qword)(address_space &space, offs_t byteaddress, u64 data); + void (*write_qword_masked)(address_space &space, offs_t byteaddress, u64 data, u64 mask); }; @@ -115,19 +115,19 @@ typedef delegate direct_update_delegate; // ======================> read_delegate // declare delegates for each width -typedef device_delegate read8_delegate; -typedef device_delegate read16_delegate; -typedef device_delegate read32_delegate; -typedef device_delegate read64_delegate; +typedef device_delegate read8_delegate; +typedef device_delegate read16_delegate; +typedef device_delegate read32_delegate; +typedef device_delegate read64_delegate; // ======================> write_delegate // declare delegates for each width -typedef device_delegate write8_delegate; -typedef device_delegate write16_delegate; -typedef device_delegate write32_delegate; -typedef device_delegate write64_delegate; +typedef device_delegate write8_delegate; +typedef device_delegate write16_delegate; +typedef device_delegate write32_delegate; +typedef device_delegate write64_delegate; // ======================> setoffset_delegate @@ -165,14 +165,14 @@ public: // getters address_space &space() const { return m_space; } - uint8_t *ptr() const { return m_ptr; } + u8 *ptr() const { return m_ptr; } // see if an address is within bounds, or attempt to update it if not bool address_is_valid(offs_t byteaddress) { return EXPECTED(byteaddress >= m_bytestart && byteaddress <= m_byteend) || set_direct_region(byteaddress); } // force a recomputation on the next read void force_update() { m_byteend = 0; m_bytestart = 1; } - void force_update(uint16_t if_match) { if (m_entry == if_match) force_update(); } + void force_update(u16 if_match) { if (m_entry == if_match) force_update(); } // custom update callbacks and configuration direct_update_delegate set_direct_update(direct_update_delegate function); @@ -180,24 +180,24 @@ public: // accessor methods void *read_ptr(offs_t byteaddress, offs_t directxor = 0); - uint8_t read_byte(offs_t byteaddress, offs_t directxor = 0); - uint16_t read_word(offs_t byteaddress, offs_t directxor = 0); - uint32_t read_dword(offs_t byteaddress, offs_t directxor = 0); - uint64_t read_qword(offs_t byteaddress, offs_t directxor = 0); + u8 read_byte(offs_t byteaddress, offs_t directxor = 0); + u16 read_word(offs_t byteaddress, offs_t directxor = 0); + u32 read_dword(offs_t byteaddress, offs_t directxor = 0); + u64 read_qword(offs_t byteaddress, offs_t directxor = 0); private: // internal helpers bool set_direct_region(offs_t &byteaddress); - direct_range *find_range(offs_t byteaddress, uint16_t &entry); + direct_range *find_range(offs_t byteaddress, u16 &entry); void remove_intersecting_ranges(offs_t bytestart, offs_t byteend); // internal state address_space & m_space; - uint8_t * m_ptr; // direct access data pointer + u8 * m_ptr; // direct access data pointer offs_t m_bytemask; // byte address mask offs_t m_bytestart; // minimum valid byte address offs_t m_byteend; // maximum valid byte address - uint16_t m_entry; // live entry + u16 m_entry; // live entry std::list m_rangelist[TOTAL_MEMORY_BANKS]; // list of ranges for each entry direct_update_delegate m_directupdate; // fast direct-access update callback }; @@ -211,10 +211,10 @@ class address_space_config public: // construction/destruction address_space_config(); - address_space_config(const char *name, endianness_t endian, uint8_t datawidth, uint8_t addrwidth, int8_t addrshift = 0, address_map_constructor internal = nullptr, address_map_constructor defmap = nullptr); - address_space_config(const char *name, endianness_t endian, uint8_t datawidth, uint8_t addrwidth, int8_t addrshift, uint8_t logwidth, uint8_t pageshift, address_map_constructor internal = nullptr, address_map_constructor defmap = nullptr); - address_space_config(const char *name, endianness_t endian, uint8_t datawidth, uint8_t addrwidth, int8_t addrshift, address_map_delegate internal, address_map_delegate defmap = address_map_delegate()); - address_space_config(const char *name, endianness_t endian, uint8_t datawidth, uint8_t addrwidth, int8_t addrshift, uint8_t logwidth, uint8_t pageshift, address_map_delegate internal, address_map_delegate defmap = address_map_delegate()); + address_space_config(const char *name, endianness_t endian, u8 datawidth, u8 addrwidth, s8 addrshift = 0, address_map_constructor internal = nullptr, address_map_constructor defmap = nullptr); + address_space_config(const char *name, endianness_t endian, u8 datawidth, u8 addrwidth, s8 addrshift, u8 logwidth, u8 pageshift, address_map_constructor internal = nullptr, address_map_constructor defmap = nullptr); + address_space_config(const char *name, endianness_t endian, u8 datawidth, u8 addrwidth, s8 addrshift, address_map_delegate internal, address_map_delegate defmap = address_map_delegate()); + address_space_config(const char *name, endianness_t endian, u8 datawidth, u8 addrwidth, s8 addrshift, u8 logwidth, u8 pageshift, address_map_delegate internal, address_map_delegate defmap = address_map_delegate()); // getters const char *name() const { return m_name; } @@ -231,11 +231,11 @@ public: // state const char * m_name; endianness_t m_endianness; - uint8_t m_databus_width; - uint8_t m_addrbus_width; - int8_t m_addrbus_shift; - uint8_t m_logaddr_width; - uint8_t m_page_shift; + u8 m_databus_width; + u8 m_addrbus_width; + s8 m_addrbus_shift; + u8 m_logaddr_width; + u8 m_page_shift; bool m_is_octal; // to determine if messages/debugger will show octal or hex address_map_constructor m_internal_map; @@ -278,15 +278,15 @@ public: int data_width() const { return m_config.data_width(); } int addr_width() const { return m_config.addr_width(); } endianness_t endianness() const { return m_config.endianness(); } - uint64_t unmap() const { return m_unmap; } + u64 unmap() const { return m_unmap; } bool is_octal() const { return m_config.m_is_octal; } offs_t addrmask() const { return m_addrmask; } offs_t bytemask() const { return m_bytemask; } - uint8_t addrchars() const { return m_addrchars; } + u8 addrchars() const { return m_addrchars; } offs_t logaddrmask() const { return m_logaddrmask; } offs_t logbytemask() const { return m_logbytemask; } - uint8_t logaddrchars() const { return m_logaddrchars; } + u8 logaddrchars() const { return m_logaddrchars; } // debug helpers const char *get_handler_string(read_or_write readorwrite, offs_t byteaddress); @@ -306,34 +306,34 @@ public: virtual void *get_write_ptr(offs_t byteaddress) = 0; // read accessors - virtual uint8_t read_byte(offs_t byteaddress) = 0; - virtual uint16_t read_word(offs_t byteaddress) = 0; - virtual uint16_t read_word(offs_t byteaddress, uint16_t mask) = 0; - virtual uint16_t read_word_unaligned(offs_t byteaddress) = 0; - virtual uint16_t read_word_unaligned(offs_t byteaddress, uint16_t mask) = 0; - virtual uint32_t read_dword(offs_t byteaddress) = 0; - virtual uint32_t read_dword(offs_t byteaddress, uint32_t mask) = 0; - virtual uint32_t read_dword_unaligned(offs_t byteaddress) = 0; - virtual uint32_t read_dword_unaligned(offs_t byteaddress, uint32_t mask) = 0; - virtual uint64_t read_qword(offs_t byteaddress) = 0; - virtual uint64_t read_qword(offs_t byteaddress, uint64_t mask) = 0; - virtual uint64_t read_qword_unaligned(offs_t byteaddress) = 0; - virtual uint64_t read_qword_unaligned(offs_t byteaddress, uint64_t mask) = 0; + virtual u8 read_byte(offs_t byteaddress) = 0; + virtual u16 read_word(offs_t byteaddress) = 0; + virtual u16 read_word(offs_t byteaddress, u16 mask) = 0; + virtual u16 read_word_unaligned(offs_t byteaddress) = 0; + virtual u16 read_word_unaligned(offs_t byteaddress, u16 mask) = 0; + virtual u32 read_dword(offs_t byteaddress) = 0; + virtual u32 read_dword(offs_t byteaddress, u32 mask) = 0; + virtual u32 read_dword_unaligned(offs_t byteaddress) = 0; + virtual u32 read_dword_unaligned(offs_t byteaddress, u32 mask) = 0; + virtual u64 read_qword(offs_t byteaddress) = 0; + virtual u64 read_qword(offs_t byteaddress, u64 mask) = 0; + virtual u64 read_qword_unaligned(offs_t byteaddress) = 0; + virtual u64 read_qword_unaligned(offs_t byteaddress, u64 mask) = 0; // write accessors - virtual void write_byte(offs_t byteaddress, uint8_t data) = 0; - virtual void write_word(offs_t byteaddress, uint16_t data) = 0; - virtual void write_word(offs_t byteaddress, uint16_t data, uint16_t mask) = 0; - virtual void write_word_unaligned(offs_t byteaddress, uint16_t data) = 0; - virtual void write_word_unaligned(offs_t byteaddress, uint16_t data, uint16_t mask) = 0; - virtual void write_dword(offs_t byteaddress, uint32_t data) = 0; - virtual void write_dword(offs_t byteaddress, uint32_t data, uint32_t mask) = 0; - virtual void write_dword_unaligned(offs_t byteaddress, uint32_t data) = 0; - virtual void write_dword_unaligned(offs_t byteaddress, uint32_t data, uint32_t mask) = 0; - virtual void write_qword(offs_t byteaddress, uint64_t data) = 0; - virtual void write_qword(offs_t byteaddress, uint64_t data, uint64_t mask) = 0; - virtual void write_qword_unaligned(offs_t byteaddress, uint64_t data) = 0; - virtual void write_qword_unaligned(offs_t byteaddress, uint64_t data, uint64_t mask) = 0; + virtual void write_byte(offs_t byteaddress, u8 data) = 0; + virtual void write_word(offs_t byteaddress, u16 data) = 0; + virtual void write_word(offs_t byteaddress, u16 data, u16 mask) = 0; + virtual void write_word_unaligned(offs_t byteaddress, u16 data) = 0; + virtual void write_word_unaligned(offs_t byteaddress, u16 data, u16 mask) = 0; + virtual void write_dword(offs_t byteaddress, u32 data) = 0; + virtual void write_dword(offs_t byteaddress, u32 data, u32 mask) = 0; + virtual void write_dword_unaligned(offs_t byteaddress, u32 data) = 0; + virtual void write_dword_unaligned(offs_t byteaddress, u32 data, u32 mask) = 0; + virtual void write_qword(offs_t byteaddress, u64 data) = 0; + virtual void write_qword(offs_t byteaddress, u64 data, u64 mask) = 0; + virtual void write_qword_unaligned(offs_t byteaddress, u64 data) = 0; + virtual void write_qword_unaligned(offs_t byteaddress, u64 data, u64 mask) = 0; // Set address. This will invoke setoffset handlers for the respective entries. virtual void set_address(offs_t byteaddress) = 0; @@ -384,44 +384,44 @@ public: void install_ram(offs_t addrstart, offs_t addrend, offs_t addrmirror, void *baseptr = nullptr) { install_ram_generic(addrstart, addrend, addrmirror, ROW_READWRITE, baseptr); } // install device memory maps - template void install_device(offs_t addrstart, offs_t addrend, T &device, void (T::*map)(address_map &map), int bits = 0, uint64_t unitmask = 0) { + template void install_device(offs_t addrstart, offs_t addrend, T &device, void (T::*map)(address_map &map), int bits = 0, u64 unitmask = 0) { address_map_delegate delegate(map, "dynamic_device_install", &device); install_device_delegate(addrstart, addrend, device, delegate, bits, unitmask); } - void install_device_delegate(offs_t addrstart, offs_t addrend, device_t &device, address_map_delegate &map, int bits = 0, uint64_t unitmask = 0); + void install_device_delegate(offs_t addrstart, offs_t addrend, device_t &device, address_map_delegate &map, int bits = 0, u64 unitmask = 0); // install setoffset handler - void install_setoffset_handler(offs_t addrstart, offs_t addrend, setoffset_delegate sohandler, uint64_t unitmask = 0) { install_setoffset_handler(addrstart, addrend, 0, 0, 0, sohandler, unitmask); } - void install_setoffset_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, setoffset_delegate sohandler, uint64_t unitmask = 0); + void install_setoffset_handler(offs_t addrstart, offs_t addrend, setoffset_delegate sohandler, u64 unitmask = 0) { install_setoffset_handler(addrstart, addrend, 0, 0, 0, sohandler, unitmask); } + void install_setoffset_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, setoffset_delegate sohandler, u64 unitmask = 0); // install new-style delegate handlers (short form) - void install_read_handler(offs_t addrstart, offs_t addrend, read8_delegate rhandler, uint64_t unitmask = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask); } - void install_write_handler(offs_t addrstart, offs_t addrend, write8_delegate whandler, uint64_t unitmask = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask); } - void install_readwrite_handler(offs_t addrstart, offs_t addrend, read8_delegate rhandler, write8_delegate whandler, uint64_t unitmask = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask); } - void install_read_handler(offs_t addrstart, offs_t addrend, read16_delegate rhandler, uint64_t unitmask = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask); } - void install_write_handler(offs_t addrstart, offs_t addrend, write16_delegate whandler, uint64_t unitmask = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask); } - void install_readwrite_handler(offs_t addrstart, offs_t addrend, read16_delegate rhandler, write16_delegate whandler, uint64_t unitmask = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask); } - void install_read_handler(offs_t addrstart, offs_t addrend, read32_delegate rhandler, uint64_t unitmask = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask); } - void install_write_handler(offs_t addrstart, offs_t addrend, write32_delegate whandler, uint64_t unitmask = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask); } - void install_readwrite_handler(offs_t addrstart, offs_t addrend, read32_delegate rhandler, write32_delegate whandler, uint64_t unitmask = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask); } - void install_read_handler(offs_t addrstart, offs_t addrend, read64_delegate rhandler, uint64_t unitmask = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask); } - void install_write_handler(offs_t addrstart, offs_t addrend, write64_delegate whandler, uint64_t unitmask = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask); } - void install_readwrite_handler(offs_t addrstart, offs_t addrend, read64_delegate rhandler, write64_delegate whandler, uint64_t unitmask = 0) { install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask); } + void install_read_handler(offs_t addrstart, offs_t addrend, read8_delegate rhandler, u64 unitmask = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask); } + void install_write_handler(offs_t addrstart, offs_t addrend, write8_delegate whandler, u64 unitmask = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask); } + void install_readwrite_handler(offs_t addrstart, offs_t addrend, read8_delegate rhandler, write8_delegate whandler, u64 unitmask = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask); } + void install_read_handler(offs_t addrstart, offs_t addrend, read16_delegate rhandler, u64 unitmask = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask); } + void install_write_handler(offs_t addrstart, offs_t addrend, write16_delegate whandler, u64 unitmask = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask); } + void install_readwrite_handler(offs_t addrstart, offs_t addrend, read16_delegate rhandler, write16_delegate whandler, u64 unitmask = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask); } + void install_read_handler(offs_t addrstart, offs_t addrend, read32_delegate rhandler, u64 unitmask = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask); } + void install_write_handler(offs_t addrstart, offs_t addrend, write32_delegate whandler, u64 unitmask = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask); } + void install_readwrite_handler(offs_t addrstart, offs_t addrend, read32_delegate rhandler, write32_delegate whandler, u64 unitmask = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask); } + void install_read_handler(offs_t addrstart, offs_t addrend, read64_delegate rhandler, u64 unitmask = 0) { install_read_handler(addrstart, addrend, 0, 0, 0, rhandler, unitmask); } + void install_write_handler(offs_t addrstart, offs_t addrend, write64_delegate whandler, u64 unitmask = 0) { install_write_handler(addrstart, addrend, 0, 0, 0, whandler, unitmask); } + void install_readwrite_handler(offs_t addrstart, offs_t addrend, read64_delegate rhandler, write64_delegate whandler, u64 unitmask = 0) { install_readwrite_handler(addrstart, addrend, 0, 0, 0, rhandler, whandler, unitmask); } // install new-style delegate handlers (with mirror/mask) - void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8_delegate rhandler, uint64_t unitmask = 0); - void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8_delegate whandler, uint64_t unitmask = 0); - void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8_delegate rhandler, write8_delegate whandler, uint64_t unitmask = 0); - void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16_delegate rhandler, uint64_t unitmask = 0); - void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16_delegate whandler, uint64_t unitmask = 0); - void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16_delegate rhandler, write16_delegate whandler, uint64_t unitmask = 0); - void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32_delegate rhandler, uint64_t unitmask = 0); - void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32_delegate whandler, uint64_t unitmask = 0); - void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32_delegate rhandler, write32_delegate whandler, uint64_t unitmask = 0); - void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64_delegate rhandler, uint64_t unitmask = 0); - void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64_delegate whandler, uint64_t unitmask = 0); - void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64_delegate rhandler, write64_delegate whandler, uint64_t unitmask = 0); + void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8_delegate rhandler, u64 unitmask = 0); + void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write8_delegate whandler, u64 unitmask = 0); + void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read8_delegate rhandler, write8_delegate whandler, u64 unitmask = 0); + void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16_delegate rhandler, u64 unitmask = 0); + void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write16_delegate whandler, u64 unitmask = 0); + void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read16_delegate rhandler, write16_delegate whandler, u64 unitmask = 0); + void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32_delegate rhandler, u64 unitmask = 0); + void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write32_delegate whandler, u64 unitmask = 0); + void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read32_delegate rhandler, write32_delegate whandler, u64 unitmask = 0); + void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64_delegate rhandler, u64 unitmask = 0); + void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, write64_delegate whandler, u64 unitmask = 0); + void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, read64_delegate rhandler, write64_delegate whandler, u64 unitmask = 0); // setup void prepare_map(); @@ -446,7 +446,7 @@ private: bool needs_backing_store(const address_map_entry &entry); memory_bank &bank_find_or_allocate(const char *tag, offs_t addrstart, offs_t addrend, offs_t addrmirror, read_or_write readorwrite); memory_bank *bank_find_anonymous(offs_t bytestart, offs_t byteend) const; - address_map_entry *block_assign_intersecting(offs_t bytestart, offs_t byteend, uint8_t *base); + address_map_entry *block_assign_intersecting(offs_t bytestart, offs_t byteend, u8 *base); void check_optimize_all(const char *function, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, offs_t addrselect, offs_t &nstart, offs_t &nend, offs_t &nmask, offs_t &nmirror); void check_optimize_mirror(const char *function, offs_t addrstart, offs_t addrend, offs_t addrmirror, offs_t &nstart, offs_t &nend, offs_t &nmask, offs_t &nmirror); void check_address(const char *function, offs_t addrstart, offs_t addrend); @@ -455,19 +455,19 @@ protected: // private state const address_space_config &m_config; // configuration of this space device_t & m_device; // reference to the owning device - std::unique_ptr m_map; // original memory map + std::unique_ptr m_map; // original memory map offs_t m_addrmask; // physical address mask offs_t m_bytemask; // byte-converted physical address mask offs_t m_logaddrmask; // logical address mask offs_t m_logbytemask; // byte-converted logical address mask - uint64_t m_unmap; // unmapped value + u64 m_unmap; // unmapped value address_spacenum m_spacenum; // address space index bool m_debugger_access; // treat accesses as coming from the debugger bool m_log_unmap; // log unmapped accesses in this space? std::unique_ptr m_direct; // fast direct-access read info const char * m_name; // friendly name of the address space - uint8_t m_addrchars; // number of characters to use for physical addresses - uint8_t m_logaddrchars; // number of characters to use for logical addresses + u8 m_addrchars; // number of characters to use for physical addresses + u8 m_logaddrchars; // number of characters to use for logical addresses private: memory_manager & m_manager; // reference to the owning manager @@ -518,7 +518,7 @@ public: running_machine &machine() const { return m_machine; } offs_t bytestart() const { return m_bytestart; } offs_t byteend() const { return m_byteend; } - uint8_t *data() const { return m_data; } + u8 *data() const { return m_data; } // is the given range contained by this memory block? bool contains(address_space &space, offs_t bytestart, offs_t byteend) const @@ -531,8 +531,8 @@ private: running_machine & m_machine; // need the machine to free our memory address_space & m_space; // which address space are we associated with? offs_t m_bytestart, m_byteend; // byte-normalized start/end for verifying a match - uint8_t * m_data; // pointer to the data for this block - std::vector m_allocated; // pointer to the actually allocated block + u8 * m_data; // pointer to the data for this block + std::vector m_allocated; // pointer to the actually allocated block }; @@ -568,7 +568,7 @@ class memory_bank // a bank_entry contains a pointer struct bank_entry { - uint8_t * m_ptr; + u8 * m_ptr; }; public: @@ -611,8 +611,8 @@ private: // internal state running_machine & m_machine; // need the machine to free our memory - uint8_t ** m_baseptr; // pointer to our base pointer in the global array - uint16_t m_index; // array index for this handler + u8 ** m_baseptr; // pointer to our base pointer in the global array + u16 m_index; // array index for this handler bool m_anonymous; // are we anonymous or explicit? offs_t m_bytestart; // byte-adjusted start offset offs_t m_byteend; // byte-adjusted end offset @@ -631,7 +631,7 @@ class memory_share { public: // construction/destruction - memory_share(uint8_t width, size_t bytes, endianness_t endianness, void *ptr = nullptr) + memory_share(u8 width, size_t bytes, endianness_t endianness, void *ptr = nullptr) : m_ptr(ptr), m_bytes(bytes), m_endianness(endianness), @@ -643,8 +643,8 @@ public: void *ptr() const { return m_ptr; } size_t bytes() const { return m_bytes; } endianness_t endianness() const { return m_endianness; } - uint8_t bitwidth() const { return m_bitwidth; } - uint8_t bytewidth() const { return m_bytewidth; } + u8 bitwidth() const { return m_bitwidth; } + u8 bytewidth() const { return m_bytewidth; } // setters void set_ptr(void *ptr) { m_ptr = ptr; } @@ -654,8 +654,8 @@ private: void * m_ptr; // pointer to the memory backing the region size_t m_bytes; // size of the shared region in bytes endianness_t m_endianness; // endianness of the memory - uint8_t m_bitwidth; // width of the shared region in bits - uint8_t m_bytewidth; // width in bytes, rounded up to a power of 2 + u8 m_bitwidth; // width of the shared region in bits + u8 m_bytewidth; // width in bytes, rounded up to a power of 2 }; @@ -670,34 +670,34 @@ class memory_region friend class memory_manager; public: // construction/destruction - memory_region(running_machine &machine, const char *name, uint32_t length, uint8_t width, endianness_t endian); + memory_region(running_machine &machine, const char *name, u32 length, u8 width, endianness_t endian); // getters running_machine &machine() const { return m_machine; } - uint8_t *base() { return (m_buffer.size() > 0) ? &m_buffer[0] : nullptr; } - uint8_t *end() { return base() + m_buffer.size(); } - uint32_t bytes() const { return m_buffer.size(); } + u8 *base() { return (m_buffer.size() > 0) ? &m_buffer[0] : nullptr; } + u8 *end() { return base() + m_buffer.size(); } + u32 bytes() const { return m_buffer.size(); } const char *name() const { return m_name.c_str(); } // flag expansion endianness_t endianness() const { return m_endianness; } - uint8_t bitwidth() const { return m_bitwidth; } - uint8_t bytewidth() const { return m_bytewidth; } + u8 bitwidth() const { return m_bitwidth; } + u8 bytewidth() const { return m_bytewidth; } // data access - uint8_t &u8(offs_t offset = 0) { return m_buffer[offset]; } - uint16_t &u16(offs_t offset = 0) { return reinterpret_cast(base())[offset]; } - uint32_t &u32(offs_t offset = 0) { return reinterpret_cast(base())[offset]; } - uint64_t &u64(offs_t offset = 0) { return reinterpret_cast(base())[offset]; } + u8 &as_u8(offs_t offset = 0) { return m_buffer[offset]; } + u16 &as_u16(offs_t offset = 0) { return reinterpret_cast(base())[offset]; } + u32 &as_u32(offs_t offset = 0) { return reinterpret_cast(base())[offset]; } + u64 &as_u64(offs_t offset = 0) { return reinterpret_cast(base())[offset]; } private: // internal data running_machine & m_machine; std::string m_name; - std::vector m_buffer; + std::vector m_buffer; endianness_t m_endianness; - uint8_t m_bitwidth; - uint8_t m_bytewidth; + u8 m_bitwidth; + u8 m_bytewidth; }; @@ -708,7 +708,7 @@ private: class memory_manager { friend class address_space; - friend memory_region::memory_region(running_machine &machine, const char *name, uint32_t length, uint8_t width, endianness_t endian); + friend memory_region::memory_region(running_machine &machine, const char *name, u32 length, u8 width, endianness_t endian); public: // construction/destruction memory_manager(running_machine &machine); @@ -724,10 +724,10 @@ public: void dump(FILE *file); // pointers to a bank pointer (internal usage only) - uint8_t **bank_pointer_addr(uint8_t index) { return &m_bank_ptr[index]; } + u8 **bank_pointer_addr(u8 index) { return &m_bank_ptr[index]; } // regions - memory_region *region_alloc(const char *name, uint32_t length, uint8_t width, endianness_t endian); + memory_region *region_alloc(const char *name, u32 length, u8 width, endianness_t endian); void region_free(const char *name); memory_region *region_containing(const void *memory, offs_t bytes) const; @@ -740,13 +740,13 @@ private: running_machine & m_machine; // reference to the machine bool m_initialized; // have we completed initialization? - uint8_t * m_bank_ptr[TOTAL_MEMORY_BANKS]; // array of bank pointers + u8 * m_bank_ptr[TOTAL_MEMORY_BANKS]; // array of bank pointers std::vector> m_spacelist; // list of address spaces std::vector> m_blocklist; // head of the list of memory blocks std::unordered_map> m_banklist; // data gathered for each bank - uint16_t m_banknext; // next bank to allocate + u16 m_banknext; // next bank to allocate std::unordered_map> m_sharelist; // map for share lookups @@ -760,32 +760,32 @@ private: //************************************************************************** // opcode base adjustment handler function macro -#define DIRECT_UPDATE_MEMBER(name) offs_t name(ATTR_UNUSED direct_read_data &direct, ATTR_UNUSED offs_t address) +#define DIRECT_UPDATE_MEMBER(name) offs_t name(ATTR_UNUSED direct_read_data &direct, ATTR_UNUSED offs_t address) #define DECLARE_DIRECT_UPDATE_MEMBER(name) offs_t name(ATTR_UNUSED direct_read_data &direct, ATTR_UNUSED offs_t address) // space read/write handler function macros -#define READ8_MEMBER(name) uint8_t name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED uint8_t mem_mask) -#define WRITE8_MEMBER(name) void name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED uint8_t data, ATTR_UNUSED uint8_t mem_mask) -#define READ16_MEMBER(name) uint16_t name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED uint16_t mem_mask) -#define WRITE16_MEMBER(name) void name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED uint16_t data, ATTR_UNUSED uint16_t mem_mask) -#define READ32_MEMBER(name) uint32_t name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED uint32_t mem_mask) -#define WRITE32_MEMBER(name) void name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED uint32_t data, ATTR_UNUSED uint32_t mem_mask) -#define READ64_MEMBER(name) uint64_t name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED uint64_t mem_mask) -#define WRITE64_MEMBER(name) void name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED uint64_t data, ATTR_UNUSED uint64_t mem_mask) +#define READ8_MEMBER(name) u8 name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED u8 mem_mask) +#define WRITE8_MEMBER(name) void name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED u8 data, ATTR_UNUSED u8 mem_mask) +#define READ16_MEMBER(name) u16 name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED u16 mem_mask) +#define WRITE16_MEMBER(name) void name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED u16 data, ATTR_UNUSED u16 mem_mask) +#define READ32_MEMBER(name) u32 name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED u32 mem_mask) +#define WRITE32_MEMBER(name) void name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED u32 data, ATTR_UNUSED u32 mem_mask) +#define READ64_MEMBER(name) u64 name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED u64 mem_mask) +#define WRITE64_MEMBER(name) void name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED u64 data, ATTR_UNUSED u64 mem_mask) -#define DECLARE_READ8_MEMBER(name) uint8_t name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED uint8_t mem_mask = 0xff) -#define DECLARE_WRITE8_MEMBER(name) void name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED uint8_t data, ATTR_UNUSED uint8_t mem_mask = 0xff) -#define DECLARE_READ16_MEMBER(name) uint16_t name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED uint16_t mem_mask = 0xffff) -#define DECLARE_WRITE16_MEMBER(name) void name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED uint16_t data, ATTR_UNUSED uint16_t mem_mask = 0xffff) -#define DECLARE_READ32_MEMBER(name) uint32_t name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED uint32_t mem_mask = 0xffffffff) -#define DECLARE_WRITE32_MEMBER(name) void name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED uint32_t data, ATTR_UNUSED uint32_t mem_mask = 0xffffffff) -#define DECLARE_READ64_MEMBER(name) uint64_t name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED uint64_t mem_mask = U64(0xffffffffffffffff)) -#define DECLARE_WRITE64_MEMBER(name) void name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED uint64_t data, ATTR_UNUSED uint64_t mem_mask = U64(0xffffffffffffffff)) +#define DECLARE_READ8_MEMBER(name) u8 name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED u8 mem_mask = 0xff) +#define DECLARE_WRITE8_MEMBER(name) void name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED u8 data, ATTR_UNUSED u8 mem_mask = 0xff) +#define DECLARE_READ16_MEMBER(name) u16 name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED u16 mem_mask = 0xffff) +#define DECLARE_WRITE16_MEMBER(name) void name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED u16 data, ATTR_UNUSED u16 mem_mask = 0xffff) +#define DECLARE_READ32_MEMBER(name) u32 name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED u32 mem_mask = 0xffffffff) +#define DECLARE_WRITE32_MEMBER(name) void name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED u32 data, ATTR_UNUSED u32 mem_mask = 0xffffffff) +#define DECLARE_READ64_MEMBER(name) u64 name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED u64 mem_mask = 0xffffffffffffffffU) +#define DECLARE_WRITE64_MEMBER(name) void name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED u64 data, ATTR_UNUSED u64 mem_mask = 0xffffffffffffffffU) -#define SETOFFSET_MEMBER(name) void name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset) -#define DECLARE_SETOFFSET_MEMBER(name) void name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset) +#define SETOFFSET_MEMBER(name) void name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset) +#define DECLARE_SETOFFSET_MEMBER(name) void name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset) // device delegate macros #define READ8_DELEGATE(_class, _member) read8_delegate(FUNC(_class::_member), this) @@ -810,22 +810,22 @@ private: // helper macro for merging data with the memory mask #define COMBINE_DATA(varptr) (*(varptr) = (*(varptr) & ~mem_mask) | (data & mem_mask)) -#define ACCESSING_BITS_0_7 ((mem_mask & 0x000000ff) != 0) -#define ACCESSING_BITS_8_15 ((mem_mask & 0x0000ff00) != 0) -#define ACCESSING_BITS_16_23 ((mem_mask & 0x00ff0000) != 0) -#define ACCESSING_BITS_24_31 ((mem_mask & 0xff000000) != 0) -#define ACCESSING_BITS_32_39 ((mem_mask & U64(0x000000ff00000000)) != 0) -#define ACCESSING_BITS_40_47 ((mem_mask & U64(0x0000ff0000000000)) != 0) -#define ACCESSING_BITS_48_55 ((mem_mask & U64(0x00ff000000000000)) != 0) -#define ACCESSING_BITS_56_63 ((mem_mask & U64(0xff00000000000000)) != 0) +#define ACCESSING_BITS_0_7 ((mem_mask & 0x000000ffU) != 0) +#define ACCESSING_BITS_8_15 ((mem_mask & 0x0000ff00U) != 0) +#define ACCESSING_BITS_16_23 ((mem_mask & 0x00ff0000U) != 0) +#define ACCESSING_BITS_24_31 ((mem_mask & 0xff000000U) != 0) +#define ACCESSING_BITS_32_39 ((mem_mask & 0x000000ff00000000U) != 0) +#define ACCESSING_BITS_40_47 ((mem_mask & 0x0000ff0000000000U) != 0) +#define ACCESSING_BITS_48_55 ((mem_mask & 0x00ff000000000000U) != 0) +#define ACCESSING_BITS_56_63 ((mem_mask & 0xff00000000000000U) != 0) -#define ACCESSING_BITS_0_15 ((mem_mask & 0x0000ffff) != 0) -#define ACCESSING_BITS_16_31 ((mem_mask & 0xffff0000) != 0) -#define ACCESSING_BITS_32_47 ((mem_mask & U64(0x0000ffff00000000)) != 0) -#define ACCESSING_BITS_48_63 ((mem_mask & U64(0xffff000000000000)) != 0) +#define ACCESSING_BITS_0_15 ((mem_mask & 0x0000ffffU) != 0) +#define ACCESSING_BITS_16_31 ((mem_mask & 0xffff0000U) != 0) +#define ACCESSING_BITS_32_47 ((mem_mask & 0x0000ffff00000000U) != 0) +#define ACCESSING_BITS_48_63 ((mem_mask & 0xffff000000000000U) != 0) -#define ACCESSING_BITS_0_31 ((mem_mask & 0xffffffff) != 0) -#define ACCESSING_BITS_32_63 ((mem_mask & U64(0xffffffff00000000)) != 0) +#define ACCESSING_BITS_0_31 ((mem_mask & 0xffffffffU) != 0) +#define ACCESSING_BITS_32_63 ((mem_mask & 0xffffffff00000000U) != 0) // macros for accessing bytes and words within larger chunks @@ -885,7 +885,7 @@ inline void *direct_read_data::read_ptr(offs_t byteaddress, offs_t directxor) // direct_read_data class //------------------------------------------------- -inline uint8_t direct_read_data::read_byte(offs_t byteaddress, offs_t directxor) +inline u8 direct_read_data::read_byte(offs_t byteaddress, offs_t directxor) { if (address_is_valid(byteaddress)) return m_ptr[(byteaddress ^ directxor) & m_bytemask]; @@ -898,10 +898,10 @@ inline uint8_t direct_read_data::read_byte(offs_t byteaddress, offs_t directxor) // direct_read_data class //------------------------------------------------- -inline uint16_t direct_read_data::read_word(offs_t byteaddress, offs_t directxor) +inline u16 direct_read_data::read_word(offs_t byteaddress, offs_t directxor) { if (address_is_valid(byteaddress)) - return *reinterpret_cast(&m_ptr[(byteaddress ^ directxor) & m_bytemask]); + return *reinterpret_cast(&m_ptr[(byteaddress ^ directxor) & m_bytemask]); return m_space.read_word(byteaddress); } @@ -911,10 +911,10 @@ inline uint16_t direct_read_data::read_word(offs_t byteaddress, offs_t directxor // direct_read_data class //------------------------------------------------- -inline uint32_t direct_read_data::read_dword(offs_t byteaddress, offs_t directxor) +inline u32 direct_read_data::read_dword(offs_t byteaddress, offs_t directxor) { if (address_is_valid(byteaddress)) - return *reinterpret_cast(&m_ptr[(byteaddress ^ directxor) & m_bytemask]); + return *reinterpret_cast(&m_ptr[(byteaddress ^ directxor) & m_bytemask]); return m_space.read_dword(byteaddress); } @@ -924,11 +924,11 @@ inline uint32_t direct_read_data::read_dword(offs_t byteaddress, offs_t directxo // direct_read_data class //------------------------------------------------- -inline uint64_t direct_read_data::read_qword(offs_t byteaddress, offs_t directxor) +inline u64 direct_read_data::read_qword(offs_t byteaddress, offs_t directxor) { if (address_is_valid(byteaddress)) - return *reinterpret_cast(&m_ptr[(byteaddress ^ directxor) & m_bytemask]); + return *reinterpret_cast(&m_ptr[(byteaddress ^ directxor) & m_bytemask]); return m_space.read_qword(byteaddress); } -#endif /* __EMUMEM_H__ */ +#endif /* MAME_EMU_EMUMEM_H */ diff --git a/src/emu/emupal.cpp b/src/emu/emupal.cpp index 2b4393ee6be..d155d4d61ee 100644 --- a/src/emu/emupal.cpp +++ b/src/emu/emupal.cpp @@ -19,7 +19,7 @@ const device_type PALETTE = &device_creator; -palette_device::palette_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +palette_device::palette_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, PALETTE, "palette", tag, owner, clock, "palette", __FILE__), m_entries(0), m_indirect_entries(0), @@ -122,7 +122,7 @@ void palette_device::set_indirect_color(int index, rgb_t rgb) m_indirect_colors[index] = rgb; // update the palette for any colortable entries that reference it - for (uint32_t pen = 0; pen < m_indirect_pens.size(); pen++) + for (u32 pen = 0; pen < m_indirect_pens.size(); pen++) if (m_indirect_pens[pen] == index) m_palette->entry_set_color(pen, rgb); } @@ -150,9 +150,9 @@ void palette_device::set_pen_indirect(pen_t pen, indirect_pen_t index) // transcolor //------------------------------------------------- -uint32_t palette_device::transpen_mask(gfx_element &gfx, uint32_t color, indirect_pen_t transcolor) +u32 palette_device::transpen_mask(gfx_element &gfx, u32 color, indirect_pen_t transcolor) { - uint32_t entry = gfx.colorbase() + (color % gfx.colors()) * gfx.granularity(); + u32 entry = gfx.colorbase() + (color % gfx.colors()) * gfx.granularity(); // make sure we are in range assert(entry < m_indirect_pens.size()); @@ -162,7 +162,7 @@ uint32_t palette_device::transpen_mask(gfx_element &gfx, uint32_t color, indirec int count = std::min(size_t(gfx.depth()), m_indirect_pens.size() - entry); // set a bit anywhere the transcolor matches - uint32_t mask = 0; + u32 mask = 0; for (int bit = 0; bit < count; bit++) if (m_indirect_pens[entry++] == transcolor) mask |= 1 << bit; @@ -715,9 +715,9 @@ void palette_device::configure_rgb_shadows(int mode, float factor) int ifactor = int(factor * 256.0f); for (int rgb555 = 0; rgb555 < 32768; rgb555++) { - uint8_t r = rgb_t::clamp((pal5bit(rgb555 >> 10) * ifactor) >> 8); - uint8_t g = rgb_t::clamp((pal5bit(rgb555 >> 5) * ifactor) >> 8); - uint8_t b = rgb_t::clamp((pal5bit(rgb555 >> 0) * ifactor) >> 8); + u8 const r = rgb_t::clamp((pal5bit(rgb555 >> 10) * ifactor) >> 8); + u8 const g = rgb_t::clamp((pal5bit(rgb555 >> 5) * ifactor) >> 8); + u8 const b = rgb_t::clamp((pal5bit(rgb555 >> 0) * ifactor) >> 8); // store either 16 or 32 bit rgb_t final = rgb_t(r, g, b); @@ -859,7 +859,7 @@ void palette_device::palette_init_3bit_bgr(palette_device &palette) void palette_device::palette_init_RRRRGGGGBBBB_proms(palette_device &palette) { - const uint8_t *color_prom = machine().root_device().memregion("proms")->base(); + const u8 *color_prom = machine().root_device().memregion("proms")->base(); int i; for (i = 0; i < palette.entries(); i++) @@ -932,35 +932,35 @@ void palette_device::palette_init_RRRRRGGGGGGBBBBB(palette_device &palette) palette.set_pen_color(i, rgbexpand<5,6,5>(i, 11, 5, 0)); } -rgb_t raw_to_rgb_converter::IRRRRRGGGGGBBBBB_decoder(uint32_t raw) +rgb_t raw_to_rgb_converter::IRRRRRGGGGGBBBBB_decoder(u32 raw) { - uint8_t i = (raw >> 15) & 1; - uint8_t r = pal6bit(((raw >> 9) & 0x3e) | i); - uint8_t g = pal6bit(((raw >> 4) & 0x3e) | i); - uint8_t b = pal6bit(((raw << 1) & 0x3e) | i); + u8 const i = (raw >> 15) & 1; + u8 const r = pal6bit(((raw >> 9) & 0x3e) | i); + u8 const g = pal6bit(((raw >> 4) & 0x3e) | i); + u8 const b = pal6bit(((raw << 1) & 0x3e) | i); return rgb_t(r, g, b); } -rgb_t raw_to_rgb_converter::RRRRGGGGBBBBRGBx_decoder(uint32_t raw) +rgb_t raw_to_rgb_converter::RRRRGGGGBBBBRGBx_decoder(u32 raw) { - uint8_t r = pal5bit(((raw >> 11) & 0x1e) | ((raw >> 3) & 0x01)); - uint8_t g = pal5bit(((raw >> 7) & 0x1e) | ((raw >> 2) & 0x01)); - uint8_t b = pal5bit(((raw >> 3) & 0x1e) | ((raw >> 1) & 0x01)); + u8 const r = pal5bit(((raw >> 11) & 0x1e) | ((raw >> 3) & 0x01)); + u8 const g = pal5bit(((raw >> 7) & 0x1e) | ((raw >> 2) & 0x01)); + u8 const b = pal5bit(((raw >> 3) & 0x1e) | ((raw >> 1) & 0x01)); return rgb_t(r, g, b); } -rgb_t raw_to_rgb_converter::xRGBRRRRGGGGBBBB_bit0_decoder(uint32_t raw) +rgb_t raw_to_rgb_converter::xRGBRRRRGGGGBBBB_bit0_decoder(u32 raw) { - uint8_t r = pal5bit(((raw >> 7) & 0x1e) | ((raw >> 14) & 0x01)); - uint8_t g = pal5bit(((raw >> 3) & 0x1e) | ((raw >> 13) & 0x01)); - uint8_t b = pal5bit(((raw << 1) & 0x1e) | ((raw >> 12) & 0x01)); + u8 const r = pal5bit(((raw >> 7) & 0x1e) | ((raw >> 14) & 0x01)); + u8 const g = pal5bit(((raw >> 3) & 0x1e) | ((raw >> 13) & 0x01)); + u8 const b = pal5bit(((raw << 1) & 0x1e) | ((raw >> 12) & 0x01)); return rgb_t(r, g, b); } -rgb_t raw_to_rgb_converter::xRGBRRRRGGGGBBBB_bit4_decoder(uint32_t raw) +rgb_t raw_to_rgb_converter::xRGBRRRRGGGGBBBB_bit4_decoder(u32 raw) { - uint8_t r = pal5bit(((raw >> 8) & 0x0f) | ((raw >> 10) & 0x10)); - uint8_t g = pal5bit(((raw >> 4) & 0x0f) | ((raw >> 9) & 0x10)); - uint8_t b = pal5bit(((raw >> 0) & 0x0f) | ((raw >> 8) & 0x10)); + u8 const r = pal5bit(((raw >> 8) & 0x0f) | ((raw >> 10) & 0x10)); + u8 const g = pal5bit(((raw >> 4) & 0x0f) | ((raw >> 9) & 0x10)); + u8 const b = pal5bit(((raw >> 0) & 0x0f) | ((raw >> 8) & 0x10)); return rgb_t(r, g, b); } diff --git a/src/emu/emupal.h b/src/emu/emupal.h index fca513d8424..a8af7713b48 100644 --- a/src/emu/emupal.h +++ b/src/emu/emupal.h @@ -96,8 +96,8 @@ #error Dont include this file directly; include emu.h instead. #endif -#ifndef __EMUPAL_H__ -#define __EMUPAL_H__ +#ifndef MAME_EMU_EMUPAL_H +#define MAME_EMU_EMUPAL_H //************************************************************************** @@ -112,8 +112,8 @@ #define PALETTE_INIT_MEMBER(_Class, _Name) void _Class::PALETTE_INIT_NAME(_Name)(palette_device &palette) #define PALETTE_DECODER_NAME(_Name) _Name##_decoder -#define DECLARE_PALETTE_DECODER(_Name) static rgb_t PALETTE_DECODER_NAME(_Name)(uint32_t raw) -#define PALETTE_DECODER_MEMBER(_Class, _Name) rgb_t _Class::PALETTE_DECODER_NAME(_Name)(uint32_t raw) +#define DECLARE_PALETTE_DECODER(_Name) static rgb_t PALETTE_DECODER_NAME(_Name)(u32 raw) +#define PALETTE_DECODER_MEMBER(_Class, _Name) rgb_t _Class::PALETTE_DECODER_NAME(_Name)(u32 raw) // standard 3-3-2 formats #define PALETTE_FORMAT_BBGGGRRR raw_to_rgb_converter(1, &raw_to_rgb_converter::standard_rgb_decoder<3,3,2, 0,3,6>) @@ -290,7 +290,7 @@ typedef device_delegate palette_init_delegate; -typedef uint16_t indirect_pen_t; +typedef u16 indirect_pen_t; // ======================> raw_to_rgb_converter @@ -298,7 +298,7 @@ typedef uint16_t indirect_pen_t; class raw_to_rgb_converter { // helper function - typedef rgb_t (*raw_to_rgb_func)(uint32_t raw); + typedef rgb_t (*raw_to_rgb_func)(u32 raw); public: // constructor @@ -310,43 +310,43 @@ public: int bytes_per_entry() const { return m_bytes_per_entry; } // helpers - rgb_t operator()(uint32_t raw) const { return (*m_func)(raw); } + rgb_t operator()(u32 raw) const { return (*m_func)(raw); } // generic raw-to-RGB conversion helpers template - static rgb_t standard_rgb_decoder(uint32_t raw) + static rgb_t standard_rgb_decoder(u32 raw) { - uint8_t r = palexpand<_RedBits>(raw >> _RedShift); - uint8_t g = palexpand<_GreenBits>(raw >> _GreenShift); - uint8_t b = palexpand<_BlueBits>(raw >> _BlueShift); + u8 const r = palexpand<_RedBits>(raw >> _RedShift); + u8 const g = palexpand<_GreenBits>(raw >> _GreenShift); + u8 const b = palexpand<_BlueBits>(raw >> _BlueShift); return rgb_t(r, g, b); } // data-inverted generic raw-to-RGB conversion helpers template - static rgb_t inverted_rgb_decoder(uint32_t raw) + static rgb_t inverted_rgb_decoder(u32 raw) { - uint8_t r = palexpand<_RedBits>(~raw >> _RedShift); - uint8_t g = palexpand<_GreenBits>(~raw >> _GreenShift); - uint8_t b = palexpand<_BlueBits>(~raw >> _BlueShift); + u8 const r = palexpand<_RedBits>(~raw >> _RedShift); + u8 const g = palexpand<_GreenBits>(~raw >> _GreenShift); + u8 const b = palexpand<_BlueBits>(~raw >> _BlueShift); return rgb_t(r, g, b); } template - static rgb_t standard_irgb_decoder(uint32_t raw) + static rgb_t standard_irgb_decoder(u32 raw) { - uint8_t i = palexpand<_IntBits>(raw >> _IntShift); - uint8_t r = (i * palexpand<_RedBits>(raw >> _RedShift)) >> 8; - uint8_t g = (i * palexpand<_GreenBits>(raw >> _GreenShift)) >> 8; - uint8_t b = (i * palexpand<_BlueBits>(raw >> _BlueShift)) >> 8; + u8 const i = palexpand<_IntBits>(raw >> _IntShift); + u8 const r = (i * palexpand<_RedBits>(raw >> _RedShift)) >> 8; + u8 const g = (i * palexpand<_GreenBits>(raw >> _GreenShift)) >> 8; + u8 const b = (i * palexpand<_BlueBits>(raw >> _BlueShift)) >> 8; return rgb_t(r, g, b); } // other standard decoders - static rgb_t IRRRRRGGGGGBBBBB_decoder(uint32_t raw); - static rgb_t RRRRGGGGBBBBRGBx_decoder(uint32_t raw); // bits 3/2/1 are LSb - static rgb_t xRGBRRRRGGGGBBBB_bit0_decoder(uint32_t raw); // bits 14/13/12 are LSb - static rgb_t xRGBRRRRGGGGBBBB_bit4_decoder(uint32_t raw); // bits 14/13/12 are MSb + static rgb_t IRRRRRGGGGGBBBBB_decoder(u32 raw); + static rgb_t RRRRGGGGBBBBRGBx_decoder(u32 raw); // bits 3/2/1 are LSb + static rgb_t xRGBRRRRGGGGBBBB_bit0_decoder(u32 raw); // bits 14/13/12 are LSb + static rgb_t xRGBRRRRGGGGBBBB_bit4_decoder(u32 raw); // bits 14/13/12 are MSb private: // internal data @@ -366,7 +366,7 @@ class palette_device : public device_t public: // construction/destruction - palette_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + palette_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); // static configuration static void static_set_init(device_t &device, palette_init_delegate init); @@ -395,9 +395,9 @@ public: bool hilights_enabled() { return m_enable_hilights; } // raw entry reading - uint32_t read_entry(pen_t pen) const + u32 read_entry(pen_t pen) const { - uint32_t data = m_paletteram.read(pen); + u32 data = m_paletteram.read(pen); if (m_paletteram_ext.base() != nullptr) data |= m_paletteram_ext.read(pen) << (8 * m_paletteram.bytes_per_entry()); return data; @@ -405,10 +405,10 @@ public: // setters void set_pen_color(pen_t pen, rgb_t rgb) { m_palette->entry_set_color(pen, rgb); } - void set_pen_red_level(pen_t pen, uint8_t level) { m_palette->entry_set_red_level(pen, level); } - void set_pen_green_level(pen_t pen, uint8_t level) { m_palette->entry_set_green_level(pen, level); } - void set_pen_blue_level(pen_t pen, uint8_t level) { m_palette->entry_set_blue_level(pen, level); } - void set_pen_color(pen_t pen, uint8_t r, uint8_t g, uint8_t b) { m_palette->entry_set_color(pen, rgb_t(r, g, b)); } + void set_pen_red_level(pen_t pen, u8 level) { m_palette->entry_set_red_level(pen, level); } + void set_pen_green_level(pen_t pen, u8 level) { m_palette->entry_set_green_level(pen, level); } + void set_pen_blue_level(pen_t pen, u8 level) { m_palette->entry_set_blue_level(pen, level); } + void set_pen_color(pen_t pen, u8 r, u8 g, u8 b) { m_palette->entry_set_color(pen, rgb_t(r, g, b)); } void set_pen_colors(pen_t color_base, const rgb_t *colors, int color_count) { while (color_count--) set_pen_color(color_base++, *colors++); } void set_pen_colors(pen_t color_base, const std::vector &colors) { for(unsigned int i=0; i != colors.size(); i++) set_pen_color(color_base+i, colors[i]); } void set_pen_contrast(pen_t pen, double bright) { m_palette->entry_set_contrast(pen, bright); } @@ -418,7 +418,7 @@ public: rgb_t indirect_color(int index) const { return m_indirect_colors[index]; } void set_indirect_color(int index, rgb_t rgb); void set_pen_indirect(pen_t pen, indirect_pen_t index); - uint32_t transpen_mask(gfx_element &gfx, uint32_t color, indirect_pen_t transcolor); + u32 transpen_mask(gfx_element &gfx, u32 color, indirect_pen_t transcolor); // shadow config void set_shadow_factor(double factor) { assert(m_shadow_group != 0); m_palette->group_set_contrast(m_shadow_group, factor); } @@ -494,8 +494,8 @@ private: const pen_t * m_pens; // remapped palette pen numbers bitmap_format m_format; // format assumed for palette data pen_t * m_shadow_table; // table for looking up a shadowed pen - uint32_t m_shadow_group; // index of the shadow group, or 0 if none - uint32_t m_hilight_group; // index of the hilight group, or 0 if none + u32 m_shadow_group; // index of the shadow group, or 0 if none + u32 m_hilight_group; // index of the hilight group, or 0 if none pen_t m_white_pen; // precomputed white pen value pen_t m_black_pen; // precomputed black pen value @@ -506,9 +506,9 @@ private: struct shadow_table_data { pen_t * base; // pointer to the base of the table - int16_t dr; // delta red value - int16_t dg; // delta green value - int16_t db; // delta blue value + s16 dr; // delta red value + s16 dg; // delta green value + s16 db; // delta blue value bool noclip; // clip? }; shadow_table_data m_shadow_tables[MAX_SHADOW_PRESETS]; // array of shadow table data @@ -526,4 +526,4 @@ private: typedef device_type_iterator<&device_creator, palette_device> palette_device_iterator; -#endif // __EMUPAL_H__ +#endif // MAME_EMU_EMUPAL_H diff --git a/src/emu/fileio.cpp b/src/emu/fileio.cpp index 4670fd2b789..3ec686266c8 100644 --- a/src/emu/fileio.cpp +++ b/src/emu/fileio.cpp @@ -13,7 +13,7 @@ #include "fileio.h" -const uint32_t OPEN_FLAG_HAS_CRC = 0x10000; +const u32 OPEN_FLAG_HAS_CRC = 0x10000; @@ -164,7 +164,7 @@ const osd::directory::entry *file_enumerator::next() // emu_file - constructor //------------------------------------------------- -emu_file::emu_file(uint32_t openflags) +emu_file::emu_file(u32 openflags) : m_file() , m_iterator(std::string()) , m_mediapaths(std::string()) @@ -180,7 +180,7 @@ emu_file::emu_file(uint32_t openflags) throw emu_fatalerror("Attempted to open a file for write with OPEN_FLAG_HAS_CRC"); } -emu_file::emu_file(std::string &&searchpath, uint32_t openflags) +emu_file::emu_file(std::string &&searchpath, u32 openflags) : m_file() , m_iterator(searchpath) , m_mediapaths(std::move(searchpath)) @@ -257,7 +257,7 @@ util::hash_collection &emu_file::hashes(const char *types) } // read the data if we can - const uint8_t *filedata = (const uint8_t *)m_file->buffer(); + const u8 *filedata = (const u8 *)m_file->buffer(); if (filedata == nullptr) return m_hashes; @@ -301,7 +301,7 @@ osd_file::error emu_file::open(const std::string &name1, const std::string &name return open(name1 + name2 + name3 + name4); } -osd_file::error emu_file::open(const std::string &name, uint32_t crc) +osd_file::error emu_file::open(const std::string &name, u32 crc) { // remember the filename and CRC info m_filename = name; @@ -313,19 +313,19 @@ osd_file::error emu_file::open(const std::string &name, uint32_t crc) return open_next(); } -osd_file::error emu_file::open(const std::string &name1, const std::string &name2, uint32_t crc) +osd_file::error emu_file::open(const std::string &name1, const std::string &name2, u32 crc) { // concatenate the strings and do a standard open return open(name1 + name2, crc); } -osd_file::error emu_file::open(const std::string &name1, const std::string &name2, const std::string &name3, uint32_t crc) +osd_file::error emu_file::open(const std::string &name1, const std::string &name2, const std::string &name3, u32 crc) { // concatenate the strings and do a standard open return open(name1 + name2 + name3, crc); } -osd_file::error emu_file::open(const std::string &name1, const std::string &name2, const std::string &name3, const std::string &name4, uint32_t crc) +osd_file::error emu_file::open(const std::string &name1, const std::string &name2, const std::string &name3, const std::string &name4, u32 crc) { // concatenate the strings and do a standard open return open(name1 + name2 + name3 + name4, crc); @@ -369,7 +369,7 @@ osd_file::error emu_file::open_next() // just an array of data in RAM //------------------------------------------------- -osd_file::error emu_file::open_ram(const void *data, uint32_t length) +osd_file::error emu_file::open_ram(const void *data, u32 length) { // set a fake filename and CRC m_filename = "RAM"; @@ -433,7 +433,7 @@ bool emu_file::compressed_file_ready(void) // seek - seek within a file //------------------------------------------------- -int emu_file::seek(int64_t offset, int whence) +int emu_file::seek(s64 offset, int whence) { // load the ZIP file now if we haven't yet if (compressed_file_ready()) @@ -451,7 +451,7 @@ int emu_file::seek(int64_t offset, int whence) // tell - return the current file position //------------------------------------------------- -uint64_t emu_file::tell() +u64 emu_file::tell() { // load the ZIP file now if we haven't yet if (compressed_file_ready()) @@ -487,7 +487,7 @@ bool emu_file::eof() // size - returns the size of a file //------------------------------------------------- -uint64_t emu_file::size() +u64 emu_file::size() { // use the ZIP length if present if (m_zipfile != nullptr) @@ -505,7 +505,7 @@ uint64_t emu_file::size() // read - read from a file //------------------------------------------------- -uint32_t emu_file::read(void *buffer, uint32_t length) +u32 emu_file::read(void *buffer, u32 length) { // load the ZIP file now if we haven't yet if (compressed_file_ready()) @@ -577,7 +577,7 @@ char *emu_file::gets(char *s, int n) // write - write to a file //------------------------------------------------- -uint32_t emu_file::write(const void *buffer, uint32_t length) +u32 emu_file::write(const void *buffer, u32 length) { // write the data if we can if (m_file) diff --git a/src/emu/fileio.h b/src/emu/fileio.h index a121cafb66e..900cd5c8141 100644 --- a/src/emu/fileio.h +++ b/src/emu/fileio.h @@ -8,11 +8,11 @@ ***************************************************************************/ -#pragma once - #ifndef MAME_EMU_FILEIO_H #define MAME_EMU_FILEIO_H +#pragma once + #include "corefile.h" #include "hash.h" @@ -88,8 +88,8 @@ class emu_file { public: // file open/creation - emu_file(uint32_t openflags); - emu_file(std::string &&searchpath, uint32_t openflags); + emu_file(u32 openflags); + emu_file(std::string &&searchpath, u32 openflags); virtual ~emu_file(); // getters @@ -97,14 +97,14 @@ public: bool is_open() const { return bool(m_file); } const char *filename() const { return m_filename.c_str(); } const char *fullpath() const { return m_fullpath.c_str(); } - uint32_t openflags() const { return m_openflags; } + u32 openflags() const { return m_openflags; } util::hash_collection &hashes(const char *types); bool restrict_to_mediapath() const { return m_restrict_to_mediapath; } bool part_of_mediapath(std::string path); // setters void remove_on_close() { m_remove_on_close = true; } - void set_openflags(uint32_t openflags) { assert(!m_file); m_openflags = openflags; } + void set_openflags(u32 openflags) { assert(!m_file); m_openflags = openflags; } void set_restrict_to_mediapath(bool rtmp = true) { m_restrict_to_mediapath = rtmp; } // open/close @@ -112,31 +112,31 @@ public: osd_file::error open(const std::string &name1, const std::string &name2); osd_file::error open(const std::string &name1, const std::string &name2, const std::string &name3); osd_file::error open(const std::string &name1, const std::string &name2, const std::string &name3, const std::string &name4); - osd_file::error open(const std::string &name, uint32_t crc); - osd_file::error open(const std::string &name1, const std::string &name2, uint32_t crc); - osd_file::error open(const std::string &name1, const std::string &name2, const std::string &name3, uint32_t crc); - osd_file::error open(const std::string &name1, const std::string &name2, const std::string &name3, const std::string &name4, uint32_t crc); + osd_file::error open(const std::string &name, u32 crc); + osd_file::error open(const std::string &name1, const std::string &name2, u32 crc); + osd_file::error open(const std::string &name1, const std::string &name2, const std::string &name3, u32 crc); + osd_file::error open(const std::string &name1, const std::string &name2, const std::string &name3, const std::string &name4, u32 crc); osd_file::error open_next(); - osd_file::error open_ram(const void *data, uint32_t length); + osd_file::error open_ram(const void *data, u32 length); void close(); // control osd_file::error compress(int compress); // position - int seek(int64_t offset, int whence); - uint64_t tell(); + int seek(s64 offset, int whence); + u64 tell(); bool eof(); - uint64_t size(); + u64 size(); // reading - uint32_t read(void *buffer, uint32_t length); + u32 read(void *buffer, u32 length); int getc(); int ungetc(int c); char *gets(char *s, int n); // writing - uint32_t write(const void *buffer, uint32_t length); + u32 write(const void *buffer, u32 length); int puts(const char *s); int vprintf(util::format_argument_pack const &args); template int printf(Format &&fmt, Params &&...args) @@ -155,21 +155,21 @@ private: osd_file::error load_zipped_file(); // internal state - std::string m_filename; // original filename provided - std::string m_fullpath; // full filename - util::core_file::ptr m_file; // core file pointer - path_iterator m_iterator; // iterator for paths - path_iterator m_mediapaths; // media-path iterator - uint32_t m_crc; // file's CRC - uint32_t m_openflags; // flags we used for the open - util::hash_collection m_hashes; // collection of hashes + std::string m_filename; // original filename provided + std::string m_fullpath; // full filename + util::core_file::ptr m_file; // core file pointer + path_iterator m_iterator; // iterator for paths + path_iterator m_mediapaths; // media-path iterator + u32 m_crc; // file's CRC + u32 m_openflags; // flags we used for the open + util::hash_collection m_hashes; // collection of hashes std::unique_ptr m_zipfile; // ZIP file pointer - std::vector m_zipdata; // ZIP file data - uint64_t m_ziplength; // ZIP file length + std::vector m_zipdata; // ZIP file data + u64 m_ziplength; // ZIP file length - bool m_remove_on_close; // flag: remove the file when closing - bool m_restrict_to_mediapath; // flag: restrict to paths inside the media-path + bool m_remove_on_close; // flag: remove the file when closing + bool m_restrict_to_mediapath; // flag: restrict to paths inside the media-path }; #endif // MAME_EMU_FILEIO_H diff --git a/src/emu/gamedrv.h b/src/emu/gamedrv.h index f6a14df64b1..09973005a57 100644 --- a/src/emu/gamedrv.h +++ b/src/emu/gamedrv.h @@ -8,10 +8,10 @@ ***************************************************************************/ -#pragma once +#ifndef MAME_EMU_GAMEDRV_H +#define MAME_EMU_GAMEDRV_H -#ifndef __GAMEDRV_H__ -#define __GAMEDRV_H__ +#pragma once //************************************************************************** @@ -19,44 +19,44 @@ //************************************************************************** // maxima -const int MAX_DRIVER_NAME_CHARS = 8; +constexpr int MAX_DRIVER_NAME_CHARS = 16; // flags for game drivers -const uint32_t ORIENTATION_MASK = 0x00000007; -const uint32_t MACHINE_NOT_WORKING = 0x00000008; -const uint32_t MACHINE_UNEMULATED_PROTECTION = 0x00000010; // game's protection not fully emulated -const uint32_t MACHINE_WRONG_COLORS = 0x00000020; // colors are totally wrong -const uint32_t MACHINE_IMPERFECT_COLORS = 0x00000040; // colors are not 100% accurate, but close -const uint32_t MACHINE_IMPERFECT_GRAPHICS = 0x00000080; // graphics are wrong/incomplete -const uint32_t MACHINE_NO_COCKTAIL = 0x00000100; // screen flip support is missing -const uint32_t MACHINE_NO_SOUND = 0x00000200; // sound is missing -const uint32_t MACHINE_IMPERFECT_SOUND = 0x00000400; // sound is known to be wrong -const uint32_t MACHINE_SUPPORTS_SAVE = 0x00000800; // game supports save states -const uint32_t MACHINE_IS_BIOS_ROOT = 0x00001000; // this driver entry is a BIOS root -const uint32_t MACHINE_NO_STANDALONE = 0x00002000; // this driver cannot stand alone -const uint32_t MACHINE_REQUIRES_ARTWORK = 0x00004000; // the driver requires external artwork for key elements of the game -const uint32_t MACHINE_UNOFFICIAL = 0x00008000; // unofficial hardware change -const uint32_t MACHINE_NO_SOUND_HW = 0x00010000; // sound hardware not available -const uint32_t MACHINE_MECHANICAL = 0x00020000; // contains mechanical parts (pinball, redemption games,...) -const uint32_t MACHINE_TYPE_ARCADE = 0x00040000; // arcade machine (coin operated machines) -const uint32_t MACHINE_TYPE_CONSOLE = 0x00080000; // console system -const uint32_t MACHINE_TYPE_COMPUTER = 0x00100000; // any kind of computer including home computers, minis, calcs,... -const uint32_t MACHINE_TYPE_OTHER = 0x00200000; // any other emulated system that doesn't fit above (ex. clock, satelite receiver,...) -const uint32_t MACHINE_IMPERFECT_KEYBOARD = 0x00400000; // keyboard is known to be wrong -const uint32_t MACHINE_CLICKABLE_ARTWORK = 0x00800000; // marking that artwork is clickable and require mouse cursor -const uint32_t MACHINE_IS_INCOMPLETE = 0x01000000; // any official game/system with blantantly incomplete HW or SW should be marked with this -const uint32_t MACHINE_NODEVICE_MICROPHONE = 0x02000000; // any game/system that has unemulated recording voice device peripheral -const uint32_t MACHINE_NODEVICE_CAMERA = 0x04000000; // any game/system that has unemulated capturing image device peripheral -const uint32_t MACHINE_NODEVICE_PRINTER = 0x08000000; // any game/system that has unemulated grabbing of screen content device -const uint32_t MACHINE_NODEVICE_LAN = 0x10000000; // any game/system that has unemulated multi-linking capability -const uint32_t MACHINE_NODEVICE_WAN = 0x20000000; // any game/system that has unemulated networking capability +constexpr u32 ORIENTATION_MASK = 0x00000007; +constexpr u32 MACHINE_NOT_WORKING = 0x00000008; +constexpr u32 MACHINE_UNEMULATED_PROTECTION = 0x00000010; // game's protection not fully emulated +constexpr u32 MACHINE_WRONG_COLORS = 0x00000020; // colors are totally wrong +constexpr u32 MACHINE_IMPERFECT_COLORS = 0x00000040; // colors are not 100% accurate, but close +constexpr u32 MACHINE_IMPERFECT_GRAPHICS = 0x00000080; // graphics are wrong/incomplete +constexpr u32 MACHINE_NO_COCKTAIL = 0x00000100; // screen flip support is missing +constexpr u32 MACHINE_NO_SOUND = 0x00000200; // sound is missing +constexpr u32 MACHINE_IMPERFECT_SOUND = 0x00000400; // sound is known to be wrong +constexpr u32 MACHINE_SUPPORTS_SAVE = 0x00000800; // game supports save states +constexpr u32 MACHINE_IS_BIOS_ROOT = 0x00001000; // this driver entry is a BIOS root +constexpr u32 MACHINE_NO_STANDALONE = 0x00002000; // this driver cannot stand alone +constexpr u32 MACHINE_REQUIRES_ARTWORK = 0x00004000; // the driver requires external artwork for key elements of the game +constexpr u32 MACHINE_UNOFFICIAL = 0x00008000; // unofficial hardware change +constexpr u32 MACHINE_NO_SOUND_HW = 0x00010000; // sound hardware not available +constexpr u32 MACHINE_MECHANICAL = 0x00020000; // contains mechanical parts (pinball, redemption games,...) +constexpr u32 MACHINE_TYPE_ARCADE = 0x00040000; // arcade machine (coin operated machines) +constexpr u32 MACHINE_TYPE_CONSOLE = 0x00080000; // console system +constexpr u32 MACHINE_TYPE_COMPUTER = 0x00100000; // any kind of computer including home computers, minis, calcs,... +constexpr u32 MACHINE_TYPE_OTHER = 0x00200000; // any other emulated system that doesn't fit above (ex. clock, satelite receiver,...) +constexpr u32 MACHINE_IMPERFECT_KEYBOARD = 0x00400000; // keyboard is known to be wrong +constexpr u32 MACHINE_CLICKABLE_ARTWORK = 0x00800000; // marking that artwork is clickable and require mouse cursor +constexpr u32 MACHINE_IS_INCOMPLETE = 0x01000000; // any official game/system with blantantly incomplete HW or SW should be marked with this +constexpr u32 MACHINE_NODEVICE_MICROPHONE = 0x02000000; // any game/system that has unemulated recording voice device peripheral +constexpr u32 MACHINE_NODEVICE_CAMERA = 0x04000000; // any game/system that has unemulated capturing image device peripheral +constexpr u32 MACHINE_NODEVICE_PRINTER = 0x08000000; // any game/system that has unemulated grabbing of screen content device +constexpr u32 MACHINE_NODEVICE_LAN = 0x10000000; // any game/system that has unemulated multi-linking capability +constexpr u32 MACHINE_NODEVICE_WAN = 0x20000000; // any game/system that has unemulated networking capability // useful combinations of flags -const uint32_t MACHINE_IS_SKELETON = MACHINE_NO_SOUND | MACHINE_NOT_WORKING; // mask for skelly games -const uint32_t MACHINE_IS_SKELETON_MECHANICAL = MACHINE_IS_SKELETON | MACHINE_MECHANICAL | MACHINE_REQUIRES_ARTWORK; // mask for skelly mechanical games -const uint32_t MACHINE_FATAL_FLAGS = MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION | MACHINE_MECHANICAL; // red disclaimer -const uint32_t MACHINE_WARNING_FLAGS = MACHINE_WRONG_COLORS | MACHINE_IMPERFECT_COLORS | MACHINE_REQUIRES_ARTWORK | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_KEYBOARD | MACHINE_NO_SOUND | MACHINE_NO_COCKTAIL | MACHINE_NODEVICE_MICROPHONE | MACHINE_NODEVICE_CAMERA | MACHINE_NODEVICE_PRINTER | MACHINE_NODEVICE_LAN | MACHINE_NODEVICE_WAN; // yellow disclaimer -const uint32_t MACHINE_BTANB_FLAGS = MACHINE_IS_INCOMPLETE | MACHINE_NO_SOUND_HW; // default disclaimer +constexpr u32 MACHINE_IS_SKELETON = MACHINE_NO_SOUND | MACHINE_NOT_WORKING; // mask for skelly games +constexpr u32 MACHINE_IS_SKELETON_MECHANICAL = MACHINE_IS_SKELETON | MACHINE_MECHANICAL | MACHINE_REQUIRES_ARTWORK; // mask for skelly mechanical games +constexpr u32 MACHINE_FATAL_FLAGS = MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION | MACHINE_MECHANICAL; // red disclaimer +constexpr u32 MACHINE_WARNING_FLAGS = MACHINE_WRONG_COLORS | MACHINE_IMPERFECT_COLORS | MACHINE_REQUIRES_ARTWORK | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_KEYBOARD | MACHINE_NO_SOUND | MACHINE_NO_COCKTAIL | MACHINE_NODEVICE_MICROPHONE | MACHINE_NODEVICE_CAMERA | MACHINE_NODEVICE_PRINTER | MACHINE_NODEVICE_LAN | MACHINE_NODEVICE_WAN; // yellow disclaimer +constexpr u32 MACHINE_BTANB_FLAGS = MACHINE_IS_INCOMPLETE | MACHINE_NO_SOUND_HW; // default disclaimer //************************************************************************** // TYPE DEFINITIONS @@ -79,7 +79,7 @@ struct game_driver void (*driver_init)(running_machine &machine); // DRIVER_INIT callback const tiny_rom_entry * rom; // pointer to list of ROMs for the game const char * compatible_with; - uint32_t flags; // orientation and other flags; see defines below + u32 flags; // orientation and other flags; see defines below const internal_layout * default_layout; // default internally defined layout }; @@ -195,4 +195,4 @@ extern const game_driver GAME_NAME(NAME) = \ }; -#endif +#endif // MAME_EMU_GAMEDRV_H diff --git a/src/emu/input.cpp b/src/emu/input.cpp index 91ff3350750..68882c2c3e4 100644 --- a/src/emu/input.cpp +++ b/src/emu/input.cpp @@ -27,7 +27,7 @@ //************************************************************************** // invalid memory value for axis polling -const int32_t INVALID_AXIS_VALUE = 0x7fffffff; +const s32 INVALID_AXIS_VALUE = 0x7fffffff; // additional expanded input codes for sequences const input_code input_seq::end_code(DEVICE_CLASS_INTERNAL, 0, ITEM_CLASS_INVALID, ITEM_MODIFIER_NONE, ITEM_ID_SEQ_END); @@ -49,7 +49,7 @@ const input_seq input_seq::empty_seq; // simple class to match codes to strings struct code_string_table { - uint32_t operator[](const char *string) const + u32 operator[](const char *string) const { for (const code_string_table *current = this; current->m_code != ~0; current++) if (strcmp(current->m_string, string) == 0) @@ -57,7 +57,7 @@ struct code_string_table return ~0; } - const char *operator[](uint32_t code) const + const char *operator[](u32 code) const { for (const code_string_table *current = this; current->m_code != ~0; current++) if (current->m_code == code) @@ -65,7 +65,7 @@ struct code_string_table return nullptr; } - uint32_t m_code; + u32 m_code; const char * m_string; }; @@ -594,10 +594,10 @@ input_manager::~input_manager() // input code //------------------------------------------------- -int32_t input_manager::code_value(input_code code) +s32 input_manager::code_value(input_code code) { g_profiler.start(PROFILER_INPUT); - int32_t result = 0; + s32 result = 0; // dummy loop to allow clean early exits do @@ -859,14 +859,14 @@ bool input_manager::code_check_axis(input_device_item &item, input_code code) // ignore min/max for lightguns // so the selection will not be affected by a gun going out of range - int32_t curval = code_value(code); + s32 curval = code_value(code); if (code.device_class() == DEVICE_CLASS_LIGHTGUN && (code.item_id() == ITEM_ID_XAXIS || code.item_id() == ITEM_ID_YAXIS) && (curval == INPUT_ABSOLUTE_MAX || curval == INPUT_ABSOLUTE_MIN)) return false; // compute the diff against memory - int32_t diff = curval - item.memory(); + s32 diff = curval - item.memory(); if (diff < 0) diff = -diff; @@ -1174,7 +1174,7 @@ input_code input_manager::code_from_token(const char *_token) // if we have another token, it is the item class if (curtok < numtokens) { - uint32_t temp = (*itemclass_token_table)[token[curtok].c_str()]; + u32 temp = (*itemclass_token_table)[token[curtok].c_str()]; if (temp != ~0) { curtok++; @@ -1259,14 +1259,14 @@ bool input_manager::seq_pressed(const input_seq &seq) // defined in an input sequence //------------------------------------------------- -int32_t input_manager::seq_axis_value(const input_seq &seq, input_item_class &itemclass) +s32 input_manager::seq_axis_value(const input_seq &seq, input_item_class &itemclass) { // start with no valid classes input_item_class itemclasszero = ITEM_CLASS_INVALID; itemclass = ITEM_CLASS_INVALID; // iterate over all of the codes - int32_t result = 0; + s32 result = 0; bool invert = false; bool enable = true; for (int codenum = 0; ; codenum++) @@ -1303,7 +1303,7 @@ int32_t input_manager::seq_axis_value(const input_seq &seq, input_item_class &it // non-switch codes are analog values else { - int32_t value = code_value(code); + s32 value = code_value(code); // if we got a 0 value, don't do anything except remember the first type if (value == 0) @@ -1565,7 +1565,7 @@ void input_manager::seq_from_tokens(input_seq &seq, const char *string) while (1) { // trim any leading spaces - while (*str != 0 && isspace((uint8_t)*str)) + while (*str != 0 && isspace(u8(*str))) str++; // bail if we're done @@ -1574,8 +1574,8 @@ void input_manager::seq_from_tokens(input_seq &seq, const char *string) // find the end of the token and make it upper-case along the way char *strtemp; - for (strtemp = str; *strtemp != 0 && !isspace((uint8_t)*strtemp); strtemp++) - *strtemp = toupper((uint8_t)*strtemp); + for (strtemp = str; *strtemp != 0 && !isspace(u8(*strtemp)); strtemp++) + *strtemp = toupper(u8(*strtemp)); char origspace = *strtemp; *strtemp = 0; diff --git a/src/emu/input.h b/src/emu/input.h index e8ed5aac5a3..f5bdcbbae18 100644 --- a/src/emu/input.h +++ b/src/emu/input.h @@ -14,8 +14,8 @@ #error Dont include this file directly; include emu.h instead. #endif -#ifndef __INPUT_H__ -#define __INPUT_H__ +#ifndef MAME_EMU_INPUT_H +#define MAME_EMU_INPUT_H //************************************************************************** @@ -23,19 +23,19 @@ //************************************************************************** // relative devices return ~512 units per onscreen pixel -const int32_t INPUT_RELATIVE_PER_PIXEL = 512; +constexpr s32 INPUT_RELATIVE_PER_PIXEL = 512; // absolute devices return values between -65536 and +65536 -const int32_t INPUT_ABSOLUTE_MIN = -65536; -const int32_t INPUT_ABSOLUTE_MAX = 65536; +constexpr s32 INPUT_ABSOLUTE_MIN = -65536; +constexpr s32 INPUT_ABSOLUTE_MAX = 65536; // maximum number of axis/buttons/hats with ITEM_IDs for use by osd layer -const int INPUT_MAX_AXIS = 8; -const int INPUT_MAX_BUTTONS = 32; -const int INPUT_MAX_HATS = 4; -const int INPUT_MAX_ADD_SWITCH = 16; -const int INPUT_MAX_ADD_ABSOLUTE = 16; -const int INPUT_MAX_ADD_RELATIVE = 16; +constexpr int INPUT_MAX_AXIS = 8; +constexpr int INPUT_MAX_BUTTONS = 32; +constexpr int INPUT_MAX_HATS = 4; +constexpr int INPUT_MAX_ADD_SWITCH = 16; +constexpr int INPUT_MAX_ADD_ABSOLUTE = 16; +constexpr int INPUT_MAX_ADD_RELATIVE = 16; // device classes @@ -395,7 +395,7 @@ public: private: // internal state - uint32_t m_internal; + u32 m_internal; }; @@ -459,7 +459,7 @@ public: input_class &device_class(input_device_class devclass) { assert(devclass >= DEVICE_CLASS_FIRST_VALID && devclass <= DEVICE_CLASS_LAST_VALID); return *m_class[devclass]; } // input code readers - int32_t code_value(input_code code); + s32 code_value(input_code code); bool code_pressed(input_code code) { return code_value(code) != 0; } bool code_pressed_once(input_code code); @@ -480,7 +480,7 @@ public: // input sequence readers bool seq_pressed(const input_seq &seq); - int32_t seq_axis_value(const input_seq &seq, input_item_class &itemclass); + s32 seq_axis_value(const input_seq &seq, input_item_class &itemclass); // input sequence polling void seq_poll_start(input_item_class itemclass, const input_seq *startseq = nullptr); @@ -962,4 +962,4 @@ private: -#endif // __INPUT_H__ +#endif // MAME_EMU_INPUT_H diff --git a/src/emu/inputdev.cpp b/src/emu/inputdev.cpp index ff58d63268b..380b42d9c3a 100644 --- a/src/emu/inputdev.cpp +++ b/src/emu/inputdev.cpp @@ -27,9 +27,9 @@ public: input_device_switch_item(input_device &device, const char *name, void *internal, input_item_id itemid, item_get_state_func getstate); // readers - virtual int32_t read_as_switch(input_item_modifier modifier) override; - virtual int32_t read_as_relative(input_item_modifier modifier) override; - virtual int32_t read_as_absolute(input_item_modifier modifier) override; + virtual s32 read_as_switch(input_item_modifier modifier) override; + virtual s32 read_as_relative(input_item_modifier modifier) override; + virtual s32 read_as_absolute(input_item_modifier modifier) override; // steadykey helper bool steadykey_changed(); @@ -37,8 +37,8 @@ public: private: // internal state - int32_t m_steadykey; // the live steadykey state - int32_t m_oldkey; // old live state + s32 m_steadykey; // the live steadykey state + s32 m_oldkey; // old live state }; @@ -52,9 +52,9 @@ public: input_device_relative_item(input_device &device, const char *name, void *internal, input_item_id itemid, item_get_state_func getstate); // readers - virtual int32_t read_as_switch(input_item_modifier modifier) override; - virtual int32_t read_as_relative(input_item_modifier modifier) override; - virtual int32_t read_as_absolute(input_item_modifier modifier) override; + virtual s32 read_as_switch(input_item_modifier modifier) override; + virtual s32 read_as_relative(input_item_modifier modifier) override; + virtual s32 read_as_absolute(input_item_modifier modifier) override; }; @@ -68,9 +68,9 @@ public: input_device_absolute_item(input_device &device, const char *name, void *internal, input_item_id itemid, item_get_state_func getstate); // readers - virtual int32_t read_as_switch(input_item_modifier modifier) override; - virtual int32_t read_as_relative(input_item_modifier modifier) override; - virtual int32_t read_as_absolute(input_item_modifier modifier) override; + virtual s32 read_as_switch(input_item_modifier modifier) override; + virtual s32 read_as_relative(input_item_modifier modifier) override; + virtual s32 read_as_absolute(input_item_modifier modifier) override; }; @@ -116,7 +116,7 @@ bool joystick_map::parse(const char *mapstring) if (*mapstring == 0 || *mapstring == '.') { bool symmetric = (rownum >= 5 && *mapstring == 0); - const uint8_t *srcrow = &m_map[symmetric ? (8 - rownum) : (rownum - 1)][0]; + const u8 *srcrow = &m_map[symmetric ? (8 - rownum) : (rownum - 1)][0]; // if this is row 0, we don't have a source row -- invalid if (rownum == 0) @@ -125,7 +125,7 @@ bool joystick_map::parse(const char *mapstring) // copy from the srcrow, applying up/down symmetry if in the bottom half for (int colnum = 0; colnum < 9; colnum++) { - uint8_t val = srcrow[colnum]; + u8 val = srcrow[colnum]; if (symmetric) val = (val & (JOYSTICK_MAP_LEFT | JOYSTICK_MAP_RIGHT)) | ((val & JOYSTICK_MAP_UP) << 1) | ((val & JOYSTICK_MAP_DOWN) >> 1); m_map[rownum][colnum] = val; @@ -141,7 +141,7 @@ bool joystick_map::parse(const char *mapstring) if (colnum > 0 && (*mapstring == 0 || *mapstring == '.')) { bool symmetric = (colnum >= 5); - uint8_t val = m_map[rownum][symmetric ? (8 - colnum) : (colnum - 1)]; + u8 val = m_map[rownum][symmetric ? (8 - colnum) : (colnum - 1)]; if (symmetric) val = (val & (JOYSTICK_MAP_UP | JOYSTICK_MAP_DOWN)) | ((val & JOYSTICK_MAP_LEFT) << 1) | ((val & JOYSTICK_MAP_RIGHT) >> 1); m_map[rownum][colnum] = val; @@ -150,7 +150,7 @@ bool joystick_map::parse(const char *mapstring) // otherwise, convert the character to its value else { - static const uint8_t charmap[] = + static const u8 charmap[] = { JOYSTICK_MAP_UP | JOYSTICK_MAP_LEFT, JOYSTICK_MAP_UP, @@ -221,12 +221,12 @@ std::string joystick_map::to_string() const // map based on the given X/Y axis values //------------------------------------------------- -uint8_t joystick_map::update(int32_t xaxisval, int32_t yaxisval) +u8 joystick_map::update(s32 xaxisval, s32 yaxisval) { // now map the X and Y axes to a 9x9 grid using the raw values xaxisval = ((xaxisval - INPUT_ABSOLUTE_MIN) * 9) / (INPUT_ABSOLUTE_MAX - INPUT_ABSOLUTE_MIN + 1); yaxisval = ((yaxisval - INPUT_ABSOLUTE_MIN) * 9) / (INPUT_ABSOLUTE_MAX - INPUT_ABSOLUTE_MIN + 1); - uint8_t mapval = m_map[yaxisval][xaxisval]; + u8 mapval = m_map[yaxisval][xaxisval]; // handle stickiness if (mapval == JOYSTICK_MAP_STICKY) @@ -406,8 +406,8 @@ input_device_lightgun::input_device_lightgun(input_manager &manager, const char input_device_joystick::input_device_joystick(input_manager &manager, const char *_name, const char *_id, void *_internal) : input_device(manager, _name, _id, _internal), - m_joystick_deadzone((int32_t)(manager.machine().options().joystick_deadzone() * INPUT_ABSOLUTE_MAX)), - m_joystick_saturation((int32_t)(manager.machine().options().joystick_saturation() * INPUT_ABSOLUTE_MAX)) + m_joystick_deadzone(s32(manager.machine().options().joystick_deadzone() * INPUT_ABSOLUTE_MAX)), + m_joystick_saturation(s32(manager.machine().options().joystick_saturation() * INPUT_ABSOLUTE_MAX)) { // get the default joystick map const char *mapstring = machine().options().joystick_map(); @@ -431,7 +431,7 @@ input_device_joystick::input_device_joystick(input_manager &manager, const char // absolute value //------------------------------------------------- -int32_t input_device_joystick::adjust_absolute_value(int32_t result) const +s32 input_device_joystick::adjust_absolute_value(s32 result) const { // properties are symmetric bool negative = false; @@ -451,7 +451,7 @@ int32_t input_device_joystick::adjust_absolute_value(int32_t result) const // otherwise, scale else - result = (int64_t)(result - m_joystick_deadzone) * (int64_t)INPUT_ABSOLUTE_MAX / (int64_t)(m_joystick_saturation - m_joystick_deadzone); + result = s64(result - m_joystick_deadzone) * s64(INPUT_ABSOLUTE_MAX) / s64(m_joystick_saturation - m_joystick_deadzone); // re-apply sign and return return negative ? -result : result; @@ -719,7 +719,7 @@ input_device_switch_item::input_device_switch_item(input_device &device, const c // modified as necessary //------------------------------------------------- -int32_t input_device_switch_item::read_as_switch(input_item_modifier modifier) +s32 input_device_switch_item::read_as_switch(input_item_modifier modifier) { // if we're doing a lightgun reload hack, button 1 and 2 operate differently input_device_class devclass = m_device.devclass(); @@ -752,7 +752,7 @@ int32_t input_device_switch_item::read_as_switch(input_item_modifier modifier) // a relative axis value //------------------------------------------------- -int32_t input_device_switch_item::read_as_relative(input_item_modifier modifier) +s32 input_device_switch_item::read_as_relative(input_item_modifier modifier) { // no translation to relative return 0; @@ -764,7 +764,7 @@ int32_t input_device_switch_item::read_as_relative(input_item_modifier modifier) // an absolute axis value //------------------------------------------------- -int32_t input_device_switch_item::read_as_absolute(input_item_modifier modifier) +s32 input_device_switch_item::read_as_absolute(input_item_modifier modifier) { // no translation to absolute return 0; @@ -779,7 +779,7 @@ int32_t input_device_switch_item::read_as_absolute(input_item_modifier modifier) bool input_device_switch_item::steadykey_changed() { - int32_t old = m_oldkey; + s32 old = m_oldkey; m_oldkey = update_value(); if (((m_current ^ old) & 1) == 0) return false; @@ -811,7 +811,7 @@ input_device_relative_item::input_device_relative_item(input_device &device, con // a switch result based on the modifier //------------------------------------------------- -int32_t input_device_relative_item::read_as_switch(input_item_modifier modifier) +s32 input_device_relative_item::read_as_switch(input_item_modifier modifier) { // process according to modifiers if (modifier == ITEM_MODIFIER_POS || modifier == ITEM_MODIFIER_RIGHT || modifier == ITEM_MODIFIER_DOWN) @@ -829,7 +829,7 @@ int32_t input_device_relative_item::read_as_switch(input_item_modifier modifier) // as a relative axis value //------------------------------------------------- -int32_t input_device_relative_item::read_as_relative(input_item_modifier modifier) +s32 input_device_relative_item::read_as_relative(input_item_modifier modifier) { // just return directly return update_value(); @@ -841,7 +841,7 @@ int32_t input_device_relative_item::read_as_relative(input_item_modifier modifie // as an absolute axis value //------------------------------------------------- -int32_t input_device_relative_item::read_as_absolute(input_item_modifier modifier) +s32 input_device_relative_item::read_as_absolute(input_item_modifier modifier) { // no translation to absolute return 0; @@ -868,10 +868,10 @@ input_device_absolute_item::input_device_absolute_item(input_device &device, con // a switch result based on the modifier //------------------------------------------------- -int32_t input_device_absolute_item::read_as_switch(input_item_modifier modifier) +s32 input_device_absolute_item::read_as_switch(input_item_modifier modifier) { // start with the current value - int32_t result = m_device.adjust_absolute(update_value()); + s32 result = m_device.adjust_absolute(update_value()); assert(result >= INPUT_ABSOLUTE_MIN && result <= INPUT_ABSOLUTE_MAX); // left/right/up/down: if this is a joystick, fetch the paired X/Y axis values and convert @@ -910,7 +910,7 @@ int32_t input_device_absolute_item::read_as_switch(input_item_modifier modifier) // as a relative axis value //------------------------------------------------- -int32_t input_device_absolute_item::read_as_relative(input_item_modifier modifier) +s32 input_device_absolute_item::read_as_relative(input_item_modifier modifier) { // no translation to relative return 0; @@ -923,10 +923,10 @@ int32_t input_device_absolute_item::read_as_relative(input_item_modifier modifie // tweaks //------------------------------------------------- -int32_t input_device_absolute_item::read_as_absolute(input_item_modifier modifier) +s32 input_device_absolute_item::read_as_absolute(input_item_modifier modifier) { // start with the current value - int32_t result = m_device.adjust_absolute(update_value()); + s32 result = m_device.adjust_absolute(update_value()); assert(result >= INPUT_ABSOLUTE_MIN && result <= INPUT_ABSOLUTE_MAX); // if we're doing a lightgun reload hack, override the value diff --git a/src/emu/inputdev.h b/src/emu/inputdev.h index 5b4adcd84f3..767e2b8978b 100644 --- a/src/emu/inputdev.h +++ b/src/emu/inputdev.h @@ -25,7 +25,7 @@ class input_manager; // callback for getting the value of an item on a device -typedef int32_t (*item_get_state_func)(void *device_internal, void *item_internal); +typedef s32 (*item_get_state_func)(void *device_internal, void *item_internal); // ======================> joystick_map @@ -47,15 +47,15 @@ public: std::string to_string() const; // update the state of a live map - uint8_t update(int32_t xaxisval, int32_t yaxisval); + u8 update(s32 xaxisval, s32 yaxisval); // joystick mapping codes - static const uint8_t JOYSTICK_MAP_NEUTRAL = 0x00; - static const uint8_t JOYSTICK_MAP_LEFT = 0x01; - static const uint8_t JOYSTICK_MAP_RIGHT = 0x02; - static const uint8_t JOYSTICK_MAP_UP = 0x04; - static const uint8_t JOYSTICK_MAP_DOWN = 0x08; - static const uint8_t JOYSTICK_MAP_STICKY = 0x0f; + static constexpr u8 JOYSTICK_MAP_NEUTRAL = 0x00; + static constexpr u8 JOYSTICK_MAP_LEFT = 0x01; + static constexpr u8 JOYSTICK_MAP_RIGHT = 0x02; + static constexpr u8 JOYSTICK_MAP_UP = 0x04; + static constexpr u8 JOYSTICK_MAP_DOWN = 0x08; + static constexpr u8 JOYSTICK_MAP_STICKY = 0x0f; private: // internal helpers @@ -67,8 +67,8 @@ private: } // internal state - uint8_t m_map[9][9]; // 9x9 grid - uint8_t m_lastmap; // last value returned (for sticky tracking) + u8 m_map[9][9]; // 9x9 grid + u8 m_lastmap; // last value returned (for sticky tracking) std::string m_origstring; // originally parsed string }; @@ -95,17 +95,17 @@ public: input_item_class itemclass() const { return m_itemclass; } input_code code() const; const char *token() const { return m_token.c_str(); } - int32_t current() const { return m_current; } - int32_t memory() const { return m_memory; } + s32 current() const { return m_current; } + s32 memory() const { return m_memory; } // helpers - int32_t update_value(); - void set_memory(int32_t value) { m_memory = value; } + s32 update_value(); + void set_memory(s32 value) { m_memory = value; } // readers - virtual int32_t read_as_switch(input_item_modifier modifier) = 0; - virtual int32_t read_as_relative(input_item_modifier modifier) = 0; - virtual int32_t read_as_absolute(input_item_modifier modifier) = 0; + virtual s32 read_as_switch(input_item_modifier modifier) = 0; + virtual s32 read_as_relative(input_item_modifier modifier) = 0; + virtual s32 read_as_absolute(input_item_modifier modifier) = 0; protected: // internal state @@ -118,8 +118,8 @@ protected: std::string m_token; // tokenized name for non-standard items // live state - int32_t m_current; // current raw value - int32_t m_memory; // "memory" value, to remember where we started during polling + s32 m_current; // current raw value + s32 m_memory; // "memory" value, to remember where we started during polling }; @@ -155,13 +155,13 @@ public: input_item_id add_item(const char *name, input_item_id itemid, item_get_state_func getstate, void *internal = nullptr); // helpers - int32_t adjust_absolute(int32_t value) const { return adjust_absolute_value(value); } + s32 adjust_absolute(s32 value) const { return adjust_absolute_value(value); } bool match_device_id(const char *deviceid); protected: // specific overrides virtual input_device_class device_class() const = 0; - virtual int32_t adjust_absolute_value(int32_t value) const { return value; } + virtual s32 adjust_absolute_value(s32 value) const { return value; } private: // internal state @@ -241,13 +241,13 @@ public: protected: // specific overrides virtual input_device_class device_class() const override { return DEVICE_CLASS_JOYSTICK; } - virtual int32_t adjust_absolute_value(int32_t value) const override; + virtual s32 adjust_absolute_value(s32 value) const override; private: // joystick information joystick_map m_joymap; // joystick map for this device - int32_t m_joystick_deadzone; // deadzone for joystick - int32_t m_joystick_saturation; // saturation position for joystick + s32 m_joystick_deadzone; // deadzone for joystick + s32 m_joystick_saturation; // saturation position for joystick }; @@ -393,7 +393,7 @@ protected: inline input_manager &input_device_item::manager() const { return m_device.manager(); } inline running_machine &input_device_item::machine() const { return m_device.machine(); } inline input_code input_device_item::code() const { return input_code(m_device.devclass(), m_device.devindex(), m_itemclass, ITEM_MODIFIER_NONE, m_itemid); } -inline int32_t input_device_item::update_value() { return m_current = (*m_getstate)(m_device.internal(), m_internal); } +inline s32 input_device_item::update_value() { return m_current = (*m_getstate)(m_device.internal(), m_internal); } diff --git a/src/emu/ioport.cpp b/src/emu/ioport.cpp index 7892225d817..5e268ffa750 100644 --- a/src/emu/ioport.cpp +++ b/src/emu/ioport.cpp @@ -129,9 +129,9 @@ const int SPACE_COUNT = 3; // from a numerator and a denominator //------------------------------------------------- -inline int64_t compute_scale(int32_t num, int32_t den) +inline s64 compute_scale(s32 num, s32 den) { - return (int64_t(num) << 24) / den; + return (s64(num) << 24) / den; } @@ -140,9 +140,9 @@ inline int64_t compute_scale(int32_t num, int32_t den) // an 8.24 scale value //------------------------------------------------- -inline int64_t recip_scale(int64_t scale) +inline s64 recip_scale(s64 scale) { - return (int64_t(1) << 48) / scale; + return (s64(1) << 48) / scale; } @@ -151,9 +151,9 @@ inline int64_t recip_scale(int64_t scale) // a 32-bit value //------------------------------------------------- -inline int32_t apply_scale(int32_t value, int64_t scale) +inline s32 apply_scale(s32 value, s64 scale) { - return (int64_t(value) * scale) >> 24; + return (s64(value) * scale) >> 24; } @@ -164,7 +164,7 @@ inline int32_t apply_scale(int32_t value, int64_t scale) const struct { - uint32_t id; + u32 id; const char *string; } input_port_default_strings[] = { @@ -296,7 +296,7 @@ const struct const char *const ioport_manager::seqtypestrings[] = { "standard", "increment", "decrement" }; -std::uint8_t const inp_header::MAGIC[inp_header::OFFS_BASETIME - inp_header::OFFS_MAGIC] = { 'M', 'A', 'M', 'E', 'I', 'N', 'P', 0 }; +u8 const inp_header::MAGIC[inp_header::OFFS_BASETIME - inp_header::OFFS_MAGIC] = { 'M', 'A', 'M', 'E', 'I', 'N', 'P', 0 }; @@ -573,7 +573,7 @@ ioport_setting::ioport_setting(ioport_field &field, ioport_value _value, const c // ioport_diplocation - constructor //------------------------------------------------- -ioport_diplocation::ioport_diplocation(const char *name, uint8_t swnum, bool invert) +ioport_diplocation::ioport_diplocation(const char *name, u8 swnum, bool invert) : m_next(nullptr), m_name(name), m_number(swnum), @@ -1151,7 +1151,7 @@ void ioport_field::frame_update(ioport_value &result) // additional logic to restrict digital joysticks if (curstate && !m_digital_value && m_live->joystick != nullptr && m_way != 16 && !machine().options().joystick_contradictory()) { - uint8_t mask = (m_way == 4) ? m_live->joystick->current4way() : m_live->joystick->current(); + u8 mask = (m_way == 4) ? m_live->joystick->current4way() : m_live->joystick->current(); if (!(mask & (1 << m_live->joydir))) curstate = false; } @@ -1852,7 +1852,7 @@ ioport_manager::~ioport_manager() // type/player //------------------------------------------------- -const char *ioport_manager::type_name(ioport_type type, uint8_t player) +const char *ioport_manager::type_name(ioport_type type, u8 player) { // if we have a machine, use the live state and quick lookup input_type_entry *entry = m_type_to_entry[type][player]; @@ -2063,7 +2063,7 @@ g_profiler.stop(); // values based on the time between frames //------------------------------------------------- -int32_t ioport_manager::frame_interpolate(int32_t oldval, int32_t newval) +s32 ioport_manager::frame_interpolate(s32 oldval, s32 newval) { // if no last delta, just use new value if (m_last_delta_nsec == 0) @@ -2071,7 +2071,7 @@ int32_t ioport_manager::frame_interpolate(int32_t oldval, int32_t newval) // otherwise, interpolate attoseconds_t nsec_since_last = (machine().time() - m_last_frame_time).as_attoseconds() / ATTOSECONDS_PER_NANOSECOND; - return oldval + (int64_t(newval - oldval) * nsec_since_last / m_last_delta_nsec); + return oldval + (s64(newval - oldval) * nsec_since_last / m_last_delta_nsec); } @@ -2504,7 +2504,7 @@ _Type ioport_manager::playback_read(_Type &result) template<> bool ioport_manager::playback_read(bool &result) { - uint8_t temp; + u8 temp; playback_read(temp); return result = bool(temp); } @@ -2571,8 +2571,8 @@ void ioport_manager::playback_end(const char *message) // display speed stats if (m_playback_accumulated_speed > 0) m_playback_accumulated_speed /= m_playback_accumulated_frames; - osd_printf_info("Total playback frames: %d\n", uint32_t(m_playback_accumulated_frames)); - osd_printf_info("Average recorded speed: %d%%\n", uint32_t((m_playback_accumulated_speed * 200 + 1) >> 21)); + osd_printf_info("Total playback frames: %d\n", u32(m_playback_accumulated_frames)); + osd_printf_info("Average recorded speed: %d%%\n", u32((m_playback_accumulated_speed * 200 + 1) >> 21)); // close the program at the end of inp file playback if (machine().options().exit_after_playback()) { @@ -2603,7 +2603,7 @@ void ioport_manager::playback_frame(const attotime &curtime) playback_end("Out of sync"); // then the speed - uint32_t curspeed; + u32 curspeed; m_playback_accumulated_speed += playback_read(curspeed); m_playback_accumulated_frames++; } @@ -2657,7 +2657,7 @@ void ioport_manager::record_write(_Type value) template<> void ioport_manager::record_write(bool value) { - uint8_t byte = uint8_t(value); + u8 byte = u8(value); record_write(byte); } @@ -2676,7 +2676,7 @@ void ioport_manager::timecode_write(_Type value) /*template<> void ioport_manager::timecode_write(bool value) { - uint8_t byte = uint8_t(value); + u8 byte = u8(value); timecode_write(byte); }*/ template<> @@ -2805,7 +2805,7 @@ void ioport_manager::record_frame(const attotime &curtime) record_write(curtime.attoseconds()); // then the current speed - record_write(uint32_t(machine().video().speed_percent() * double(1 << 20))); + record_write(u32(machine().video().speed_percent() * double(1 << 20))); } if (m_timecode_file.is_open() && machine().video().get_timecode_write()) @@ -3382,12 +3382,12 @@ analog_field::analog_field(ioport_field &field) // the appropriate min/max for the analog control //------------------------------------------------- -inline int32_t analog_field::apply_min_max(int32_t value) const +inline s32 analog_field::apply_min_max(s32 value) const { // take the analog minimum and maximum values and apply the inverse of the // sensitivity so that we can clamp against them before applying sensitivity - int32_t adjmin = apply_inverse_sensitivity(m_minimum); - int32_t adjmax = apply_inverse_sensitivity(m_maximum); + s32 adjmin = apply_inverse_sensitivity(m_minimum); + s32 adjmax = apply_inverse_sensitivity(m_maximum); // for absolute devices, clamp to the bounds absolutely if (!m_wraps) @@ -3401,7 +3401,7 @@ inline int32_t analog_field::apply_min_max(int32_t value) const // for relative devices, wrap around when we go past the edge else { - int32_t range = adjmax - adjmin; + s32 range = adjmax - adjmin; // rolls to other end when 1 position past end. value = (value - adjmin) % range; if (value < 0) @@ -3418,9 +3418,9 @@ inline int32_t analog_field::apply_min_max(int32_t value) const // adjustment for a current value //------------------------------------------------- -inline int32_t analog_field::apply_sensitivity(int32_t value) const +inline s32 analog_field::apply_sensitivity(s32 value) const { - return int32_t((int64_t(value) * m_sensitivity) / 100.0 + 0.5); + return s32((s64(value) * m_sensitivity) / 100.0 + 0.5); } @@ -3429,9 +3429,9 @@ inline int32_t analog_field::apply_sensitivity(int32_t value) const // sensitivity adjustment for a current value //------------------------------------------------- -inline int32_t analog_field::apply_inverse_sensitivity(int32_t value) const +inline s32 analog_field::apply_inverse_sensitivity(s32 value) const { - return int32_t((int64_t(value) * 100) / m_sensitivity); + return s32((s64(value) * 100) / m_sensitivity); } @@ -3440,7 +3440,7 @@ inline int32_t analog_field::apply_inverse_sensitivity(int32_t value) const // analog input //------------------------------------------------- -int32_t analog_field::apply_settings(int32_t value) const +s32 analog_field::apply_settings(s32 value) const { // apply the min/max and then the sensitivity value = apply_min_max(value); @@ -3477,7 +3477,7 @@ void analog_field::frame_update(running_machine &machine) // get the new raw analog value and its type input_item_class itemclass; - int32_t rawvalue = machine.input().seq_axis_value(m_field.seq(SEQ_TYPE_STANDARD), itemclass); + s32 rawvalue = machine.input().seq_axis_value(m_field.seq(SEQ_TYPE_STANDARD), itemclass); // if we got an absolute input, it overrides everything else if (itemclass == ITEM_CLASS_ABSOLUTE) @@ -3525,14 +3525,14 @@ void analog_field::frame_update(running_machine &machine) // if we got it from a relative device, use that as the starting delta // also note that the last input was not a digital one - int32_t delta = 0; + s32 delta = 0; if (itemclass == ITEM_CLASS_RELATIVE && rawvalue != 0) { delta = rawvalue; m_lastdigital = false; } - int64_t keyscale = (m_accum >= 0) ? m_keyscalepos : m_keyscaleneg; + s64 keyscale = (m_accum >= 0) ? m_keyscalepos : m_keyscaleneg; // if the decrement code sequence is pressed, add the key delta to // the accumulated delta; also note that the last input was a digital one @@ -3575,7 +3575,7 @@ void analog_field::frame_update(running_machine &machine) // was pressed, apply autocentering if (m_autocenter) { - int32_t center = apply_inverse_sensitivity(m_center); + s32 center = apply_inverse_sensitivity(m_center); if (m_lastdigital && !keypressed) { // autocenter from positive values @@ -3618,7 +3618,7 @@ void analog_field::read(ioport_value &result) return; // start with the raw value - int32_t value = m_accum; + s32 value = m_accum; // interpolate if appropriate and if time has passed since the last update if (m_interpolate) @@ -3647,7 +3647,7 @@ void analog_field::read(ioport_value &result) float analog_field::crosshair_read() { - int32_t rawvalue = apply_settings(m_accum) & (m_field.mask() >> m_shift); + s32 rawvalue = apply_settings(m_accum) & (m_field.mask() >> m_shift); return float(rawvalue - m_adjmin) / float(m_adjmax - m_adjmin); } diff --git a/src/emu/ioport.h b/src/emu/ioport.h index 8c46e38e3f4..2f266261698 100644 --- a/src/emu/ioport.h +++ b/src/emu/ioport.h @@ -14,8 +14,8 @@ #error Dont include this file directly; include emu.h instead. #endif -#ifndef __INPTPORT_H__ -#define __INPTPORT_H__ +#ifndef MAME_EMU_IOPORT_H +#define MAME_EMU_IOPORT_H #include #include @@ -27,7 +27,7 @@ //************************************************************************** // input ports support up to 32 bits each -typedef uint32_t ioport_value; +typedef u32 ioport_value; // active high/low values for input ports const ioport_value IP_ACTIVE_HIGH = 0x00000000; @@ -696,17 +696,17 @@ public: { return 0 == std::memcmp(MAGIC, m_data + OFFS_MAGIC, OFFS_BASETIME - OFFS_MAGIC); } - std::uint64_t get_basetime() const + u64 get_basetime() const { return - (std::uint64_t(m_data[OFFS_BASETIME + 0]) << (0 * 8)) | - (std::uint64_t(m_data[OFFS_BASETIME + 1]) << (1 * 8)) | - (std::uint64_t(m_data[OFFS_BASETIME + 2]) << (2 * 8)) | - (std::uint64_t(m_data[OFFS_BASETIME + 3]) << (3 * 8)) | - (std::uint64_t(m_data[OFFS_BASETIME + 4]) << (4 * 8)) | - (std::uint64_t(m_data[OFFS_BASETIME + 5]) << (5 * 8)) | - (std::uint64_t(m_data[OFFS_BASETIME + 6]) << (6 * 8)) | - (std::uint64_t(m_data[OFFS_BASETIME + 7]) << (7 * 8)); + (u64(m_data[OFFS_BASETIME + 0]) << (0 * 8)) | + (u64(m_data[OFFS_BASETIME + 1]) << (1 * 8)) | + (u64(m_data[OFFS_BASETIME + 2]) << (2 * 8)) | + (u64(m_data[OFFS_BASETIME + 3]) << (3 * 8)) | + (u64(m_data[OFFS_BASETIME + 4]) << (4 * 8)) | + (u64(m_data[OFFS_BASETIME + 5]) << (5 * 8)) | + (u64(m_data[OFFS_BASETIME + 6]) << (6 * 8)) | + (u64(m_data[OFFS_BASETIME + 7]) << (7 * 8)); } unsigned get_majversion() const { @@ -729,16 +729,16 @@ public: { std::memcpy(m_data + OFFS_MAGIC, MAGIC, OFFS_BASETIME - OFFS_MAGIC); } - void set_basetime(std::uint64_t time) + void set_basetime(u64 time) { - m_data[OFFS_BASETIME + 0] = std::uint8_t((time >> (0 * 8)) & 0x00ff); - m_data[OFFS_BASETIME + 1] = std::uint8_t((time >> (1 * 8)) & 0x00ff); - m_data[OFFS_BASETIME + 2] = std::uint8_t((time >> (2 * 8)) & 0x00ff); - m_data[OFFS_BASETIME + 3] = std::uint8_t((time >> (3 * 8)) & 0x00ff); - m_data[OFFS_BASETIME + 4] = std::uint8_t((time >> (4 * 8)) & 0x00ff); - m_data[OFFS_BASETIME + 5] = std::uint8_t((time >> (5 * 8)) & 0x00ff); - m_data[OFFS_BASETIME + 6] = std::uint8_t((time >> (6 * 8)) & 0x00ff); - m_data[OFFS_BASETIME + 7] = std::uint8_t((time >> (7 * 8)) & 0x00ff); + m_data[OFFS_BASETIME + 0] = u8((time >> (0 * 8)) & 0x00ff); + m_data[OFFS_BASETIME + 1] = u8((time >> (1 * 8)) & 0x00ff); + m_data[OFFS_BASETIME + 2] = u8((time >> (2 * 8)) & 0x00ff); + m_data[OFFS_BASETIME + 3] = u8((time >> (3 * 8)) & 0x00ff); + m_data[OFFS_BASETIME + 4] = u8((time >> (4 * 8)) & 0x00ff); + m_data[OFFS_BASETIME + 5] = u8((time >> (5 * 8)) & 0x00ff); + m_data[OFFS_BASETIME + 6] = u8((time >> (6 * 8)) & 0x00ff); + m_data[OFFS_BASETIME + 7] = u8((time >> (7 * 8)) & 0x00ff); } void set_version() { @@ -777,9 +777,9 @@ private: static constexpr std::size_t OFFS_APPDESC = 0x20; // 0x20 bytes (ASCII) static constexpr std::size_t OFFS_END = 0x40; - static std::uint8_t const MAGIC[OFFS_BASETIME - OFFS_MAGIC]; + static u8 const MAGIC[OFFS_BASETIME - OFFS_MAGIC]; - std::uint8_t m_data[OFFS_END]; + u8 m_data[OFFS_END]; }; @@ -811,7 +811,7 @@ public: input_type_entry *next() const { return m_next; } ioport_type type() const { return m_type; } ioport_group group() const { return m_group; } - uint8_t player() const { return m_player; } + u8 player() const { return m_player; } const char *token() const { return m_token; } const char *name() const { return m_name; } input_seq &defseq(input_seq_type seqtype = SEQ_TYPE_STANDARD) { return m_defseq[seqtype]; } @@ -826,7 +826,7 @@ private: input_type_entry * m_next; // next description in the list ioport_type m_type; // IPT_* for this entry ioport_group m_group; // which group the port belongs to - uint8_t m_player; // player number (0 is player 1) + u8 m_player; // player number (0 is player 1) const char * m_token; // token used to store settings const char * m_name; // user-friendly name input_seq m_defseq[SEQ_TYPE_TOTAL];// default input sequence @@ -854,10 +854,10 @@ public: }; // bit constants - static const uint8_t UP_BIT = 1 << JOYDIR_UP; - static const uint8_t DOWN_BIT = 1 << JOYDIR_DOWN; - static const uint8_t LEFT_BIT = 1 << JOYDIR_LEFT; - static const uint8_t RIGHT_BIT = 1 << JOYDIR_RIGHT; + static constexpr u8 UP_BIT = 1 << JOYDIR_UP; + static constexpr u8 DOWN_BIT = 1 << JOYDIR_DOWN; + static constexpr u8 LEFT_BIT = 1 << JOYDIR_LEFT; + static constexpr u8 RIGHT_BIT = 1 << JOYDIR_RIGHT; // construction/destruction digital_joystick(int player, int number); @@ -866,8 +866,8 @@ public: digital_joystick *next() const { return m_next; } int player() const { return m_player; } int number() const { return m_number; } - uint8_t current() const { return m_current; } - uint8_t current4way() const { return m_current4way; } + u8 current() const { return m_current; } + u8 current4way() const { return m_current4way; } // configuration direction_t add_axis(ioport_field &field); @@ -881,9 +881,9 @@ private: int m_player; // player number represented int m_number; // joystick number represented simple_list > m_field[JOYDIR_COUNT]; // potential input fields for each direction - uint8_t m_current; // current value - uint8_t m_current4way; // current 4-way value - uint8_t m_previous; // previous value + u8 m_current; // current value + u8 m_current4way; // current 4-way value + u8 m_previous; // previous value }; DECLARE_ENUM_OPERATORS(digital_joystick::direction_t) @@ -984,18 +984,18 @@ class ioport_diplocation public: // construction/destruction - ioport_diplocation(const char *name, uint8_t swnum, bool invert); + ioport_diplocation(const char *name, u8 swnum, bool invert); // getters ioport_diplocation *next() const { return m_next; } const char *name() const { return m_name.c_str(); } - uint8_t number() const { return m_number; } + u8 number() const { return m_number; } bool inverted() const { return m_invert; } private: ioport_diplocation * m_next; // pointer to the next bit std::string m_name; // name of the physical DIP switch - uint8_t m_number; // physical switch number + u8 m_number; // physical switch number bool m_invert; // is this an active-high DIP? }; @@ -1039,7 +1039,7 @@ public: ioport_value defvalue() const { return m_defvalue; } ioport_condition &condition() { return m_condition; } ioport_type type() const { return m_type; } - uint8_t player() const { return m_player; } + u8 player() const { return m_player; } bool digital_value() const { return m_digital_value; } void set_value(ioport_value value); @@ -1052,7 +1052,7 @@ public: bool analog_wraps() const { return ((m_flags & ANALOG_FLAG_WRAPS) != 0); } bool analog_invert() const { return ((m_flags & ANALOG_FLAG_INVERT) != 0); } - uint8_t impulse() const { return m_impulse; } + u8 impulse() const { return m_impulse; } const char *name() const; const char *specific_name() const { return m_name; } const input_seq &seq(input_seq_type seqtype = SEQ_TYPE_STANDARD) const; @@ -1063,16 +1063,16 @@ public: ioport_value minval() const { return m_min; } ioport_value maxval() const { return m_max; } - int32_t sensitivity() const { return m_sensitivity; } - int32_t delta() const { return m_delta; } - int32_t centerdelta() const { return m_centerdelta; } + s32 sensitivity() const { return m_sensitivity; } + s32 delta() const { return m_delta; } + s32 centerdelta() const { return m_centerdelta; } crosshair_axis_t crosshair_axis() const { return m_crosshair_axis; } double crosshair_scale() const { return m_crosshair_scale; } double crosshair_offset() const { return m_crosshair_offset; } - uint16_t full_turn_count() const { return m_full_turn_count; } + u16 full_turn_count() const { return m_full_turn_count; } const ioport_value *remap_table() const { return m_remap_table; } - uint8_t way() const { return m_way; } + u8 way() const { return m_way; } char32_t keyboard_code(int which) const; std::string key_name(int which) const; ioport_field_live &live() const { assert(m_live != nullptr); return *m_live; } @@ -1080,7 +1080,7 @@ public: // setters void set_crosshair_scale(double scale) { m_crosshair_scale = scale; } void set_crosshair_offset(double offset) { m_crosshair_offset = offset; } - void set_player(uint8_t player) { m_player = player; } + void set_player(u8 player) { m_player = player; } // derived getters ioport_type_class type_class() const; @@ -1105,9 +1105,9 @@ public: ioport_value value; // for DIP switches bool autofire; // for autofire settings input_seq seq[SEQ_TYPE_TOTAL]; // sequences of all types - int32_t sensitivity; // for analog controls - int32_t delta; // for analog controls - int32_t centerdelta; // for analog controls + s32 sensitivity; // for analog controls + s32 delta; // for analog controls + s32 centerdelta; // for analog controls bool reverse; // for analog controls bool toggle; // for non-analog controls }; @@ -1130,9 +1130,9 @@ private: ioport_value m_defvalue; // default value of these bits ioport_condition m_condition; // condition under which this field is relevant ioport_type m_type; // IPT_* type for this port - uint8_t m_player; // player number (0-based) - uint32_t m_flags; // combination of FIELD_FLAG_* and ANALOG_FLAG_* above - uint8_t m_impulse; // number of frames before reverting to defvalue + u8 m_player; // player number (0-based) + u32 m_flags; // combination of FIELD_FLAG_* and ANALOG_FLAG_* above + u8 m_impulse; // number of frames before reverting to defvalue const char * m_name; // user-friendly name to display input_seq m_seq[SEQ_TYPE_TOTAL];// sequences of all types ioport_field_read_delegate m_read; // read callback routine @@ -1146,20 +1146,20 @@ private: // data relevant to analog control types ioport_value m_min; // minimum value for absolute axes ioport_value m_max; // maximum value for absolute axes - int32_t m_sensitivity; // sensitivity (100=normal) - int32_t m_delta; // delta to apply each frame a digital inc/dec key is pressed - int32_t m_centerdelta; // delta to apply each frame no digital inputs are pressed + s32 m_sensitivity; // sensitivity (100=normal) + s32 m_delta; // delta to apply each frame a digital inc/dec key is pressed + s32 m_centerdelta; // delta to apply each frame no digital inputs are pressed crosshair_axis_t m_crosshair_axis; // crosshair axis double m_crosshair_scale; // crosshair scale double m_crosshair_offset; // crosshair offset double m_crosshair_altaxis;// crosshair alternate axis value ioport_field_crossmap_delegate m_crosshair_mapper; // crosshair mapping function - uint16_t m_full_turn_count; // number of optical counts for 1 full turn of the original control + u16 m_full_turn_count; // number of optical counts for 1 full turn of the original control const ioport_value * m_remap_table; // pointer to an array that remaps the port value // data relevant to other specific types - uint8_t m_way; // digital joystick 2/4/8-way descriptions - char32_t m_chars[4]; // unicode key data + u8 m_way; // digital joystick 2/4/8-way descriptions + char32_t m_chars[4]; // unicode key data }; @@ -1176,7 +1176,7 @@ struct ioport_field_live digital_joystick * joystick; // pointer to digital joystick information input_seq seq[SEQ_TYPE_TOTAL];// currently configured input sequences ioport_value value; // current value of this port - uint8_t impulse; // counter for impulse controls + u8 impulse; // counter for impulse controls bool last; // were we pressed last time? bool toggle; // current toggle setting digital_joystick::direction_t joydir; // digital joystick direction index @@ -1269,10 +1269,10 @@ public: analog_field *next() const { return m_next; } ioport_manager &manager() const { return m_field.manager(); } ioport_field &field() const { return m_field; } - int32_t sensitivity() const { return m_sensitivity; } + s32 sensitivity() const { return m_sensitivity; } bool reverse() const { return m_reverse; } - int32_t delta() const { return m_delta; } - int32_t centerdelta() const { return m_centerdelta; } + s32 delta() const { return m_delta; } + s32 centerdelta() const { return m_centerdelta; } // readers void read(ioport_value &value); @@ -1281,44 +1281,44 @@ public: private: // helpers - int32_t apply_min_max(int32_t value) const; - int32_t apply_settings(int32_t value) const; - int32_t apply_sensitivity(int32_t value) const; - int32_t apply_inverse_sensitivity(int32_t value) const; + s32 apply_min_max(s32 value) const; + s32 apply_settings(s32 value) const; + s32 apply_sensitivity(s32 value) const; + s32 apply_inverse_sensitivity(s32 value) const; // internal state analog_field * m_next; // link to the next analog state for this port ioport_field & m_field; // pointer to the input field referenced // adjusted values (right-justified and tweaked) - uint8_t m_shift; // shift to align final value in the port - int32_t m_adjdefvalue; // adjusted default value from the config - int32_t m_adjmin; // adjusted minimum value from the config - int32_t m_adjmax; // adjusted maximum value from the config + u8 m_shift; // shift to align final value in the port + s32 m_adjdefvalue; // adjusted default value from the config + s32 m_adjmin; // adjusted minimum value from the config + s32 m_adjmax; // adjusted maximum value from the config // live values of configurable parameters - int32_t m_sensitivity; // current live sensitivity (100=normal) + s32 m_sensitivity; // current live sensitivity (100=normal) bool m_reverse; // current live reverse flag - int32_t m_delta; // current live delta to apply each frame a digital inc/dec key is pressed - int32_t m_centerdelta; // current live delta to apply each frame no digital inputs are pressed + s32 m_delta; // current live delta to apply each frame a digital inc/dec key is pressed + s32 m_centerdelta; // current live delta to apply each frame no digital inputs are pressed // live analog value tracking - int32_t m_accum; // accumulated value (including relative adjustments) - int32_t m_previous; // previous adjusted value - int32_t m_previousanalog; // previous analog value + s32 m_accum; // accumulated value (including relative adjustments) + s32 m_previous; // previous adjusted value + s32 m_previousanalog; // previous analog value // parameters for modifying live values - int32_t m_minimum; // minimum adjusted value - int32_t m_maximum; // maximum adjusted value - int32_t m_center; // center adjusted value for autocentering - int32_t m_reverse_val; // value where we subtract from to reverse directions + s32 m_minimum; // minimum adjusted value + s32 m_maximum; // maximum adjusted value + s32 m_center; // center adjusted value for autocentering + s32 m_reverse_val; // value where we subtract from to reverse directions // scaling factors - int64_t m_scalepos; // scale factor to apply to positive adjusted values - int64_t m_scaleneg; // scale factor to apply to negative adjusted values - int64_t m_keyscalepos; // scale factor to apply to the key delta field when pos - int64_t m_keyscaleneg; // scale factor to apply to the key delta field when neg - int64_t m_positionalscale; // scale factor to divide a joystick into positions + s64 m_scalepos; // scale factor to apply to positive adjusted values + s64 m_scaleneg; // scale factor to apply to negative adjusted values + s64 m_keyscalepos; // scale factor to apply to the key delta field when pos + s64 m_keyscaleneg; // scale factor to apply to the key delta field when neg + s64 m_positionalscale; // scale factor to divide a joystick into positions // misc flags bool m_absolute; // is this an absolute or relative input? @@ -1353,7 +1353,7 @@ private: // internal state dynamic_field * m_next; // linked list of info for this port ioport_field & m_field; // reference to the input field - uint8_t m_shift; // shift to apply to the final result + u8 m_shift; // shift to apply to the final result ioport_value m_oldval; // last value }; @@ -1402,7 +1402,7 @@ public: // type helpers const simple_list &types() const { return m_typelist; } bool type_pressed(ioport_type type, int player = 0); - const char *type_name(ioport_type type, uint8_t player); + const char *type_name(ioport_type type, u8 player); ioport_group type_group(ioport_type type, int player); const input_seq &type_seq(ioport_type type, int player = 0, input_seq_type seqtype = SEQ_TYPE_STANDARD); void set_type_seq(ioport_type type, int player, input_seq_type seqtype, const input_seq &newseq); @@ -1413,7 +1413,7 @@ public: digital_joystick &digjoystick(int player, int joysticknum); int count_players() const; bool crosshair_position(int player, float &x, float &y); - int32_t frame_interpolate(int32_t oldval, int32_t newval); + s32 frame_interpolate(s32 oldval, s32 newval); ioport_type token_to_input_type(const char *string, int &player) const; std::string input_type_to_token(ioport_type type, int player); @@ -1483,8 +1483,8 @@ private: // playback/record information emu_file m_record_file; // recording file (nullptr if not recording) emu_file m_playback_file; // playback file (nullptr if not recording) - uint64_t m_playback_accumulated_speed; // accumulated speed during playback - uint32_t m_playback_accumulated_frames; // accumulated frames during playback + u64 m_playback_accumulated_speed; // accumulated speed during playback + u32 m_playback_accumulated_frames; // accumulated frames during playback emu_file m_timecode_file; // timecode/frames playback file (nullptr if not recording) int m_timecode_count; attotime m_timecode_last_time; @@ -1521,17 +1521,17 @@ public: ioport_configurer& field_set_player(int player) { m_curfield->m_player = player - 1; return *this; } ioport_configurer& field_set_cocktail() { m_curfield->m_flags |= ioport_field::FIELD_FLAG_COCKTAIL; field_set_player(2); return *this; } ioport_configurer& field_set_toggle() { m_curfield->m_flags |= ioport_field::FIELD_FLAG_TOGGLE; return *this; } - ioport_configurer& field_set_impulse(uint8_t impulse) { m_curfield->m_impulse = impulse; return *this; } + ioport_configurer& field_set_impulse(u8 impulse) { m_curfield->m_impulse = impulse; return *this; } ioport_configurer& field_set_analog_reverse() { m_curfield->m_flags |= ioport_field::ANALOG_FLAG_REVERSE; return *this; } ioport_configurer& field_set_analog_reset() { m_curfield->m_flags |= ioport_field::ANALOG_FLAG_RESET; return *this; } ioport_configurer& field_set_optional() { m_curfield->m_flags |= ioport_field::FIELD_FLAG_OPTIONAL; return *this; } ioport_configurer& field_set_min_max(ioport_value minval, ioport_value maxval) { m_curfield->m_min = minval; m_curfield->m_max = maxval; return *this; } - ioport_configurer& field_set_sensitivity(int32_t sensitivity) { m_curfield->m_sensitivity = sensitivity; return *this; } - ioport_configurer& field_set_delta(int32_t delta) { m_curfield->m_centerdelta = m_curfield->m_delta = delta; return *this; } - ioport_configurer& field_set_centerdelta(int32_t delta) { m_curfield->m_centerdelta = delta; return *this; } + ioport_configurer& field_set_sensitivity(s32 sensitivity) { m_curfield->m_sensitivity = sensitivity; return *this; } + ioport_configurer& field_set_delta(s32 delta) { m_curfield->m_centerdelta = m_curfield->m_delta = delta; return *this; } + ioport_configurer& field_set_centerdelta(s32 delta) { m_curfield->m_centerdelta = delta; return *this; } ioport_configurer& field_set_crosshair(crosshair_axis_t axis, double altaxis, double scale, double offset) { m_curfield->m_crosshair_axis = axis; m_curfield->m_crosshair_altaxis = altaxis; m_curfield->m_crosshair_scale = scale; m_curfield->m_crosshair_offset = offset; return *this; } ioport_configurer& field_set_crossmapper(ioport_field_crossmap_delegate callback) { m_curfield->m_crosshair_mapper = callback; return *this; } - ioport_configurer& field_set_full_turn_count(uint16_t count) { m_curfield->m_full_turn_count = count; return *this; } + ioport_configurer& field_set_full_turn_count(u16 count) { m_curfield->m_full_turn_count = count; return *this; } ioport_configurer& field_set_analog_wraps() { m_curfield->m_flags |= ioport_field::ANALOG_FLAG_WRAPS; return *this; } ioport_configurer& field_set_remap_table(const ioport_value *table) { m_curfield->m_remap_table = table; return *this; } ioport_configurer& field_set_analog_invert() { m_curfield->m_flags |= ioport_field::ANALOG_FLAG_INVERT; return *this; } @@ -1822,4 +1822,4 @@ inline device_t &ioport_setting::device() const { return m_field.device(); } inline running_machine &ioport_setting::machine() const { return m_field.machine(); } -#endif // __INPTPORT_H__ */ +#endif // MAME_EMU_IOPORT_H */ diff --git a/src/emu/machine.cpp b/src/emu/machine.cpp index 5815dd9115a..91999a8307e 100644 --- a/src/emu/machine.cpp +++ b/src/emu/machine.cpp @@ -817,7 +817,7 @@ void running_machine::set_rtc_datetime(const system_time &systime) // rand - standardized random numbers //------------------------------------------------- -uint32_t running_machine::rand() +u32 running_machine::rand() { m_rand_seed = 1664525 * m_rand_seed + 1013904223; @@ -863,7 +863,7 @@ void running_machine::handle_saveload() } else { - uint32_t const openflags = (m_saveload_schedule == SLS_LOAD) ? OPEN_FLAG_READ : (OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + u32 const openflags = (m_saveload_schedule == SLS_LOAD) ? OPEN_FLAG_READ : (OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); // open the file emu_file file(m_saveload_searchpath, openflags); @@ -927,7 +927,7 @@ void running_machine::handle_saveload() // of the system //------------------------------------------------- -void running_machine::soft_reset(void *ptr, int32_t param) +void running_machine::soft_reset(void *ptr, s32 param) { logerror("Soft reset\n"); @@ -1249,7 +1249,7 @@ ADDRESS_MAP_END const device_type DUMMY_SPACE = &device_creator; -dummy_space_device::dummy_space_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : +dummy_space_device::dummy_space_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, DUMMY_SPACE, "Dummy Space", tag, owner, clock, "dummy_space", __FILE__), device_memory_interface(mconfig, *this), m_space_config("dummy", ENDIANNESS_LITTLE, 8, 32, 0, nullptr, *ADDRESS_MAP_NAME(dummy)) diff --git a/src/emu/machine.h b/src/emu/machine.h index 6f9e26b24f5..cac9a3f38b6 100644 --- a/src/emu/machine.h +++ b/src/emu/machine.h @@ -14,8 +14,8 @@ #error Dont include this file directly; include emu.h instead. #endif -#ifndef __MACHINE_H__ -#define __MACHINE_H__ +#ifndef MAME_EMU_MACHINE_H +#define MAME_EMU_MACHINE_H #include @@ -114,18 +114,18 @@ public: { void set(struct tm &t); - uint8_t second; // seconds (0-59) - uint8_t minute; // minutes (0-59) - uint8_t hour; // hours (0-23) - uint8_t mday; // day of month (1-31) - uint8_t month; // month (0-11) - int32_t year; // year (1=1 AD) - uint8_t weekday; // day of week (0-6) - uint16_t day; // day of year (0-365) - uint8_t is_dst; // is this daylight savings? + u8 second; // seconds (0-59) + u8 minute; // minutes (0-59) + u8 hour; // hours (0-23) + u8 mday; // day of month (1-31) + u8 month; // month (0-11) + s32 year; // year (1=1 AD) + u8 weekday; // day of week (0-6) + u16 day; // day of year (0-365) + u8 is_dst; // is this daylight savings? }; - int64_t time; // number of seconds elapsed since midnight, January 1 1970 UTC + s64 time; // number of seconds elapsed since midnight, January 1 1970 UTC full_time local_time; // local time full_time utc_time; // UTC coordinated time }; @@ -140,7 +140,7 @@ class dummy_space_device : public device_t, public device_memory_interface { public: - dummy_space_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + dummy_space_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); DECLARE_READ8_MEMBER(read); DECLARE_WRITE8_MEMBER(write); @@ -262,7 +262,7 @@ public: template void popmessage(Format &&fmt, Params &&... args) const; template void logerror(Format &&fmt, Params &&... args) const; void strlog(const char *str) const; - uint32_t rand(); + u32 rand(); const char *describe_context(); std::string compose_saveload_filename(const char *base_filename, const char **searchpath = nullptr); @@ -275,7 +275,7 @@ private: public: // debugger-related information - uint32_t debug_flags; // the current debug flags + u32 debug_flags; // the current debug flags private: // internal helpers @@ -285,7 +285,7 @@ private: void set_saveload_filename(const char *filename); std::string get_statename(const char *statename_opt) const; void handle_saveload(); - void soft_reset(void *ptr = nullptr, int32_t param = 0); + void soft_reset(void *ptr = nullptr, s32 param = 0); std::string nvram_filename(device_t &device) const; void nvram_load(); void nvram_save(); @@ -332,7 +332,7 @@ private: emu_timer * m_soft_reset_timer; // timer used to schedule a soft reset // misc state - uint32_t m_rand_seed; // current random number seed + u32 m_rand_seed; // current random number seed bool m_ui_active; // ui active or not (useful for games / systems with keyboard inputs) time_t m_base_time; // real time at initial emulation time std::string m_basename; // basename used for game-related paths @@ -436,4 +436,4 @@ inline void running_machine::logerror(Format &&fmt, Params &&... args) const } } -#endif /* __MACHINE_H__ */ +#endif /* MAME_EMU_MACHINE_H */ diff --git a/src/emu/main.h b/src/emu/main.h index efb5896f099..7b753dd167f 100644 --- a/src/emu/main.h +++ b/src/emu/main.h @@ -13,8 +13,8 @@ #error Dont include this file directly; include emu.h instead. #endif -#ifndef __MAIN_H__ -#define __MAIN_H__ +#ifndef MAME_EMU_MAIN_H +#define MAME_EMU_MAIN_H #include @@ -94,4 +94,4 @@ protected: }; -#endif /* __MAIN_H__ */ +#endif /* MAME_EMU_MAIN_H */ diff --git a/src/emu/mconfig.cpp b/src/emu/mconfig.cpp index 96ca495aa5a..0eb4532e543 100644 --- a/src/emu/mconfig.cpp +++ b/src/emu/mconfig.cpp @@ -103,7 +103,7 @@ screen_device *machine_config::first_screen() const // new device //------------------------------------------------- -device_t *machine_config::device_add(device_t *owner, const char *tag, device_type type, uint32_t clock) +device_t *machine_config::device_add(device_t *owner, const char *tag, device_type type, u32 clock) { const char *orig_tag = tag; @@ -149,7 +149,7 @@ device_t *machine_config::device_add(device_t *owner, const char *tag, device_ty // replace one device with a new device //------------------------------------------------- -device_t *machine_config::device_replace(device_t *owner, const char *tag, device_type type, uint32_t clock) +device_t *machine_config::device_replace(device_t *owner, const char *tag, device_type type, u32 clock) { // find the original device by relative tag (must exist) assert(owner != nullptr); diff --git a/src/emu/mconfig.h b/src/emu/mconfig.h index 19f4e6faf91..8a3774b8725 100644 --- a/src/emu/mconfig.h +++ b/src/emu/mconfig.h @@ -15,8 +15,8 @@ #error Dont include this file directly; include emu.h instead. #endif -#ifndef __MCONFIG_H__ -#define __MCONFIG_H__ +#ifndef MAME_EMU_MCONFIG_H +#define MAME_EMU_MCONFIG_H //************************************************************************** // CONSTANTS @@ -38,8 +38,8 @@ struct internal_layout { size_t decompressed_size; size_t compressed_size; - uint8_t compression_type; - const uint8_t* data; + u8 compression_type; + const u8* data; }; @@ -73,8 +73,8 @@ public: const internal_layout * m_default_layout; // default layout for this machine // helpers during configuration; not for general use - device_t *device_add(device_t *owner, const char *tag, device_type type, uint32_t clock); - device_t *device_replace(device_t *owner, const char *tag, device_type type, uint32_t clock); + device_t *device_add(device_t *owner, const char *tag, device_type type, u32 clock); + device_t *device_replace(device_t *owner, const char *tag, device_type type, u32 clock); device_t *device_remove(device_t *owner, const char *tag); device_t *device_find(device_t *owner, const char *tag); @@ -211,5 +211,5 @@ References an external machine config. #define MCFG_DEVICE_MODIFY(_tag) \ device = config.device_find(owner, _tag); -#endif /* __MCONFIG_H__ */ - /** @} */ +#endif /* MAME_EMU_MCONFIG_H */ +/** @} */ diff --git a/src/emu/memarray.cpp b/src/emu/memarray.cpp index c1e615776e2..50bd270fd4f 100644 --- a/src/emu/memarray.cpp +++ b/src/emu/memarray.cpp @@ -35,7 +35,7 @@ memory_array::memory_array() // set - configure the parameters //------------------------------------------------- -void memory_array::set(void *base, uint32_t bytes, int membits, endianness_t endianness, int bpe) +void memory_array::set(void *base, u32 bytes, int membits, endianness_t endianness, int bpe) { // validate inputs assert(base != nullptr); @@ -89,7 +89,7 @@ void memory_array::set(void *base, uint32_t bytes, int membits, endianness_t end // set - additional setter variants //------------------------------------------------- -void memory_array::set(const address_space &space, void *base, uint32_t bytes, int bpe) +void memory_array::set(const address_space &space, void *base, u32 bytes, int bpe) { set(base, bytes, space.data_width(), space.endianness(), bpe); } @@ -125,23 +125,23 @@ void memory_array::set_endianness(endianness_t endianness) // heleprs for 1 byte-per-entry //------------------------------------------------- -uint32_t memory_array::read8_from_8(int index) const { return reinterpret_cast(m_base)[index]; } -void memory_array::write8_to_8(int index, uint32_t data) { reinterpret_cast(m_base)[index] = data; } +u32 memory_array::read8_from_8(int index) const { return reinterpret_cast(m_base)[index]; } +void memory_array::write8_to_8(int index, u32 data) { reinterpret_cast(m_base)[index] = data; } -uint32_t memory_array::read8_from_16le(int index) const { return reinterpret_cast(m_base)[BYTE_XOR_LE(index)]; } -void memory_array::write8_to_16le(int index, uint32_t data) { reinterpret_cast(m_base)[BYTE_XOR_LE(index)] = data; } -uint32_t memory_array::read8_from_16be(int index) const { return reinterpret_cast(m_base)[BYTE_XOR_BE(index)]; } -void memory_array::write8_to_16be(int index, uint32_t data) { reinterpret_cast(m_base)[BYTE_XOR_BE(index)] = data; } +u32 memory_array::read8_from_16le(int index) const { return reinterpret_cast(m_base)[BYTE_XOR_LE(index)]; } +void memory_array::write8_to_16le(int index, u32 data) { reinterpret_cast(m_base)[BYTE_XOR_LE(index)] = data; } +u32 memory_array::read8_from_16be(int index) const { return reinterpret_cast(m_base)[BYTE_XOR_BE(index)]; } +void memory_array::write8_to_16be(int index, u32 data) { reinterpret_cast(m_base)[BYTE_XOR_BE(index)] = data; } -uint32_t memory_array::read8_from_32le(int index) const { return reinterpret_cast(m_base)[BYTE4_XOR_LE(index)]; } -void memory_array::write8_to_32le(int index, uint32_t data) { reinterpret_cast(m_base)[BYTE4_XOR_LE(index)] = data; } -uint32_t memory_array::read8_from_32be(int index) const { return reinterpret_cast(m_base)[BYTE4_XOR_BE(index)]; } -void memory_array::write8_to_32be(int index, uint32_t data) { reinterpret_cast(m_base)[BYTE4_XOR_BE(index)] = data; } +u32 memory_array::read8_from_32le(int index) const { return reinterpret_cast(m_base)[BYTE4_XOR_LE(index)]; } +void memory_array::write8_to_32le(int index, u32 data) { reinterpret_cast(m_base)[BYTE4_XOR_LE(index)] = data; } +u32 memory_array::read8_from_32be(int index) const { return reinterpret_cast(m_base)[BYTE4_XOR_BE(index)]; } +void memory_array::write8_to_32be(int index, u32 data) { reinterpret_cast(m_base)[BYTE4_XOR_BE(index)] = data; } -uint32_t memory_array::read8_from_64le(int index) const { return reinterpret_cast(m_base)[BYTE8_XOR_BE(index)]; } -void memory_array::write8_to_64le(int index, uint32_t data) { reinterpret_cast(m_base)[BYTE8_XOR_BE(index)] = data; } -uint32_t memory_array::read8_from_64be(int index) const { return reinterpret_cast(m_base)[BYTE8_XOR_BE(index)]; } -void memory_array::write8_to_64be(int index, uint32_t data) { reinterpret_cast(m_base)[BYTE8_XOR_BE(index)] = data; } +u32 memory_array::read8_from_64le(int index) const { return reinterpret_cast(m_base)[BYTE8_XOR_BE(index)]; } +void memory_array::write8_to_64le(int index, u32 data) { reinterpret_cast(m_base)[BYTE8_XOR_BE(index)] = data; } +u32 memory_array::read8_from_64be(int index) const { return reinterpret_cast(m_base)[BYTE8_XOR_BE(index)]; } +void memory_array::write8_to_64be(int index, u32 data) { reinterpret_cast(m_base)[BYTE8_XOR_BE(index)] = data; } //------------------------------------------------- @@ -149,23 +149,23 @@ void memory_array::write8_to_64be(int index, uint32_t data) { reinterpret_cast> 8); } -uint32_t memory_array::read16_from_8be(int index) const { return (read8_from_8(index*2) << 8) | read8_from_8(index*2+1); } -void memory_array::write16_to_8be(int index, uint32_t data) { write8_to_8(index*2, data >> 8); write8_to_8(index*2+1, data); } +u32 memory_array::read16_from_8le(int index) const { return read8_from_8(index*2) | (read8_from_8(index*2+1) << 8); } +void memory_array::write16_to_8le(int index, u32 data) { write8_to_8(index*2, data); write8_to_8(index*2+1, data >> 8); } +u32 memory_array::read16_from_8be(int index) const { return (read8_from_8(index*2) << 8) | read8_from_8(index*2+1); } +void memory_array::write16_to_8be(int index, u32 data) { write8_to_8(index*2, data >> 8); write8_to_8(index*2+1, data); } -uint32_t memory_array::read16_from_16(int index) const { return reinterpret_cast(m_base)[index]; } -void memory_array::write16_to_16(int index, uint32_t data) { reinterpret_cast(m_base)[index] = data; } +u32 memory_array::read16_from_16(int index) const { return reinterpret_cast(m_base)[index]; } +void memory_array::write16_to_16(int index, u32 data) { reinterpret_cast(m_base)[index] = data; } -uint32_t memory_array::read16_from_32le(int index) const { return reinterpret_cast(m_base)[BYTE_XOR_LE(index)]; } -void memory_array::write16_to_32le(int index, uint32_t data) { reinterpret_cast(m_base)[BYTE_XOR_LE(index)] = data; } -uint32_t memory_array::read16_from_32be(int index) const { return reinterpret_cast(m_base)[BYTE_XOR_BE(index)]; } -void memory_array::write16_to_32be(int index, uint32_t data) { reinterpret_cast(m_base)[BYTE_XOR_BE(index)] = data; } +u32 memory_array::read16_from_32le(int index) const { return reinterpret_cast(m_base)[BYTE_XOR_LE(index)]; } +void memory_array::write16_to_32le(int index, u32 data) { reinterpret_cast(m_base)[BYTE_XOR_LE(index)] = data; } +u32 memory_array::read16_from_32be(int index) const { return reinterpret_cast(m_base)[BYTE_XOR_BE(index)]; } +void memory_array::write16_to_32be(int index, u32 data) { reinterpret_cast(m_base)[BYTE_XOR_BE(index)] = data; } -uint32_t memory_array::read16_from_64le(int index) const { return reinterpret_cast(m_base)[BYTE4_XOR_LE(index)]; } -void memory_array::write16_to_64le(int index, uint32_t data) { reinterpret_cast(m_base)[BYTE4_XOR_LE(index)] = data; } -uint32_t memory_array::read16_from_64be(int index) const { return reinterpret_cast(m_base)[BYTE4_XOR_BE(index)]; } -void memory_array::write16_to_64be(int index, uint32_t data) { reinterpret_cast(m_base)[BYTE4_XOR_BE(index)] = data; } +u32 memory_array::read16_from_64le(int index) const { return reinterpret_cast(m_base)[BYTE4_XOR_LE(index)]; } +void memory_array::write16_to_64le(int index, u32 data) { reinterpret_cast(m_base)[BYTE4_XOR_LE(index)] = data; } +u32 memory_array::read16_from_64be(int index) const { return reinterpret_cast(m_base)[BYTE4_XOR_BE(index)]; } +void memory_array::write16_to_64be(int index, u32 data) { reinterpret_cast(m_base)[BYTE4_XOR_BE(index)] = data; } //------------------------------------------------- @@ -173,20 +173,20 @@ void memory_array::write16_to_64be(int index, uint32_t data) { reinterpret_cast< // heleprs for 4 bytes-per-entry //------------------------------------------------- -uint32_t memory_array::read32_from_8le(int index) const { return read16_from_8le(index*2) | (read16_from_8le(index*2+1) << 16); } -void memory_array::write32_to_8le(int index, uint32_t data) { write16_to_8le(index*2, data); write16_to_8le(index*2+1, data >> 16); } -uint32_t memory_array::read32_from_8be(int index) const { return (read16_from_8be(index*2) << 16) | read16_from_8be(index*2+1); } -void memory_array::write32_to_8be(int index, uint32_t data) { write16_to_8be(index*2, data >> 16); write16_to_8be(index*2+1, data); } +u32 memory_array::read32_from_8le(int index) const { return read16_from_8le(index*2) | (read16_from_8le(index*2+1) << 16); } +void memory_array::write32_to_8le(int index, u32 data) { write16_to_8le(index*2, data); write16_to_8le(index*2+1, data >> 16); } +u32 memory_array::read32_from_8be(int index) const { return (read16_from_8be(index*2) << 16) | read16_from_8be(index*2+1); } +void memory_array::write32_to_8be(int index, u32 data) { write16_to_8be(index*2, data >> 16); write16_to_8be(index*2+1, data); } -uint32_t memory_array::read32_from_16le(int index) const { return read16_from_16(index*2) | (read16_from_16(index*2+1) << 16); } -void memory_array::write32_to_16le(int index, uint32_t data) { write16_to_16(index*2, data); write16_to_16(index*2+1, data >> 16); } -uint32_t memory_array::read32_from_16be(int index) const { return (read16_from_16(index*2) << 16) | read16_from_16(index*2+1); } -void memory_array::write32_to_16be(int index, uint32_t data) { write16_to_16(index*2, data >> 16); write16_to_16(index*2+1, data); } +u32 memory_array::read32_from_16le(int index) const { return read16_from_16(index*2) | (read16_from_16(index*2+1) << 16); } +void memory_array::write32_to_16le(int index, u32 data) { write16_to_16(index*2, data); write16_to_16(index*2+1, data >> 16); } +u32 memory_array::read32_from_16be(int index) const { return (read16_from_16(index*2) << 16) | read16_from_16(index*2+1); } +void memory_array::write32_to_16be(int index, u32 data) { write16_to_16(index*2, data >> 16); write16_to_16(index*2+1, data); } -uint32_t memory_array::read32_from_32(int index) const { return reinterpret_cast(m_base)[index]; } -void memory_array::write32_to_32(int index, uint32_t data) { reinterpret_cast(m_base)[index] = data; } +u32 memory_array::read32_from_32(int index) const { return reinterpret_cast(m_base)[index]; } +void memory_array::write32_to_32(int index, u32 data) { reinterpret_cast(m_base)[index] = data; } -uint32_t memory_array::read32_from_64le(int index) const { return reinterpret_cast(m_base)[BYTE_XOR_LE(index)]; } -void memory_array::write32_to_64le(int index, uint32_t data) { reinterpret_cast(m_base)[BYTE_XOR_LE(index)] = data; } -uint32_t memory_array::read32_from_64be(int index) const { return reinterpret_cast(m_base)[BYTE_XOR_BE(index)]; } -void memory_array::write32_to_64be(int index, uint32_t data) { reinterpret_cast(m_base)[BYTE_XOR_BE(index)] = data; } +u32 memory_array::read32_from_64le(int index) const { return reinterpret_cast(m_base)[BYTE_XOR_LE(index)]; } +void memory_array::write32_to_64le(int index, u32 data) { reinterpret_cast(m_base)[BYTE_XOR_LE(index)] = data; } +u32 memory_array::read32_from_64be(int index) const { return reinterpret_cast(m_base)[BYTE_XOR_BE(index)]; } +void memory_array::write32_to_64be(int index, u32 data) { reinterpret_cast(m_base)[BYTE_XOR_BE(index)] = data; } diff --git a/src/emu/memarray.h b/src/emu/memarray.h index fc6556b5389..d7bbd51df1c 100644 --- a/src/emu/memarray.h +++ b/src/emu/memarray.h @@ -27,8 +27,8 @@ #error Dont include this file directly; include emu.h instead. #endif -#ifndef __MEMARRAY_H__ -#define __MEMARRAY_H__ +#ifndef MAME_EMU_MEMARRAY_H +#define MAME_EMU_MEMARRAY_H //************************************************************************** @@ -44,16 +44,16 @@ class memory_array public: // construction/destruction memory_array(); - memory_array(void *base, uint32_t bytes, int membits, endianness_t endianness, int bpe) { set(base, bytes, membits, endianness, bpe); } + memory_array(void *base, u32 bytes, int membits, endianness_t endianness, int bpe) { set(base, bytes, membits, endianness, bpe); } template memory_array(std::vector<_Type> &array, endianness_t endianness, int bpe) { set(array, endianness, bpe); } - memory_array(const address_space &space, void *base, uint32_t bytes, int bpe) { set(space, base, bytes, bpe); } + memory_array(const address_space &space, void *base, u32 bytes, int bpe) { set(space, base, bytes, bpe); } memory_array(const memory_share &share, int bpe) { set(share, bpe); } memory_array(const memory_array &array) { set(array); } // configuration - void set(void *base, uint32_t bytes, int membits, endianness_t endianness, int bpe); + void set(void *base, u32 bytes, int membits, endianness_t endianness, int bpe); template void set(std::vector<_Type> &array, endianness_t endianness, int bpe) { set(&array[0], array.size(), 8*sizeof(_Type), endianness, bpe); } - void set(const address_space &space, void *base, uint32_t bytes, int bpe); + void set(const address_space &space, void *base, u32 bytes, int bpe); void set(const memory_share &share, int bpe); void set(const memory_array &array); @@ -63,63 +63,63 @@ public: // getters void *base() const { return m_base; } - uint32_t bytes() const { return m_bytes; } + u32 bytes() const { return m_bytes; } int membits() const { return m_membits; } endianness_t endianness() const { return m_endianness; } int bytes_per_entry() const { return m_bytes_per_entry; } // entry-level readers and writers - uint32_t read(int index) const { return (this->*m_read_entry)(index); } - void write(int index, uint32_t data) { (this->*m_write_entry)(index, data); } + u32 read(int index) const { return (this->*m_read_entry)(index); } + void write(int index, u32 data) { (this->*m_write_entry)(index, data); } // byte/word/dword-level readers and writers - uint8_t read8(offs_t offset) const { return reinterpret_cast(m_base)[offset]; } - uint16_t read16(offs_t offset) const { return reinterpret_cast(m_base)[offset]; } - uint32_t read32(offs_t offset) const { return reinterpret_cast(m_base)[offset]; } - uint64_t read64(offs_t offset) const { return reinterpret_cast(m_base)[offset]; } - void write8(offs_t offset, uint8_t data) { reinterpret_cast(m_base)[offset] = data; } - void write16(offs_t offset, uint16_t data, uint16_t mem_mask = 0xffff) { COMBINE_DATA(&reinterpret_cast(m_base)[offset]); } - void write32(offs_t offset, uint32_t data, uint32_t mem_mask = 0xffffffff) { COMBINE_DATA(&reinterpret_cast(m_base)[offset]); } - void write64(offs_t offset, uint64_t data, uint64_t mem_mask = U64(0xffffffffffffffff)) { COMBINE_DATA(&reinterpret_cast(m_base)[offset]); } + u8 read8(offs_t offset) const { return reinterpret_cast(m_base)[offset]; } + u16 read16(offs_t offset) const { return reinterpret_cast(m_base)[offset]; } + u32 read32(offs_t offset) const { return reinterpret_cast(m_base)[offset]; } + u64 read64(offs_t offset) const { return reinterpret_cast(m_base)[offset]; } + void write8(offs_t offset, u8 data) { reinterpret_cast(m_base)[offset] = data; } + void write16(offs_t offset, u16 data, u16 mem_mask = 0xffff) { COMBINE_DATA(&reinterpret_cast(m_base)[offset]); } + void write32(offs_t offset, u32 data, u32 mem_mask = 0xffffffff) { COMBINE_DATA(&reinterpret_cast(m_base)[offset]); } + void write64(offs_t offset, u64 data, u64 mem_mask = 0xffffffffffffffffU) { COMBINE_DATA(&reinterpret_cast(m_base)[offset]); } private: // internal read/write helpers for 1 byte entries - uint32_t read8_from_8(int index) const; void write8_to_8(int index, uint32_t data); - uint32_t read8_from_16le(int index) const; void write8_to_16le(int index, uint32_t data); - uint32_t read8_from_16be(int index) const; void write8_to_16be(int index, uint32_t data); - uint32_t read8_from_32le(int index) const; void write8_to_32le(int index, uint32_t data); - uint32_t read8_from_32be(int index) const; void write8_to_32be(int index, uint32_t data); - uint32_t read8_from_64le(int index) const; void write8_to_64le(int index, uint32_t data); - uint32_t read8_from_64be(int index) const; void write8_to_64be(int index, uint32_t data); + u32 read8_from_8(int index) const; void write8_to_8(int index, u32 data); + u32 read8_from_16le(int index) const; void write8_to_16le(int index, u32 data); + u32 read8_from_16be(int index) const; void write8_to_16be(int index, u32 data); + u32 read8_from_32le(int index) const; void write8_to_32le(int index, u32 data); + u32 read8_from_32be(int index) const; void write8_to_32be(int index, u32 data); + u32 read8_from_64le(int index) const; void write8_to_64le(int index, u32 data); + u32 read8_from_64be(int index) const; void write8_to_64be(int index, u32 data); // internal read/write helpers for 2 byte entries - uint32_t read16_from_8le(int index) const; void write16_to_8le(int index, uint32_t data); - uint32_t read16_from_8be(int index) const; void write16_to_8be(int index, uint32_t data); - uint32_t read16_from_16(int index) const; void write16_to_16(int index, uint32_t data); - uint32_t read16_from_32le(int index) const; void write16_to_32le(int index, uint32_t data); - uint32_t read16_from_32be(int index) const; void write16_to_32be(int index, uint32_t data); - uint32_t read16_from_64le(int index) const; void write16_to_64le(int index, uint32_t data); - uint32_t read16_from_64be(int index) const; void write16_to_64be(int index, uint32_t data); + u32 read16_from_8le(int index) const; void write16_to_8le(int index, u32 data); + u32 read16_from_8be(int index) const; void write16_to_8be(int index, u32 data); + u32 read16_from_16(int index) const; void write16_to_16(int index, u32 data); + u32 read16_from_32le(int index) const; void write16_to_32le(int index, u32 data); + u32 read16_from_32be(int index) const; void write16_to_32be(int index, u32 data); + u32 read16_from_64le(int index) const; void write16_to_64le(int index, u32 data); + u32 read16_from_64be(int index) const; void write16_to_64be(int index, u32 data); // internal read/write helpers for 4 byte entries - uint32_t read32_from_8le(int index) const; void write32_to_8le(int index, uint32_t data); - uint32_t read32_from_8be(int index) const; void write32_to_8be(int index, uint32_t data); - uint32_t read32_from_16le(int index) const; void write32_to_16le(int index, uint32_t data); - uint32_t read32_from_16be(int index) const; void write32_to_16be(int index, uint32_t data); - uint32_t read32_from_32(int index) const; void write32_to_32(int index, uint32_t data); - uint32_t read32_from_64le(int index) const; void write32_to_64le(int index, uint32_t data); - uint32_t read32_from_64be(int index) const; void write32_to_64be(int index, uint32_t data); + u32 read32_from_8le(int index) const; void write32_to_8le(int index, u32 data); + u32 read32_from_8be(int index) const; void write32_to_8be(int index, u32 data); + u32 read32_from_16le(int index) const; void write32_to_16le(int index, u32 data); + u32 read32_from_16be(int index) const; void write32_to_16be(int index, u32 data); + u32 read32_from_32(int index) const; void write32_to_32(int index, u32 data); + u32 read32_from_64le(int index) const; void write32_to_64le(int index, u32 data); + u32 read32_from_64be(int index) const; void write32_to_64be(int index, u32 data); // internal state void * m_base; - uint32_t m_bytes; + u32 m_bytes; int m_membits; endianness_t m_endianness; int m_bytes_per_entry; - uint32_t (memory_array::*m_read_entry)(int) const; - void (memory_array::*m_write_entry)(int, uint32_t); + u32 (memory_array::*m_read_entry)(int) const; + void (memory_array::*m_write_entry)(int, u32); }; -#endif // __MEMARRAY_H__ +#endif // MAME_EMU_MEMARRAY_H diff --git a/src/emu/natkeyboard.h b/src/emu/natkeyboard.h index 4cbdd04eab5..74bc9ac72d5 100644 --- a/src/emu/natkeyboard.h +++ b/src/emu/natkeyboard.h @@ -75,19 +75,19 @@ private: const keycode_map_entry *find_code(char32_t ch) const; // internal state - running_machine & m_machine; // reference to our machine - bool m_in_use; // is natural keyboard in use? - uint32_t m_bufbegin; // index of starting character - uint32_t m_bufend; // index of ending character - std::vector m_buffer; // actual buffer - bool m_status_keydown; // current keydown status - bool m_last_cr; // was the last char a CR? - emu_timer * m_timer; // timer for posting characters - attotime m_current_rate; // current rate for posting - ioport_queue_chars_delegate m_queue_chars; // queue characters callback - ioport_accept_char_delegate m_accept_char; // accept character callback - ioport_charqueue_empty_delegate m_charqueue_empty; // character queue empty callback - std::vector m_keycode_map; // keycode map + running_machine & m_machine; // reference to our machine + bool m_in_use; // is natural keyboard in use? + u32 m_bufbegin; // index of starting character + u32 m_bufend; // index of ending character + std::vector m_buffer; // actual buffer + bool m_status_keydown; // current keydown status + bool m_last_cr; // was the last char a CR? + emu_timer * m_timer; // timer for posting characters + attotime m_current_rate; // current rate for posting + ioport_queue_chars_delegate m_queue_chars; // queue characters callback + ioport_accept_char_delegate m_accept_char; // accept character callback + ioport_charqueue_empty_delegate m_charqueue_empty; // character queue empty callback + std::vector m_keycode_map; // keycode map }; #endif diff --git a/src/emu/network.cpp b/src/emu/network.cpp index ec1a876e117..8239949c958 100644 --- a/src/emu/network.cpp +++ b/src/emu/network.cpp @@ -84,7 +84,7 @@ void network_manager::config_save(config_type cfg_type, xml_data_node *parentnod node->set_attribute_int("interface", network.get_interface()); const char *mac = network.get_mac(); char mac_addr[6 * 3]; - sprintf(mac_addr, "%02x:%02x:%02x:%02x:%02x:%02x", (uint8_t)mac[0], (uint8_t)mac[1], (uint8_t)mac[2], (uint8_t)mac[3], (uint8_t)mac[4], (uint8_t)mac[5]); + sprintf(mac_addr, "%02x:%02x:%02x:%02x:%02x:%02x", u8(mac[0]), u8(mac[1]), u8(mac[2]), u8(mac[3]), u8(mac[4]), u8(mac[5])); node->set_attribute("mac", mac_addr); } } diff --git a/src/emu/output.cpp b/src/emu/output.cpp index 60489cae11e..d2ccf9d8cda 100644 --- a/src/emu/output.cpp +++ b/src/emu/output.cpp @@ -50,7 +50,7 @@ output_manager::output_item* output_manager::find_item(const char *string) create_new_item - create a new item -------------------------------------------------*/ -output_manager::output_item *output_manager::create_new_item(const char *outname, int32_t value) +output_manager::output_item *output_manager::create_new_item(const char *outname, s32 value) { output_item item; @@ -83,10 +83,10 @@ void output_manager::resume() output_set_value - set the value of an output -------------------------------------------------*/ -void output_manager::set_value(const char *outname, int32_t value) +void output_manager::set_value(const char *outname, s32 value) { output_item *item = find_item(outname); - int32_t oldval; + s32 oldval; /* if no item of that name, create a new one and send the item's state */ if (item == nullptr) @@ -150,7 +150,7 @@ void output_manager::set_indexed_value(const char *basename, int index, int valu output -------------------------------------------------*/ -int32_t output_manager::get_value(const char *outname) +s32 output_manager::get_value(const char *outname) { output_item *item = find_item(outname); @@ -166,7 +166,7 @@ int32_t output_manager::get_value(const char *outname) indexed output -------------------------------------------------*/ -int32_t output_manager::get_indexed_value(const char *basename, int index) +s32 output_manager::get_indexed_value(const char *basename, int index) { char buffer[100]; char *dest = buffer; @@ -229,7 +229,7 @@ void output_manager::notify_all(output_module *module) a given name -------------------------------------------------*/ -uint32_t output_manager::name_to_id(const char *outname) +u32 output_manager::name_to_id(const char *outname) { output_item *item = find_item(outname); @@ -245,7 +245,7 @@ uint32_t output_manager::name_to_id(const char *outname) to a given unique ID -------------------------------------------------*/ -const char *output_manager::id_to_name(uint32_t id) +const char *output_manager::id_to_name(u32 id) { for (auto &item : m_itemtable) if (item.second.id == id) diff --git a/src/emu/output.h b/src/emu/output.h index c2400639c43..20b5086db9a 100644 --- a/src/emu/output.h +++ b/src/emu/output.h @@ -13,8 +13,8 @@ #error Dont include this file directly; include emu.h instead. #endif -#ifndef __OUTPUT_H__ -#define __OUTPUT_H__ +#ifndef MAME_EMU_OUTPUT_H +#define MAME_EMU_OUTPUT_H /*************************************************************************** @@ -22,7 +22,7 @@ ***************************************************************************/ class output_module; -typedef void (*output_notifier_func)(const char *outname, int32_t value, void *param); +typedef void (*output_notifier_func)(const char *outname, s32 value, void *param); // ======================> output_manager @@ -44,9 +44,9 @@ class output_manager { public: std::string name; // string name of the item - uint32_t hash; // hash for this item name - uint32_t id; // unique ID for this item - int32_t value; // current value + u32 hash; // hash for this item name + u32 id; // unique ID for this item + s32 value; // current value std::vector notifylist; // list of notifier callbacks }; @@ -58,16 +58,16 @@ public: running_machine &machine() const { return m_machine; } // set the value for a given output - void set_value(const char *outname, int32_t value); + void set_value(const char *outname, s32 value); // set an indexed value for an output (concatenates basename + index) void set_indexed_value(const char *basename, int index, int value); // return the current value for a given output - int32_t get_value(const char *outname); + s32 get_value(const char *outname); // return the current value for a given indexed output - int32_t get_indexed_value(const char *outname, int index); + s32 get_indexed_value(const char *outname, int index); // set a notifier on a particular output, or globally if nullptr void set_notifier(const char *outname, output_notifier_func callback, void *param); @@ -76,31 +76,31 @@ public: void notify_all(output_module *module); // map a name to a unique ID - uint32_t name_to_id(const char *outname); + u32 name_to_id(const char *outname); // map a unique ID back to a name - const char *id_to_name(uint32_t id); + const char *id_to_name(u32 id); // helpers void set_led_value(int index, int value) { set_indexed_value("led", index, value ? 1 : 0); } void set_lamp_value(int index, int value) { set_indexed_value("lamp", index, value); } void set_digit_value(int index, int value) { set_indexed_value("digit", index, value); } - int32_t get_led_value(int index) { return get_indexed_value("led", index); } - int32_t get_lamp_value(int index) { return get_indexed_value("lamp", index); } - int32_t get_digit_value(int index) { return get_indexed_value("digit", index); } + s32 get_led_value(int index) { return get_indexed_value("led", index); } + s32 get_lamp_value(int index) { return get_indexed_value("lamp", index); } + s32 get_digit_value(int index) { return get_indexed_value("digit", index); } void pause(); void resume(); private: output_item *find_item(const char *string); - output_item *create_new_item(const char *outname, int32_t value); + output_item *create_new_item(const char *outname, s32 value); // internal state running_machine & m_machine; // reference to our machine std::unordered_map m_itemtable; std::vector m_global_notifylist; - uint32_t m_uniqueid; + u32 m_uniqueid; }; -#endif // __OUTPUT_H__ +#endif // MAME_EMU_OUTPUT_H diff --git a/src/emu/parameters.h b/src/emu/parameters.h index 23bdd010357..75e90391d1f 100644 --- a/src/emu/parameters.h +++ b/src/emu/parameters.h @@ -14,8 +14,8 @@ #error Dont include this file directly; include emu.h instead. #endif -#ifndef __PARAMETERS_H__ -#define __PARAMETERS_H__ +#ifndef MAME_EMU_PARAMETERS_H +#define MAME_EMU_PARAMETERS_H //************************************************************************** @@ -45,4 +45,4 @@ private: std::unordered_map m_parameters; }; -#endif // __INPTPORT_H__ */ +#endif // MAME_EMU_PARAMETERS_H diff --git a/src/emu/profiler.cpp b/src/emu/profiler.cpp index e9cb8f29fda..4e14d27ceec 100644 --- a/src/emu/profiler.cpp +++ b/src/emu/profiler.cpp @@ -173,18 +173,18 @@ void real_profiler_state::update_text(running_machine &machine) }; // compute the total time for all bits, not including profiler or idle - uint64_t computed = 0; + u64 computed = 0; profile_type curtype; for (curtype = PROFILER_DEVICE_FIRST; curtype < PROFILER_PROFILER; ++curtype) computed += m_data[curtype]; // save that result in normalize, and continue adding the rest - uint64_t normalize = computed; + u64 normalize = computed; for ( ; curtype < PROFILER_TOTAL; ++curtype) computed += m_data[curtype]; // this becomes the total; if we end up with 0 for anything, we were just started, so return empty - uint64_t total = computed; + u64 total = computed; m_text.clear(); if (total == 0 || normalize == 0) { diff --git a/src/emu/profiler.h b/src/emu/profiler.h index 9309b130df2..997c8c480e1 100644 --- a/src/emu/profiler.h +++ b/src/emu/profiler.h @@ -21,10 +21,10 @@ ***************************************************************************/ -#pragma once +#ifndef MAME_EMU_PROFILER_H +#define MAME_EMU_PROFILER_H -#ifndef __PROFILER_H__ -#define __PROFILER_H__ +#pragma once #include "attotime.h" @@ -212,4 +212,4 @@ typedef dummy_profiler_state profiler_state; extern profiler_state g_profiler; -#endif /* __PROFILER_H__ */ +#endif /* MAME_EMU_PROFILER_H */ diff --git a/src/emu/render.cpp b/src/emu/render.cpp index c4516a80726..d1ee1a600f7 100644 --- a/src/emu/render.cpp +++ b/src/emu/render.cpp @@ -434,7 +434,7 @@ void render_texture::hq_scale(bitmap_argb32 &dest, bitmap_argb32 &source, const // get_scaled - get a scaled bitmap (if we can) //------------------------------------------------- -void render_texture::get_scaled(uint32_t dwidth, uint32_t dheight, render_texinfo &texinfo, render_primitive_list &primlist, uint32_t flags) +void render_texture::get_scaled(u32 dwidth, u32 dheight, render_texinfo &texinfo, render_primitive_list &primlist, u32 flags) { // source width/height come from the source bounds int swidth = m_sbounds.width(); @@ -636,7 +636,7 @@ void render_container::set_user_settings(const user_settings &settings) // add_line - add a line item to this container //------------------------------------------------- -void render_container::add_line(float x0, float y0, float x1, float y1, float width, rgb_t argb, uint32_t flags) +void render_container::add_line(float x0, float y0, float x1, float y1, float width, rgb_t argb, u32 flags) { item &newitem = add_generic(CONTAINER_ITEM_LINE, x0, y0, x1, y1, argb); newitem.m_width = width; @@ -648,7 +648,7 @@ void render_container::add_line(float x0, float y0, float x1, float y1, float wi // add_quad - add a quad item to this container //------------------------------------------------- -void render_container::add_quad(float x0, float y0, float x1, float y1, rgb_t argb, render_texture *texture, uint32_t flags) +void render_container::add_quad(float x0, float y0, float x1, float y1, rgb_t argb, render_texture *texture, u32 flags) { item &newitem = add_generic(CONTAINER_ITEM_QUAD, x0, y0, x1, y1, argb); newitem.m_texture = texture; @@ -660,7 +660,7 @@ void render_container::add_quad(float x0, float y0, float x1, float y1, rgb_t ar // add_char - add a char item to this container //------------------------------------------------- -void render_container::add_char(float x0, float y0, float height, float aspect, rgb_t argb, render_font &font, uint16_t ch) +void render_container::add_char(float x0, float y0, float height, float aspect, rgb_t argb, render_font &font, u16 ch) { // compute the bounds of the character cell and get the texture render_bounds bounds; @@ -682,7 +682,7 @@ void render_container::add_char(float x0, float y0, float height, float aspect, // an 8-bit value //------------------------------------------------- -uint8_t render_container::apply_brightness_contrast_gamma(uint8_t value) +u8 render_container::apply_brightness_contrast_gamma(u8 value) { return ::apply_brightness_contrast_gamma(value, m_user.m_brightness, m_user.m_contrast, m_user.m_gamma); } @@ -741,8 +741,8 @@ void render_container::overlay_scale(bitmap_argb32 &dest, bitmap_argb32 &source, // simply replicate the source bitmap over the target for (int y = 0; y < dest.height(); y++) { - uint32_t *src = &source.pix32(y % source.height()); - uint32_t *dst = &dest.pix32(y); + u32 *src = &source.pix32(y % source.height()); + u32 *dst = &dest.pix32(y); int sx = 0; // loop over columns @@ -761,7 +761,7 @@ void render_container::overlay_scale(bitmap_argb32 &dest, bitmap_argb32 &source, // container //------------------------------------------------- -render_container::item &render_container::add_generic(uint8_t type, float x0, float y0, float x1, float y1, rgb_t argb) +render_container::item &render_container::add_generic(u8 type, float x0, float y0, float x1, float y1, rgb_t argb) { item *newitem = m_item_allocator.alloc(); @@ -800,7 +800,7 @@ void render_container::recompute_lookups() // recompute the 256 entry lookup table for (int i = 0; i < 0x100; i++) { - uint8_t adjustedval = apply_brightness_contrast_gamma(i); + u8 adjustedval = apply_brightness_contrast_gamma(i); m_bcglookup256[i + 0x000] = adjustedval << 0; m_bcglookup256[i + 0x100] = adjustedval << 8; m_bcglookup256[i + 0x200] = adjustedval << 16; @@ -843,8 +843,8 @@ void render_container::update_palette() return; // get the dirty list - uint32_t mindirty, maxdirty; - const uint32_t *dirty = m_palclient->dirty_list(mindirty, maxdirty); + u32 mindirty, maxdirty; + const u32 *dirty = m_palclient->dirty_list(mindirty, maxdirty); // iterate over dirty items and update them if (dirty != nullptr) @@ -855,16 +855,16 @@ void render_container::update_palette() if (has_brightness_contrast_gamma_changes()) { // loop over chunks of 32 entries, since we can quickly examine 32 at a time - for (uint32_t entry32 = mindirty / 32; entry32 <= maxdirty / 32; entry32++) + for (u32 entry32 = mindirty / 32; entry32 <= maxdirty / 32; entry32++) { - uint32_t dirtybits = dirty[entry32]; + u32 dirtybits = dirty[entry32]; if (dirtybits != 0) // this chunk of 32 has dirty entries; fix them up - for (uint32_t entry = 0; entry < 32; entry++) + for (u32 entry = 0; entry < 32; entry++) if (dirtybits & (1 << entry)) { - uint32_t finalentry = entry32 * 32 + entry; + u32 finalentry = entry32 * 32 + entry; rgb_t newval = adjusted_palette[finalentry]; m_bcglookup[finalentry] = (newval & 0xff000000) | m_bcglookup256[0x200 + newval.r()] | @@ -905,7 +905,7 @@ render_container::user_settings::user_settings() // render_target - constructor //------------------------------------------------- -render_target::render_target(render_manager &manager, const internal_layout *layoutfile, uint32_t flags) +render_target::render_target(render_manager &manager, const internal_layout *layoutfile, u32 flags) : m_next(nullptr), m_manager(manager), m_curview(nullptr), @@ -1013,7 +1013,7 @@ int render_target::index() const // of a target //------------------------------------------------- -void render_target::set_bounds(int32_t width, int32_t height, float pixel_aspect) +void render_target::set_bounds(s32 width, s32 height, float pixel_aspect) { m_width = width; m_height = height; @@ -1156,7 +1156,7 @@ const render_screen_list &render_target::view_screens(int viewindex) // layout and proposed new parameters //------------------------------------------------- -void render_target::compute_visible_area(int32_t target_width, int32_t target_height, float target_pixel_aspect, int target_orientation, int32_t &visible_width, int32_t &visible_height) +void render_target::compute_visible_area(s32 target_width, s32 target_height, float target_pixel_aspect, int target_orientation, s32 &visible_width, s32 &visible_height) { switch (m_scale_mode) { @@ -1203,7 +1203,7 @@ void render_target::compute_visible_area(int32_t target_width, int32_t target_he default: { // get source size and aspect - int32_t src_width, src_height; + s32 src_width, src_height; compute_minimum_size(src_width, src_height); float src_aspect = m_curview->effective_aspect(m_layerconfig); @@ -1261,7 +1261,7 @@ void render_target::compute_visible_area(int32_t target_width, int32_t target_he // source pixel for all included screens //------------------------------------------------- -void render_target::compute_minimum_size(int32_t &minwidth, int32_t &minheight) +void render_target::compute_minimum_size(s32 &minwidth, s32 &minheight) { float maxxscale = 1.0f, maxyscale = 1.0f; int screens_considered = 0; @@ -1346,7 +1346,7 @@ render_primitive_list &render_target::get_primitives() list.release_all(); // compute the visible width/height - int32_t viswidth, visheight; + s32 viswidth, visheight; compute_visible_area(m_width, m_height, m_pixel_aspect, m_orientation, viswidth, visheight); // create a root transform for the target @@ -1467,7 +1467,7 @@ render_primitive_list &render_target::get_primitives() // specified container, if possible //------------------------------------------------- -bool render_target::map_point_container(int32_t target_x, int32_t target_y, render_container &container, float &container_x, float &container_y) +bool render_target::map_point_container(s32 target_x, s32 target_y, render_container &container, float &container_x, float &container_y) { ioport_port *input_port; ioport_value input_mask; @@ -1481,7 +1481,7 @@ bool render_target::map_point_container(int32_t target_x, int32_t target_y, rend // container, if possible //------------------------------------------------- -bool render_target::map_point_input(int32_t target_x, int32_t target_y, ioport_port *&input_port, ioport_value &input_mask, float &input_x, float &input_y) +bool render_target::map_point_input(s32 target_x, s32 target_y, ioport_port *&input_port, ioport_value &input_mask, float &input_x, float &input_y) { return map_point_internal(target_x, target_y, nullptr, input_x, input_y, input_port, input_mask);; } @@ -1653,7 +1653,7 @@ void render_target::load_layout_files(const internal_layout *layoutfile, bool si bool render_target::load_layout_file(const char *dirname, const internal_layout *layout_data) { // +1 to ensure data is terminated for XML parser - auto tempout = make_unique_clear(layout_data->decompressed_size+1); + auto tempout = make_unique_clear(layout_data->decompressed_size+1); z_stream stream; int zerr; @@ -2008,7 +2008,7 @@ void render_target::add_container_primitives(render_primitive_list &list, const // add the overlay if it exists if (container.overlay() != nullptr && m_layerconfig.screen_overlay_enabled()) { - int32_t width, height; + s32 width, height; // allocate a primitive render_primitive *prim = list.alloc(render_primitive::QUAD); @@ -2060,8 +2060,8 @@ void render_target::add_element_primitives(render_primitive_list &list, const ob prim->flags = PRIMFLAG_TEXORIENT(xform.orientation) | PRIMFLAG_BLENDMODE(blendmode) | PRIMFLAG_TEXFORMAT(texture->format()); // compute the bounds - int32_t width = render_round_nearest(xform.xscale); - int32_t height = render_round_nearest(xform.yscale); + s32 width = render_round_nearest(xform.xscale); + s32 height = render_round_nearest(xform.yscale); set_render_bounds_wh(&prim->bounds, render_round_nearest(xform.xoffs), render_round_nearest(xform.yoffs), (float) width, (float) height); prim->full_bounds = prim->bounds; if (xform.orientation & ORIENTATION_SWAP_XY) @@ -2096,10 +2096,10 @@ void render_target::add_element_primitives(render_primitive_list &list, const ob // mapping points //------------------------------------------------- -bool render_target::map_point_internal(int32_t target_x, int32_t target_y, render_container *container, float &mapped_x, float &mapped_y, ioport_port *&mapped_input_port, ioport_value &mapped_input_mask) +bool render_target::map_point_internal(s32 target_x, s32 target_y, render_container *container, float &mapped_x, float &mapped_y, ioport_port *&mapped_input_port, ioport_value &mapped_input_mask) { // compute the visible width/height - int32_t viswidth, visheight; + s32 viswidth, visheight; compute_visible_area(m_width, m_height, m_pixel_aspect, m_orientation, viswidth, visheight); // create a root transform for the target @@ -2356,19 +2356,19 @@ void render_target::init_clear_extents() bool render_target::remove_clear_extent(const render_bounds &bounds) { - int32_t *max = &m_clear_extents[MAX_CLEAR_EXTENTS]; - int32_t *last = &m_clear_extents[m_clear_extent_count]; - int32_t *ext = &m_clear_extents[0]; - int32_t boundsx0 = ceil(bounds.x0); - int32_t boundsx1 = floor(bounds.x1); - int32_t boundsy0 = ceil(bounds.y0); - int32_t boundsy1 = floor(bounds.y1); - int32_t y0, y1 = 0; + s32 *max = &m_clear_extents[MAX_CLEAR_EXTENTS]; + s32 *last = &m_clear_extents[m_clear_extent_count]; + s32 *ext = &m_clear_extents[0]; + s32 boundsx0 = ceil(bounds.x0); + s32 boundsx1 = floor(bounds.x1); + s32 boundsy0 = ceil(bounds.y0); + s32 boundsy1 = floor(bounds.y1); + s32 y0, y1 = 0; // loop over Y extents while (ext < last) { - int32_t *linelast; + s32 *linelast; // first entry of each line should always be negative assert(ext[0] < 0.0f); @@ -2378,8 +2378,8 @@ bool render_target::remove_clear_extent(const render_bounds &bounds) // do we intersect this extent? if (boundsy0 < y1 && boundsy1 > y0) { - int32_t *xext; - int32_t x0, x1 = 0; + s32 *xext; + s32 x0, x1 = 0; // split the top if (y0 < boundsy0) @@ -2491,16 +2491,16 @@ abort: void render_target::add_clear_extents(render_primitive_list &list) { simple_list clearlist; - int32_t *last = &m_clear_extents[m_clear_extent_count]; - int32_t *ext = &m_clear_extents[0]; - int32_t y0, y1 = 0; + s32 *last = &m_clear_extents[m_clear_extent_count]; + s32 *ext = &m_clear_extents[0]; + s32 y0, y1 = 0; // loop over all extents while (ext < last) { - int32_t *linelast = &ext[ext[1] + 2]; - int32_t *xext = &ext[2]; - int32_t x0, x1 = 0; + s32 *linelast = &ext[ext[1] + 2]; + s32 *xext = &ext[2]; + s32 x0, x1 = 0; // first entry should always be negative assert(ext[0] < 0); @@ -2681,7 +2681,7 @@ float render_manager::max_update_rate() const // target_alloc - allocate a new target //------------------------------------------------- -render_target *render_manager::target_alloc(const internal_layout *layoutfile, uint32_t flags) +render_target *render_manager::target_alloc(const internal_layout *layoutfile, u32 flags) { return &m_targetlist.append(*global_alloc(render_target(*this, layoutfile, flags))); } diff --git a/src/emu/render.h b/src/emu/render.h index 991b88a36d8..edffd769607 100644 --- a/src/emu/render.h +++ b/src/emu/render.h @@ -77,9 +77,9 @@ enum // render creation flags -const uint8_t RENDER_CREATE_NO_ART = 0x01; // ignore any views that have art in them -const uint8_t RENDER_CREATE_SINGLE_FILE = 0x02; // only load views from the file specified -const uint8_t RENDER_CREATE_HIDDEN = 0x04; // don't make this target visible +constexpr u8 RENDER_CREATE_NO_ART = 0x01; // ignore any views that have art in them +constexpr u8 RENDER_CREATE_SINGLE_FILE = 0x02; // only load views from the file specified +constexpr u8 RENDER_CREATE_HIDDEN = 0x04; // don't make this target visible // render scaling modes enum @@ -92,39 +92,39 @@ enum }; // flags for primitives -const int PRIMFLAG_TEXORIENT_SHIFT = 0; -const uint32_t PRIMFLAG_TEXORIENT_MASK = 15 << PRIMFLAG_TEXORIENT_SHIFT; +constexpr int PRIMFLAG_TEXORIENT_SHIFT = 0; +constexpr u32 PRIMFLAG_TEXORIENT_MASK = 15 << PRIMFLAG_TEXORIENT_SHIFT; -const int PRIMFLAG_TEXFORMAT_SHIFT = 4; -const uint32_t PRIMFLAG_TEXFORMAT_MASK = 15 << PRIMFLAG_TEXFORMAT_SHIFT; +constexpr int PRIMFLAG_TEXFORMAT_SHIFT = 4; +constexpr u32 PRIMFLAG_TEXFORMAT_MASK = 15 << PRIMFLAG_TEXFORMAT_SHIFT; -const int PRIMFLAG_BLENDMODE_SHIFT = 8; -const uint32_t PRIMFLAG_BLENDMODE_MASK = 15 << PRIMFLAG_BLENDMODE_SHIFT; +constexpr int PRIMFLAG_BLENDMODE_SHIFT = 8; +constexpr u32 PRIMFLAG_BLENDMODE_MASK = 15 << PRIMFLAG_BLENDMODE_SHIFT; -const int PRIMFLAG_ANTIALIAS_SHIFT = 12; -const uint32_t PRIMFLAG_ANTIALIAS_MASK = 1 << PRIMFLAG_ANTIALIAS_SHIFT; -const int PRIMFLAG_SCREENTEX_SHIFT = 13; -const uint32_t PRIMFLAG_SCREENTEX_MASK = 1 << PRIMFLAG_SCREENTEX_SHIFT; +constexpr int PRIMFLAG_ANTIALIAS_SHIFT = 12; +constexpr u32 PRIMFLAG_ANTIALIAS_MASK = 1 << PRIMFLAG_ANTIALIAS_SHIFT; +constexpr int PRIMFLAG_SCREENTEX_SHIFT = 13; +constexpr u32 PRIMFLAG_SCREENTEX_MASK = 1 << PRIMFLAG_SCREENTEX_SHIFT; -const int PRIMFLAG_TEXWRAP_SHIFT = 14; -const uint32_t PRIMFLAG_TEXWRAP_MASK = 1 << PRIMFLAG_TEXWRAP_SHIFT; +constexpr int PRIMFLAG_TEXWRAP_SHIFT = 14; +constexpr u32 PRIMFLAG_TEXWRAP_MASK = 1 << PRIMFLAG_TEXWRAP_SHIFT; -const int PRIMFLAG_TEXSHADE_SHIFT = 15; -const uint32_t PRIMFLAG_TEXSHADE_MASK = 3 << PRIMFLAG_TEXSHADE_SHIFT; +constexpr int PRIMFLAG_TEXSHADE_SHIFT = 15; +constexpr u32 PRIMFLAG_TEXSHADE_MASK = 3 << PRIMFLAG_TEXSHADE_SHIFT; -const int PRIMFLAG_VECTOR_SHIFT = 17; -const uint32_t PRIMFLAG_VECTOR_MASK = 1 << PRIMFLAG_VECTOR_SHIFT; +constexpr int PRIMFLAG_VECTOR_SHIFT = 17; +constexpr u32 PRIMFLAG_VECTOR_MASK = 1 << PRIMFLAG_VECTOR_SHIFT; -const int PRIMFLAG_VECTORBUF_SHIFT = 18; -const uint32_t PRIMFLAG_VECTORBUF_MASK = 1 << PRIMFLAG_VECTORBUF_SHIFT; +constexpr int PRIMFLAG_VECTORBUF_SHIFT = 18; +constexpr u32 PRIMFLAG_VECTORBUF_MASK = 1 << PRIMFLAG_VECTORBUF_SHIFT; -const int PRIMFLAG_TYPE_SHIFT = 19; -const uint32_t PRIMFLAG_TYPE_MASK = 3 << PRIMFLAG_TYPE_SHIFT; -const uint32_t PRIMFLAG_TYPE_LINE = 0 << PRIMFLAG_TYPE_SHIFT; -const uint32_t PRIMFLAG_TYPE_QUAD = 1 << PRIMFLAG_TYPE_SHIFT; +constexpr int PRIMFLAG_TYPE_SHIFT = 19; +constexpr u32 PRIMFLAG_TYPE_MASK = 3 << PRIMFLAG_TYPE_SHIFT; +constexpr u32 PRIMFLAG_TYPE_LINE = 0 << PRIMFLAG_TYPE_SHIFT; +constexpr u32 PRIMFLAG_TYPE_QUAD = 1 << PRIMFLAG_TYPE_SHIFT; -const int PRIMFLAG_PACKABLE_SHIFT = 21; -const uint32_t PRIMFLAG_PACKABLE = 1 << PRIMFLAG_PACKABLE_SHIFT; +constexpr int PRIMFLAG_PACKABLE_SHIFT = 21; +constexpr u32 PRIMFLAG_PACKABLE = 1 << PRIMFLAG_PACKABLE_SHIFT; //************************************************************************** // MACROS @@ -222,11 +222,11 @@ struct render_quad_texuv struct render_texinfo { void * base; // base of the data - uint32_t rowpixels; // pixels per row - uint32_t width; // width of the image - uint32_t height; // height of the image - uint32_t seqid; // sequence ID - uint64_t osddata; // aux data to pass to osd + u32 rowpixels; // pixels per row + u32 width; // width of the image + u32 height; // height of the image + u32 seqid; // sequence ID + u64 osddata; // aux data to pass to osd const rgb_t * palette; // palette for PALETTE16 textures, bcg lookup table for RGB32/YUY16 }; @@ -281,14 +281,14 @@ private: // render_layer_config - describes the state of layers class render_layer_config { - static const uint8_t ENABLE_BACKDROP = 0x01; // enable backdrop layers - static const uint8_t ENABLE_OVERLAY = 0x02; // enable overlay layers - static const uint8_t ENABLE_BEZEL = 0x04; // enable bezel layers - static const uint8_t ENABLE_CPANEL = 0x08; // enable cpanel layers - static const uint8_t ENABLE_MARQUEE = 0x10; // enable marquee layers - static const uint8_t ZOOM_TO_SCREEN = 0x20; // zoom to screen area by default - static const uint8_t ENABLE_SCREEN_OVERLAY = 0x40; // enable screen overlays - static const uint8_t DEFAULT = ENABLE_BACKDROP | ENABLE_OVERLAY | ENABLE_BEZEL | ENABLE_CPANEL | ENABLE_MARQUEE | ENABLE_SCREEN_OVERLAY; + static constexpr u8 ENABLE_BACKDROP = 0x01; // enable backdrop layers + static constexpr u8 ENABLE_OVERLAY = 0x02; // enable overlay layers + static constexpr u8 ENABLE_BEZEL = 0x04; // enable bezel layers + static constexpr u8 ENABLE_CPANEL = 0x08; // enable cpanel layers + static constexpr u8 ENABLE_MARQUEE = 0x10; // enable marquee layers + static constexpr u8 ZOOM_TO_SCREEN = 0x20; // zoom to screen area by default + static constexpr u8 ENABLE_SCREEN_OVERLAY = 0x40; // enable screen overlays + static constexpr u8 DEFAULT = ENABLE_BACKDROP | ENABLE_OVERLAY | ENABLE_BEZEL | ENABLE_CPANEL | ENABLE_MARQUEE | ENABLE_SCREEN_OVERLAY; public: render_layer_config() @@ -314,7 +314,7 @@ public: render_layer_config &set_zoom_to_screen(bool zoom) { if (zoom) m_state |= ZOOM_TO_SCREEN; else m_state &= ~ZOOM_TO_SCREEN; return *this; } private: - uint8_t m_state; + u8 m_state; }; @@ -344,7 +344,7 @@ public: // getters render_primitive *next() const { return m_next; } - bool packable(const int32_t pack_size) const { return (flags & PRIMFLAG_PACKABLE) && texture.base != nullptr && texture.width <= pack_size && texture.height <= pack_size; } + bool packable(const s32 pack_size) const { return (flags & PRIMFLAG_PACKABLE) && texture.base != nullptr && texture.width <= pack_size && texture.height <= pack_size; } float get_quad_width() const { return fabsf(bounds.x1 - bounds.x0); } float get_quad_height() const { return fabsf(bounds.y1 - bounds.y0); } float get_full_quad_width() const { return fabsf(full_bounds.x1 - full_bounds.x0); } @@ -358,7 +358,7 @@ public: render_bounds bounds; // bounds or positions render_bounds full_bounds; // bounds or positions (unclipped) render_color color; // RGBA values - uint32_t flags; // flags + u32 flags; // flags float width; // width (for line primitives) render_texinfo texture; // texture info (for quad primitives) render_quad_texuv texcoords; // texture coordinates (for quad primitives) @@ -455,14 +455,14 @@ public: void set_bitmap(bitmap_t &bitmap, const rectangle &sbounds, texture_format format); // set any necessary aux data - void set_osd_data(uint64_t data) { m_osddata = data; } + void set_osd_data(u64 data) { m_osddata = data; } // generic high-quality bitmap scaler static void hq_scale(bitmap_argb32 &dest, bitmap_argb32 &source, const rectangle &sbounds, void *param); private: // internal helpers - void get_scaled(uint32_t dwidth, uint32_t dheight, render_texinfo &texinfo, render_primitive_list &primlist, uint32_t flags = 0); + void get_scaled(u32 dwidth, u32 dheight, render_texinfo &texinfo, render_primitive_list &primlist, u32 flags = 0); const rgb_t *get_adjusted_palette(render_container &container); static const int MAX_TEXTURE_SCALES = 16; @@ -471,7 +471,7 @@ private: struct scaled_texture { bitmap_argb32 * bitmap; // final bitmap - uint32_t seqid; // sequence number + u32 seqid; // sequence number }; // internal state @@ -480,12 +480,12 @@ private: bitmap_t * m_bitmap; // pointer to the original bitmap rectangle m_sbounds; // source bounds within the bitmap texture_format m_format; // format of the texture data - uint64_t m_osddata; // aux data to pass to osd + u64 m_osddata; // aux data to pass to osd // scaling state (ARGB32 only) texture_scaler_func m_scaler; // scaling callback void * m_param; // scaling callback parameter - uint32_t m_curseq; // current sequence number + u32 m_curseq; // current sequence number scaled_texture m_scaled[MAX_TEXTURE_SCALES];// array of scaled variants of this texture }; @@ -543,15 +543,15 @@ public: void empty() { m_item_allocator.reclaim_all(m_itemlist); } // add items to the list - void add_line(float x0, float y0, float x1, float y1, float width, rgb_t argb, uint32_t flags); - void add_quad(float x0, float y0, float x1, float y1, rgb_t argb, render_texture *texture, uint32_t flags); - void add_char(float x0, float y0, float height, float aspect, rgb_t argb, render_font &font, uint16_t ch); - void add_point(float x0, float y0, float diameter, rgb_t argb, uint32_t flags) { add_line(x0, y0, x0, y0, diameter, argb, flags); } - void add_rect(float x0, float y0, float x1, float y1, rgb_t argb, uint32_t flags) { add_quad(x0, y0, x1, y1, argb, nullptr, flags); } + void add_line(float x0, float y0, float x1, float y1, float width, rgb_t argb, u32 flags); + void add_quad(float x0, float y0, float x1, float y1, rgb_t argb, render_texture *texture, u32 flags); + void add_char(float x0, float y0, float height, float aspect, rgb_t argb, render_font &font, u16 ch); + void add_point(float x0, float y0, float diameter, rgb_t argb, u32 flags) { add_line(x0, y0, x0, y0, diameter, argb, flags); } + void add_rect(float x0, float y0, float x1, float y1, rgb_t argb, u32 flags) { add_quad(x0, y0, x1, y1, argb, nullptr, flags); } // brightness/contrast/gamma helpers bool has_brightness_contrast_gamma_changes() const { return (m_user.m_brightness != 1.0f || m_user.m_contrast != 1.0f || m_user.m_gamma != 1.0f); } - uint8_t apply_brightness_contrast_gamma(uint8_t value); + u8 apply_brightness_contrast_gamma(u8 value); float apply_brightness_contrast_gamma_fp(float value); const rgb_t *bcg_lookup_table(int texformat, palette_t *palette = nullptr); @@ -567,22 +567,22 @@ private: // getters item *next() const { return m_next; } - uint8_t type() const { return m_type; } + u8 type() const { return m_type; } const render_bounds &bounds() const { return m_bounds; } const render_color &color() const { return m_color; } - uint32_t flags() const { return m_flags; } - uint32_t internal() const { return m_internal; } + u32 flags() const { return m_flags; } + u32 internal() const { return m_internal; } float width() const { return m_width; } render_texture *texture() const { return m_texture; } private: // internal state item * m_next; // pointer to the next element in the list - uint8_t m_type; // type of element + u8 m_type; // type of element render_bounds m_bounds; // bounds of the element render_color m_color; // RGBA factors - uint32_t m_flags; // option flags - uint32_t m_internal; // internal flags + u32 m_flags; // option flags + u32 m_internal; // internal flags float m_width; // width of the line (lines only) render_texture * m_texture; // pointer to the source texture (quads only) }; @@ -592,7 +592,7 @@ private: // internal helpers const simple_list &items() const { return m_itemlist; } - item &add_generic(uint8_t type, float x0, float y0, float x1, float y1, rgb_t argb); + item &add_generic(u8 type, float x0, float y0, float x1, float y1, rgb_t argb); void recompute_lookups(); void update_palette(); @@ -1083,15 +1083,15 @@ class render_target friend class render_manager; // construction/destruction - render_target(render_manager &manager, const internal_layout *layoutfile = nullptr, uint32_t flags = 0); + render_target(render_manager &manager, const internal_layout *layoutfile = nullptr, u32 flags = 0); ~render_target(); public: // getters render_target *next() const { return m_next; } render_manager &manager() const { return m_manager; } - uint32_t width() const { return m_width; } - uint32_t height() const { return m_height; } + u32 width() const { return m_width; } + u32 height() const { return m_height; } float pixel_aspect() const { return m_pixel_aspect; } int scale_mode() const { return m_scale_mode; } float max_update_rate() const { return m_max_refresh; } @@ -1104,7 +1104,7 @@ public: int index() const; // setters - void set_bounds(int32_t width, int32_t height, float pixel_aspect = 0); + void set_bounds(s32 width, s32 height, float pixel_aspect = 0); void set_max_update_rate(float updates_per_second) { m_max_refresh = updates_per_second; } void set_orientation(int orientation) { m_orientation = orientation; } void set_view(int viewindex); @@ -1139,15 +1139,15 @@ public: const render_screen_list &view_screens(int viewindex); // bounds computations - void compute_visible_area(int32_t target_width, int32_t target_height, float target_pixel_aspect, int target_orientation, int32_t &visible_width, int32_t &visible_height); - void compute_minimum_size(int32_t &minwidth, int32_t &minheight); + void compute_visible_area(s32 target_width, s32 target_height, float target_pixel_aspect, int target_orientation, s32 &visible_width, s32 &visible_height); + void compute_minimum_size(s32 &minwidth, s32 &minheight); // get a primitive list render_primitive_list &get_primitives(); // hit testing - bool map_point_container(int32_t target_x, int32_t target_y, render_container &container, float &container_x, float &container_y); - bool map_point_input(int32_t target_x, int32_t target_y, ioport_port *&input_port, ioport_value &input_mask, float &input_x, float &input_y); + bool map_point_container(s32 target_x, s32 target_y, render_container &container, float &container_x, float &container_y); + bool map_point_input(s32 target_x, s32 target_y, ioport_port *&input_port, ioport_value &input_mask, float &input_x, float &input_y); // reference tracking void invalidate_all(void *refptr); @@ -1168,7 +1168,7 @@ private: bool load_layout_file(const char *dirname, const internal_layout *layout_data); void add_container_primitives(render_primitive_list &list, const object_transform &root_xform, const object_transform &xform, render_container &container, int blendmode); void add_element_primitives(render_primitive_list &list, const object_transform &xform, layout_element &element, int state, int blendmode); - bool map_point_internal(int32_t target_x, int32_t target_y, render_container *container, float &mapped_x, float &mapped_y, ioport_port *&mapped_input_port, ioport_value &mapped_input_mask); + bool map_point_internal(s32 target_x, s32 target_y, render_container *container, float &mapped_x, float &mapped_y, ioport_port *&mapped_input_port, ioport_value &mapped_input_mask); // config callbacks void config_load(xml_data_node const &targetnode); @@ -1185,19 +1185,19 @@ private: void add_clear_and_optimize_primitive_list(render_primitive_list &list); // constants - static const int NUM_PRIMLISTS = 3; - static const int MAX_CLEAR_EXTENTS = 1000; + static constexpr int NUM_PRIMLISTS = 3; + static constexpr int MAX_CLEAR_EXTENTS = 1000; // internal state render_target * m_next; // link to next target render_manager & m_manager; // reference to our owning manager layout_view * m_curview; // current view simple_list m_filelist; // list of layout files - uint32_t m_flags; // creation flags + u32 m_flags; // creation flags render_primitive_list m_primlist[NUM_PRIMLISTS]; // list of primitives int m_listindex; // index of next primlist to use - int32_t m_width; // width in pixels - int32_t m_height; // height in pixels + s32 m_width; // width in pixels + s32 m_height; // height in pixels render_bounds m_bounds; // bounds of the target bool m_keepaspect; // constrain aspect ratio bool m_int_overscan; // allow overscan on integer scaled targets @@ -1214,8 +1214,8 @@ private: int m_maxtexwidth; // maximum width of a texture int m_maxtexheight; // maximum height of a texture simple_list m_debug_containers; // list of debug containers - int32_t m_clear_extent_count; // number of clear extents - int32_t m_clear_extents[MAX_CLEAR_EXTENTS]; // array of clear extents + s32 m_clear_extent_count; // number of clear extents + s32 m_clear_extents[MAX_CLEAR_EXTENTS]; // array of clear extents bool m_transform_container; // determines whether the screen container is transformed by the core renderer, // otherwise the respective render API will handle the transformation (scale, offset) @@ -1243,7 +1243,7 @@ public: float max_update_rate() const; // targets - render_target *target_alloc(const internal_layout *layoutfile = nullptr, uint32_t flags = 0); + render_target *target_alloc(const internal_layout *layoutfile = nullptr, u32 flags = 0); void target_free(render_target *target); const simple_list &targets() const { return m_targetlist; } render_target *first_target() const { return m_targetlist.first(); } @@ -1288,7 +1288,7 @@ private: render_target * m_ui_target; // current UI target // texture lists - uint32_t m_live_textures; // number of live textures + u32 m_live_textures; // number of live textures fixed_allocator m_texture_allocator;// texture allocator // containers for the UI and for screens diff --git a/src/emu/rendersw.hxx b/src/emu/rendersw.hxx index 911ac67a6f6..32df8b833ff 100644 --- a/src/emu/rendersw.hxx +++ b/src/emu/rendersw.hxx @@ -22,10 +22,10 @@ private: // internal structs struct quad_setup_data { - int32_t dudx, dvdx, dudy, dvdy; - int32_t startu, startv; - int32_t startx, starty; - int32_t endx, endy; + s32 dudx, dvdx, dudy, dvdy; + s32 startu, startv; + s32 startx, starty; + s32 endx, endy; }; // internal helpers @@ -35,21 +35,21 @@ private: static inline float round_nearest(float f) { return floor(f + 0.5f); } // destination pixels are written based on the values of the template parameters - static inline _PixelType dest_assemble_rgb(uint32_t r, uint32_t g, uint32_t b) { return (r << _DstShiftR) | (g << _DstShiftG) | (b << _DstShiftB); } - static inline _PixelType dest_rgb_to_pixel(uint32_t r, uint32_t g, uint32_t b) { return dest_assemble_rgb(r >> _SrcShiftR, g >> _SrcShiftG, b >> _SrcShiftB); } + static inline _PixelType dest_assemble_rgb(u32 r, u32 g, u32 b) { return (r << _DstShiftR) | (g << _DstShiftG) | (b << _DstShiftB); } + static inline _PixelType dest_rgb_to_pixel(u32 r, u32 g, u32 b) { return dest_assemble_rgb(r >> _SrcShiftR, g >> _SrcShiftG, b >> _SrcShiftB); } // source 32-bit pixels are in MAME standardized format - static inline uint32_t source32_r(uint32_t pixel) { return (pixel >> (16 + _SrcShiftR)) & (0xff >> _SrcShiftR); } - static inline uint32_t source32_g(uint32_t pixel) { return (pixel >> ( 8 + _SrcShiftG)) & (0xff >> _SrcShiftG); } - static inline uint32_t source32_b(uint32_t pixel) { return (pixel >> ( 0 + _SrcShiftB)) & (0xff >> _SrcShiftB); } + static inline u32 source32_r(u32 pixel) { return (pixel >> (16 + _SrcShiftR)) & (0xff >> _SrcShiftR); } + static inline u32 source32_g(u32 pixel) { return (pixel >> ( 8 + _SrcShiftG)) & (0xff >> _SrcShiftG); } + static inline u32 source32_b(u32 pixel) { return (pixel >> ( 0 + _SrcShiftB)) & (0xff >> _SrcShiftB); } // destination pixel masks are based on the template parameters as well - static inline uint32_t dest_r(_PixelType pixel) { return (pixel >> _DstShiftR) & (0xff >> _SrcShiftR); } - static inline uint32_t dest_g(_PixelType pixel) { return (pixel >> _DstShiftG) & (0xff >> _SrcShiftG); } - static inline uint32_t dest_b(_PixelType pixel) { return (pixel >> _DstShiftB) & (0xff >> _SrcShiftB); } + static inline u32 dest_r(_PixelType pixel) { return (pixel >> _DstShiftR) & (0xff >> _SrcShiftR); } + static inline u32 dest_g(_PixelType pixel) { return (pixel >> _DstShiftG) & (0xff >> _SrcShiftG); } + static inline u32 dest_b(_PixelType pixel) { return (pixel >> _DstShiftB) & (0xff >> _SrcShiftB); } // generic conversion with special optimization for destinations in the standard format - static inline _PixelType source32_to_dest(uint32_t pixel) + static inline _PixelType source32_to_dest(u32 pixel) { if (_SrcShiftR == 0 && _SrcShiftG == 0 && _SrcShiftB == 0 && _DstShiftR == 16 && _DstShiftG == 8 && _DstShiftB == 0) return pixel; @@ -67,12 +67,12 @@ private: // The document also contains the constants below as floats. //------------------------------------------------- - static inline uint32_t clamp16_shift8(uint32_t x) + static inline u32 clamp16_shift8(u32 x) { - return ((int32_t(x) < 0) ? 0 : (x > 65535 ? 255: x >> 8)); + return ((s32(x) < 0) ? 0 : (x > 65535 ? 255: x >> 8)); } - static inline uint32_t ycc_to_rgb(uint32_t ycc) + static inline u32 ycc_to_rgb(u32 ycc) { // original equations: // @@ -109,14 +109,14 @@ private: // B = clip(( common + 516 * Cb - 13696) >> 8) // - uint8_t y = ycc; - uint8_t cb = ycc >> 8; - uint8_t cr = ycc >> 16; + u8 y = ycc; + u8 cb = ycc >> 8; + u8 cr = ycc >> 16; - uint32_t common = 298 * y - 56992; - uint32_t r = (common + 409 * cr); - uint32_t g = (common - 100 * cb - 208 * cr + 91776); - uint32_t b = (common + 516 * cb - 13696); + u32 common = 298 * y - 56992; + u32 r = (common + 409 * cr); + u32 g = (common - 100 * cb - 208 * cr + 91776); + u32 b = (common + 516 * cb - 13696); // Now clamp and shift back return rgb_t(clamp16_shift8(r), clamp16_shift8(g), clamp16_shift8(b)); @@ -128,32 +128,32 @@ private: // palettized 16bpp source //------------------------------------------------- - static inline uint32_t get_texel_palette16(const render_texinfo &texture, int32_t curu, int32_t curv) + static inline u32 get_texel_palette16(const render_texinfo &texture, s32 curu, s32 curv) { const rgb_t *palbase = texture.palette; if (_BilinearFilter) { - int32_t u0 = curu >> 16; - int32_t u1 = 1; + s32 u0 = curu >> 16; + s32 u1 = 1; if (u0 < 0) u0 = u1 = 0; else if (u0 + 1 >= texture.width) u0 = texture.width - 1, u1 = 0; - int32_t v0 = curv >> 16; - int32_t v1 = texture.rowpixels; + s32 v0 = curv >> 16; + s32 v1 = texture.rowpixels; if (v0 < 0) v0 = v1 = 0; else if (v0 + 1 >= texture.height) v0 = texture.height - 1, v1 = 0; - const uint16_t *texbase = reinterpret_cast(texture.base); + const u16 *texbase = reinterpret_cast(texture.base); texbase += v0 * texture.rowpixels + u0; - uint32_t pix00 = palbase[texbase[0]]; - uint32_t pix01 = palbase[texbase[u1]]; - uint32_t pix10 = palbase[texbase[v1]]; - uint32_t pix11 = palbase[texbase[u1 + v1]]; + u32 pix00 = palbase[texbase[0]]; + u32 pix01 = palbase[texbase[u1]]; + u32 pix10 = palbase[texbase[v1]]; + u32 pix11 = palbase[texbase[u1 + v1]]; return rgbaint_t::bilinear_filter(pix00, pix01, pix10, pix11, curu >> 8, curv >> 8); } else { - const uint16_t *texbase = reinterpret_cast(texture.base) + (curv >> 16) * texture.rowpixels + (curu >> 16); + const u16 *texbase = reinterpret_cast(texture.base) + (curv >> 16) * texture.rowpixels + (curu >> 16); return palbase[texbase[0]]; } } @@ -164,28 +164,28 @@ private: // palettized 16bpp source with alpha //------------------------------------------------- - static inline uint32_t get_texel_palette16a(const render_texinfo &texture, int32_t curu, int32_t curv) + static inline u32 get_texel_palette16a(const render_texinfo &texture, s32 curu, s32 curv) { const rgb_t *palbase = texture.palette; if (_BilinearFilter) { - int32_t u0 = curu >> 16; - int32_t u1 = 1; + s32 u0 = curu >> 16; + s32 u1 = 1; if (u0 < 0) u0 = u1 = 0; else if (u0 + 1 >= texture.width) u0 = texture.width - 1, u1 = 0; - int32_t v0 = curv >> 16; - int32_t v1 = texture.rowpixels; + s32 v0 = curv >> 16; + s32 v1 = texture.rowpixels; if (v0 < 0) v0 = v1 = 0; else if (v0 + 1 >= texture.height) v0 = texture.height - 1, v1 = 0; - const uint16_t *texbase = reinterpret_cast(texture.base); + const u16 *texbase = reinterpret_cast(texture.base); texbase += v0 * texture.rowpixels + u0; return rgbaint_t::bilinear_filter(palbase[texbase[0]], palbase[texbase[u1]], palbase[texbase[v1]], palbase[texbase[u1 + v1]], curu >> 8, curv >> 8); } else { - const uint16_t *texbase = reinterpret_cast(texture.base) + (curv >> 16) * texture.rowpixels + (curu >> 16); + const u16 *texbase = reinterpret_cast(texture.base) + (curv >> 16) * texture.rowpixels + (curu >> 16); return palbase[texbase[0]]; } } @@ -196,26 +196,26 @@ private: // YCbCr source (pixel is returned as Cr-Cb-Y) //------------------------------------------------- - static inline uint32_t get_texel_yuy16(const render_texinfo &texture, int32_t curu, int32_t curv) + static inline u32 get_texel_yuy16(const render_texinfo &texture, s32 curu, s32 curv) { if (_BilinearFilter) { - int32_t u0 = curu >> 16; - int32_t u1 = 1; + s32 u0 = curu >> 16; + s32 u1 = 1; if (u0 < 0) u0 = u1 = 0; else if (u0 + 1 >= texture.width) u0 = texture.width - 1, u1 = 0; - int32_t v0 = curv >> 16; - int32_t v1 = texture.rowpixels; + s32 v0 = curv >> 16; + s32 v1 = texture.rowpixels; if (v0 < 0) v0 = v1 = 0; else if (v0 + 1 >= texture.height) v0 = texture.height - 1, v1 = 0; - const uint16_t *texbase = reinterpret_cast(texture.base); + const u16 *texbase = reinterpret_cast(texture.base); texbase += v0 * texture.rowpixels + (u0 & ~1); - uint32_t pix00, pix01, pix10, pix11; + u32 pix00, pix01, pix10, pix11; if ((curu & 0x10000) == 0) { - uint32_t cbcr = ((texbase[0] & 0xff) << 8) | ((texbase[1] & 0xff) << 16); + u32 cbcr = ((texbase[0] & 0xff) << 8) | ((texbase[1] & 0xff) << 16); pix00 = (texbase[0] >> 8) | cbcr; pix01 = (texbase[u1] >> 8) | cbcr; cbcr = ((texbase[v1 + 0] & 0xff) << 8) | ((texbase[v1 + 1] & 0xff) << 16); @@ -224,7 +224,7 @@ private: } else { - uint32_t cbcr = ((texbase[0] & 0xff) << 8) | ((texbase[1] & 0xff) << 16); + u32 cbcr = ((texbase[0] & 0xff) << 8) | ((texbase[1] & 0xff) << 16); pix00 = (texbase[1] >> 8) | cbcr; if (u1 != 0) { @@ -247,7 +247,7 @@ private: } else { - const uint16_t *texbase = reinterpret_cast(texture.base) + (curv >> 16) * texture.rowpixels + (curu >> 17) * 2; + const u16 *texbase = reinterpret_cast(texture.base) + (curv >> 16) * texture.rowpixels + (curu >> 17) * 2; return (texbase[(curu >> 16) & 1] >> 8) | ((texbase[0] & 0xff) << 8) | ((texbase[1] & 0xff) << 16); } } @@ -258,27 +258,27 @@ private: // RGB source //------------------------------------------------- - static inline uint32_t get_texel_rgb32(const render_texinfo &texture, int32_t curu, int32_t curv) + static inline u32 get_texel_rgb32(const render_texinfo &texture, s32 curu, s32 curv) { if (_BilinearFilter) { - int32_t u0 = curu >> 16; - int32_t u1 = 1; + s32 u0 = curu >> 16; + s32 u1 = 1; if (u0 < 0) u0 = u1 = 0; else if (u0 + 1 >= texture.width) u0 = texture.width - 1, u1 = 0; - int32_t v0 = curv >> 16; - int32_t v1 = texture.rowpixels; + s32 v0 = curv >> 16; + s32 v1 = texture.rowpixels; if (v0 < 0) v0 = v1 = 0; else if (v0 + 1 >= texture.height) v0 = texture.height - 1, v1 = 0; - const uint32_t *texbase = reinterpret_cast(texture.base); + const u32 *texbase = reinterpret_cast(texture.base); texbase += v0 * texture.rowpixels + u0; return rgbaint_t::bilinear_filter(texbase[0], texbase[u1], texbase[v1], texbase[u1 + v1], curu >> 8, curv >> 8); } else { - const uint32_t *texbase = reinterpret_cast(texture.base) + (curv >> 16) * texture.rowpixels + (curu >> 16); + const u32 *texbase = reinterpret_cast(texture.base) + (curv >> 16) * texture.rowpixels + (curu >> 16); return texbase[0]; } } @@ -289,27 +289,27 @@ private: // ARGB source //------------------------------------------------- - static inline uint32_t get_texel_argb32(const render_texinfo &texture, int32_t curu, int32_t curv) + static inline u32 get_texel_argb32(const render_texinfo &texture, s32 curu, s32 curv) { if (_BilinearFilter) { - int32_t u0 = curu >> 16; - int32_t u1 = 1; + s32 u0 = curu >> 16; + s32 u1 = 1; if (u0 < 0) u0 = u1 = 0; else if (u0 + 1 >= texture.width) u0 = texture.width - 1, u1 = 0; - int32_t v0 = curv >> 16; - int32_t v1 = texture.rowpixels; + s32 v0 = curv >> 16; + s32 v1 = texture.rowpixels; if (v0 < 0) v0 = v1 = 0; else if (v0 + 1 >= texture.height) v0 = texture.height - 1, v1 = 0; - const uint32_t *texbase = reinterpret_cast(texture.base); + const u32 *texbase = reinterpret_cast(texture.base); texbase += v0 * texture.rowpixels + u0; return rgbaint_t::bilinear_filter(texbase[0], texbase[u1], texbase[v1], texbase[u1 + v1], curu >> 8, curv >> 8); } else { - const uint32_t *texbase = reinterpret_cast(texture.base) + (curv >> 16) * texture.rowpixels + (curu >> 16); + const u32 *texbase = reinterpret_cast(texture.base) + (curv >> 16) * texture.rowpixels + (curu >> 16); return texbase[0]; } } @@ -319,13 +319,13 @@ private: // draw_aa_pixel - draw an antialiased pixel //------------------------------------------------- - static inline void draw_aa_pixel(_PixelType *dstdata, uint32_t pitch, int x, int y, uint32_t col) + static inline void draw_aa_pixel(_PixelType *dstdata, u32 pitch, int x, int y, u32 col) { _PixelType *dest = dstdata + y * pitch + x; - uint32_t dpix = _NoDestRead ? 0 : *dest; - uint32_t dr = source32_r(col) + dest_r(dpix); - uint32_t dg = source32_g(col) + dest_g(dpix); - uint32_t db = source32_b(col) + dest_b(dpix); + u32 dpix = _NoDestRead ? 0 : *dest; + u32 dr = source32_r(col) + dest_r(dpix); + u32 dg = source32_g(col) + dest_g(dpix); + u32 db = source32_b(col) + dest_b(dpix); dr = (dr | -(dr >> (8 - _SrcShiftR))) & (0xff >> _SrcShiftR); dg = (dg | -(dg >> (8 - _SrcShiftG))) & (0xff >> _SrcShiftG); db = (db | -(db >> (8 - _SrcShiftB))) & (0xff >> _SrcShiftB); @@ -337,10 +337,10 @@ private: // draw_line - draw a line or point //------------------------------------------------- - static void draw_line(const render_primitive &prim, _PixelType *dstdata, int32_t width, int32_t height, uint32_t pitch) + static void draw_line(const render_primitive &prim, _PixelType *dstdata, s32 width, s32 height, u32 pitch) { // internal tables - static uint32_t s_cosine_table[2049]; + static u32 s_cosine_table[2049]; // compute the start/end coordinates int x1 = int(prim.bounds.x0 * 65536.0f); @@ -349,7 +349,7 @@ private: int y2 = int(prim.bounds.y1 * 65536.0f); // handle color and intensity - uint32_t col = rgb_t(int(255.0f * prim.color.r * prim.color.a), int(255.0f * prim.color.g * prim.color.a), int(255.0f * prim.color.b * prim.color.a)); + u32 col = rgb_t(int(255.0f * prim.color.r * prim.color.a), int(255.0f * prim.color.g * prim.color.a), int(255.0f * prim.color.b * prim.color.a)); if (PRIMFLAG_GET_ANTIALIAS(prim.flags)) { @@ -386,7 +386,7 @@ private: draw_aa_pixel(dstdata, pitch, x1, dy, apply_intensity(0xff & (~y1 >> 8), col)); dy++; dx -= 0x10000 - (0xffff & y1); // take off amount plotted - uint8_t a1 = (dx >> 8) & 0xff; // calc remainder pixel + u8 a1 = (dx >> 8) & 0xff; // calc remainder pixel dx >>= 16; // adjust to pixel (solid) count while (dx--) // plot rest of pixels { @@ -422,7 +422,7 @@ private: draw_aa_pixel(dstdata, pitch, dx, y1, apply_intensity(0xff & (~x1 >> 8), col)); dx++; dy -= 0x10000 - (0xffff & x1); // take off amount plotted - uint8_t a1 = (dy >> 8) & 0xff; // remainder pixel + u8 a1 = (dy >> 8) & 0xff; // remainder pixel dy >>= 16; // adjust to pixel (solid) count while (dy--) // plot rest of pixels { @@ -498,17 +498,17 @@ private: // draw_rect - draw a solid rectangle //------------------------------------------------- - static void draw_rect(const render_primitive &prim, _PixelType *dstdata, int32_t width, int32_t height, uint32_t pitch) + static void draw_rect(const render_primitive &prim, _PixelType *dstdata, s32 width, s32 height, u32 pitch) { render_bounds fpos = prim.bounds; assert(fpos.x0 <= fpos.x1); assert(fpos.y0 <= fpos.y1); // clamp to integers - int32_t startx = round_nearest(fpos.x0); - int32_t starty = round_nearest(fpos.y0); - int32_t endx = round_nearest(fpos.x1); - int32_t endy = round_nearest(fpos.y1); + s32 startx = round_nearest(fpos.x0); + s32 starty = round_nearest(fpos.y0); + s32 endx = round_nearest(fpos.x1); + s32 endy = round_nearest(fpos.y1); // ensure we fit if (startx < 0) startx = 0; @@ -531,24 +531,24 @@ private: // fast case: no alpha if (PRIMFLAG_GET_BLENDMODE(prim.flags) == BLENDMODE_NONE || is_opaque(prim.color.a)) { - uint32_t r = uint32_t(256.0f * prim.color.r); - uint32_t g = uint32_t(256.0f * prim.color.g); - uint32_t b = uint32_t(256.0f * prim.color.b); - uint32_t pix; + u32 r = u32(256.0f * prim.color.r); + u32 g = u32(256.0f * prim.color.g); + u32 b = u32(256.0f * prim.color.b); + u32 pix; // clamp R,G,B to 0-256 range - if (r > 0xff) { if (int32_t(r) < 0) r = 0; else r = 0xff; } - if (g > 0xff) { if (int32_t(g) < 0) g = 0; else g = 0xff; } - if (b > 0xff) { if (int32_t(b) < 0) b = 0; else b = 0xff; } + if (r > 0xff) { if (s32(r) < 0) r = 0; else r = 0xff; } + if (g > 0xff) { if (s32(g) < 0) g = 0; else g = 0xff; } + if (b > 0xff) { if (s32(b) < 0) b = 0; else b = 0xff; } pix = dest_rgb_to_pixel(r, g, b); // loop over rows - for (int32_t y = starty; y < endy; y++) + for (s32 y = starty; y < endy; y++) { _PixelType *dest = dstdata + y * pitch + startx; // loop over cols - for (int32_t x = startx; x < endx; x++) + for (s32 x = startx; x < endx; x++) *dest++ = pix; } } @@ -556,19 +556,19 @@ private: // alpha and/or coloring case else if (!is_transparent(prim.color.a)) { - uint32_t rmask = dest_rgb_to_pixel(0xff,0x00,0x00); - uint32_t gmask = dest_rgb_to_pixel(0x00,0xff,0x00); - uint32_t bmask = dest_rgb_to_pixel(0x00,0x00,0xff); - uint32_t r = uint32_t(256.0f * prim.color.r * prim.color.a); - uint32_t g = uint32_t(256.0f * prim.color.g * prim.color.a); - uint32_t b = uint32_t(256.0f * prim.color.b * prim.color.a); - uint32_t inva = uint32_t(256.0f * (1.0f - prim.color.a)); + u32 rmask = dest_rgb_to_pixel(0xff,0x00,0x00); + u32 gmask = dest_rgb_to_pixel(0x00,0xff,0x00); + u32 bmask = dest_rgb_to_pixel(0x00,0x00,0xff); + u32 r = u32(256.0f * prim.color.r * prim.color.a); + u32 g = u32(256.0f * prim.color.g * prim.color.a); + u32 b = u32(256.0f * prim.color.b * prim.color.a); + u32 inva = u32(256.0f * (1.0f - prim.color.a)); // clamp R,G,B and inverse A to 0-256 range - if (r > 0xff) { if (int32_t(r) < 0) r = 0; else r = 0xff; } - if (g > 0xff) { if (int32_t(g) < 0) g = 0; else g = 0xff; } - if (b > 0xff) { if (int32_t(b) < 0) b = 0; else b = 0xff; } - if (inva > 0x100) { if (int32_t(inva) < 0) inva = 0; else inva = 0x100; } + if (r > 0xff) { if (s32(r) < 0) r = 0; else r = 0xff; } + if (g > 0xff) { if (s32(g) < 0) g = 0; else g = 0xff; } + if (b > 0xff) { if (s32(b) < 0) b = 0; else b = 0xff; } + if (inva > 0x100) { if (s32(inva) < 0) inva = 0; else inva = 0x100; } // pre-shift the RGBA pieces r = dest_rgb_to_pixel(r, 0, 0) << 8; @@ -576,17 +576,17 @@ private: b = dest_rgb_to_pixel(0, 0, b) << 8; // loop over rows - for (int32_t y = starty; y < endy; y++) + for (s32 y = starty; y < endy; y++) { _PixelType *dest = dstdata + y * pitch + startx; // loop over cols - for (int32_t x = startx; x < endx; x++) + for (s32 x = startx; x < endx; x++) { - uint32_t dpix = _NoDestRead ? 0 : *dest; - uint32_t dr = (r + ((dpix & rmask) * inva)) & (rmask << 8); - uint32_t dg = (g + ((dpix & gmask) * inva)) & (gmask << 8); - uint32_t db = (b + ((dpix & bmask) * inva)) & (bmask << 8); + u32 dpix = _NoDestRead ? 0 : *dest; + u32 dr = (r + ((dpix & rmask) * inva)) & (rmask << 8); + u32 dg = (g + ((dpix & gmask) * inva)) & (gmask << 8); + u32 db = (b + ((dpix & bmask) * inva)) & (bmask << 8); *dest++ = (dr | dg | db) >> 8; } } @@ -603,11 +603,11 @@ private: // rasterization of a 16bpp palettized texture //------------------------------------------------- - static void draw_quad_palette16_none(const render_primitive &prim, _PixelType *dstdata, uint32_t pitch, quad_setup_data &setup) + static void draw_quad_palette16_none(const render_primitive &prim, _PixelType *dstdata, u32 pitch, quad_setup_data &setup) { - int32_t dudx = setup.dudx; - int32_t dvdx = setup.dvdx; - int32_t endx = setup.endx; + s32 dudx = setup.dudx; + s32 dvdx = setup.dvdx; + s32 endx = setup.endx; // ensure all parameters are valid assert(prim.texture.palette != nullptr); @@ -616,16 +616,16 @@ private: if (prim.color.r >= 1.0f && prim.color.g >= 1.0f && prim.color.b >= 1.0f && is_opaque(prim.color.a)) { // loop over rows - for (int32_t y = setup.starty; y < setup.endy; y++) + for (s32 y = setup.starty; y < setup.endy; y++) { _PixelType *dest = dstdata + y * pitch + setup.startx; - int32_t curu = setup.startu + (y - setup.starty) * setup.dudy; - int32_t curv = setup.startv + (y - setup.starty) * setup.dvdy; + s32 curu = setup.startu + (y - setup.starty) * setup.dudy; + s32 curv = setup.startv + (y - setup.starty) * setup.dvdy; // loop over cols - for (int32_t x = setup.startx; x < endx; x++) + for (s32 x = setup.startx; x < endx; x++) { - uint32_t pix = get_texel_palette16(prim.texture, curu, curv); + u32 pix = get_texel_palette16(prim.texture, curu, curv); *dest++ = source32_to_dest(pix); curu += dudx; curv += dvdx; @@ -636,29 +636,29 @@ private: // coloring-only case else if (is_opaque(prim.color.a)) { - uint32_t sr = uint32_t(256.0f * prim.color.r); - uint32_t sg = uint32_t(256.0f * prim.color.g); - uint32_t sb = uint32_t(256.0f * prim.color.b); + u32 sr = u32(256.0f * prim.color.r); + u32 sg = u32(256.0f * prim.color.g); + u32 sb = u32(256.0f * prim.color.b); // clamp R,G,B to 0-256 range - if (sr > 0x100) { if (int32_t(sr) < 0) sr = 0; else sr = 0x100; } - if (sg > 0x100) { if (int32_t(sg) < 0) sg = 0; else sg = 0x100; } - if (sb > 0x100) { if (int32_t(sb) < 0) sb = 0; else sb = 0x100; } + if (sr > 0x100) { if (s32(sr) < 0) sr = 0; else sr = 0x100; } + if (sg > 0x100) { if (s32(sg) < 0) sg = 0; else sg = 0x100; } + if (sb > 0x100) { if (s32(sb) < 0) sb = 0; else sb = 0x100; } // loop over rows - for (int32_t y = setup.starty; y < setup.endy; y++) + for (s32 y = setup.starty; y < setup.endy; y++) { _PixelType *dest = dstdata + y * pitch + setup.startx; - int32_t curu = setup.startu + (y - setup.starty) * setup.dudy; - int32_t curv = setup.startv + (y - setup.starty) * setup.dvdy; + s32 curu = setup.startu + (y - setup.starty) * setup.dudy; + s32 curv = setup.startv + (y - setup.starty) * setup.dvdy; // loop over cols - for (int32_t x = setup.startx; x < endx; x++) + for (s32 x = setup.startx; x < endx; x++) { - uint32_t pix = get_texel_palette16(prim.texture, curu, curv); - uint32_t r = (source32_r(pix) * sr) >> 8; - uint32_t g = (source32_g(pix) * sg) >> 8; - uint32_t b = (source32_b(pix) * sb) >> 8; + u32 pix = get_texel_palette16(prim.texture, curu, curv); + u32 r = (source32_r(pix) * sr) >> 8; + u32 g = (source32_g(pix) * sg) >> 8; + u32 b = (source32_b(pix) * sb) >> 8; *dest++ = dest_assemble_rgb(r, g, b); curu += dudx; @@ -670,32 +670,32 @@ private: // alpha and/or coloring case else if (!is_transparent(prim.color.a)) { - uint32_t sr = uint32_t(256.0f * prim.color.r * prim.color.a); - uint32_t sg = uint32_t(256.0f * prim.color.g * prim.color.a); - uint32_t sb = uint32_t(256.0f * prim.color.b * prim.color.a); - uint32_t invsa = uint32_t(256.0f * (1.0f - prim.color.a)); + u32 sr = u32(256.0f * prim.color.r * prim.color.a); + u32 sg = u32(256.0f * prim.color.g * prim.color.a); + u32 sb = u32(256.0f * prim.color.b * prim.color.a); + u32 invsa = u32(256.0f * (1.0f - prim.color.a)); // clamp R,G,B and inverse A to 0-256 range - if (sr > 0x100) { if (int32_t(sr) < 0) sr = 0; else sr = 0x100; } - if (sg > 0x100) { if (int32_t(sg) < 0) sg = 0; else sg = 0x100; } - if (sb > 0x100) { if (int32_t(sb) < 0) sb = 0; else sb = 0x100; } - if (invsa > 0x100) { if (int32_t(invsa) < 0) invsa = 0; else invsa = 0x100; } + if (sr > 0x100) { if (s32(sr) < 0) sr = 0; else sr = 0x100; } + if (sg > 0x100) { if (s32(sg) < 0) sg = 0; else sg = 0x100; } + if (sb > 0x100) { if (s32(sb) < 0) sb = 0; else sb = 0x100; } + if (invsa > 0x100) { if (s32(invsa) < 0) invsa = 0; else invsa = 0x100; } // loop over rows - for (int32_t y = setup.starty; y < setup.endy; y++) + for (s32 y = setup.starty; y < setup.endy; y++) { _PixelType *dest = dstdata + y * pitch + setup.startx; - int32_t curu = setup.startu + (y - setup.starty) * setup.dudy; - int32_t curv = setup.startv + (y - setup.starty) * setup.dvdy; + s32 curu = setup.startu + (y - setup.starty) * setup.dudy; + s32 curv = setup.startv + (y - setup.starty) * setup.dvdy; // loop over cols - for (int32_t x = setup.startx; x < endx; x++) + for (s32 x = setup.startx; x < endx; x++) { - uint32_t pix = get_texel_palette16(prim.texture, curu, curv); - uint32_t dpix = _NoDestRead ? 0 : *dest; - uint32_t r = (source32_r(pix) * sr + dest_r(dpix) * invsa) >> 8; - uint32_t g = (source32_g(pix) * sg + dest_g(dpix) * invsa) >> 8; - uint32_t b = (source32_b(pix) * sb + dest_b(dpix) * invsa) >> 8; + u32 pix = get_texel_palette16(prim.texture, curu, curv); + u32 dpix = _NoDestRead ? 0 : *dest; + u32 r = (source32_r(pix) * sr + dest_r(dpix) * invsa) >> 8; + u32 g = (source32_g(pix) * sg + dest_g(dpix) * invsa) >> 8; + u32 b = (source32_b(pix) * sb + dest_b(dpix) * invsa) >> 8; *dest++ = dest_assemble_rgb(r, g, b); curu += dudx; @@ -711,11 +711,11 @@ private: // rasterization of a 16bpp palettized texture //------------------------------------------------- - static void draw_quad_palette16_add(const render_primitive &prim, _PixelType *dstdata, uint32_t pitch, quad_setup_data &setup) + static void draw_quad_palette16_add(const render_primitive &prim, _PixelType *dstdata, u32 pitch, quad_setup_data &setup) { - int32_t dudx = setup.dudx; - int32_t dvdx = setup.dvdx; - int32_t endx = setup.endx; + s32 dudx = setup.dudx; + s32 dvdx = setup.dvdx; + s32 endx = setup.endx; // ensure all parameters are valid assert(prim.texture.palette != nullptr); @@ -724,22 +724,22 @@ private: if (prim.color.r >= 1.0f && prim.color.g >= 1.0f && prim.color.b >= 1.0f && is_opaque(prim.color.a)) { // loop over rows - for (int32_t y = setup.starty; y < setup.endy; y++) + for (s32 y = setup.starty; y < setup.endy; y++) { _PixelType *dest = dstdata + y * pitch + setup.startx; - int32_t curu = setup.startu + (y - setup.starty) * setup.dudy; - int32_t curv = setup.startv + (y - setup.starty) * setup.dvdy; + s32 curu = setup.startu + (y - setup.starty) * setup.dudy; + s32 curv = setup.startv + (y - setup.starty) * setup.dvdy; // loop over cols - for (int32_t x = setup.startx; x < endx; x++) + for (s32 x = setup.startx; x < endx; x++) { - uint32_t pix = get_texel_palette16(prim.texture, curu, curv); + u32 pix = get_texel_palette16(prim.texture, curu, curv); if ((pix & 0xffffff) != 0) { - uint32_t dpix = _NoDestRead ? 0 : *dest; - uint32_t r = source32_r(pix) + dest_r(dpix); - uint32_t g = source32_g(pix) + dest_g(dpix); - uint32_t b = source32_b(pix) + dest_b(dpix); + u32 dpix = _NoDestRead ? 0 : *dest; + u32 r = source32_r(pix) + dest_r(dpix); + u32 g = source32_g(pix) + dest_g(dpix); + u32 b = source32_b(pix) + dest_b(dpix); r = (r | -(r >> (8 - _SrcShiftR))) & (0xff >> _SrcShiftR); g = (g | -(g >> (8 - _SrcShiftG))) & (0xff >> _SrcShiftG); b = (b | -(b >> (8 - _SrcShiftB))) & (0xff >> _SrcShiftB); @@ -755,32 +755,32 @@ private: // alpha and/or coloring case else { - uint32_t sr = uint32_t(256.0f * prim.color.r * prim.color.a); - uint32_t sg = uint32_t(256.0f * prim.color.g * prim.color.a); - uint32_t sb = uint32_t(256.0f * prim.color.b * prim.color.a); + u32 sr = u32(256.0f * prim.color.r * prim.color.a); + u32 sg = u32(256.0f * prim.color.g * prim.color.a); + u32 sb = u32(256.0f * prim.color.b * prim.color.a); // clamp R,G,B and inverse A to 0-256 range - if (sr > 0x100) { if (int32_t(sr) < 0) sr = 0; else sr = 0x100; } - if (sg > 0x100) { if (int32_t(sg) < 0) sg = 0; else sg = 0x100; } - if (sb > 0x100) { if (int32_t(sb) < 0) sb = 0; else sb = 0x100; } + if (sr > 0x100) { if (s32(sr) < 0) sr = 0; else sr = 0x100; } + if (sg > 0x100) { if (s32(sg) < 0) sg = 0; else sg = 0x100; } + if (sb > 0x100) { if (s32(sb) < 0) sb = 0; else sb = 0x100; } // loop over rows - for (int32_t y = setup.starty; y < setup.endy; y++) + for (s32 y = setup.starty; y < setup.endy; y++) { _PixelType *dest = dstdata + y * pitch + setup.startx; - int32_t curu = setup.startu + (y - setup.starty) * setup.dudy; - int32_t curv = setup.startv + (y - setup.starty) * setup.dvdy; + s32 curu = setup.startu + (y - setup.starty) * setup.dudy; + s32 curv = setup.startv + (y - setup.starty) * setup.dvdy; // loop over cols - for (int32_t x = setup.startx; x < endx; x++) + for (s32 x = setup.startx; x < endx; x++) { - uint32_t pix = get_texel_palette16(prim.texture, curu, curv); + u32 pix = get_texel_palette16(prim.texture, curu, curv); if ((pix & 0xffffff) != 0) { - uint32_t dpix = _NoDestRead ? 0 : *dest; - uint32_t r = ((source32_r(pix) * sr) >> 8) + dest_r(dpix); - uint32_t g = ((source32_g(pix) * sg) >> 8) + dest_g(dpix); - uint32_t b = ((source32_b(pix) * sb) >> 8) + dest_b(dpix); + u32 dpix = _NoDestRead ? 0 : *dest; + u32 r = ((source32_r(pix) * sr) >> 8) + dest_r(dpix); + u32 g = ((source32_g(pix) * sg) >> 8) + dest_g(dpix); + u32 b = ((source32_b(pix) * sb) >> 8) + dest_b(dpix); r = (r | -(r >> (8 - _SrcShiftR))) & (0xff >> _SrcShiftR); g = (g | -(g >> (8 - _SrcShiftG))) & (0xff >> _SrcShiftG); b = (b | -(b >> (8 - _SrcShiftB))) & (0xff >> _SrcShiftB); @@ -804,11 +804,11 @@ private: // rasterization using standard alpha blending //------------------------------------------------- - static void draw_quad_palettea16_alpha(const render_primitive &prim, _PixelType *dstdata, uint32_t pitch, quad_setup_data &setup) + static void draw_quad_palettea16_alpha(const render_primitive &prim, _PixelType *dstdata, u32 pitch, quad_setup_data &setup) { - int32_t dudx = setup.dudx; - int32_t dvdx = setup.dvdx; - int32_t endx = setup.endx; + s32 dudx = setup.dudx; + s32 dvdx = setup.dvdx; + s32 endx = setup.endx; // ensure all parameters are valid assert(prim.texture.palette != nullptr); @@ -817,24 +817,24 @@ private: if (prim.color.r >= 1.0f && prim.color.g >= 1.0f && prim.color.b >= 1.0f && is_opaque(prim.color.a)) { // loop over rows - for (int32_t y = setup.starty; y < setup.endy; y++) + for (s32 y = setup.starty; y < setup.endy; y++) { _PixelType *dest = dstdata + y * pitch + setup.startx; - int32_t curu = setup.startu + (y - setup.starty) * setup.dudy; - int32_t curv = setup.startv + (y - setup.starty) * setup.dvdy; + s32 curu = setup.startu + (y - setup.starty) * setup.dudy; + s32 curv = setup.startv + (y - setup.starty) * setup.dvdy; // loop over cols - for (int32_t x = setup.startx; x < endx; x++) + for (s32 x = setup.startx; x < endx; x++) { - uint32_t pix = get_texel_palette16a(prim.texture, curu, curv); - uint32_t ta = pix >> 24; + u32 pix = get_texel_palette16a(prim.texture, curu, curv); + u32 ta = pix >> 24; if (ta != 0) { - uint32_t dpix = _NoDestRead ? 0 : *dest; - uint32_t invta = 0x100 - ta; - uint32_t r = (source32_r(pix) * ta + dest_r(dpix) * invta) >> 8; - uint32_t g = (source32_g(pix) * ta + dest_g(dpix) * invta) >> 8; - uint32_t b = (source32_b(pix) * ta + dest_b(dpix) * invta) >> 8; + u32 dpix = _NoDestRead ? 0 : *dest; + u32 invta = 0x100 - ta; + u32 r = (source32_r(pix) * ta + dest_r(dpix) * invta) >> 8; + u32 g = (source32_g(pix) * ta + dest_g(dpix) * invta) >> 8; + u32 b = (source32_b(pix) * ta + dest_b(dpix) * invta) >> 8; *dest = dest_assemble_rgb(r, g, b); } @@ -848,36 +848,36 @@ private: // alpha and/or coloring case else { - uint32_t sr = uint32_t(256.0f * prim.color.r); - uint32_t sg = uint32_t(256.0f * prim.color.g); - uint32_t sb = uint32_t(256.0f * prim.color.b); - uint32_t sa = uint32_t(256.0f * prim.color.a); + u32 sr = u32(256.0f * prim.color.r); + u32 sg = u32(256.0f * prim.color.g); + u32 sb = u32(256.0f * prim.color.b); + u32 sa = u32(256.0f * prim.color.a); // clamp R,G,B and inverse A to 0-256 range - if (sr > 0x100) { if (int32_t(sr) < 0) sr = 0; else sr = 0x100; } - if (sg > 0x100) { if (int32_t(sg) < 0) sg = 0; else sg = 0x100; } - if (sb > 0x100) { if (int32_t(sb) < 0) sb = 0; else sb = 0x100; } - if (sa > 0x100) { if (int32_t(sa) < 0) sa = 0; else sa = 0x100; } + if (sr > 0x100) { if (s32(sr) < 0) sr = 0; else sr = 0x100; } + if (sg > 0x100) { if (s32(sg) < 0) sg = 0; else sg = 0x100; } + if (sb > 0x100) { if (s32(sb) < 0) sb = 0; else sb = 0x100; } + if (sa > 0x100) { if (s32(sa) < 0) sa = 0; else sa = 0x100; } // loop over rows - for (int32_t y = setup.starty; y < setup.endy; y++) + for (s32 y = setup.starty; y < setup.endy; y++) { _PixelType *dest = dstdata + y * pitch + setup.startx; - int32_t curu = setup.startu + (y - setup.starty) * setup.dudy; - int32_t curv = setup.startv + (y - setup.starty) * setup.dvdy; + s32 curu = setup.startu + (y - setup.starty) * setup.dudy; + s32 curv = setup.startv + (y - setup.starty) * setup.dvdy; // loop over cols - for (int32_t x = setup.startx; x < endx; x++) + for (s32 x = setup.startx; x < endx; x++) { - uint32_t pix = get_texel_palette16a(prim.texture, curu, curv); - uint32_t ta = (pix >> 24) * sa; + u32 pix = get_texel_palette16a(prim.texture, curu, curv); + u32 ta = (pix >> 24) * sa; if (ta != 0) { - uint32_t dpix = _NoDestRead ? 0 : *dest; - uint32_t invsta = (0x10000 - ta) << 8; - uint32_t r = (source32_r(pix) * sr * ta + dest_r(dpix) * invsta) >> 24; - uint32_t g = (source32_g(pix) * sg * ta + dest_g(dpix) * invsta) >> 24; - uint32_t b = (source32_b(pix) * sb * ta + dest_b(dpix) * invsta) >> 24; + u32 dpix = _NoDestRead ? 0 : *dest; + u32 invsta = (0x10000 - ta) << 8; + u32 r = (source32_r(pix) * sr * ta + dest_r(dpix) * invsta) >> 24; + u32 g = (source32_g(pix) * sg * ta + dest_g(dpix) * invsta) >> 24; + u32 b = (source32_b(pix) * sb * ta + dest_b(dpix) * invsta) >> 24; *dest = dest_assemble_rgb(r, g, b); } @@ -900,26 +900,26 @@ private: // rasterization of a 16bpp YUY image //------------------------------------------------- - static void draw_quad_yuy16_none(const render_primitive &prim, _PixelType *dstdata, uint32_t pitch, quad_setup_data &setup) + static void draw_quad_yuy16_none(const render_primitive &prim, _PixelType *dstdata, u32 pitch, quad_setup_data &setup) { - int32_t dudx = setup.dudx; - int32_t dvdx = setup.dvdx; - int32_t endx = setup.endx; + s32 dudx = setup.dudx; + s32 dvdx = setup.dvdx; + s32 endx = setup.endx; // fast case: no coloring, no alpha if (prim.color.r >= 1.0f && prim.color.g >= 1.0f && prim.color.b >= 1.0f && is_opaque(prim.color.a)) { // loop over rows - for (int32_t y = setup.starty; y < setup.endy; y++) + for (s32 y = setup.starty; y < setup.endy; y++) { _PixelType *dest = dstdata + y * pitch + setup.startx; - int32_t curu = setup.startu + (y - setup.starty) * setup.dudy; - int32_t curv = setup.startv + (y - setup.starty) * setup.dvdy; + s32 curu = setup.startu + (y - setup.starty) * setup.dudy; + s32 curv = setup.startv + (y - setup.starty) * setup.dvdy; // loop over cols - for (int32_t x = setup.startx; x < endx; x++) + for (s32 x = setup.startx; x < endx; x++) { - uint32_t pix = ycc_to_rgb(get_texel_yuy16(prim.texture, curu, curv)); + u32 pix = ycc_to_rgb(get_texel_yuy16(prim.texture, curu, curv)); *dest++ = source32_to_dest(pix); curu += dudx; curv += dvdx; @@ -930,29 +930,29 @@ private: // coloring-only case else if (is_opaque(prim.color.a)) { - uint32_t sr = uint32_t(256.0f * prim.color.r); - uint32_t sg = uint32_t(256.0f * prim.color.g); - uint32_t sb = uint32_t(256.0f * prim.color.b); + u32 sr = u32(256.0f * prim.color.r); + u32 sg = u32(256.0f * prim.color.g); + u32 sb = u32(256.0f * prim.color.b); // clamp R,G,B to 0-256 range - if (sr > 0x100) { if (int32_t(sr) < 0) sr = 0; else sr = 0x100; } - if (sg > 0x100) { if (int32_t(sg) < 0) sg = 0; else sg = 0x100; } - if (sb > 0x100) { if (int32_t(sb) < 0) sb = 0; else sb = 0x100; } + if (sr > 0x100) { if (s32(sr) < 0) sr = 0; else sr = 0x100; } + if (sg > 0x100) { if (s32(sg) < 0) sg = 0; else sg = 0x100; } + if (sb > 0x100) { if (s32(sb) < 0) sb = 0; else sb = 0x100; } // loop over rows - for (int32_t y = setup.starty; y < setup.endy; y++) + for (s32 y = setup.starty; y < setup.endy; y++) { _PixelType *dest = dstdata + y * pitch + setup.startx; - int32_t curu = setup.startu + (y - setup.starty) * setup.dudy; - int32_t curv = setup.startv + (y - setup.starty) * setup.dvdy; + s32 curu = setup.startu + (y - setup.starty) * setup.dudy; + s32 curv = setup.startv + (y - setup.starty) * setup.dvdy; // loop over cols - for (int32_t x = setup.startx; x < endx; x++) + for (s32 x = setup.startx; x < endx; x++) { - uint32_t pix = ycc_to_rgb(get_texel_yuy16(prim.texture, curu, curv)); - uint32_t r = (source32_r(pix) * sr) >> 8; - uint32_t g = (source32_g(pix) * sg) >> 8; - uint32_t b = (source32_b(pix) * sb) >> 8; + u32 pix = ycc_to_rgb(get_texel_yuy16(prim.texture, curu, curv)); + u32 r = (source32_r(pix) * sr) >> 8; + u32 g = (source32_g(pix) * sg) >> 8; + u32 b = (source32_b(pix) * sb) >> 8; *dest++ = dest_assemble_rgb(r, g, b); curu += dudx; @@ -964,32 +964,32 @@ private: // alpha and/or coloring case else if (!is_transparent(prim.color.a)) { - uint32_t sr = uint32_t(256.0f * prim.color.r * prim.color.a); - uint32_t sg = uint32_t(256.0f * prim.color.g * prim.color.a); - uint32_t sb = uint32_t(256.0f * prim.color.b * prim.color.a); - uint32_t invsa = uint32_t(256.0f * (1.0f - prim.color.a)); + u32 sr = u32(256.0f * prim.color.r * prim.color.a); + u32 sg = u32(256.0f * prim.color.g * prim.color.a); + u32 sb = u32(256.0f * prim.color.b * prim.color.a); + u32 invsa = u32(256.0f * (1.0f - prim.color.a)); // clamp R,G,B and inverse A to 0-256 range - if (sr > 0x100) { if (int32_t(sr) < 0) sr = 0; else sr = 0x100; } - if (sg > 0x100) { if (int32_t(sg) < 0) sg = 0; else sg = 0x100; } - if (sb > 0x100) { if (int32_t(sb) < 0) sb = 0; else sb = 0x100; } - if (invsa > 0x100) { if (int32_t(invsa) < 0) invsa = 0; else invsa = 0x100; } + if (sr > 0x100) { if (s32(sr) < 0) sr = 0; else sr = 0x100; } + if (sg > 0x100) { if (s32(sg) < 0) sg = 0; else sg = 0x100; } + if (sb > 0x100) { if (s32(sb) < 0) sb = 0; else sb = 0x100; } + if (invsa > 0x100) { if (s32(invsa) < 0) invsa = 0; else invsa = 0x100; } // loop over rows - for (int32_t y = setup.starty; y < setup.endy; y++) + for (s32 y = setup.starty; y < setup.endy; y++) { _PixelType *dest = dstdata + y * pitch + setup.startx; - int32_t curu = setup.startu + (y - setup.starty) * setup.dudy; - int32_t curv = setup.startv + (y - setup.starty) * setup.dvdy; + s32 curu = setup.startu + (y - setup.starty) * setup.dudy; + s32 curv = setup.startv + (y - setup.starty) * setup.dvdy; // loop over cols - for (int32_t x = setup.startx; x < endx; x++) + for (s32 x = setup.startx; x < endx; x++) { - uint32_t pix = ycc_to_rgb(get_texel_yuy16(prim.texture, curu, curv)); - uint32_t dpix = _NoDestRead ? 0 : *dest; - uint32_t r = (source32_r(pix) * sr + dest_r(dpix) * invsa) >> 8; - uint32_t g = (source32_g(pix) * sg + dest_g(dpix) * invsa) >> 8; - uint32_t b = (source32_b(pix) * sb + dest_b(dpix) * invsa) >> 8; + u32 pix = ycc_to_rgb(get_texel_yuy16(prim.texture, curu, curv)); + u32 dpix = _NoDestRead ? 0 : *dest; + u32 r = (source32_r(pix) * sr + dest_r(dpix) * invsa) >> 8; + u32 g = (source32_g(pix) * sg + dest_g(dpix) * invsa) >> 8; + u32 b = (source32_b(pix) * sb + dest_b(dpix) * invsa) >> 8; *dest++ = dest_assemble_rgb(r, g, b); curu += dudx; @@ -1006,11 +1006,11 @@ private: // conversion //------------------------------------------------- - static void draw_quad_yuy16_add(const render_primitive &prim, _PixelType *dstdata, uint32_t pitch, quad_setup_data &setup) + static void draw_quad_yuy16_add(const render_primitive &prim, _PixelType *dstdata, u32 pitch, quad_setup_data &setup) { - int32_t dudx = setup.dudx; - int32_t dvdx = setup.dvdx; - int32_t endx = setup.endx; + s32 dudx = setup.dudx; + s32 dvdx = setup.dvdx; + s32 endx = setup.endx; // simply can't do this without reading from the dest if (_NoDestRead) @@ -1020,20 +1020,20 @@ private: if (prim.color.r >= 1.0f && prim.color.g >= 1.0f && prim.color.b >= 1.0f && is_opaque(prim.color.a)) { // loop over rows - for (int32_t y = setup.starty; y < setup.endy; y++) + for (s32 y = setup.starty; y < setup.endy; y++) { _PixelType *dest = dstdata + y * pitch + setup.startx; - int32_t curu = setup.startu + (y - setup.starty) * setup.dudy; - int32_t curv = setup.startv + (y - setup.starty) * setup.dvdy; + s32 curu = setup.startu + (y - setup.starty) * setup.dudy; + s32 curv = setup.startv + (y - setup.starty) * setup.dvdy; // loop over cols - for (int32_t x = setup.startx; x < endx; x++) + for (s32 x = setup.startx; x < endx; x++) { - uint32_t pix = ycc_to_rgb(get_texel_yuy16(prim.texture, curu, curv)); - uint32_t dpix = _NoDestRead ? 0 : *dest; - uint32_t r = source32_r(pix) + dest_r(dpix); - uint32_t g = source32_g(pix) + dest_g(dpix); - uint32_t b = source32_b(pix) + dest_b(dpix); + u32 pix = ycc_to_rgb(get_texel_yuy16(prim.texture, curu, curv)); + u32 dpix = _NoDestRead ? 0 : *dest; + u32 r = source32_r(pix) + dest_r(dpix); + u32 g = source32_g(pix) + dest_g(dpix); + u32 b = source32_b(pix) + dest_b(dpix); r = (r | -(r >> (8 - _SrcShiftR))) & (0xff >> _SrcShiftR); g = (g | -(g >> (8 - _SrcShiftG))) & (0xff >> _SrcShiftG); b = (b | -(b >> (8 - _SrcShiftB))) & (0xff >> _SrcShiftB); @@ -1047,32 +1047,32 @@ private: // alpha and/or coloring case else { - uint32_t sr = uint32_t(256.0f * prim.color.r); - uint32_t sg = uint32_t(256.0f * prim.color.g); - uint32_t sb = uint32_t(256.0f * prim.color.b); - uint32_t sa = uint32_t(256.0f * prim.color.a); + u32 sr = u32(256.0f * prim.color.r); + u32 sg = u32(256.0f * prim.color.g); + u32 sb = u32(256.0f * prim.color.b); + u32 sa = u32(256.0f * prim.color.a); // clamp R,G,B and inverse A to 0-256 range - if (sr > 0x100) { if (int32_t(sr) < 0) sr = 0; else sr = 0x100; } - if (sg > 0x100) { if (int32_t(sg) < 0) sg = 0; else sg = 0x100; } - if (sb > 0x100) { if (int32_t(sb) < 0) sb = 0; else sb = 0x100; } - if (sa > 0x100) { if (int32_t(sa) < 0) sa = 0; else sa = 0x100; } + if (sr > 0x100) { if (s32(sr) < 0) sr = 0; else sr = 0x100; } + if (sg > 0x100) { if (s32(sg) < 0) sg = 0; else sg = 0x100; } + if (sb > 0x100) { if (s32(sb) < 0) sb = 0; else sb = 0x100; } + if (sa > 0x100) { if (s32(sa) < 0) sa = 0; else sa = 0x100; } // loop over rows - for (int32_t y = setup.starty; y < setup.endy; y++) + for (s32 y = setup.starty; y < setup.endy; y++) { _PixelType *dest = dstdata + y * pitch + setup.startx; - int32_t curu = setup.startu + (y - setup.starty) * setup.dudy; - int32_t curv = setup.startv + (y - setup.starty) * setup.dvdy; + s32 curu = setup.startu + (y - setup.starty) * setup.dudy; + s32 curv = setup.startv + (y - setup.starty) * setup.dvdy; // loop over cols - for (int32_t x = setup.startx; x < endx; x++) + for (s32 x = setup.startx; x < endx; x++) { - uint32_t pix = ycc_to_rgb(get_texel_yuy16(prim.texture, curu, curv)); - uint32_t dpix = _NoDestRead ? 0 : *dest; - uint32_t r = ((source32_r(pix) * sr * sa) >> 16) + dest_r(dpix); - uint32_t g = ((source32_g(pix) * sg * sa) >> 16) + dest_g(dpix); - uint32_t b = ((source32_b(pix) * sb * sa) >> 16) + dest_b(dpix); + u32 pix = ycc_to_rgb(get_texel_yuy16(prim.texture, curu, curv)); + u32 dpix = _NoDestRead ? 0 : *dest; + u32 r = ((source32_r(pix) * sr * sa) >> 16) + dest_r(dpix); + u32 g = ((source32_g(pix) * sg * sa) >> 16) + dest_g(dpix); + u32 b = ((source32_b(pix) * sb * sa) >> 16) + dest_b(dpix); r = (r | -(r >> (8 - _SrcShiftR))) & (0xff >> _SrcShiftR); g = (g | -(g >> (8 - _SrcShiftG))) & (0xff >> _SrcShiftG); b = (b | -(b >> (8 - _SrcShiftB))) & (0xff >> _SrcShiftB); @@ -1094,30 +1094,30 @@ private: // a 32bpp RGB texture //------------------------------------------------- - static void draw_quad_rgb32(const render_primitive &prim, _PixelType *dstdata, uint32_t pitch, quad_setup_data &setup) + static void draw_quad_rgb32(const render_primitive &prim, _PixelType *dstdata, u32 pitch, quad_setup_data &setup) { const rgb_t *palbase = prim.texture.palette; - int32_t dudx = setup.dudx; - int32_t dvdx = setup.dvdx; - int32_t endx = setup.endx; + s32 dudx = setup.dudx; + s32 dvdx = setup.dvdx; + s32 endx = setup.endx; // fast case: no coloring, no alpha if (prim.color.r >= 1.0f && prim.color.g >= 1.0f && prim.color.b >= 1.0f && is_opaque(prim.color.a)) { // loop over rows - for (int32_t y = setup.starty; y < setup.endy; y++) + for (s32 y = setup.starty; y < setup.endy; y++) { _PixelType *dest = dstdata + y * pitch + setup.startx; - int32_t curu = setup.startu + (y - setup.starty) * setup.dudy; - int32_t curv = setup.startv + (y - setup.starty) * setup.dvdy; + s32 curu = setup.startu + (y - setup.starty) * setup.dudy; + s32 curv = setup.startv + (y - setup.starty) * setup.dvdy; // no lookup case if (palbase == nullptr) { // loop over cols - for (int32_t x = setup.startx; x < endx; x++) + for (s32 x = setup.startx; x < endx; x++) { - uint32_t pix = get_texel_rgb32(prim.texture, curu, curv); + u32 pix = get_texel_rgb32(prim.texture, curu, curv); *dest++ = source32_to_dest(pix); curu += dudx; curv += dvdx; @@ -1128,12 +1128,12 @@ private: else { // loop over cols - for (int32_t x = setup.startx; x < endx; x++) + for (s32 x = setup.startx; x < endx; x++) { - uint32_t pix = get_texel_rgb32(prim.texture, curu, curv); - uint32_t r = palbase[(pix >> 16) & 0xff] >> _SrcShiftR; - uint32_t g = palbase[(pix >> 8) & 0xff] >> _SrcShiftG; - uint32_t b = palbase[(pix >> 0) & 0xff] >> _SrcShiftB; + u32 pix = get_texel_rgb32(prim.texture, curu, curv); + u32 r = palbase[(pix >> 16) & 0xff] >> _SrcShiftR; + u32 g = palbase[(pix >> 8) & 0xff] >> _SrcShiftG; + u32 b = palbase[(pix >> 0) & 0xff] >> _SrcShiftB; *dest++ = dest_assemble_rgb(r, g, b); curu += dudx; @@ -1146,32 +1146,32 @@ private: // coloring-only case else if (is_opaque(prim.color.a)) { - uint32_t sr = uint32_t(256.0f * prim.color.r); - uint32_t sg = uint32_t(256.0f * prim.color.g); - uint32_t sb = uint32_t(256.0f * prim.color.b); + u32 sr = u32(256.0f * prim.color.r); + u32 sg = u32(256.0f * prim.color.g); + u32 sb = u32(256.0f * prim.color.b); // clamp R,G,B to 0-256 range - if (sr > 0x100) { if (int32_t(sr) < 0) sr = 0; else sr = 0x100; } - if (sg > 0x100) { if (int32_t(sg) < 0) sg = 0; else sg = 0x100; } - if (sb > 0x100) { if (int32_t(sb) < 0) sb = 0; else sb = 0x100; } + if (sr > 0x100) { if (s32(sr) < 0) sr = 0; else sr = 0x100; } + if (sg > 0x100) { if (s32(sg) < 0) sg = 0; else sg = 0x100; } + if (sb > 0x100) { if (s32(sb) < 0) sb = 0; else sb = 0x100; } // loop over rows - for (int32_t y = setup.starty; y < setup.endy; y++) + for (s32 y = setup.starty; y < setup.endy; y++) { _PixelType *dest = dstdata + y * pitch + setup.startx; - int32_t curu = setup.startu + (y - setup.starty) * setup.dudy; - int32_t curv = setup.startv + (y - setup.starty) * setup.dvdy; + s32 curu = setup.startu + (y - setup.starty) * setup.dudy; + s32 curv = setup.startv + (y - setup.starty) * setup.dvdy; // no lookup case if (palbase == nullptr) { // loop over cols - for (int32_t x = setup.startx; x < endx; x++) + for (s32 x = setup.startx; x < endx; x++) { - uint32_t pix = get_texel_rgb32(prim.texture, curu, curv); - uint32_t r = (source32_r(pix) * sr) >> 8; - uint32_t g = (source32_g(pix) * sg) >> 8; - uint32_t b = (source32_b(pix) * sb) >> 8; + u32 pix = get_texel_rgb32(prim.texture, curu, curv); + u32 r = (source32_r(pix) * sr) >> 8; + u32 g = (source32_g(pix) * sg) >> 8; + u32 b = (source32_b(pix) * sb) >> 8; *dest++ = dest_assemble_rgb(r, g, b); curu += dudx; @@ -1183,12 +1183,12 @@ private: else { // loop over cols - for (int32_t x = setup.startx; x < endx; x++) + for (s32 x = setup.startx; x < endx; x++) { - uint32_t pix = get_texel_rgb32(prim.texture, curu, curv); - uint32_t r = (palbase[(pix >> 16) & 0xff] * sr) >> (8 + _SrcShiftR); - uint32_t g = (palbase[(pix >> 8) & 0xff] * sg) >> (8 + _SrcShiftG); - uint32_t b = (palbase[(pix >> 0) & 0xff] * sb) >> (8 + _SrcShiftB); + u32 pix = get_texel_rgb32(prim.texture, curu, curv); + u32 r = (palbase[(pix >> 16) & 0xff] * sr) >> (8 + _SrcShiftR); + u32 g = (palbase[(pix >> 8) & 0xff] * sg) >> (8 + _SrcShiftG); + u32 b = (palbase[(pix >> 0) & 0xff] * sb) >> (8 + _SrcShiftB); *dest++ = dest_assemble_rgb(r, g, b); curu += dudx; @@ -1201,35 +1201,35 @@ private: // alpha and/or coloring case else if (!is_transparent(prim.color.a)) { - uint32_t sr = uint32_t(256.0f * prim.color.r * prim.color.a); - uint32_t sg = uint32_t(256.0f * prim.color.g * prim.color.a); - uint32_t sb = uint32_t(256.0f * prim.color.b * prim.color.a); - uint32_t invsa = uint32_t(256.0f * (1.0f - prim.color.a)); + u32 sr = u32(256.0f * prim.color.r * prim.color.a); + u32 sg = u32(256.0f * prim.color.g * prim.color.a); + u32 sb = u32(256.0f * prim.color.b * prim.color.a); + u32 invsa = u32(256.0f * (1.0f - prim.color.a)); // clamp R,G,B and inverse A to 0-256 range - if (sr > 0x100) { if (int32_t(sr) < 0) sr = 0; else sr = 0x100; } - if (sg > 0x100) { if (int32_t(sg) < 0) sg = 0; else sg = 0x100; } - if (sb > 0x100) { if (int32_t(sb) < 0) sb = 0; else sb = 0x100; } - if (invsa > 0x100) { if (int32_t(invsa) < 0) invsa = 0; else invsa = 0x100; } + if (sr > 0x100) { if (s32(sr) < 0) sr = 0; else sr = 0x100; } + if (sg > 0x100) { if (s32(sg) < 0) sg = 0; else sg = 0x100; } + if (sb > 0x100) { if (s32(sb) < 0) sb = 0; else sb = 0x100; } + if (invsa > 0x100) { if (s32(invsa) < 0) invsa = 0; else invsa = 0x100; } // loop over rows - for (int32_t y = setup.starty; y < setup.endy; y++) + for (s32 y = setup.starty; y < setup.endy; y++) { _PixelType *dest = dstdata + y * pitch + setup.startx; - int32_t curu = setup.startu + (y - setup.starty) * setup.dudy; - int32_t curv = setup.startv + (y - setup.starty) * setup.dvdy; + s32 curu = setup.startu + (y - setup.starty) * setup.dudy; + s32 curv = setup.startv + (y - setup.starty) * setup.dvdy; // no lookup case if (palbase == nullptr) { // loop over cols - for (int32_t x = setup.startx; x < endx; x++) + for (s32 x = setup.startx; x < endx; x++) { - uint32_t pix = get_texel_rgb32(prim.texture, curu, curv); - uint32_t dpix = _NoDestRead ? 0 : *dest; - uint32_t r = (source32_r(pix) * sr + dest_r(dpix) * invsa) >> 8; - uint32_t g = (source32_g(pix) * sg + dest_g(dpix) * invsa) >> 8; - uint32_t b = (source32_b(pix) * sb + dest_b(dpix) * invsa) >> 8; + u32 pix = get_texel_rgb32(prim.texture, curu, curv); + u32 dpix = _NoDestRead ? 0 : *dest; + u32 r = (source32_r(pix) * sr + dest_r(dpix) * invsa) >> 8; + u32 g = (source32_g(pix) * sg + dest_g(dpix) * invsa) >> 8; + u32 b = (source32_b(pix) * sb + dest_b(dpix) * invsa) >> 8; *dest++ = dest_assemble_rgb(r, g, b); curu += dudx; @@ -1241,13 +1241,13 @@ private: else { // loop over cols - for (int32_t x = setup.startx; x < endx; x++) + for (s32 x = setup.startx; x < endx; x++) { - uint32_t pix = get_texel_rgb32(prim.texture, curu, curv); - uint32_t dpix = _NoDestRead ? 0 : *dest; - uint32_t r = ((palbase[(pix >> 16) & 0xff] >> _SrcShiftR) * sr + dest_r(dpix) * invsa) >> 8; - uint32_t g = ((palbase[(pix >> 8) & 0xff] >> _SrcShiftG) * sg + dest_g(dpix) * invsa) >> 8; - uint32_t b = ((palbase[(pix >> 0) & 0xff] >> _SrcShiftB) * sb + dest_b(dpix) * invsa) >> 8; + u32 pix = get_texel_rgb32(prim.texture, curu, curv); + u32 dpix = _NoDestRead ? 0 : *dest; + u32 r = ((palbase[(pix >> 16) & 0xff] >> _SrcShiftR) * sr + dest_r(dpix) * invsa) >> 8; + u32 g = ((palbase[(pix >> 8) & 0xff] >> _SrcShiftG) * sg + dest_g(dpix) * invsa) >> 8; + u32 b = ((palbase[(pix >> 0) & 0xff] >> _SrcShiftB) * sb + dest_b(dpix) * invsa) >> 8; *dest++ = dest_assemble_rgb(r, g, b); curu += dudx; @@ -1264,12 +1264,12 @@ private: // rasterization by using RGB add //------------------------------------------------- - static void draw_quad_rgb32_add(const render_primitive &prim, _PixelType *dstdata, uint32_t pitch, quad_setup_data &setup) + static void draw_quad_rgb32_add(const render_primitive &prim, _PixelType *dstdata, u32 pitch, quad_setup_data &setup) { const rgb_t *palbase = prim.texture.palette; - int32_t dudx = setup.dudx; - int32_t dvdx = setup.dvdx; - int32_t endx = setup.endx; + s32 dudx = setup.dudx; + s32 dvdx = setup.dvdx; + s32 endx = setup.endx; // simply can't do this without reading from the dest if (_NoDestRead) @@ -1279,23 +1279,23 @@ private: if (prim.color.r >= 1.0f && prim.color.g >= 1.0f && prim.color.b >= 1.0f && is_opaque(prim.color.a)) { // loop over rows - for (int32_t y = setup.starty; y < setup.endy; y++) + for (s32 y = setup.starty; y < setup.endy; y++) { _PixelType *dest = dstdata + y * pitch + setup.startx; - int32_t curu = setup.startu + (y - setup.starty) * setup.dudy; - int32_t curv = setup.startv + (y - setup.starty) * setup.dvdy; + s32 curu = setup.startu + (y - setup.starty) * setup.dudy; + s32 curv = setup.startv + (y - setup.starty) * setup.dvdy; // no lookup case if (palbase == nullptr) { // loop over cols - for (int32_t x = setup.startx; x < endx; x++) + for (s32 x = setup.startx; x < endx; x++) { - uint32_t pix = get_texel_argb32(prim.texture, curu, curv); - uint32_t dpix = _NoDestRead ? 0 : *dest; - uint32_t r = source32_r(pix) + dest_r(dpix); - uint32_t g = source32_g(pix) + dest_g(dpix); - uint32_t b = source32_b(pix) + dest_b(dpix); + u32 pix = get_texel_argb32(prim.texture, curu, curv); + u32 dpix = _NoDestRead ? 0 : *dest; + u32 r = source32_r(pix) + dest_r(dpix); + u32 g = source32_g(pix) + dest_g(dpix); + u32 b = source32_b(pix) + dest_b(dpix); r = (r | -(r >> (8 - _SrcShiftR))) & (0xff >> _SrcShiftR); g = (g | -(g >> (8 - _SrcShiftG))) & (0xff >> _SrcShiftG); b = (b | -(b >> (8 - _SrcShiftB))) & (0xff >> _SrcShiftB); @@ -1309,13 +1309,13 @@ private: else { // loop over cols - for (int32_t x = setup.startx; x < endx; x++) + for (s32 x = setup.startx; x < endx; x++) { - uint32_t pix = get_texel_argb32(prim.texture, curu, curv); - uint32_t dpix = _NoDestRead ? 0 : *dest; - uint32_t r = (palbase[(pix >> 16) & 0xff] >> _SrcShiftR) + dest_r(dpix); - uint32_t g = (palbase[(pix >> 8) & 0xff] >> _SrcShiftG) + dest_g(dpix); - uint32_t b = (palbase[(pix >> 0) & 0xff] >> _SrcShiftB) + dest_b(dpix); + u32 pix = get_texel_argb32(prim.texture, curu, curv); + u32 dpix = _NoDestRead ? 0 : *dest; + u32 r = (palbase[(pix >> 16) & 0xff] >> _SrcShiftR) + dest_r(dpix); + u32 g = (palbase[(pix >> 8) & 0xff] >> _SrcShiftG) + dest_g(dpix); + u32 b = (palbase[(pix >> 0) & 0xff] >> _SrcShiftB) + dest_b(dpix); r = (r | -(r >> (8 - _SrcShiftR))) & (0xff >> _SrcShiftR); g = (g | -(g >> (8 - _SrcShiftG))) & (0xff >> _SrcShiftG); b = (b | -(b >> (8 - _SrcShiftB))) & (0xff >> _SrcShiftB); @@ -1330,35 +1330,35 @@ private: // alpha and/or coloring case else { - uint32_t sr = uint32_t(256.0f * prim.color.r); - uint32_t sg = uint32_t(256.0f * prim.color.g); - uint32_t sb = uint32_t(256.0f * prim.color.b); - uint32_t sa = uint32_t(256.0f * prim.color.a); + u32 sr = u32(256.0f * prim.color.r); + u32 sg = u32(256.0f * prim.color.g); + u32 sb = u32(256.0f * prim.color.b); + u32 sa = u32(256.0f * prim.color.a); // clamp R,G,B and inverse A to 0-256 range - if (sr > 0x100) { if (int32_t(sr) < 0) sr = 0; else sr = 0x100; } - if (sg > 0x100) { if (int32_t(sg) < 0) sg = 0; else sg = 0x100; } - if (sb > 0x100) { if (int32_t(sb) < 0) sb = 0; else sb = 0x100; } - if (sa > 0x100) { if (int32_t(sa) < 0) sa = 0; else sa = 0x100; } + if (sr > 0x100) { if (s32(sr) < 0) sr = 0; else sr = 0x100; } + if (sg > 0x100) { if (s32(sg) < 0) sg = 0; else sg = 0x100; } + if (sb > 0x100) { if (s32(sb) < 0) sb = 0; else sb = 0x100; } + if (sa > 0x100) { if (s32(sa) < 0) sa = 0; else sa = 0x100; } // loop over rows - for (int32_t y = setup.starty; y < setup.endy; y++) + for (s32 y = setup.starty; y < setup.endy; y++) { _PixelType *dest = dstdata + y * pitch + setup.startx; - int32_t curu = setup.startu + (y - setup.starty) * setup.dudy; - int32_t curv = setup.startv + (y - setup.starty) * setup.dvdy; + s32 curu = setup.startu + (y - setup.starty) * setup.dudy; + s32 curv = setup.startv + (y - setup.starty) * setup.dvdy; // no lookup case if (palbase == nullptr) { // loop over cols - for (int32_t x = setup.startx; x < endx; x++) + for (s32 x = setup.startx; x < endx; x++) { - uint32_t pix = get_texel_argb32(prim.texture, curu, curv); - uint32_t dpix = _NoDestRead ? 0 : *dest; - uint32_t r = ((source32_r(pix) * sr * sa) >> 16) + dest_r(dpix); - uint32_t g = ((source32_g(pix) * sg * sa) >> 16) + dest_g(dpix); - uint32_t b = ((source32_b(pix) * sb * sa) >> 16) + dest_b(dpix); + u32 pix = get_texel_argb32(prim.texture, curu, curv); + u32 dpix = _NoDestRead ? 0 : *dest; + u32 r = ((source32_r(pix) * sr * sa) >> 16) + dest_r(dpix); + u32 g = ((source32_g(pix) * sg * sa) >> 16) + dest_g(dpix); + u32 b = ((source32_b(pix) * sb * sa) >> 16) + dest_b(dpix); r = (r | -(r >> (8 - _SrcShiftR))) & (0xff >> _SrcShiftR); g = (g | -(g >> (8 - _SrcShiftG))) & (0xff >> _SrcShiftG); b = (b | -(b >> (8 - _SrcShiftB))) & (0xff >> _SrcShiftB); @@ -1372,13 +1372,13 @@ private: else { // loop over cols - for (int32_t x = setup.startx; x < endx; x++) + for (s32 x = setup.startx; x < endx; x++) { - uint32_t pix = get_texel_argb32(prim.texture, curu, curv); - uint32_t dpix = _NoDestRead ? 0 : *dest; - uint32_t r = ((palbase[(pix >> 16) & 0xff] * sr * sa) >> (16 + _SrcShiftR)) + dest_r(dpix); - uint32_t g = ((palbase[(pix >> 8) & 0xff] * sr * sa) >> (16 + _SrcShiftR)) + dest_g(dpix); - uint32_t b = ((palbase[(pix >> 0) & 0xff] * sr * sa) >> (16 + _SrcShiftR)) + dest_b(dpix); + u32 pix = get_texel_argb32(prim.texture, curu, curv); + u32 dpix = _NoDestRead ? 0 : *dest; + u32 r = ((palbase[(pix >> 16) & 0xff] * sr * sa) >> (16 + _SrcShiftR)) + dest_r(dpix); + u32 g = ((palbase[(pix >> 8) & 0xff] * sr * sa) >> (16 + _SrcShiftR)) + dest_g(dpix); + u32 b = ((palbase[(pix >> 0) & 0xff] * sr * sa) >> (16 + _SrcShiftR)) + dest_b(dpix); r = (r | -(r >> (8 - _SrcShiftR))) & (0xff >> _SrcShiftR); g = (g | -(g >> (8 - _SrcShiftG))) & (0xff >> _SrcShiftG); b = (b | -(b >> (8 - _SrcShiftB))) & (0xff >> _SrcShiftB); @@ -1402,38 +1402,38 @@ private: // rasterization using standard alpha blending //------------------------------------------------- - static void draw_quad_argb32_alpha(const render_primitive &prim, _PixelType *dstdata, uint32_t pitch, quad_setup_data &setup) + static void draw_quad_argb32_alpha(const render_primitive &prim, _PixelType *dstdata, u32 pitch, quad_setup_data &setup) { const rgb_t *palbase = prim.texture.palette; - int32_t dudx = setup.dudx; - int32_t dvdx = setup.dvdx; - int32_t endx = setup.endx; + s32 dudx = setup.dudx; + s32 dvdx = setup.dvdx; + s32 endx = setup.endx; // fast case: no coloring, no alpha if (prim.color.r >= 1.0f && prim.color.g >= 1.0f && prim.color.b >= 1.0f && is_opaque(prim.color.a)) { // loop over rows - for (int32_t y = setup.starty; y < setup.endy; y++) + for (s32 y = setup.starty; y < setup.endy; y++) { _PixelType *dest = dstdata + y * pitch + setup.startx; - int32_t curu = setup.startu + (y - setup.starty) * setup.dudy; - int32_t curv = setup.startv + (y - setup.starty) * setup.dvdy; + s32 curu = setup.startu + (y - setup.starty) * setup.dudy; + s32 curv = setup.startv + (y - setup.starty) * setup.dvdy; // no lookup case if (palbase == nullptr) { // loop over cols - for (int32_t x = setup.startx; x < endx; x++) + for (s32 x = setup.startx; x < endx; x++) { - uint32_t pix = get_texel_argb32(prim.texture, curu, curv); - uint32_t ta = pix >> 24; + u32 pix = get_texel_argb32(prim.texture, curu, curv); + u32 ta = pix >> 24; if (ta != 0) { - uint32_t dpix = _NoDestRead ? 0 : *dest; - uint32_t invta = 0x100 - ta; - uint32_t r = (source32_r(pix) * ta + dest_r(dpix) * invta) >> 8; - uint32_t g = (source32_g(pix) * ta + dest_g(dpix) * invta) >> 8; - uint32_t b = (source32_b(pix) * ta + dest_b(dpix) * invta) >> 8; + u32 dpix = _NoDestRead ? 0 : *dest; + u32 invta = 0x100 - ta; + u32 r = (source32_r(pix) * ta + dest_r(dpix) * invta) >> 8; + u32 g = (source32_g(pix) * ta + dest_g(dpix) * invta) >> 8; + u32 b = (source32_b(pix) * ta + dest_b(dpix) * invta) >> 8; *dest = dest_assemble_rgb(r, g, b); } @@ -1447,17 +1447,17 @@ private: else { // loop over cols - for (int32_t x = setup.startx; x < endx; x++) + for (s32 x = setup.startx; x < endx; x++) { - uint32_t pix = get_texel_argb32(prim.texture, curu, curv); - uint32_t ta = pix >> 24; + u32 pix = get_texel_argb32(prim.texture, curu, curv); + u32 ta = pix >> 24; if (ta != 0) { - uint32_t dpix = _NoDestRead ? 0 : *dest; - uint32_t invta = 0x100 - ta; - uint32_t r = ((palbase[(pix >> 16) & 0xff] >> _SrcShiftR) * ta + dest_r(dpix) * invta) >> 8; - uint32_t g = ((palbase[(pix >> 8) & 0xff] >> _SrcShiftG) * ta + dest_g(dpix) * invta) >> 8; - uint32_t b = ((palbase[(pix >> 0) & 0xff] >> _SrcShiftB) * ta + dest_b(dpix) * invta) >> 8; + u32 dpix = _NoDestRead ? 0 : *dest; + u32 invta = 0x100 - ta; + u32 r = ((palbase[(pix >> 16) & 0xff] >> _SrcShiftR) * ta + dest_r(dpix) * invta) >> 8; + u32 g = ((palbase[(pix >> 8) & 0xff] >> _SrcShiftG) * ta + dest_g(dpix) * invta) >> 8; + u32 b = ((palbase[(pix >> 0) & 0xff] >> _SrcShiftB) * ta + dest_b(dpix) * invta) >> 8; *dest = dest_assemble_rgb(r, g, b); } @@ -1472,39 +1472,39 @@ private: // alpha and/or coloring case else { - uint32_t sr = uint32_t(256.0f * prim.color.r); - uint32_t sg = uint32_t(256.0f * prim.color.g); - uint32_t sb = uint32_t(256.0f * prim.color.b); - uint32_t sa = uint32_t(256.0f * prim.color.a); + u32 sr = u32(256.0f * prim.color.r); + u32 sg = u32(256.0f * prim.color.g); + u32 sb = u32(256.0f * prim.color.b); + u32 sa = u32(256.0f * prim.color.a); // clamp R,G,B and inverse A to 0-256 range - if (sr > 0x100) { if (int32_t(sr) < 0) sr = 0; else sr = 0x100; } - if (sg > 0x100) { if (int32_t(sg) < 0) sg = 0; else sg = 0x100; } - if (sb > 0x100) { if (int32_t(sb) < 0) sb = 0; else sb = 0x100; } - if (sa > 0x100) { if (int32_t(sa) < 0) sa = 0; else sa = 0x100; } + if (sr > 0x100) { if (s32(sr) < 0) sr = 0; else sr = 0x100; } + if (sg > 0x100) { if (s32(sg) < 0) sg = 0; else sg = 0x100; } + if (sb > 0x100) { if (s32(sb) < 0) sb = 0; else sb = 0x100; } + if (sa > 0x100) { if (s32(sa) < 0) sa = 0; else sa = 0x100; } // loop over rows - for (int32_t y = setup.starty; y < setup.endy; y++) + for (s32 y = setup.starty; y < setup.endy; y++) { _PixelType *dest = dstdata + y * pitch + setup.startx; - int32_t curu = setup.startu + (y - setup.starty) * setup.dudy; - int32_t curv = setup.startv + (y - setup.starty) * setup.dvdy; + s32 curu = setup.startu + (y - setup.starty) * setup.dudy; + s32 curv = setup.startv + (y - setup.starty) * setup.dvdy; // no lookup case if (palbase == nullptr) { // loop over cols - for (int32_t x = setup.startx; x < endx; x++) + for (s32 x = setup.startx; x < endx; x++) { - uint32_t pix = get_texel_argb32(prim.texture, curu, curv); - uint32_t ta = (pix >> 24) * sa; + u32 pix = get_texel_argb32(prim.texture, curu, curv); + u32 ta = (pix >> 24) * sa; if (ta != 0) { - uint32_t dpix = _NoDestRead ? 0 : *dest; - uint32_t invsta = (0x10000 - ta) << 8; - uint32_t r = (source32_r(pix) * sr * ta + dest_r(dpix) * invsta) >> 24; - uint32_t g = (source32_g(pix) * sg * ta + dest_g(dpix) * invsta) >> 24; - uint32_t b = (source32_b(pix) * sb * ta + dest_b(dpix) * invsta) >> 24; + u32 dpix = _NoDestRead ? 0 : *dest; + u32 invsta = (0x10000 - ta) << 8; + u32 r = (source32_r(pix) * sr * ta + dest_r(dpix) * invsta) >> 24; + u32 g = (source32_g(pix) * sg * ta + dest_g(dpix) * invsta) >> 24; + u32 b = (source32_b(pix) * sb * ta + dest_b(dpix) * invsta) >> 24; *dest = dest_assemble_rgb(r, g, b); } @@ -1519,17 +1519,17 @@ private: else { // loop over cols - for (int32_t x = setup.startx; x < endx; x++) + for (s32 x = setup.startx; x < endx; x++) { - uint32_t pix = get_texel_argb32(prim.texture, curu, curv); - uint32_t ta = (pix >> 24) * sa; + u32 pix = get_texel_argb32(prim.texture, curu, curv); + u32 ta = (pix >> 24) * sa; if (ta != 0) { - uint32_t dpix = _NoDestRead ? 0 : *dest; - uint32_t invsta = (0x10000 - ta) << 8; - uint32_t r = ((palbase[(pix >> 16) & 0xff] >> _SrcShiftR) * sr * ta + dest_r(dpix) * invsta) >> 24; - uint32_t g = ((palbase[(pix >> 8) & 0xff] >> _SrcShiftG) * sg * ta + dest_g(dpix) * invsta) >> 24; - uint32_t b = ((palbase[(pix >> 0) & 0xff] >> _SrcShiftB) * sb * ta + dest_b(dpix) * invsta) >> 24; + u32 dpix = _NoDestRead ? 0 : *dest; + u32 invsta = (0x10000 - ta) << 8; + u32 r = ((palbase[(pix >> 16) & 0xff] >> _SrcShiftR) * sr * ta + dest_r(dpix) * invsta) >> 24; + u32 g = ((palbase[(pix >> 8) & 0xff] >> _SrcShiftG) * sg * ta + dest_g(dpix) * invsta) >> 24; + u32 b = ((palbase[(pix >> 0) & 0xff] >> _SrcShiftB) * sb * ta + dest_b(dpix) * invsta) >> 24; *dest = dest_assemble_rgb(r, g, b); } @@ -1548,12 +1548,12 @@ private: // rasterization using RGB multiply //------------------------------------------------- - static void draw_quad_argb32_multiply(const render_primitive &prim, _PixelType *dstdata, uint32_t pitch, quad_setup_data &setup) + static void draw_quad_argb32_multiply(const render_primitive &prim, _PixelType *dstdata, u32 pitch, quad_setup_data &setup) { const rgb_t *palbase = prim.texture.palette; - int32_t dudx = setup.dudx; - int32_t dvdx = setup.dvdx; - int32_t endx = setup.endx; + s32 dudx = setup.dudx; + s32 dvdx = setup.dvdx; + s32 endx = setup.endx; // simply can't do this without reading from the dest if (_NoDestRead) @@ -1563,23 +1563,23 @@ private: if (prim.color.r >= 1.0f && prim.color.g >= 1.0f && prim.color.b >= 1.0f && is_opaque(prim.color.a)) { // loop over rows - for (int32_t y = setup.starty; y < setup.endy; y++) + for (s32 y = setup.starty; y < setup.endy; y++) { _PixelType *dest = dstdata + y * pitch + setup.startx; - int32_t curu = setup.startu + (y - setup.starty) * setup.dudy; - int32_t curv = setup.startv + (y - setup.starty) * setup.dvdy; + s32 curu = setup.startu + (y - setup.starty) * setup.dudy; + s32 curv = setup.startv + (y - setup.starty) * setup.dvdy; // no lookup case if (palbase == nullptr) { // loop over cols - for (int32_t x = setup.startx; x < endx; x++) + for (s32 x = setup.startx; x < endx; x++) { - uint32_t pix = get_texel_argb32(prim.texture, curu, curv); - uint32_t dpix = _NoDestRead ? 0 : *dest; - uint32_t r = (source32_r(pix) * dest_r(dpix)) >> (8 - _SrcShiftR); - uint32_t g = (source32_g(pix) * dest_g(dpix)) >> (8 - _SrcShiftG); - uint32_t b = (source32_b(pix) * dest_b(dpix)) >> (8 - _SrcShiftB); + u32 pix = get_texel_argb32(prim.texture, curu, curv); + u32 dpix = _NoDestRead ? 0 : *dest; + u32 r = (source32_r(pix) * dest_r(dpix)) >> (8 - _SrcShiftR); + u32 g = (source32_g(pix) * dest_g(dpix)) >> (8 - _SrcShiftG); + u32 b = (source32_b(pix) * dest_b(dpix)) >> (8 - _SrcShiftB); *dest++ = dest_assemble_rgb(r, g, b); curu += dudx; @@ -1589,13 +1589,13 @@ private: else { // loop over cols - for (int32_t x = setup.startx; x < endx; x++) + for (s32 x = setup.startx; x < endx; x++) { - uint32_t pix = get_texel_argb32(prim.texture, curu, curv); - uint32_t dpix = _NoDestRead ? 0 : *dest; - uint32_t r = (palbase[(pix >> 16) & 0xff] * dest_r(dpix)) >> 8; - uint32_t g = (palbase[(pix >> 8) & 0xff] * dest_g(dpix)) >> 8; - uint32_t b = (palbase[(pix >> 0) & 0xff] * dest_b(dpix)) >> 8; + u32 pix = get_texel_argb32(prim.texture, curu, curv); + u32 dpix = _NoDestRead ? 0 : *dest; + u32 r = (palbase[(pix >> 16) & 0xff] * dest_r(dpix)) >> 8; + u32 g = (palbase[(pix >> 8) & 0xff] * dest_g(dpix)) >> 8; + u32 b = (palbase[(pix >> 0) & 0xff] * dest_b(dpix)) >> 8; *dest++ = dest_assemble_rgb(r, g, b); curu += dudx; @@ -1608,33 +1608,33 @@ private: // alpha and/or coloring case else { - uint32_t sr = uint32_t(256.0f * prim.color.r * prim.color.a); - uint32_t sg = uint32_t(256.0f * prim.color.g * prim.color.a); - uint32_t sb = uint32_t(256.0f * prim.color.b * prim.color.a); + u32 sr = u32(256.0f * prim.color.r * prim.color.a); + u32 sg = u32(256.0f * prim.color.g * prim.color.a); + u32 sb = u32(256.0f * prim.color.b * prim.color.a); // clamp R,G,B and inverse A to 0-256 range - if (sr > 0x100) { if (int32_t(sr) < 0) sr = 0; else sr = 0x100; } - if (sg > 0x100) { if (int32_t(sg) < 0) sg = 0; else sg = 0x100; } - if (sb > 0x100) { if (int32_t(sb) < 0) sb = 0; else sb = 0x100; } + if (sr > 0x100) { if (s32(sr) < 0) sr = 0; else sr = 0x100; } + if (sg > 0x100) { if (s32(sg) < 0) sg = 0; else sg = 0x100; } + if (sb > 0x100) { if (s32(sb) < 0) sb = 0; else sb = 0x100; } // loop over rows - for (int32_t y = setup.starty; y < setup.endy; y++) + for (s32 y = setup.starty; y < setup.endy; y++) { _PixelType *dest = dstdata + y * pitch + setup.startx; - int32_t curu = setup.startu + (y - setup.starty) * setup.dudy; - int32_t curv = setup.startv + (y - setup.starty) * setup.dvdy; + s32 curu = setup.startu + (y - setup.starty) * setup.dudy; + s32 curv = setup.startv + (y - setup.starty) * setup.dvdy; // no lookup case if (palbase == nullptr) { // loop over cols - for (int32_t x = setup.startx; x < endx; x++) + for (s32 x = setup.startx; x < endx; x++) { - uint32_t pix = get_texel_argb32(prim.texture, curu, curv); - uint32_t dpix = _NoDestRead ? 0 : *dest; - uint32_t r = (source32_r(pix) * sr * dest_r(dpix)) >> (16 - _SrcShiftR); - uint32_t g = (source32_g(pix) * sg * dest_g(dpix)) >> (16 - _SrcShiftG); - uint32_t b = (source32_b(pix) * sb * dest_b(dpix)) >> (16 - _SrcShiftB); + u32 pix = get_texel_argb32(prim.texture, curu, curv); + u32 dpix = _NoDestRead ? 0 : *dest; + u32 r = (source32_r(pix) * sr * dest_r(dpix)) >> (16 - _SrcShiftR); + u32 g = (source32_g(pix) * sg * dest_g(dpix)) >> (16 - _SrcShiftG); + u32 b = (source32_b(pix) * sb * dest_b(dpix)) >> (16 - _SrcShiftB); *dest++ = dest_assemble_rgb(r, g, b); curu += dudx; @@ -1644,13 +1644,13 @@ private: else { // loop over cols - for (int32_t x = setup.startx; x < endx; x++) + for (s32 x = setup.startx; x < endx; x++) { - uint32_t pix = get_texel_argb32(prim.texture, curu, curv); - uint32_t dpix = _NoDestRead ? 0 : *dest; - uint32_t r = (palbase[(pix >> 16) & 0xff] * sr * dest_r(dpix)) >> 16; - uint32_t g = (palbase[(pix >> 8) & 0xff] * sg * dest_g(dpix)) >> 16; - uint32_t b = (palbase[(pix >> 0) & 0xff] * sb * dest_b(dpix)) >> 16; + u32 pix = get_texel_argb32(prim.texture, curu, curv); + u32 dpix = _NoDestRead ? 0 : *dest; + u32 r = (palbase[(pix >> 16) & 0xff] * sr * dest_r(dpix)) >> 16; + u32 g = (palbase[(pix >> 8) & 0xff] * sg * dest_g(dpix)) >> 16; + u32 b = (palbase[(pix >> 0) & 0xff] * sb * dest_b(dpix)) >> 16; *dest++ = dest_assemble_rgb(r, g, b); curu += dudx; @@ -1667,12 +1667,12 @@ private: // rasterization by using RGB add //------------------------------------------------- - static void draw_quad_argb32_add(const render_primitive &prim, _PixelType *dstdata, uint32_t pitch, quad_setup_data &setup) + static void draw_quad_argb32_add(const render_primitive &prim, _PixelType *dstdata, u32 pitch, quad_setup_data &setup) { const rgb_t *palbase = prim.texture.palette; - int32_t dudx = setup.dudx; - int32_t dvdx = setup.dvdx; - int32_t endx = setup.endx; + s32 dudx = setup.dudx; + s32 dvdx = setup.dvdx; + s32 endx = setup.endx; // simply can't do this without reading from the dest if (_NoDestRead) @@ -1682,26 +1682,26 @@ private: if (prim.color.r >= 1.0f && prim.color.g >= 1.0f && prim.color.b >= 1.0f && is_opaque(prim.color.a)) { // loop over rows - for (int32_t y = setup.starty; y < setup.endy; y++) + for (s32 y = setup.starty; y < setup.endy; y++) { _PixelType *dest = dstdata + y * pitch + setup.startx; - int32_t curu = setup.startu + (y - setup.starty) * setup.dudy; - int32_t curv = setup.startv + (y - setup.starty) * setup.dvdy; + s32 curu = setup.startu + (y - setup.starty) * setup.dudy; + s32 curv = setup.startv + (y - setup.starty) * setup.dvdy; // no lookup case if (palbase == nullptr) { // loop over cols - for (int32_t x = setup.startx; x < endx; x++) + for (s32 x = setup.startx; x < endx; x++) { - uint32_t pix = get_texel_argb32(prim.texture, curu, curv); - uint32_t ta = pix >> 24; + u32 pix = get_texel_argb32(prim.texture, curu, curv); + u32 ta = pix >> 24; if (ta != 0) { - uint32_t dpix = _NoDestRead ? 0 : *dest; - uint32_t r = ((source32_r(pix) * ta) >> 8) + dest_r(dpix); - uint32_t g = ((source32_g(pix) * ta) >> 8) + dest_g(dpix); - uint32_t b = ((source32_b(pix) * ta) >> 8) + dest_b(dpix); + u32 dpix = _NoDestRead ? 0 : *dest; + u32 r = ((source32_r(pix) * ta) >> 8) + dest_r(dpix); + u32 g = ((source32_g(pix) * ta) >> 8) + dest_g(dpix); + u32 b = ((source32_b(pix) * ta) >> 8) + dest_b(dpix); r = (r | -(r >> (8 - _SrcShiftR))) & (0xff >> _SrcShiftR); g = (g | -(g >> (8 - _SrcShiftG))) & (0xff >> _SrcShiftG); b = (b | -(b >> (8 - _SrcShiftB))) & (0xff >> _SrcShiftB); @@ -1717,16 +1717,16 @@ private: else { // loop over cols - for (int32_t x = setup.startx; x < endx; x++) + for (s32 x = setup.startx; x < endx; x++) { - uint32_t pix = get_texel_argb32(prim.texture, curu, curv); - uint32_t ta = pix >> 24; + u32 pix = get_texel_argb32(prim.texture, curu, curv); + u32 ta = pix >> 24; if (ta != 0) { - uint32_t dpix = _NoDestRead ? 0 : *dest; - uint32_t r = ((palbase[(pix >> 16) & 0xff] * ta) >> (8 + _SrcShiftR)) + dest_r(dpix); - uint32_t g = ((palbase[(pix >> 8) & 0xff] * ta) >> (8 + _SrcShiftG)) + dest_g(dpix); - uint32_t b = ((palbase[(pix >> 0) & 0xff] * ta) >> (8 + _SrcShiftB)) + dest_b(dpix); + u32 dpix = _NoDestRead ? 0 : *dest; + u32 r = ((palbase[(pix >> 16) & 0xff] * ta) >> (8 + _SrcShiftR)) + dest_r(dpix); + u32 g = ((palbase[(pix >> 8) & 0xff] * ta) >> (8 + _SrcShiftG)) + dest_g(dpix); + u32 b = ((palbase[(pix >> 0) & 0xff] * ta) >> (8 + _SrcShiftB)) + dest_b(dpix); r = (r | -(r >> (8 - _SrcShiftR))) & (0xff >> _SrcShiftR); g = (g | -(g >> (8 - _SrcShiftG))) & (0xff >> _SrcShiftG); b = (b | -(b >> (8 - _SrcShiftB))) & (0xff >> _SrcShiftB); @@ -1743,38 +1743,38 @@ private: // alpha and/or coloring case else { - uint32_t sr = uint32_t(256.0f * prim.color.r); - uint32_t sg = uint32_t(256.0f * prim.color.g); - uint32_t sb = uint32_t(256.0f * prim.color.b); - uint32_t sa = uint32_t(256.0f * prim.color.a); + u32 sr = u32(256.0f * prim.color.r); + u32 sg = u32(256.0f * prim.color.g); + u32 sb = u32(256.0f * prim.color.b); + u32 sa = u32(256.0f * prim.color.a); // clamp R,G,B and inverse A to 0-256 range - if (sr > 0x100) { if (int32_t(sr) < 0) sr = 0; else sr = 0x100; } - if (sg > 0x100) { if (int32_t(sg) < 0) sg = 0; else sg = 0x100; } - if (sb > 0x100) { if (int32_t(sb) < 0) sb = 0; else sb = 0x100; } - if (sa > 0x100) { if (int32_t(sa) < 0) sa = 0; else sa = 0x100; } + if (sr > 0x100) { if (s32(sr) < 0) sr = 0; else sr = 0x100; } + if (sg > 0x100) { if (s32(sg) < 0) sg = 0; else sg = 0x100; } + if (sb > 0x100) { if (s32(sb) < 0) sb = 0; else sb = 0x100; } + if (sa > 0x100) { if (s32(sa) < 0) sa = 0; else sa = 0x100; } // loop over rows - for (int32_t y = setup.starty; y < setup.endy; y++) + for (s32 y = setup.starty; y < setup.endy; y++) { _PixelType *dest = dstdata + y * pitch + setup.startx; - int32_t curu = setup.startu + (y - setup.starty) * setup.dudy; - int32_t curv = setup.startv + (y - setup.starty) * setup.dvdy; + s32 curu = setup.startu + (y - setup.starty) * setup.dudy; + s32 curv = setup.startv + (y - setup.starty) * setup.dvdy; // no lookup case if (palbase == nullptr) { // loop over cols - for (int32_t x = setup.startx; x < endx; x++) + for (s32 x = setup.startx; x < endx; x++) { - uint32_t pix = get_texel_argb32(prim.texture, curu, curv); - uint32_t ta = (pix >> 24) * sa; + u32 pix = get_texel_argb32(prim.texture, curu, curv); + u32 ta = (pix >> 24) * sa; if (ta != 0) { - uint32_t dpix = _NoDestRead ? 0 : *dest; - uint32_t r = ((source32_r(pix) * sr * ta) >> 24) + dest_r(dpix); - uint32_t g = ((source32_g(pix) * sg * ta) >> 24) + dest_g(dpix); - uint32_t b = ((source32_b(pix) * sb * ta) >> 24) + dest_b(dpix); + u32 dpix = _NoDestRead ? 0 : *dest; + u32 r = ((source32_r(pix) * sr * ta) >> 24) + dest_r(dpix); + u32 g = ((source32_g(pix) * sg * ta) >> 24) + dest_g(dpix); + u32 b = ((source32_b(pix) * sb * ta) >> 24) + dest_b(dpix); r = (r | -(r >> (8 - _SrcShiftR))) & (0xff >> _SrcShiftR); g = (g | -(g >> (8 - _SrcShiftG))) & (0xff >> _SrcShiftG); b = (b | -(b >> (8 - _SrcShiftB))) & (0xff >> _SrcShiftB); @@ -1790,16 +1790,16 @@ private: else { // loop over cols - for (int32_t x = setup.startx; x < endx; x++) + for (s32 x = setup.startx; x < endx; x++) { - uint32_t pix = get_texel_argb32(prim.texture, curu, curv); - uint32_t ta = (pix >> 24) * sa; + u32 pix = get_texel_argb32(prim.texture, curu, curv); + u32 ta = (pix >> 24) * sa; if (ta != 0) { - uint32_t dpix = _NoDestRead ? 0 : *dest; - uint32_t r = ((palbase[(pix >> 16) & 0xff] * sr * ta) >> (24 + _SrcShiftR)) + dest_r(dpix); - uint32_t g = ((palbase[(pix >> 8) & 0xff] * sr * ta) >> (24 + _SrcShiftR)) + dest_g(dpix); - uint32_t b = ((palbase[(pix >> 0) & 0xff] * sr * ta) >> (24 + _SrcShiftR)) + dest_b(dpix); + u32 dpix = _NoDestRead ? 0 : *dest; + u32 r = ((palbase[(pix >> 16) & 0xff] * sr * ta) >> (24 + _SrcShiftR)) + dest_r(dpix); + u32 g = ((palbase[(pix >> 8) & 0xff] * sr * ta) >> (24 + _SrcShiftR)) + dest_g(dpix); + u32 b = ((palbase[(pix >> 0) & 0xff] * sr * ta) >> (24 + _SrcShiftR)) + dest_b(dpix); r = (r | -(r >> (8 - _SrcShiftR))) & (0xff >> _SrcShiftR); g = (g | -(g >> (8 - _SrcShiftG))) & (0xff >> _SrcShiftG); b = (b | -(b >> (8 - _SrcShiftB))) & (0xff >> _SrcShiftB); @@ -1825,7 +1825,7 @@ private: // drawing routine //------------------------------------------------- - static void setup_and_draw_textured_quad(const render_primitive &prim, _PixelType *dstdata, int32_t width, int32_t height, uint32_t pitch) + static void setup_and_draw_textured_quad(const render_primitive &prim, _PixelType *dstdata, s32 width, s32 height, u32 pitch) { assert(prim.bounds.x0 <= prim.bounds.x1); assert(prim.bounds.y0 <= prim.bounds.y1); @@ -1936,7 +1936,7 @@ private: //------------------------------------------------- public: - static void draw_primitives(const render_primitive_list &primlist, void *dstdata, uint32_t width, uint32_t height, uint32_t pitch) + static void draw_primitives(const render_primitive_list &primlist, void *dstdata, u32 width, u32 height, u32 pitch) { // loop over the list and render each element for (const render_primitive *prim = primlist.first(); prim != nullptr; prim = prim->next()) diff --git a/src/emu/rendfont.cpp b/src/emu/rendfont.cpp index aa43342958c..9adbbe2dc33 100644 --- a/src/emu/rendfont.cpp +++ b/src/emu/rendfont.cpp @@ -22,7 +22,7 @@ #include -const uint64_t render_font::CACHED_BDF_HASH_SIZE; +const u64 render_font::CACHED_BDF_HASH_SIZE; //************************************************************************** // INLINE FUNCTIONS @@ -234,11 +234,11 @@ void render_font::char_expand(char32_t chnum, glyph &gl) // extract the data const char *ptr = gl.rawdata; - uint8_t accum = 0, accumbit = 7; + u8 accum = 0, accumbit = 7; for (int y = 0; y < gl.bmheight; y++) { int desty = y + m_height_cmd + m_yoffs_cmd - gl.yoffs - gl.bmheight; - uint32_t *dest = (desty >= 0 && desty < m_height_cmd) ? &gl.bitmap.pix32(desty, 0) : nullptr; + u32 *dest = (desty >= 0 && desty < m_height_cmd) ? &gl.bitmap.pix32(desty, 0) : nullptr; { for (int x = 0; x < gl.bmwidth; x++) { @@ -283,11 +283,11 @@ void render_font::char_expand(char32_t chnum, glyph &gl) // extract the data const char *ptr = gl.rawdata; - uint8_t accum = 0, accumbit = 7; + u8 accum = 0, accumbit = 7; for (int y = 0; y < gl.bmheight; y++) { int desty = y + m_height + m_yoffs - gl.yoffs - gl.bmheight; - uint32_t *dest = (desty >= 0 && desty < m_height) ? &gl.bitmap.pix32(desty) : nullptr; + u32 *dest = (desty >= 0 && desty < m_height) ? &gl.bitmap.pix32(desty) : nullptr; // text format if (m_format == FF_TEXT) @@ -454,7 +454,7 @@ float render_font::utf8string_width(float height, float aspect, const char *utf8 // loop over the string and accumulate widths int count; - int32_t totwidth = 0; + s32 totwidth = 0; for (std::size_t offset = 0U; offset < length; offset += unsigned(count)) { char32_t uchar; @@ -490,12 +490,12 @@ bool render_font::load_cached_bdf(const char *filename) m_rawdata.resize(m_rawsize + 1); // read the first chunk - uint32_t bytes = file.read(&m_rawdata[0], std::min(CACHED_BDF_HASH_SIZE, m_rawsize)); + u32 bytes = file.read(&m_rawdata[0], std::min(CACHED_BDF_HASH_SIZE, m_rawsize)); if (bytes != std::min(CACHED_BDF_HASH_SIZE, m_rawsize)) return false; // has the chunk - uint32_t hash = core_crc32(0, (const uint8_t *)&m_rawdata[0], bytes) ^ (uint32_t)m_rawsize; + u32 hash = core_crc32(0, (const u8 *)&m_rawdata[0], bytes) ^ u32(m_rawsize); // create the cached filename, changing the 'F' to a 'C' on the extension std::string cachedname(filename); @@ -523,7 +523,7 @@ bool render_font::load_cached_bdf(const char *filename) // read in the rest of the font if (bytes < m_rawsize) { - uint32_t read = file.read(&m_rawdata[bytes], m_rawsize - bytes); + u32 read = file.read(&m_rawdata[bytes], m_rawsize - bytes); if (read != m_rawsize - bytes) { m_rawdata.clear(); @@ -664,26 +664,26 @@ bool render_font::load_bdf() // load_cached - load a font in cached format //------------------------------------------------- -bool render_font::load_cached(emu_file &file, uint32_t hash) +bool render_font::load_cached(emu_file &file, u32 hash) { // get the file size - uint64_t filesize = file.size(); + u64 filesize = file.size(); // first read the header - uint8_t header[CACHED_HEADER_SIZE]; - uint32_t bytes_read = file.read(header, CACHED_HEADER_SIZE); + u8 header[CACHED_HEADER_SIZE]; + u32 bytes_read = file.read(header, CACHED_HEADER_SIZE); if (bytes_read != CACHED_HEADER_SIZE) return false; // validate the header if (header[0] != 'f' || header[1] != 'o' || header[2] != 'n' || header[3] != 't') return false; - if (hash && (header[4] != (uint8_t)(hash >> 24) || header[5] != (uint8_t)(hash >> 16) || header[6] != (uint8_t)(hash >> 8) || header[7] != (uint8_t)hash)) + if (hash && (header[4] != u8(hash >> 24) || header[5] != u8(hash >> 16) || header[6] != u8(hash >> 8) || header[7] != u8(hash))) return false; m_height = (header[8] << 8) | header[9]; m_scale = 1.0f / (float)m_height; - m_yoffs = (int16_t)((header[10] << 8) | header[11]); - uint32_t numchars = (header[12] << 24) | (header[13] << 16) | (header[14] << 8) | header[15]; + m_yoffs = s16((header[10] << 8) | header[11]); + u32 numchars = (header[12] << 24) | (header[13] << 16) | (header[14] << 8) | header[15]; if (filesize - CACHED_HEADER_SIZE < numchars * CACHED_CHAR_SIZE) return false; @@ -697,10 +697,10 @@ bool render_font::load_cached(emu_file &file, uint32_t hash) } // extract the data from the data - uint64_t offset = numchars * CACHED_CHAR_SIZE; + u64 offset = numchars * CACHED_CHAR_SIZE; for (int chindex = 0; chindex < numchars; chindex++) { - const uint8_t *info = reinterpret_cast(&m_rawdata[chindex * CACHED_CHAR_SIZE]); + const u8 *info = reinterpret_cast(&m_rawdata[chindex * CACHED_CHAR_SIZE]); int chnum = (info[0] << 8) | info[1]; // if we don't have a subtable yet, make one @@ -710,8 +710,8 @@ bool render_font::load_cached(emu_file &file, uint32_t hash) // fill in the entry glyph &gl = m_glyphs[chnum / 256][chnum % 256]; gl.width = (info[2] << 8) | info[3]; - gl.xoffs = (int16_t)((info[4] << 8) | info[5]); - gl.yoffs = (int16_t)((info[6] << 8) | info[7]); + gl.xoffs = s16((info[4] << 8) | info[5]); + gl.yoffs = s16((info[6] << 8) | info[7]); gl.bmwidth = (info[8] << 8) | info[9]; gl.bmheight = (info[10] << 8) | info[11]; gl.rawdata = &m_rawdata[offset]; @@ -735,7 +735,7 @@ bool render_font::load_cached(emu_file &file, uint32_t hash) // save_cached - save a font in cached format //------------------------------------------------- -bool render_font::save_cached(const char *filename, uint32_t hash) +bool render_font::save_cached(const char *filename, u32 hash) { osd_printf_warning("Generating cached BDF font...\n"); @@ -760,13 +760,13 @@ bool render_font::save_cached(const char *filename, uint32_t hash) try { // allocate an array to hold the character data - std::vector chartable(numchars * CACHED_CHAR_SIZE, 0); + std::vector chartable(numchars * CACHED_CHAR_SIZE, 0); // allocate a temp buffer to compress into - std::vector tempbuffer(65536); + std::vector tempbuffer(65536); // write the header - uint8_t *dest = &tempbuffer[0]; + u8 *dest = &tempbuffer[0]; *dest++ = 'f'; *dest++ = 'o'; *dest++ = 'n'; @@ -784,7 +784,7 @@ bool render_font::save_cached(const char *filename, uint32_t hash) *dest++ = numchars >> 8; *dest++ = numchars & 0xff; assert(dest == &tempbuffer[CACHED_HEADER_SIZE]); - uint32_t bytes_written = file.write(&tempbuffer[0], CACHED_HEADER_SIZE); + u32 bytes_written = file.write(&tempbuffer[0], CACHED_HEADER_SIZE); if (bytes_written != dest - &tempbuffer[0]) throw emu_fatalerror("Error writing cached file"); @@ -805,14 +805,14 @@ bool render_font::save_cached(const char *filename, uint32_t hash) { // write the data to the tempbuffer dest = &tempbuffer[0]; - uint8_t accum = 0; - uint8_t accbit = 7; + u8 accum = 0; + u8 accbit = 7; // bit-encode the character data for (int y = 0; y < gl.bmheight; y++) { int desty = y + m_height + m_yoffs - gl.yoffs - gl.bmheight; - const uint32_t *src = (desty >= 0 && desty < m_height) ? &gl.bitmap.pix32(desty) : nullptr; + const u32 *src = (desty >= 0 && desty < m_height) ? &gl.bitmap.pix32(desty) : nullptr; for (int x = 0; x < gl.bmwidth; x++) { if (src != nullptr && rgb_t(src[x]).a() != 0) diff --git a/src/emu/rendfont.h b/src/emu/rendfont.h index 7510efb8c0a..558b5c55aa5 100644 --- a/src/emu/rendfont.h +++ b/src/emu/rendfont.h @@ -38,7 +38,7 @@ public: render_manager &manager() const { return m_manager; } // size queries - int32_t pixel_height() const { return m_height; } + s32 pixel_height() const { return m_height; } float char_width(float height, float aspect, char32_t ch); float string_width(float height, float aspect, const char *string); float utf8string_width(float height, float aspect, const char *utf8string); @@ -59,9 +59,9 @@ private: rawdata(nullptr), texture(nullptr) { } - int32_t width; // width from this character to the next - int32_t xoffs, yoffs; // X and Y offset from baseline to top,left of bitmap - int32_t bmwidth, bmheight; // width and height of bitmap + s32 width; // width from this character to the next + s32 xoffs, yoffs; // X and Y offset from baseline to top,left of bitmap + s32 bmwidth, bmheight; // width and height of bitmap const char * rawdata; // pointer to the raw data for this one render_texture * texture; // pointer to a texture for rendering and sizing bitmap_argb32 bitmap; // pointer to the bitmap containing the raw data @@ -84,9 +84,9 @@ private: void char_expand(char32_t chnum, glyph &ch); bool load_cached_bdf(const char *filename); bool load_bdf(); - bool load_cached(emu_file &file, uint32_t hash); - bool load_cached_cmd(emu_file &file, uint32_t hash); - bool save_cached(const char *filename, uint32_t hash); + bool load_cached(emu_file &file, u32 hash); + bool load_cached_cmd(emu_file &file, u32 hash); + bool save_cached(const char *filename, u32 hash); void render_font_command_glyph(); @@ -98,7 +98,7 @@ private: float m_scale; // 1 / height precomputed glyph *m_glyphs[17*256]; // array of glyph subtables std::vector m_rawdata; // pointer to the raw data for the font - uint64_t m_rawsize; // size of the raw font data + u64 m_rawsize; // size of the raw font data std::unique_ptr m_osdfont; // handle to the OSD font int m_height_cmd; // height of the font, from ascent to descent @@ -109,7 +109,7 @@ private: // constants static const int CACHED_CHAR_SIZE = 12; static const int CACHED_HEADER_SIZE = 16; - static const uint64_t CACHED_BDF_HASH_SIZE = 1024; + static const u64 CACHED_BDF_HASH_SIZE = 1024; }; void convert_command_glyph(std::string &s); diff --git a/src/emu/rendlay.cpp b/src/emu/rendlay.cpp index 3a606eeeac3..b917b958063 100644 --- a/src/emu/rendlay.cpp +++ b/src/emu/rendlay.cpp @@ -867,15 +867,15 @@ void layout_element::reel_component::draw(running_machine &machine, bitmap_argb3 int use_state = (state + m_stateoffset) % max_state_used; // compute premultiplied colors - uint32_t r = color().r * 255.0f; - uint32_t g = color().g * 255.0f; - uint32_t b = color().b * 255.0f; - uint32_t a = color().a * 255.0f; + u32 r = color().r * 255.0f; + u32 g = color().g * 255.0f; + u32 b = color().b * 255.0f; + u32 a = color().a * 255.0f; // get the width of the string render_font *font = machine.render().font_alloc("default"); float aspect = 1.0f; - int32_t width; + s32 width; int curry = 0; int num_shown = m_numsymbolsvisible; @@ -914,7 +914,7 @@ void layout_element::reel_component::draw(running_machine &machine, bitmap_argb3 aspect *= 0.9f; } - int32_t curx; + s32 curx; curx = bounds.min_x + (bounds.width() - width) / 2; if (m_file[fruit]) @@ -935,14 +935,14 @@ void layout_element::reel_component::draw(running_machine &machine, bitmap_argb3 if (effy >= bounds.min_y && effy <= bounds.max_y) { - uint32_t *src = &tempbitmap2.pix32(y); - uint32_t *d = &dest.pix32(effy); + u32 *src = &tempbitmap2.pix32(y); + u32 *d = &dest.pix32(effy); for (int x = 0; x < dest.width(); x++) { int effx = x; if (effx >= bounds.min_x && effx <= bounds.max_x) { - uint32_t spix = rgb_t(src[x]).a(); + u32 spix = rgb_t(src[x]).a(); if (spix != 0) { d[effx] = src[x]; @@ -982,21 +982,21 @@ void layout_element::reel_component::draw(running_machine &machine, bitmap_argb3 if (effy >= bounds.min_y && effy <= bounds.max_y) { - uint32_t *src = &tempbitmap.pix32(y); - uint32_t *d = &dest.pix32(effy); + u32 *src = &tempbitmap.pix32(y); + u32 *d = &dest.pix32(effy); for (int x = 0; x < chbounds.width(); x++) { int effx = curx + x + chbounds.min_x; if (effx >= bounds.min_x && effx <= bounds.max_x) { - uint32_t spix = rgb_t(src[x]).a(); + u32 spix = rgb_t(src[x]).a(); if (spix != 0) { rgb_t dpix = d[effx]; - uint32_t ta = (a * (spix + 1)) >> 8; - uint32_t tr = (r * ta + dpix.r() * (0x100 - ta)) >> 8; - uint32_t tg = (g * ta + dpix.g() * (0x100 - ta)) >> 8; - uint32_t tb = (b * ta + dpix.b() * (0x100 - ta)) >> 8; + u32 ta = (a * (spix + 1)) >> 8; + u32 tr = (r * ta + dpix.r() * (0x100 - ta)) >> 8; + u32 tg = (g * ta + dpix.g() * (0x100 - ta)) >> 8; + u32 tb = (b * ta + dpix.b() * (0x100 - ta)) >> 8; d[effx] = rgb_t(tr, tg, tb); } } @@ -1027,15 +1027,15 @@ void layout_element::reel_component::draw_beltreel(running_machine &machine, bit int use_state = (state + m_stateoffset) % max_state_used; // compute premultiplied colors - uint32_t r = color().r * 255.0f; - uint32_t g = color().g * 255.0f; - uint32_t b = color().b * 255.0f; - uint32_t a = color().a * 255.0f; + u32 r = color().r * 255.0f; + u32 g = color().g * 255.0f; + u32 b = color().b * 255.0f; + u32 a = color().a * 255.0f; // get the width of the string render_font *font = machine.render().font_alloc("default"); float aspect = 1.0f; - int32_t width; + s32 width; int currx = 0; int num_shown = m_numsymbolsvisible; @@ -1072,7 +1072,7 @@ void layout_element::reel_component::draw_beltreel(running_machine &machine, bit aspect *= 0.9f; } - int32_t curx; + s32 curx; curx = bounds.min_x; if (m_file[fruit]) @@ -1093,14 +1093,14 @@ void layout_element::reel_component::draw_beltreel(running_machine &machine, bit if (effy >= bounds.min_y && effy <= bounds.max_y) { - uint32_t *src = &tempbitmap2.pix32(y); - uint32_t *d = &dest.pix32(effy); + u32 *src = &tempbitmap2.pix32(y); + u32 *d = &dest.pix32(effy); for (int x = 0; x < ourwidth/num_shown; x++) { int effx = basex + x; if (effx >= bounds.min_x && effx <= bounds.max_x) { - uint32_t spix = rgb_t(src[x]).a(); + u32 spix = rgb_t(src[x]).a(); if (spix != 0) { d[effx] = src[x]; @@ -1142,21 +1142,21 @@ void layout_element::reel_component::draw_beltreel(running_machine &machine, bit if (effy >= bounds.min_y && effy <= bounds.max_y) { - uint32_t *src = &tempbitmap.pix32(y); - uint32_t *d = &dest.pix32(effy); + u32 *src = &tempbitmap.pix32(y); + u32 *d = &dest.pix32(effy); for (int x = 0; x < chbounds.width(); x++) { int effx = basex + curx + x; if (effx >= bounds.min_x && effx <= bounds.max_x) { - uint32_t spix = rgb_t(src[x]).a(); + u32 spix = rgb_t(src[x]).a(); if (spix != 0) { rgb_t dpix = d[effx]; - uint32_t ta = (a * (spix + 1)) >> 8; - uint32_t tr = (r * ta + dpix.r() * (0x100 - ta)) >> 8; - uint32_t tg = (g * ta + dpix.g() * (0x100 - ta)) >> 8; - uint32_t tb = (b * ta + dpix.b() * (0x100 - ta)) >> 8; + u32 ta = (a * (spix + 1)) >> 8; + u32 tr = (r * ta + dpix.r() * (0x100 - ta)) >> 8; + u32 tg = (g * ta + dpix.g() * (0x100 - ta)) >> 8; + u32 tb = (b * ta + dpix.b() * (0x100 - ta)) >> 8; d[effx] = rgb_t(tr, tg, tb); } } @@ -1825,19 +1825,19 @@ layout_element::rect_component::rect_component(running_machine &machine, xml_dat void layout_element::rect_component::draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) { // compute premultiplied colors - uint32_t r = color().r * color().a * 255.0f; - uint32_t g = color().g * color().a * 255.0f; - uint32_t b = color().b * color().a * 255.0f; - uint32_t inva = (1.0f - color().a) * 255.0f; + u32 r = color().r * color().a * 255.0f; + u32 g = color().g * color().a * 255.0f; + u32 b = color().b * color().a * 255.0f; + u32 inva = (1.0f - color().a) * 255.0f; // iterate over X and Y - for (uint32_t y = bounds.min_y; y <= bounds.max_y; y++) + for (u32 y = bounds.min_y; y <= bounds.max_y; y++) { - for (uint32_t x = bounds.min_x; x <= bounds.max_x; x++) + for (u32 x = bounds.min_x; x <= bounds.max_x; x++) { - uint32_t finalr = r; - uint32_t finalg = g; - uint32_t finalb = b; + u32 finalr = r; + u32 finalg = g; + u32 finalb = b; // if we're translucent, add in the destination pixel contribution if (inva > 0) @@ -1872,10 +1872,10 @@ layout_element::disk_component::disk_component(running_machine &machine, xml_dat void layout_element::disk_component::draw(running_machine &machine, bitmap_argb32 &dest, const rectangle &bounds, int state) { // compute premultiplied colors - uint32_t r = color().r * color().a * 255.0f; - uint32_t g = color().g * color().a * 255.0f; - uint32_t b = color().b * color().a * 255.0f; - uint32_t inva = (1.0f - color().a) * 255.0f; + u32 r = color().r * color().a * 255.0f; + u32 g = color().g * color().a * 255.0f; + u32 b = color().b * color().a * 255.0f; + u32 inva = (1.0f - color().a) * 255.0f; // find the center float xcenter = float(bounds.xcenter()); @@ -1885,21 +1885,21 @@ void layout_element::disk_component::draw(running_machine &machine, bitmap_argb3 float ooyradius2 = 1.0f / (yradius * yradius); // iterate over y - for (uint32_t y = bounds.min_y; y <= bounds.max_y; y++) + for (u32 y = bounds.min_y; y <= bounds.max_y; y++) { float ycoord = ycenter - ((float)y + 0.5f); float xval = xradius * sqrtf(1.0f - (ycoord * ycoord) * ooyradius2); // compute left/right coordinates - int32_t left = (int32_t)(xcenter - xval + 0.5f); - int32_t right = (int32_t)(xcenter + xval + 0.5f); + s32 left = s32(xcenter - xval + 0.5f); + s32 right = s32(xcenter + xval + 0.5f); // draw this scanline - for (uint32_t x = left; x < right; x++) + for (u32 x = left; x < right; x++) { - uint32_t finalr = r; - uint32_t finalg = g; - uint32_t finalb = b; + u32 finalr = r; + u32 finalg = g; + u32 finalb = b; // if we're translucent, add in the destination pixel contribution if (inva > 0) @@ -1924,14 +1924,14 @@ void layout_element::disk_component::draw(running_machine &machine, bitmap_argb3 void layout_element::component::draw_text(render_font &font, bitmap_argb32 &dest, const rectangle &bounds, const char *str, int align) { // compute premultiplied colors - uint32_t r = color().r * 255.0f; - uint32_t g = color().g * 255.0f; - uint32_t b = color().b * 255.0f; - uint32_t a = color().a * 255.0f; + u32 r = color().r * 255.0f; + u32 g = color().g * 255.0f; + u32 b = color().b * 255.0f; + u32 a = color().a * 255.0f; // get the width of the string float aspect = 1.0f; - int32_t width; + s32 width; while (1) { @@ -1942,7 +1942,7 @@ void layout_element::component::draw_text(render_font &font, bitmap_argb32 &dest } // get alignment - int32_t curx; + s32 curx; switch (align) { // left @@ -1988,21 +1988,21 @@ void layout_element::component::draw_text(render_font &font, bitmap_argb32 &dest int effy = bounds.min_y + y; if (effy >= bounds.min_y && effy <= bounds.max_y) { - uint32_t *src = &tempbitmap.pix32(y); - uint32_t *d = &dest.pix32(effy); + u32 *src = &tempbitmap.pix32(y); + u32 *d = &dest.pix32(effy); for (int x = 0; x < chbounds.width(); x++) { int effx = curx + x + chbounds.min_x; if (effx >= bounds.min_x && effx <= bounds.max_x) { - uint32_t spix = rgb_t(src[x]).a(); + u32 spix = rgb_t(src[x]).a(); if (spix != 0) { rgb_t dpix = d[effx]; - uint32_t ta = (a * (spix + 1)) >> 8; - uint32_t tr = (r * ta + dpix.r() * (0x100 - ta)) >> 8; - uint32_t tg = (g * ta + dpix.g() * (0x100 - ta)) >> 8; - uint32_t tb = (b * ta + dpix.b() * (0x100 - ta)) >> 8; + u32 ta = (a * (spix + 1)) >> 8; + u32 tr = (r * ta + dpix.r() * (0x100 - ta)) >> 8; + u32 tg = (g * ta + dpix.g() * (0x100 - ta)) >> 8; + u32 tb = (b * ta + dpix.b() * (0x100 - ta)) >> 8; d[effx] = rgb_t(tr, tg, tb); } } @@ -2028,8 +2028,8 @@ void layout_element::component::draw_segment_horizontal_caps(bitmap_argb32 &dest // loop over the width of the segment for (int y = 0; y < width / 2; y++) { - uint32_t *d0 = &dest.pix32(midy - y); - uint32_t *d1 = &dest.pix32(midy + y); + u32 *d0 = &dest.pix32(midy - y); + u32 *d1 = &dest.pix32(midy + y); int ty = (y < width / 8) ? width / 8 : y; // loop over the length of the segment @@ -2061,8 +2061,8 @@ void layout_element::component::draw_segment_vertical_caps(bitmap_argb32 &dest, // loop over the width of the segment for (int x = 0; x < width / 2; x++) { - uint32_t *d0 = &dest.pix32(0, midx - x); - uint32_t *d1 = &dest.pix32(0, midx + x); + u32 *d0 = &dest.pix32(0, midx - x); + u32 *d1 = &dest.pix32(0, midx + x); int tx = (x < width / 8) ? width / 8 : x; // loop over the length of the segment @@ -2098,7 +2098,7 @@ void layout_element::component::draw_segment_diagonal_1(bitmap_argb32 &dest, int for (int x = minx; x < maxx; x++) if (x >= 0 && x < dest.width()) { - uint32_t *d = &dest.pix32(0, x); + u32 *d = &dest.pix32(0, x); int step = (x - minx) * ratio; for (int y = maxy - width - step; y < maxy - step; y++) @@ -2123,7 +2123,7 @@ void layout_element::component::draw_segment_diagonal_2(bitmap_argb32 &dest, int for (int x = minx; x < maxx; x++) if (x >= 0 && x < dest.width()) { - uint32_t *d = &dest.pix32(0, x); + u32 *d = &dest.pix32(0, x); int step = (x - minx) * ratio; for (int y = miny + step; y < miny + step + width; y++) @@ -2144,19 +2144,19 @@ void layout_element::component::draw_segment_decimal(bitmap_argb32 &dest, int mi float ooradius2 = 1.0f / (float)(width * width); // iterate over y - for (uint32_t y = 0; y <= width; y++) + for (u32 y = 0; y <= width; y++) { - uint32_t *d0 = &dest.pix32(midy - y); - uint32_t *d1 = &dest.pix32(midy + y); + u32 *d0 = &dest.pix32(midy - y); + u32 *d1 = &dest.pix32(midy + y); float xval = width * sqrt(1.0f - (float)(y * y) * ooradius2); - int32_t left, right; + s32 left, right; // compute left/right coordinates - left = midx - (int32_t)(xval + 0.5f); - right = midx + (int32_t)(xval + 0.5f); + left = midx - s32(xval + 0.5f); + right = midx + s32(xval + 0.5f); // draw this scanline - for (uint32_t x = left; x < right; x++) + for (u32 x = left; x < right; x++) d0[x] = d1[x] = color; } } @@ -2175,7 +2175,7 @@ void layout_element::component::draw_segment_comma(bitmap_argb32 &dest, int minx // draw line for (int x = minx; x < maxx; x++) { - uint32_t *d = &dest.pix32(0, x); + u32 *d = &dest.pix32(0, x); int step = (x - minx) * ratio; for (int y = maxy; y < maxy - width - step; y--) @@ -2192,7 +2192,7 @@ void layout_element::component::apply_skew(bitmap_argb32 &dest, int skewwidth) { for (int y = 0; y < dest.height(); y++) { - uint32_t *destrow = &dest.pix32(y); + u32 *destrow = &dest.pix32(y); int offs = skewwidth * (dest.height() - y) / dest.height(); for (int x = dest.width() - skewwidth - 1; x >= 0; x--) destrow[x + offs] = destrow[x]; diff --git a/src/emu/rendutil.cpp b/src/emu/rendutil.cpp index be1eed481d2..015a08e4e11 100644 --- a/src/emu/rendutil.cpp +++ b/src/emu/rendutil.cpp @@ -19,8 +19,8 @@ ***************************************************************************/ /* utilities */ -static void resample_argb_bitmap_average(uint32_t *dest, uint32_t drowpixels, uint32_t dwidth, uint32_t dheight, const uint32_t *source, uint32_t srowpixels, uint32_t swidth, uint32_t sheight, const render_color &color, uint32_t dx, uint32_t dy); -static void resample_argb_bitmap_bilinear(uint32_t *dest, uint32_t drowpixels, uint32_t dwidth, uint32_t dheight, const uint32_t *source, uint32_t srowpixels, uint32_t swidth, uint32_t sheight, const render_color &color, uint32_t dx, uint32_t dy); +static void resample_argb_bitmap_average(u32 *dest, u32 drowpixels, u32 dwidth, u32 dheight, const u32 *source, u32 srowpixels, u32 swidth, u32 sheight, const render_color &color, u32 dx, u32 dy); +static void resample_argb_bitmap_bilinear(u32 *dest, u32 drowpixels, u32 dwidth, u32 dheight, const u32 *source, u32 srowpixels, u32 swidth, u32 sheight, const render_color &color, u32 dx, u32 dy); static bool copy_png_to_bitmap(bitmap_argb32 &bitmap, const png_info *png); static bool copy_png_alpha_to_bitmap(bitmap_argb32 &bitmap, const png_info *png); @@ -41,15 +41,15 @@ void render_resample_argb_bitmap_hq(bitmap_argb32 &dest, bitmap_argb32 &source, return; /* adjust the source base */ - const uint32_t *sbase = &source.pix32(0); + const u32 *sbase = &source.pix32(0); /* determine the steppings */ - uint32_t swidth = source.width(); - uint32_t sheight = source.height(); - uint32_t dwidth = dest.width(); - uint32_t dheight = dest.height(); - uint32_t dx = (swidth << 12) / dwidth; - uint32_t dy = (sheight << 12) / dheight; + u32 swidth = source.width(); + u32 sheight = source.height(); + u32 dwidth = dest.width(); + u32 dheight = dest.height(); + u32 dx = (swidth << 12) / dwidth; + u32 dy = (sheight << 12) / dheight; /* if the source is higher res than the target, use full averaging */ if (dx > 0x1000 || dy > 0x1000 || force) @@ -65,11 +65,11 @@ void render_resample_argb_bitmap_hq(bitmap_argb32 &dest, bitmap_argb32 &source, all contributing pixels -------------------------------------------------*/ -static void resample_argb_bitmap_average(uint32_t *dest, uint32_t drowpixels, uint32_t dwidth, uint32_t dheight, const uint32_t *source, uint32_t srowpixels, uint32_t swidth, uint32_t sheight, const render_color &color, uint32_t dx, uint32_t dy) +static void resample_argb_bitmap_average(u32 *dest, u32 drowpixels, u32 dwidth, u32 dheight, const u32 *source, u32 srowpixels, u32 swidth, u32 sheight, const render_color &color, u32 dx, u32 dy) { - uint64_t sumscale = (uint64_t)dx * (uint64_t)dy; - uint32_t r, g, b, a; - uint32_t x, y; + u64 sumscale = u64(dx) * u64(dy); + u32 r, g, b, a; + u32 x, y; /* precompute premultiplied R/G/B/A factors */ r = color.r * color.a * 256.0f; @@ -80,22 +80,22 @@ static void resample_argb_bitmap_average(uint32_t *dest, uint32_t drowpixels, ui /* loop over the target vertically */ for (y = 0; y < dheight; y++) { - uint32_t starty = y * dy; + u32 starty = y * dy; /* loop over the target horizontally */ for (x = 0; x < dwidth; x++) { - uint64_t sumr = 0, sumg = 0, sumb = 0, suma = 0; - uint32_t startx = x * dx; - uint32_t xchunk, ychunk; - uint32_t curx, cury; + u64 sumr = 0, sumg = 0, sumb = 0, suma = 0; + u32 startx = x * dx; + u32 xchunk, ychunk; + u32 curx, cury; - uint32_t yremaining = dy; + u32 yremaining = dy; /* accumulate all source pixels that contribute to this pixel */ for (cury = starty; yremaining; cury += ychunk) { - uint32_t xremaining = dx; + u32 xremaining = dx; /* determine the Y contribution, clamping to the amount remaining */ ychunk = 0x1000 - (cury & 0xfff); @@ -106,7 +106,7 @@ static void resample_argb_bitmap_average(uint32_t *dest, uint32_t drowpixels, ui /* loop over all source pixels in the X direction */ for (curx = startx; xremaining; curx += xchunk) { - uint32_t factor; + u32 factor; /* determine the X contribution, clamping to the amount remaining */ xchunk = 0x1000 - (curx & 0xfff); @@ -156,11 +156,11 @@ static void resample_argb_bitmap_average(uint32_t *dest, uint32_t drowpixels, ui sampling via a bilinear filter -------------------------------------------------*/ -static void resample_argb_bitmap_bilinear(uint32_t *dest, uint32_t drowpixels, uint32_t dwidth, uint32_t dheight, const uint32_t *source, uint32_t srowpixels, uint32_t swidth, uint32_t sheight, const render_color &color, uint32_t dx, uint32_t dy) +static void resample_argb_bitmap_bilinear(u32 *dest, u32 drowpixels, u32 dwidth, u32 dheight, const u32 *source, u32 srowpixels, u32 swidth, u32 sheight, const render_color &color, u32 dx, u32 dy) { - uint32_t maxx = swidth << 12, maxy = sheight << 12; - uint32_t r, g, b, a; - uint32_t x, y; + u32 maxx = swidth << 12, maxy = sheight << 12; + u32 r, g, b, a; + u32 x, y; /* precompute premultiplied R/G/B/A factors */ r = color.r * color.a * 256.0f; @@ -171,17 +171,17 @@ static void resample_argb_bitmap_bilinear(uint32_t *dest, uint32_t drowpixels, u /* loop over the target vertically */ for (y = 0; y < dheight; y++) { - uint32_t starty = y * dy; + u32 starty = y * dy; /* loop over the target horizontally */ for (x = 0; x < dwidth; x++) { - uint32_t startx = x * dx; + u32 startx = x * dx; rgb_t pix0, pix1, pix2, pix3; - uint32_t sumr, sumg, sumb, suma; - uint32_t nextx, nexty; - uint32_t curx, cury; - uint32_t factor; + u32 sumr, sumg, sumb, suma; + u32 nextx, nexty; + u32 curx, cury; + u32 factor; /* adjust start to the center; note that this math will tend to produce */ /* negative results on the first pixel, which is why we clamp below */ @@ -194,13 +194,13 @@ static void resample_argb_bitmap_bilinear(uint32_t *dest, uint32_t drowpixels, u /* fetch the four relevant pixels */ pix0 = pix1 = pix2 = pix3 = 0; - if ((int32_t)cury >= 0 && cury < maxy && (int32_t)curx >= 0 && curx < maxx) + if (s32(cury) >= 0 && cury < maxy && s32(curx) >= 0 && curx < maxx) pix0 = source[(cury >> 12) * srowpixels + (curx >> 12)]; - if ((int32_t)cury >= 0 && cury < maxy && (int32_t)nextx >= 0 && nextx < maxx) + if (s32(cury) >= 0 && cury < maxy && s32(nextx) >= 0 && nextx < maxx) pix1 = source[(cury >> 12) * srowpixels + (nextx >> 12)]; - if ((int32_t)nexty >= 0 && nexty < maxy && (int32_t)curx >= 0 && curx < maxx) + if (s32(nexty) >= 0 && nexty < maxy && s32(curx) >= 0 && curx < maxx) pix2 = source[(nexty >> 12) * srowpixels + (curx >> 12)]; - if ((int32_t)nexty >= 0 && nexty < maxy && (int32_t)nextx >= 0 && nextx < maxx) + if (s32(nexty) >= 0 && nexty < maxy && s32(nextx) >= 0 && nextx < maxx) pix3 = source[(nexty >> 12) * srowpixels + (nextx >> 12)]; /* compute the x/y scaling factors */ @@ -267,8 +267,8 @@ bool render_clip_line(render_bounds *bounds, const render_bounds *clip) /* loop until we get a final result */ while (1) { - uint8_t code0 = 0, code1 = 0; - uint8_t thiscode; + u8 code0 = 0, code1 = 0; + u8 thiscode; float x, y; /* compute Cohen Sutherland bits for first coordinate */ @@ -569,7 +569,7 @@ void render_load_jpeg(bitmap_argb32 &bitmap, emu_file &file, const char *dirname jpeg_create_decompress(&cinfo); // allocates a buffer for the image - uint32_t jpg_size = file.size(); + u32 jpg_size = file.size(); std::unique_ptr jpg_buffer = std::make_unique(jpg_size); // read data from the file and set them in the buffer @@ -696,8 +696,8 @@ bool render_load_png(bitmap_argb32 &bitmap, emu_file &file, const char *dirname, static bool copy_png_to_bitmap(bitmap_argb32 &bitmap, const png_info *png) { - uint8_t accumalpha = 0xff; - uint8_t *src; + u8 accumalpha = 0xff; + u8 *src; int x, y; /* handle 8bpp palettized case */ @@ -709,7 +709,7 @@ static bool copy_png_to_bitmap(bitmap_argb32 &bitmap, const png_info *png) for (x = 0; x < png->width; x++, src++) { /* determine alpha and expand to 32bpp */ - uint8_t alpha = (*src < png->num_trans) ? png->trans[*src] : 0xff; + u8 alpha = (*src < png->num_trans) ? png->trans[*src] : 0xff; accumalpha &= alpha; bitmap.pix32(y, x) = rgb_t(alpha, png->palette[*src * 3], png->palette[*src * 3 + 1], png->palette[*src * 3 + 2]); } @@ -760,8 +760,8 @@ static bool copy_png_to_bitmap(bitmap_argb32 &bitmap, const png_info *png) static bool copy_png_alpha_to_bitmap(bitmap_argb32 &bitmap, const png_info *png) { - uint8_t accumalpha = 0xff; - uint8_t *src; + u8 accumalpha = 0xff; + u8 *src; int x, y; /* handle 8bpp palettized case */ @@ -773,7 +773,7 @@ static bool copy_png_alpha_to_bitmap(bitmap_argb32 &bitmap, const png_info *png) for (x = 0; x < png->width; x++, src++) { rgb_t pixel = bitmap.pix32(y, x); - uint8_t alpha = rgb_t(png->palette[*src * 3], png->palette[*src * 3 + 1], png->palette[*src * 3 + 2]).brightness(); + u8 alpha = rgb_t(png->palette[*src * 3], png->palette[*src * 3 + 1], png->palette[*src * 3 + 2]).brightness(); accumalpha &= alpha; bitmap.pix32(y, x) = rgb_t(alpha, pixel.r(), pixel.g(), pixel.b()); } @@ -802,7 +802,7 @@ static bool copy_png_alpha_to_bitmap(bitmap_argb32 &bitmap, const png_info *png) for (x = 0; x < png->width; x++, src += 3) { rgb_t pixel = bitmap.pix32(y, x); - uint8_t alpha = rgb_t(src[0], src[1], src[2]).brightness(); + u8 alpha = rgb_t(src[0], src[1], src[2]).brightness(); accumalpha &= alpha; bitmap.pix32(y, x) = rgb_t(alpha, pixel.r(), pixel.g(), pixel.b()); } @@ -817,7 +817,7 @@ static bool copy_png_alpha_to_bitmap(bitmap_argb32 &bitmap, const png_info *png) for (x = 0; x < png->width; x++, src += 4) { rgb_t pixel = bitmap.pix32(y, x); - uint8_t alpha = rgb_t(src[0], src[1], src[2]).brightness(); + u8 alpha = rgb_t(src[0], src[1], src[2]).brightness(); accumalpha &= alpha; bitmap.pix32(y, x) = rgb_t(alpha, pixel.r(), pixel.g(), pixel.b()); } diff --git a/src/emu/rendutil.h b/src/emu/rendutil.h index dd4d8f1edf3..d1908edbafe 100644 --- a/src/emu/rendutil.h +++ b/src/emu/rendutil.h @@ -190,11 +190,11 @@ static inline float apply_brightness_contrast_gamma_fp(float srcval, float brigh a single RGB component -------------------------------------------------*/ -static inline uint8_t apply_brightness_contrast_gamma(uint8_t src, float brightness, float contrast, float gamma) +static inline u8 apply_brightness_contrast_gamma(u8 src, float brightness, float contrast, float gamma) { float srcval = (float)src * (1.0f / 255.0f); float result = apply_brightness_contrast_gamma_fp(srcval, brightness, contrast, gamma); - return (uint8_t)(result * 255.0f); + return u8(result * 255.0f); } diff --git a/src/emu/romentry.cpp b/src/emu/romentry.cpp index 11a80b20254..01df77c344a 100644 --- a/src/emu/romentry.cpp +++ b/src/emu/romentry.cpp @@ -50,7 +50,7 @@ static std::string hashdata_from_tiny_rom_entry(const tiny_rom_entry &ent) // ctor (with move constructors) //------------------------------------------------- -rom_entry::rom_entry(std::string &&name, std::string &&hashdata, uint32_t offset, uint32_t length, uint32_t flags) +rom_entry::rom_entry(std::string &&name, std::string &&hashdata, u32 offset, u32 length, u32 flags) : m_name(std::move(name)) , m_hashdata(std::move(hashdata)) , m_offset(offset) diff --git a/src/emu/romentry.h b/src/emu/romentry.h index 37ef23c6202..ff277fba8c4 100644 --- a/src/emu/romentry.h +++ b/src/emu/romentry.h @@ -8,8 +8,8 @@ *********************************************************************/ -#ifndef MAME_EMU_ROMENTRY_H_ -#define MAME_EMU_ROMENTRY_H_ +#ifndef MAME_EMU_ROMENTRY_H +#define MAME_EMU_ROMENTRY_H #include @@ -121,9 +121,9 @@ struct tiny_rom_entry { const char *name; const char *hashdata; - uint32_t offset; - uint32_t length; - uint32_t flags; + u32 offset; + u32 length; + u32 flags; }; @@ -133,7 +133,7 @@ class rom_entry { public: rom_entry(const tiny_rom_entry &ent); - rom_entry(std::string &&name, std::string &&hashdata, uint32_t offset, uint32_t length, uint32_t flags); + rom_entry(std::string &&name, std::string &&hashdata, u32 offset, u32 length, u32 flags); rom_entry(rom_entry const &) = default; rom_entry(rom_entry &&) = default; rom_entry &operator=(rom_entry const &) = default; @@ -142,18 +142,18 @@ public: // accessors const std::string &name() const { return m_name; } const std::string &hashdata() const { return m_hashdata; } - uint32_t offset() const { return m_offset; } - uint32_t length() const { return m_length; } - uint32_t flags() const { return m_flags; } - void set_flags(uint32_t flags) { m_flags = flags; } + u32 offset() const { return m_offset; } + u32 length() const { return m_length; } + u32 flags() const { return m_flags; } + void set_flags(u32 flags) { m_flags = flags; } private: std::string m_name; std::string m_hashdata; - uint32_t m_offset; - uint32_t m_length; - uint32_t m_flags; + u32 m_offset; + u32 m_length; + u32 m_flags; }; -#endif // MAME_EMU_ROMENTRY_H_ +#endif // MAME_EMU_ROMENTRY_H diff --git a/src/emu/romload.cpp b/src/emu/romload.cpp index 53d3ffb673d..f2ca54705a7 100644 --- a/src/emu/romload.cpp +++ b/src/emu/romload.cpp @@ -40,7 +40,7 @@ static osd_file::error common_process_file(emu_options &options, const char *loc return filerr; } -std::unique_ptr common_process_file(emu_options &options, const char *location, bool has_crc, uint32_t crc, const rom_entry *romp, osd_file::error &filerr) +std::unique_ptr common_process_file(emu_options &options, const char *location, bool has_crc, u32 crc, const rom_entry *romp, osd_file::error &filerr) { auto image_file = std::make_unique(options.media_path(), OPEN_FLAG_READ); @@ -184,14 +184,14 @@ std::string rom_parameter_value(const rom_entry *romp) file given the ROM description -------------------------------------------------*/ -uint32_t rom_file_size(const rom_entry *romp) +u32 rom_file_size(const rom_entry *romp) { - uint32_t maxlength = 0; + u32 maxlength = 0; /* loop until we run out of reloads */ do { - uint32_t curlength; + u32 curlength; /* loop until we run out of continues/ignores */ curlength = ROM_GETLENGTH(romp++); @@ -343,7 +343,7 @@ void rom_load_manager::count_roms() random data -------------------------------------------------*/ -void rom_load_manager::fill_random(uint8_t *base, uint32_t length) +void rom_load_manager::fill_random(u8 *base, u32 length) { while (length--) *base++ = machine().rand(); @@ -414,14 +414,14 @@ void rom_load_manager::dump_wrong_and_correct_checksums(const util::hash_collect and hash signatures of a file -------------------------------------------------*/ -void rom_load_manager::verify_length_and_hash(const char *name, uint32_t explength, const util::hash_collection &hashes) +void rom_load_manager::verify_length_and_hash(const char *name, u32 explength, const util::hash_collection &hashes) { /* we've already complained if there is no file */ if (m_file == nullptr) return; /* verify length */ - uint32_t actlength = m_file->size(); + u32 actlength = m_file->size(); if (explength != actlength) { m_errorstring.append(string_format("%s WRONG LENGTH (expected: %08x found: %08x)\n", name, explength, actlength)); @@ -462,7 +462,7 @@ void rom_load_manager::display_loading_rom_message(const char *name, bool from_l char buffer[200]; if (name != nullptr) - sprintf(buffer, "%s (%d%%)", from_list ? "Loading Software" : "Loading Machine", (uint32_t)(100 * (uint64_t)m_romsloadedsize / (uint64_t)m_romstotalsize)); + sprintf(buffer, "%s (%d%%)", from_list ? "Loading Software" : "Loading Machine", u32(100 * u64(m_romsloadedsize) / u64(m_romstotalsize))); else sprintf(buffer, "Loading Complete"); @@ -506,7 +506,7 @@ void rom_load_manager::display_rom_load_results(bool from_list) void rom_load_manager::region_post_process(const char *rgntag, bool invert) { memory_region *region = machine().root_device().memregion(rgntag); - uint8_t *base; + u8 *base; int i, j; // do nothing if no region @@ -531,7 +531,7 @@ void rom_load_manager::region_post_process(const char *rgntag, bool invert) int datawidth = region->bytewidth(); for (i = 0, base = region->base(); i < region->bytes(); i += datawidth) { - uint8_t temp[8]; + u8 temp[8]; memcpy(temp, base, datawidth); for (j = datawidth - 1; j >= 0; j--) *base++ = temp[j]; @@ -548,14 +548,14 @@ void rom_load_manager::region_post_process(const char *rgntag, bool invert) int rom_load_manager::open_rom_file(const char *regiontag, const rom_entry *romp, std::string &tried_file_names, bool from_list) { osd_file::error filerr = osd_file::error::NOT_FOUND; - uint32_t romsize = rom_file_size(romp); + u32 romsize = rom_file_size(romp); tried_file_names = ""; /* update status display */ display_loading_rom_message(ROM_GETNAME(romp), from_list); /* extract CRC to use for searching */ - uint32_t crc = 0; + u32 crc = 0; bool has_crc = util::hash_collection(ROM_GETHASHDATA(romp)).crc(crc); /* attempt reading up the chain through the parents. It automatically also @@ -663,7 +663,7 @@ int rom_load_manager::open_rom_file(const char *regiontag, const rom_entry *romp random data for a nullptr file -------------------------------------------------*/ -int rom_load_manager::rom_fread(uint8_t *buffer, int length, const rom_entry *parent_region) +int rom_load_manager::rom_fread(u8 *buffer, int length, const rom_entry *parent_region) { /* files just pass through */ if (m_file != nullptr) @@ -691,8 +691,8 @@ int rom_load_manager::read_rom_data(const rom_entry *parent_region, const rom_en int skip = ROM_GETSKIPCOUNT(romp); int reversed = ROM_ISREVERSED(romp); int numgroups = (numbytes + groupsize - 1) / groupsize; - uint8_t *base = m_region->base() + ROM_GETOFFSET(romp); - uint32_t tempbufsize; + u8 *base = m_region->base() + ROM_GETOFFSET(romp); + u32 tempbufsize; int i; LOG(("Loading ROM data: offs=%X len=%X mask=%02X group=%d skip=%d reverse=%d\n", ROM_GETOFFSET(romp), numbytes, datamask, groupsize, skip, reversed)); @@ -715,7 +715,7 @@ int rom_load_manager::read_rom_data(const rom_entry *parent_region, const rom_en /* use a temporary buffer for complex loads */ tempbufsize = std::min(TEMPBUFFER_MAX_SIZE, numbytes); - std::vector tempbuf(tempbufsize); + std::vector tempbuf(tempbufsize); /* chunky reads for complex loads */ skip += groupsize; @@ -723,7 +723,7 @@ int rom_load_manager::read_rom_data(const rom_entry *parent_region, const rom_en { int evengroupcount = (tempbufsize / groupsize) * groupsize; int bytesleft = (numbytes > evengroupcount) ? evengroupcount : numbytes; - uint8_t *bufptr = &tempbuf[0]; + u8 *bufptr = &tempbuf[0]; /* read as much as we can */ LOG((" Reading %X bytes into buffer\n", bytesleft)); @@ -799,9 +799,9 @@ int rom_load_manager::read_rom_data(const rom_entry *parent_region, const rom_en void rom_load_manager::fill_rom_data(const rom_entry *romp) { - uint32_t numbytes = ROM_GETLENGTH(romp); + u32 numbytes = ROM_GETLENGTH(romp); int skip = ROM_GETSKIPCOUNT(romp); - uint8_t *base = m_region->base() + ROM_GETOFFSET(romp); + u8 *base = m_region->base() + ROM_GETOFFSET(romp); // make sure we fill within the region space if (ROM_GETOFFSET(romp) + numbytes > m_region->bytes()) @@ -812,7 +812,7 @@ void rom_load_manager::fill_rom_data(const rom_entry *romp) fatalerror("Error in RomModule definition: FILL has an invalid length\n"); // for fill bytes, the byte that gets filled is the first byte of the hashdata string - uint8_t fill_byte = (uint8_t)strtol(ROM_GETHASHDATA(romp), nullptr, 0); + u8 fill_byte = u8(strtol(ROM_GETHASHDATA(romp), nullptr, 0)); // fill the data (filling value is stored in place of the hashdata) if(skip != 0) @@ -831,10 +831,10 @@ void rom_load_manager::fill_rom_data(const rom_entry *romp) void rom_load_manager::copy_rom_data(const rom_entry *romp) { - uint8_t *base = m_region->base() + ROM_GETOFFSET(romp); + u8 *base = m_region->base() + ROM_GETOFFSET(romp); const char *srcrgntag = ROM_GETNAME(romp); - uint32_t numbytes = ROM_GETLENGTH(romp); - uint32_t srcoffs = (uint32_t) strtol(ROM_GETHASHDATA(romp), nullptr, 0); /* srcoffset in place of hashdata */ + u32 numbytes = ROM_GETLENGTH(romp); + u32 srcoffs = u32(strtol(ROM_GETHASHDATA(romp), nullptr, 0)); /* srcoffset in place of hashdata */ /* make sure we copy within the region space */ if (ROM_GETOFFSET(romp) + numbytes > m_region->bytes()) @@ -865,7 +865,7 @@ void rom_load_manager::copy_rom_data(const rom_entry *romp) void rom_load_manager::process_rom_entries(const char *regiontag, const rom_entry *parent_region, const rom_entry *romp, device_t *device, bool from_list) { - uint32_t lastflags = 0; + u32 lastflags = 0; /* loop until we hit the end of this region */ while (!ROMENTRY_ISREGIONEND(romp)) @@ -1223,7 +1223,7 @@ void rom_load_manager::process_disk_entries(const char *regiontag, const rom_ent flags for the given device -------------------------------------------------*/ -void rom_load_manager::normalize_flags_for_device(running_machine &machine, const char *rgntag, uint8_t &width, endianness_t &endian) +void rom_load_manager::normalize_flags_for_device(running_machine &machine, const char *rgntag, u8 &width, endianness_t &endian) { device_t *device = machine.device(rgntag); device_memory_interface *memory; @@ -1280,7 +1280,7 @@ void rom_load_manager::load_software_part_region(device_t &device, software_list const software_info *swinfo = swlist.find(swname); if (swinfo != nullptr) { - uint32_t supported = swinfo->supported(); + u32 supported = swinfo->supported(); if (supported == SOFTWARE_SUPPORTED_PARTIAL) { m_errorstring.append(string_format("WARNING: support for software %s (in list %s) is only partial\n", swname, swlist.list_name())); @@ -1311,7 +1311,7 @@ void rom_load_manager::load_software_part_region(device_t &device, software_list /* loop until we hit the end */ for (region = start_region; region != nullptr; region = rom_next_region(region)) { - uint32_t regionlength = ROMREGION_GETLENGTH(region); + u32 regionlength = ROMREGION_GETLENGTH(region); regiontag = device.subtag(ROMREGION_GETTAG(region)); LOG(("Processing region \"%s\" (length=%X)\n", regiontag.c_str(), regionlength)); @@ -1321,7 +1321,7 @@ void rom_load_manager::load_software_part_region(device_t &device, software_list /* if this is a device region, override with the device width and endianness */ endianness_t endianness = ROMREGION_ISBIGENDIAN(region) ? ENDIANNESS_BIG : ENDIANNESS_LITTLE; - uint8_t width = ROMREGION_GETWIDTH(region) / 8; + u8 width = ROMREGION_GETWIDTH(region) / 8; memory_region *memregion = machine().root_device().memregion(regiontag.c_str()); if (memregion != nullptr) { @@ -1389,7 +1389,7 @@ void rom_load_manager::process_region_list() for (device_t &device : deviter) for (const rom_entry *region = rom_first_region(device); region != nullptr; region = rom_next_region(region)) { - uint32_t regionlength = ROMREGION_GETLENGTH(region); + u32 regionlength = ROMREGION_GETLENGTH(region); regiontag = rom_region_name(device, region); LOG(("Processing region \"%s\" (length=%X)\n", regiontag.c_str(), regionlength)); @@ -1400,7 +1400,7 @@ void rom_load_manager::process_region_list() if (ROMREGION_ISROMDATA(region)) { /* if this is a device region, override with the device width and endianness */ - uint8_t width = ROMREGION_GETWIDTH(region) / 8; + u8 width = ROMREGION_GETWIDTH(region) / 8; endianness_t endianness = ROMREGION_ISBIGENDIAN(region) ? ENDIANNESS_BIG : ENDIANNESS_LITTLE; if (machine().device(regiontag.c_str()) != nullptr) normalize_flags_for_device(machine(), regiontag.c_str(), width, endianness); diff --git a/src/emu/romload.h b/src/emu/romload.h index 2d11cf7bfe7..41d02dbadae 100644 --- a/src/emu/romload.h +++ b/src/emu/romload.h @@ -111,35 +111,35 @@ class software_list_device; /* ----- specialized loading macros ----- */ -#define ROM_LOAD_NIB_HIGH(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI) -#define ROM_LOAD_NIB_LOW(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO) -#define ROM_LOAD16_BYTE(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_SKIP(1)) -#define ROM_LOAD16_WORD(name,offset,length,hash) ROM_LOAD(name, offset, length, hash) -#define ROM_LOAD16_WORD_SWAP(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_REVERSE) -#define ROM_LOAD32_BYTE(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_SKIP(3)) -#define ROM_LOAD32_WORD(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_SKIP(2)) -#define ROM_LOAD32_WORD_SWAP(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2)) -#define ROM_LOAD32_DWORD(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_GROUPDWORD) -#define ROM_LOAD64_WORD(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_SKIP(6)) -#define ROM_LOAD64_WORD_SWAP(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(6)) -#define ROM_LOAD64_DWORD_SWAP(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_GROUPDWORD | ROM_REVERSE | ROM_SKIP(4)) +#define ROM_LOAD_NIB_HIGH(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI) +#define ROM_LOAD_NIB_LOW(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO) +#define ROM_LOAD16_BYTE(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_SKIP(1)) +#define ROM_LOAD16_WORD(name,offset,length,hash) ROM_LOAD(name, offset, length, hash) +#define ROM_LOAD16_WORD_SWAP(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_REVERSE) +#define ROM_LOAD32_BYTE(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_SKIP(3)) +#define ROM_LOAD32_WORD(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_SKIP(2)) +#define ROM_LOAD32_WORD_SWAP(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2)) +#define ROM_LOAD32_DWORD(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_GROUPDWORD) +#define ROM_LOAD64_WORD(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_SKIP(6)) +#define ROM_LOAD64_WORD_SWAP(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(6)) +#define ROM_LOAD64_DWORD_SWAP(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_GROUPDWORD | ROM_REVERSE | ROM_SKIP(4)) /* ----- ROM_RELOAD related macros ----- */ #define ROM_RELOAD(offset,length) { nullptr, nullptr, offset, length, ROMENTRYTYPE_RELOAD | ROM_INHERITFLAGS }, -#define ROM_RELOAD_PLAIN(offset,length) { nullptr, nullptr, offset, length, ROMENTRYTYPE_RELOAD }, +#define ROM_RELOAD_PLAIN(offset,length) { nullptr, nullptr, offset, length, ROMENTRYTYPE_RELOAD }, /* ----- additional ROM-related macros ----- */ -#define ROM_CONTINUE(offset,length) { nullptr, nullptr, (offset), (length), ROMENTRYTYPE_CONTINUE | ROM_INHERITFLAGS }, -#define ROM_IGNORE(length) { nullptr, nullptr, 0, (length), ROMENTRYTYPE_IGNORE | ROM_INHERITFLAGS }, -#define ROM_FILL(offset,length,value) { nullptr, (const char *)(value), (offset), (length), ROMENTRYTYPE_FILL }, -#define ROMX_FILL(offset,length,value,flags) { nullptr, (const char *)(value), (offset), (length), ROMENTRYTYPE_FILL | flags }, +#define ROM_CONTINUE(offset,length) { nullptr, nullptr, (offset), (length), ROMENTRYTYPE_CONTINUE | ROM_INHERITFLAGS }, +#define ROM_IGNORE(length) { nullptr, nullptr, 0, (length), ROMENTRYTYPE_IGNORE | ROM_INHERITFLAGS }, +#define ROM_FILL(offset,length,value) { nullptr, (const char *)(value), (offset), (length), ROMENTRYTYPE_FILL }, +#define ROMX_FILL(offset,length,value,flags) { nullptr, (const char *)(value), (offset), (length), ROMENTRYTYPE_FILL | flags }, #define ROM_COPY(srctag,srcoffs,offset,length) { (srctag), (const char *)(srcoffs), (offset), (length), ROMENTRYTYPE_COPY }, /* ----- system BIOS macros ----- */ #define ROM_SYSTEM_BIOS(value,name,description) { name, description, 0, 0, ROMENTRYTYPE_SYSTEM_BIOS | ROM_BIOS(value+1) }, -#define ROM_DEFAULT_BIOS(name) { name, nullptr, 0, 0, ROMENTRYTYPE_DEFAULT_BIOS }, +#define ROM_DEFAULT_BIOS(name) { name, nullptr, 0, 0, ROMENTRYTYPE_DEFAULT_BIOS }, /* ----- game parameter macro ----- */ @@ -163,8 +163,7 @@ class rom_load_manager class open_chd { public: - open_chd(const char *region) - : m_region(region) { } + open_chd(const char *region) : m_region(region) { } const char *region() const { return m_region.c_str(); } chd_file &chd() { return m_diffchd.opened() ? m_diffchd : m_origchd; } @@ -205,50 +204,50 @@ public: private: void determine_bios_rom(device_t &device, const char *specbios); void count_roms(); - void fill_random(uint8_t *base, uint32_t length); + void fill_random(u8 *base, u32 length); void handle_missing_file(const rom_entry *romp, std::string tried_file_names, chd_error chderr); void dump_wrong_and_correct_checksums(const util::hash_collection &hashes, const util::hash_collection &acthashes); - void verify_length_and_hash(const char *name, uint32_t explength, const util::hash_collection &hashes); + void verify_length_and_hash(const char *name, u32 explength, const util::hash_collection &hashes); void display_loading_rom_message(const char *name, bool from_list); void display_rom_load_results(bool from_list); void region_post_process(const char *rgntag, bool invert); int open_rom_file(const char *regiontag, const rom_entry *romp, std::string &tried_file_names, bool from_list); - int rom_fread(uint8_t *buffer, int length, const rom_entry *parent_region); + int rom_fread(u8 *buffer, int length, const rom_entry *parent_region); int read_rom_data(const rom_entry *parent_region, const rom_entry *romp); void fill_rom_data(const rom_entry *romp); void copy_rom_data(const rom_entry *romp); void process_rom_entries(const char *regiontag, const rom_entry *parent_region, const rom_entry *romp, device_t *device, bool from_list); chd_error open_disk_diff(emu_options &options, const rom_entry *romp, chd_file &source, chd_file &diff_chd); void process_disk_entries(const char *regiontag, const rom_entry *parent_region, const rom_entry *romp, const char *locationtag); - void normalize_flags_for_device(running_machine &machine, const char *rgntag, uint8_t &width, endianness_t &endian); + void normalize_flags_for_device(running_machine &machine, const char *rgntag, u8 &width, endianness_t &endian); void process_region_list(); // internal state - running_machine & m_machine; // reference to our machine + running_machine & m_machine; // reference to our machine - int m_warnings; /* warning count during processing */ - int m_knownbad; /* BAD_DUMP/NO_DUMP count during processing */ - int m_errors; /* error count during processing */ + int m_warnings; // warning count during processing + int m_knownbad; // BAD_DUMP/NO_DUMP count during processing + int m_errors; // error count during processing - int m_romsloaded; /* current ROMs loaded count */ - int m_romstotal; /* total number of ROMs to read */ - uint32_t m_romsloadedsize; /* total size of ROMs loaded so far */ - uint32_t m_romstotalsize; /* total size of ROMs to read */ + int m_romsloaded; // current ROMs loaded count + int m_romstotal; // total number of ROMs to read + u32 m_romsloadedsize; // total size of ROMs loaded so far + u32 m_romstotalsize; // total size of ROMs to read std::unique_ptr m_file; /* current file */ std::vector> m_chd_list; /* disks */ - memory_region * m_region; /* info about current region */ + memory_region * m_region; // info about current region - std::string m_errorstring; /* error string */ - std::string m_softwarningstring; /* software warning string */ + std::string m_errorstring; // error string + std::string m_softwarningstring; // software warning string }; /* ----- Helpers ----- */ -std::unique_ptr common_process_file(emu_options &options, const char *location, bool has_crc, uint32_t crc, const rom_entry *romp, osd_file::error &filerr); +std::unique_ptr common_process_file(emu_options &options, const char *location, bool has_crc, u32 crc, const rom_entry *romp, osd_file::error &filerr); /* return pointer to the first ROM region within a source */ const rom_entry *rom_first_region(const device_t &device); @@ -263,7 +262,7 @@ const rom_entry *rom_first_file(const rom_entry *romp); const rom_entry *rom_next_file(const rom_entry *romp); /* return the expected size of a file given the ROM description */ -uint32_t rom_file_size(const rom_entry *romp); +u32 rom_file_size(const rom_entry *romp); /* return the appropriate name for a rom region */ std::string rom_region_name(const device_t &device, const rom_entry *romp); diff --git a/src/emu/save.cpp b/src/emu/save.cpp index 4a94c9baea1..c85f0d1b9ef 100644 --- a/src/emu/save.cpp +++ b/src/emu/save.cpp @@ -86,7 +86,7 @@ void save_manager::allow_registration(bool allowed) // index //------------------------------------------------- -const char *save_manager::indexed_item(int index, void *&base, uint32_t &valsize, uint32_t &valcount) const +const char *save_manager::indexed_item(int index, void *&base, u32 &valsize, u32 &valcount) const { if (index >= m_entry_list.size() || index < 0) return nullptr; @@ -147,7 +147,7 @@ void save_manager::register_postload(save_prepost_delegate func) // memory //------------------------------------------------- -void save_manager::save_memory(device_t *device, const char *module, const char *tag, uint32_t index, const char *name, void *val, uint32_t valsize, uint32_t valcount) +void save_manager::save_memory(device_t *device, const char *module, const char *tag, u32 index, const char *name, void *val, u32 valsize, u32 valcount) { assert(valsize == 1 || valsize == 2 || valsize == 4 || valsize == 8); @@ -195,13 +195,13 @@ void save_manager::save_memory(device_t *device, const char *module, const char save_error save_manager::check_file(running_machine &machine, emu_file &file, const char *gamename, void (CLIB_DECL *errormsg)(const char *fmt, ...)) { // if we want to validate the signature, compute it - uint32_t sig; + u32 sig; sig = machine.save().signature(); // seek to the beginning and read the header file.compress(FCOMPRESS_NONE); file.seek(0, SEEK_SET); - uint8_t header[HEADER_SIZE]; + u8 header[HEADER_SIZE]; if (file.read(header, sizeof(header)) != sizeof(header)) { if (errormsg != nullptr) @@ -238,13 +238,13 @@ save_error save_manager::read_file(emu_file &file) // read the header and turn on compression for the rest of the file file.compress(FCOMPRESS_NONE); file.seek(0, SEEK_SET); - uint8_t header[HEADER_SIZE]; + u8 header[HEADER_SIZE]; if (file.read(header, sizeof(header)) != sizeof(header)) return STATERR_READ_ERROR; file.compress(FCOMPRESS_MEDIUM); // verify the header and report an error if it doesn't match - uint32_t sig = signature(); + u32 sig = signature(); if (validate_header(header, machine().system().name, sig, nullptr, "Error: ") != STATERR_NONE) return STATERR_INVALID_HEADER; @@ -254,7 +254,7 @@ save_error save_manager::read_file(emu_file &file) // read all the data, flipping if necessary for (auto &entry : m_entry_list) { - uint32_t totalsize = entry->m_typesize * entry->m_typecount; + u32 totalsize = entry->m_typesize * entry->m_typecount; if (file.read(entry->m_data, totalsize) != totalsize) return STATERR_READ_ERROR; @@ -292,13 +292,13 @@ save_error save_manager::write_file(emu_file &file) return STATERR_ILLEGAL_REGISTRATIONS; // generate the header - uint8_t header[HEADER_SIZE]; + u8 header[HEADER_SIZE]; memcpy(&header[0], STATE_MAGIC_NUM, 8); header[8] = SAVE_VERSION; header[9] = NATIVE_ENDIAN_VALUE_LE_BE(0, SS_MSB_FIRST); strncpy((char *)&header[0x0a], machine().system().name, 0x1c - 0x0a); - uint32_t sig = signature(); - *(uint32_t *)&header[0x1c] = little_endianize_int32(sig); + u32 sig = signature(); + *(u32 *)&header[0x1c] = little_endianize_int32(sig); // write the header and turn on compression for the rest of the file file.compress(FCOMPRESS_NONE); @@ -313,7 +313,7 @@ save_error save_manager::write_file(emu_file &file) // then write all the data for (auto &entry : m_entry_list) { - uint32_t totalsize = entry->m_typesize * entry->m_typecount; + u32 totalsize = entry->m_typesize * entry->m_typecount; if (file.write(entry->m_data, totalsize) != totalsize) return STATERR_WRITE_ERROR; } @@ -326,20 +326,20 @@ save_error save_manager::write_file(emu_file &file) // is a CRC over the structure of the data //------------------------------------------------- -uint32_t save_manager::signature() const +u32 save_manager::signature() const { // iterate over entries - uint32_t crc = 0; + u32 crc = 0; for (auto &entry : m_entry_list) { // add the entry name to the CRC - crc = core_crc32(crc, (uint8_t *)entry->m_name.c_str(), entry->m_name.length()); + crc = core_crc32(crc, (u8 *)entry->m_name.c_str(), entry->m_name.length()); // add the type and size to the CRC - uint32_t temp[2]; + u32 temp[2]; temp[0] = little_endianize_int32(entry->m_typecount); temp[1] = little_endianize_int32(entry->m_typesize); - crc = core_crc32(crc, (uint8_t *)&temp[0], sizeof(temp)); + crc = core_crc32(crc, (u8 *)&temp[0], sizeof(temp)); } return crc; } @@ -362,7 +362,7 @@ void save_manager::dump_registry() const // header //------------------------------------------------- -save_error save_manager::validate_header(const uint8_t *header, const char *gamename, uint32_t signature, +save_error save_manager::validate_header(const u8 *header, const char *gamename, u32 signature, void (CLIB_DECL *errormsg)(const char *fmt, ...), const char *error_prefix) { // check magic number @@ -392,7 +392,7 @@ save_error save_manager::validate_header(const uint8_t *header, const char *game // check signature, if we were asked to if (signature != 0) { - uint32_t rawsig = *(uint32_t *)&header[0x1c]; + u32 rawsig = *(u32 *)&header[0x1c]; if (signature != little_endianize_int32(rawsig)) { if (errormsg != nullptr) @@ -418,7 +418,7 @@ save_manager::state_callback::state_callback(save_prepost_delegate callback) // state_entry - constructor //------------------------------------------------- -state_entry::state_entry(void *data, const char *name, device_t *device, const char *module, const char *tag, int index, uint8_t size, uint32_t count) +state_entry::state_entry(void *data, const char *name, device_t *device, const char *module, const char *tag, int index, u8 size, u32 count) : m_data(data), m_name(name), m_device(device), @@ -439,27 +439,27 @@ state_entry::state_entry(void *data, const char *name, device_t *device, const c void state_entry::flip_data() { - uint16_t *data16; - uint32_t *data32; - uint64_t *data64; + u16 *data16; + u32 *data32; + u64 *data64; int count; switch (m_typesize) { case 2: - data16 = (uint16_t *)m_data; + data16 = (u16 *)m_data; for (count = 0; count < m_typecount; count++) data16[count] = flipendian_int16(data16[count]); break; case 4: - data32 = (uint32_t *)m_data; + data32 = (u32 *)m_data; for (count = 0; count < m_typecount; count++) data32[count] = flipendian_int32(data32[count]); break; case 8: - data64 = (uint64_t *)m_data; + data64 = (u64 *)m_data; for (count = 0; count < m_typecount; count++) data64[count] = flipendian_int64(data64[count]); break; diff --git a/src/emu/save.h b/src/emu/save.h index 7c8c6ac5e32..59bf5f54a5e 100644 --- a/src/emu/save.h +++ b/src/emu/save.h @@ -14,8 +14,8 @@ #error Dont include this file directly; include emu.h instead. #endif -#ifndef __SAVE_H__ -#define __SAVE_H__ +#ifndef MAME_EMU_SAVE_H +#define MAME_EMU_SAVE_H @@ -62,21 +62,21 @@ class state_entry { public: // construction/destruction - state_entry(void *data, const char *name, device_t *device, const char *module, const char *tag, int index, uint8_t size, uint32_t count); + state_entry(void *data, const char *name, device_t *device, const char *module, const char *tag, int index, u8 size, u32 count); // helpers void flip_data(); // state - void * m_data; // pointer to the memory to save/restore - std::string m_name; // full name - device_t * m_device; // associated device, nullptr if none - std::string m_module; // module name - std::string m_tag; // tag name - int m_index; // index - uint8_t m_typesize; // size of the raw data type - uint32_t m_typecount; // number of items - uint32_t m_offset; // offset within the final structure + void * m_data; // pointer to the memory to save/restore + std::string m_name; // full name + device_t * m_device; // associated device, nullptr if none + std::string m_module; // module name + std::string m_tag; // tag name + int m_index; // index + u8 m_typesize; // size of the raw data type + u32 m_typecount; // number of items + u32 m_offset; // offset within the final structure }; class save_manager @@ -96,7 +96,7 @@ public: // registration control void allow_registration(bool allowed = true); - const char *indexed_item(int index, void *&base, uint32_t &valsize, uint32_t &valcount) const; + const char *indexed_item(int index, void *&base, u32 &valsize, u32 &valcount) const; // function registration void register_presave(save_prepost_delegate func); @@ -107,7 +107,7 @@ public: void dispatch_postload(); // generic memory registration - void save_memory(device_t *device, const char *module, const char *tag, uint32_t index, const char *name, void *val, uint32_t valsize, uint32_t valcount = 1); + void save_memory(device_t *device, const char *module, const char *tag, u32 index, const char *name, void *val, u32 valsize, u32 valcount = 1); // templatized wrapper for general objects template @@ -136,7 +136,7 @@ public: // templatized wrapper for pointers template - void save_pointer(device_t *device, const char *module, const char *tag, int index, _ItemType *value, const char *valname, uint32_t count) + void save_pointer(device_t *device, const char *module, const char *tag, int index, _ItemType *value, const char *valname, u32 count) { if (!type_checker<_ItemType>::is_atom) throw emu_fatalerror("Called save_item on a non-fundamental type!"); save_memory(device, module, tag, index, valname, value, sizeof(*value), count); @@ -146,7 +146,7 @@ public: template void save_item(_ItemType &value, const char *valname, int index = 0) { save_item(nullptr, "global", nullptr, index, value, valname); } template - void save_pointer(_ItemType *value, const char *valname, uint32_t count, int index = 0) { save_pointer(nullptr, "global", nullptr, index, value, valname, count); } + void save_pointer(_ItemType *value, const char *valname, u32 count, int index = 0) { save_pointer(nullptr, "global", nullptr, index, value, valname, count); } // file processing static save_error check_file(running_machine &machine, emu_file &file, const char *gamename, void (CLIB_DECL *errormsg)(const char *fmt, ...)); @@ -155,9 +155,9 @@ public: private: // internal helpers - uint32_t signature() const; + u32 signature() const; void dump_registry() const; - static save_error validate_header(const uint8_t *header, const char *gamename, uint32_t signature, void (CLIB_DECL *errormsg)(const char *fmt, ...), const char *error_prefix); + static save_error validate_header(const u8 *header, const char *gamename, u32 signature, void (CLIB_DECL *errormsg)(const char *fmt, ...), const char *error_prefix); // state callback item class state_callback @@ -183,14 +183,14 @@ private: // template specializations to enumerate the fundamental atomic types you are allowed to save ALLOW_SAVE_TYPE_AND_ARRAY(char) ALLOW_SAVE_TYPE (bool); // std::vector may be packed internally -ALLOW_SAVE_TYPE_AND_ARRAY(int8_t) -ALLOW_SAVE_TYPE_AND_ARRAY(uint8_t) -ALLOW_SAVE_TYPE_AND_ARRAY(int16_t) -ALLOW_SAVE_TYPE_AND_ARRAY(uint16_t) -ALLOW_SAVE_TYPE_AND_ARRAY(int32_t) -ALLOW_SAVE_TYPE_AND_ARRAY(uint32_t) -ALLOW_SAVE_TYPE_AND_ARRAY(int64_t) -ALLOW_SAVE_TYPE_AND_ARRAY(uint64_t) +ALLOW_SAVE_TYPE_AND_ARRAY(s8) +ALLOW_SAVE_TYPE_AND_ARRAY(u8) +ALLOW_SAVE_TYPE_AND_ARRAY(s16) +ALLOW_SAVE_TYPE_AND_ARRAY(u16) +ALLOW_SAVE_TYPE_AND_ARRAY(s32) +ALLOW_SAVE_TYPE_AND_ARRAY(u32) +ALLOW_SAVE_TYPE_AND_ARRAY(s64) +ALLOW_SAVE_TYPE_AND_ARRAY(u64) ALLOW_SAVE_TYPE_AND_ARRAY(PAIR) ALLOW_SAVE_TYPE_AND_ARRAY(PAIR64) ALLOW_SAVE_TYPE_AND_ARRAY(float) @@ -247,4 +247,4 @@ inline void save_manager::save_item(device_t *device, const char *module, const } -#endif /* __SAVE_H__ */ +#endif /* MAME_EMU_SAVE_H */ diff --git a/src/emu/schedule.cpp b/src/emu/schedule.cpp index e02ba15e142..16e880e8a58 100644 --- a/src/emu/schedule.cpp +++ b/src/emu/schedule.cpp @@ -174,7 +174,7 @@ bool emu_timer::enable(bool enable) // firings //------------------------------------------------- -void emu_timer::adjust(attotime start_delay, int32_t param, const attotime &period) +void emu_timer::adjust(attotime start_delay, s32 param, const attotime &period) { // if this is the callback timer, mark it modified device_scheduler &scheduler = machine().scheduler(); @@ -393,7 +393,7 @@ bool device_scheduler::can_save() const inline void device_scheduler::apply_suspend_changes() { - uint32_t suspendchanged = 0; + u32 suspendchanged = 0; for (device_execute_interface *exec = m_execute_list; exec != nullptr; exec = exec->m_nextexec) { suspendchanged |= exec->m_suspend ^ exec->m_nextsuspend; @@ -461,7 +461,7 @@ void device_scheduler::timeslice() if (delta >= exec->m_attoseconds_per_cycle) { // compute how many cycles we want to execute - int ran = exec->m_cycles_running = divu_64x32((uint64_t)delta >> exec->m_divshift, exec->m_divisor); + int ran = exec->m_cycles_running = divu_64x32(u64(delta) >> exec->m_divshift, exec->m_divisor); LOG((" cpu '%s': %d (%d cycles)\n", exec->device().tag(), delta, exec->m_cycles_running)); // if we're not suspended, actually execute @@ -498,7 +498,7 @@ void device_scheduler::timeslice() attotime deltatime(0, exec->m_attoseconds_per_cycle * ran); assert(deltatime >= attotime::zero); exec->m_localtime += deltatime; - LOG((" %d ran, %d total, time = %s\n", ran, (int32_t)exec->m_totalcycles, exec->m_localtime.as_string(PRECISION))); + LOG((" %d ran, %d total, time = %s\n", ran, s32(exec->m_totalcycles), exec->m_localtime.as_string(PRECISION))); // if the new local CPU time is less than our target, move the target up, but not before the base if (exec->m_localtime < target) @@ -642,7 +642,7 @@ void device_scheduler::eat_all_cycles() // given amount of time //------------------------------------------------- -void device_scheduler::timed_trigger(void *ptr, int32_t param) +void device_scheduler::timed_trigger(void *ptr, s32 param) { trigger(param); } diff --git a/src/emu/schedule.h b/src/emu/schedule.h index 56fb750c0aa..0bbffedc5b0 100644 --- a/src/emu/schedule.h +++ b/src/emu/schedule.h @@ -14,8 +14,8 @@ #error Dont include this file directly; include emu.h instead. #endif -#ifndef __SCHEDULE_H__ -#define __SCHEDULE_H__ +#ifndef MAME_EMU_SCHEDULE_H +#define MAME_EMU_SCHEDULE_H //************************************************************************** @@ -39,7 +39,7 @@ //************************************************************************** // timer callbacks look like this -typedef named_delegate timer_expired_delegate; +typedef named_delegate timer_expired_delegate; // ======================> emu_timer @@ -74,7 +74,7 @@ public: // control void reset(const attotime &duration = attotime::never) { adjust(duration, m_param, m_period); } - void adjust(attotime start_delay, int32_t param = 0, const attotime &periodicity = attotime::never); + void adjust(attotime start_delay, s32 param = 0, const attotime &periodicity = attotime::never); // timing queries attotime elapsed() const; @@ -93,7 +93,7 @@ private: emu_timer * m_next; // next timer in order in the list emu_timer * m_prev; // previous timer in order in the list timer_expired_delegate m_callback; // callback function - int32_t m_param; // integer parameter + s32 m_param; // integer parameter void * m_ptr; // pointer parameter bool m_enabled; // is the timer enabled? bool m_temporary; // is the timer temporary? @@ -149,7 +149,7 @@ public: private: // callbacks - void timed_trigger(void *ptr, int32_t param); + void timed_trigger(void *ptr, s32 param); void presave(); void postload(); @@ -199,4 +199,4 @@ private: }; -#endif // __SCHEDULE_H__ */ +#endif // MAME_EMU_SCHEDULE_H */ diff --git a/src/emu/screen.cpp b/src/emu/screen.cpp index 4742963d9d3..f204b9c034e 100644 --- a/src/emu/screen.cpp +++ b/src/emu/screen.cpp @@ -35,7 +35,7 @@ const device_type SCREEN = &device_creator; const attotime screen_device::DEFAULT_FRAME_PERIOD(attotime::from_hz(DEFAULT_FRAME_RATE)); -uint32_t screen_device::m_id_counter = 0; +u32 screen_device::m_id_counter = 0; class screen_device_svg_renderer { public: @@ -47,7 +47,7 @@ public: int render(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - static void output_notifier(const char *outname, int32_t value, void *param); + static void output_notifier(const char *outname, s32 value, void *param); private: struct paired_entry { @@ -58,7 +58,7 @@ private: struct cached_bitmap { int x, y, sx, sy; - std::vector image; + std::vector image; std::vector pairs; }; @@ -75,16 +75,16 @@ private: int m_sx, m_sy; double m_scale; - std::vector m_background; + std::vector m_background; std::vector m_cache; - void output_change(const char *outname, int32_t value); - void render_state(std::vector &dest, const std::vector &state); + void output_change(const char *outname, s32 value); + void render_state(std::vector &dest, const std::vector &state); void compute_initial_bboxes(std::vector &bboxes); bool compute_mask_intersection_bbox(int key1, int key2, bbox &bb) const; - void compute_diff_image(const std::vector &rend, const bbox &bb, cached_bitmap &dest) const; - void compute_dual_diff_image(const std::vector &rend, const bbox &bb, const cached_bitmap &src1, const cached_bitmap &src2, cached_bitmap &dest) const; + void compute_diff_image(const std::vector &rend, const bbox &bb, cached_bitmap &dest) const; + void compute_dual_diff_image(const std::vector &rend, const bbox &bb, const cached_bitmap &src1, const cached_bitmap &src2, cached_bitmap &dest) const; void rebuild_cache(); void blit(bitmap_rgb32 &bitmap, const cached_bitmap &src) const; }; @@ -153,7 +153,7 @@ int screen_device_svg_renderer::height() const return int(m_image->height + 0.5); } -void screen_device_svg_renderer::render_state(std::vector &dest, const std::vector &state) +void screen_device_svg_renderer::render_state(std::vector &dest, const std::vector &state) { for(int key = 0; key != m_key_count; key++) { if (state[key]) @@ -170,30 +170,30 @@ void screen_device_svg_renderer::render_state(std::vector &dest, const // alpha to "blend" against a black background. Plus align the // channel order to what we do. - uint8_t *image = (uint8_t *)&dest[0]; + u8 *image = (u8 *)&dest[0]; for(unsigned int pixel=0; pixel != m_sy*m_sx; pixel++) { - uint8_t r = image[0]; - uint8_t g = image[1]; - uint8_t b = image[2]; - uint8_t a = image[3]; + u8 r = image[0]; + u8 g = image[1]; + u8 b = image[2]; + u8 a = image[3]; if(a != 0xff) { r = r*a/255; g = g*a/255; b = b*a/255; } - uint32_t color = 0xff000000 | (r << 16) | (g << 8) | (b << 0); - *(uint32_t *)image = color; + u32 color = 0xff000000 | (r << 16) | (g << 8) | (b << 0); + *(u32 *)image = color; image += 4; } } void screen_device_svg_renderer::blit(bitmap_rgb32 &bitmap, const cached_bitmap &src) const { - const uint32_t *s = &src.image[0]; + const u32 *s = &src.image[0]; for(int y=0; y(param)->output_change(outname, value); } -void screen_device_svg_renderer::output_change(const char *outname, int32_t value) +void screen_device_svg_renderer::output_change(const char *outname, s32 value) { auto l = m_key_ids.find(outname); if (l == m_key_ids.end()) @@ -300,13 +300,13 @@ void screen_device_svg_renderer::compute_initial_bboxes(std::vector &bboxe } } -void screen_device_svg_renderer::compute_diff_image(const std::vector &rend, const bbox &bb, cached_bitmap &dest) const +void screen_device_svg_renderer::compute_diff_image(const std::vector &rend, const bbox &bb, cached_bitmap &dest) const { int x0, y0, x1, y1; x0 = y0 = x1 = y1 = -1; for(int y = bb.y0; y != bb.y1; y++) { - const uint32_t *src1 = &m_background[bb.x0 + y * m_sx]; - const uint32_t *src2 = &rend[bb.x0 + y * m_sx]; + const u32 *src1 = &m_background[bb.x0 + y * m_sx]; + const u32 *src2 = &rend[bb.x0 + y * m_sx]; for(int x = bb.x0; x != bb.x1; x++) { if(*src1 != *src2) { if(x0 == -1) { @@ -337,10 +337,10 @@ void screen_device_svg_renderer::compute_diff_image(const std::vector dest.sx = x1+1-x0; dest.sy = y1+1-y0; dest.image.resize(dest.sx * dest.sy); - uint32_t *dst = &dest.image[0]; + u32 *dst = &dest.image[0]; for(int y = 0; y != dest.sy; y++) { - const uint32_t *src1 = &m_background[dest.x + (y + dest.y) * m_sx]; - const uint32_t *src2 = &rend[dest.x + (y + dest.y) * m_sx]; + const u32 *src1 = &m_background[dest.x + (y + dest.y) * m_sx]; + const u32 *src2 = &rend[dest.x + (y + dest.y) * m_sx]; for(int x = 0; x != dest.sx; x++) { if(*src1 != *src2) *dst = *src2; @@ -372,8 +372,8 @@ bool screen_device_svg_renderer::compute_mask_intersection_bbox(int key1, int ke x0 = y0 = x1 = y1 = -1; for(int y = cy0; y < cy1; y++) { - const uint32_t *src1 = &c1.image[(cx0 - c1.x) + c1.sx * (y - c1.y)]; - const uint32_t *src2 = &c2.image[(cx0 - c2.x) + c2.sx * (y - c2.y)]; + const u32 *src1 = &c1.image[(cx0 - c1.x) + c1.sx * (y - c1.y)]; + const u32 *src2 = &c2.image[(cx0 - c2.x) + c2.sx * (y - c2.y)]; for(int x = cx0; x < cx1; x++) { if(*src1 && *src2 && *src1 != *src2) { if(x0 == -1) { @@ -403,7 +403,7 @@ bool screen_device_svg_renderer::compute_mask_intersection_bbox(int key1, int ke return true; } -void screen_device_svg_renderer::compute_dual_diff_image(const std::vector &rend, const bbox &bb, const cached_bitmap &src1, const cached_bitmap &src2, cached_bitmap &dest) const +void screen_device_svg_renderer::compute_dual_diff_image(const std::vector &rend, const bbox &bb, const cached_bitmap &src1, const cached_bitmap &src2, cached_bitmap &dest) const { dest.x = bb.x0; dest.y = bb.y0; @@ -411,10 +411,10 @@ void screen_device_svg_renderer::compute_dual_diff_image(const std::vector rend(m_sx*m_sy); + std::vector rend(m_sx*m_sy); // Render the background, e.g. with everything off std::vector state(m_key_count); @@ -544,7 +544,7 @@ void screen_device_svg_renderer::rebuild_cache() // screen_device - constructor //------------------------------------------------- -screen_device::screen_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +screen_device::screen_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, SCREEN, "Video Screen", tag, owner, clock, "screen", __FILE__), m_type(SCREEN_TYPE_RASTER), m_oldstyle_vblank_supplied(false), @@ -619,7 +619,7 @@ void screen_device::static_set_svg_region(device_t &device, const char *region) // to set the raw screen parameters //------------------------------------------------- -void screen_device::static_set_raw(device_t &device, uint32_t pixclock, uint16_t htotal, uint16_t hbend, uint16_t hbstart, uint16_t vtotal, uint16_t vbend, uint16_t vbstart) +void screen_device::static_set_raw(device_t &device, u32 pixclock, u16 htotal, u16 hbend, u16 hbstart, u16 vtotal, u16 vbend, u16 vbstart) { screen_device &screen = downcast(device); screen.m_clock = pixclock; @@ -660,7 +660,7 @@ void screen_device::static_set_vblank_time(device_t &device, attoseconds_t time) // the width/height of the screen //------------------------------------------------- -void screen_device::static_set_size(device_t &device, uint16_t width, uint16_t height) +void screen_device::static_set_size(device_t &device, u16 width, u16 height) { screen_device &screen = downcast(device); screen.m_width = width; @@ -673,7 +673,7 @@ void screen_device::static_set_size(device_t &device, uint16_t width, uint16_t h // set the visible area of the screen //------------------------------------------------- -void screen_device::static_set_visarea(device_t &device, int16_t minx, int16_t maxx, int16_t miny, int16_t maxy) +void screen_device::static_set_visarea(device_t &device, s16 minx, s16 maxx, s16 miny, s16 maxy) { downcast(device).m_visarea.set(minx, maxx, miny, maxy); } @@ -743,7 +743,7 @@ void screen_device::static_set_palette(device_t &device, const char *tag) // video attributes //------------------------------------------------- -void screen_device::static_set_video_attributes(device_t &device, uint32_t flags) +void screen_device::static_set_video_attributes(device_t &device, u32 flags) { screen_device &screen = downcast(device); screen.m_video_attributes = flags; @@ -844,9 +844,9 @@ void screen_device::device_start() // allocate raw textures m_texture[0] = machine().render().texture_alloc(); - m_texture[0]->set_osd_data((uint64_t)((m_unique_id << 1) | 0)); + m_texture[0]->set_osd_data(u64((m_unique_id << 1) | 0)); m_texture[1] = machine().render().texture_alloc(); - m_texture[1]->set_osd_data((uint64_t)((m_unique_id << 1) | 1)); + m_texture[1]->set_osd_data(u64((m_unique_id << 1) | 1)); // configure the default cliparea render_container::user_settings settings; @@ -1091,8 +1091,8 @@ void screen_device::realloc_screen_bitmaps() return; // determine effective size to allocate - int32_t effwidth = std::max(m_width, m_visarea.max_x + 1); - int32_t effheight = std::max(m_height, m_visarea.max_y + 1); + s32 effwidth = std::max(m_width, m_visarea.max_x + 1); + s32 effheight = std::max(m_height, m_visarea.max_y + 1); // reize all registered screen bitmaps for (auto &item : m_auto_bitmap_list) @@ -1177,7 +1177,7 @@ bool screen_device::update_partial(int scanline) LOG_PARTIAL_UPDATES(("updating %d-%d\n", clip.min_y, clip.max_y)); g_profiler.start(PROFILER_VIDEO); - uint32_t flags; + u32 flags; if (m_type != SCREEN_TYPE_SVG) { screen_bitmap &curbitmap = m_bitmap[m_curbitmap]; @@ -1242,7 +1242,7 @@ void screen_device::update_now() // if the line before us was incomplete, we must do it in two pieces if (m_partial_scan_hpos > 0) { - int32_t save_scan = m_partial_scan_hpos; + s32 save_scan = m_partial_scan_hpos; update_partial(current_vpos - 2); m_partial_scan_hpos = save_scan; @@ -1301,7 +1301,7 @@ void screen_device::update_now() LOG_PARTIAL_UPDATES(("doing scanline partial draw: Y %d X %d-%d\n", clip.max_y, clip.min_x, clip.max_x)); - uint32_t flags; + u32 flags; screen_bitmap &curbitmap = m_bitmap[m_curbitmap]; switch (curbitmap.format()) { @@ -1585,8 +1585,8 @@ void screen_device::update_burnin() int dstheight = m_burnin.height(); int xstep = (srcwidth << 16) / dstwidth; int ystep = (srcheight << 16) / dstheight; - int xstart = ((uint32_t)rand() % 32767) * xstep / 32767; - int ystart = ((uint32_t)rand() % 32767) * ystep / 32767; + int xstart = (u32(rand()) % 32767) * xstep / 32767; + int ystart = (u32(rand()) % 32767) * ystep / 32767; int srcx, srcy; int x, y; @@ -1599,8 +1599,8 @@ void screen_device::update_burnin() bitmap_ind16 &srcbitmap = curbitmap.as_ind16(); for (y = 0, srcy = ystart; y < dstheight; y++, srcy += ystep) { - uint64_t *dst = &m_burnin.pix64(y); - const uint16_t *src = &srcbitmap.pix16(srcy >> 16); + u64 *dst = &m_burnin.pix64(y); + const u16 *src = &srcbitmap.pix16(srcy >> 16); const rgb_t *palette = m_palette->palette()->entry_list_adjusted(); for (x = 0, srcx = xstart; x < dstwidth; x++, srcx += xstep) { @@ -1617,8 +1617,8 @@ void screen_device::update_burnin() bitmap_rgb32 &srcbitmap = curbitmap.as_rgb32(); for (y = 0, srcy = ystart; y < dstheight; y++, srcy += ystep) { - uint64_t *dst = &m_burnin.pix64(y); - const uint32_t *src = &srcbitmap.pix32(srcy >> 16); + u64 *dst = &m_burnin.pix64(y); + const u32 *src = &srcbitmap.pix32(srcy >> 16); for (x = 0, srcx = xstart; x < dstwidth; x++, srcx += xstep) { rgb_t pixel = src[srcx >> 16]; @@ -1657,11 +1657,11 @@ void screen_device::finalize_burnin() int ystep = (srcheight << 16) / dstheight; // find the maximum value - uint64_t minval = ~(uint64_t)0; - uint64_t maxval = 0; + u64 minval = ~u64(0); + u64 maxval = 0; for (int y = 0; y < srcheight; y++) { - uint64_t *src = &m_burnin.pix64(y); + u64 *src = &m_burnin.pix64(y); for (int x = 0; x < srcwidth; x++) { minval = std::min(minval, src[x]); @@ -1675,11 +1675,11 @@ void screen_device::finalize_burnin() // now normalize and convert to RGB for (int y = 0, srcy = 0; y < dstheight; y++, srcy += ystep) { - uint64_t *src = &m_burnin.pix64(srcy >> 16); - uint32_t *dst = &finalmap.pix32(y); + u64 *src = &m_burnin.pix64(srcy >> 16); + u32 *dst = &finalmap.pix32(y); for (int x = 0, srcx = 0; x < dstwidth; x++, srcx += xstep) { - int brightness = (uint64_t)(maxval - src[srcx >> 16]) * 255 / (maxval - minval); + int brightness = u64(maxval - src[srcx >> 16]) * 255 / (maxval - minval); dst[x] = rgb_t(0xff, brightness, brightness, brightness); } } diff --git a/src/emu/screen.h b/src/emu/screen.h index 8e0b34d7a27..24dab4e7be4 100644 --- a/src/emu/screen.h +++ b/src/emu/screen.h @@ -16,8 +16,8 @@ #error Dont include this file directly; include emu.h instead. #endif -#ifndef __SCREEN_H__ -#define __SCREEN_H__ +#ifndef MAME_EMU_SCREEN_H +#define MAME_EMU_SCREEN_H //************************************************************************** @@ -46,7 +46,7 @@ enum texture_format }; // screen_update callback flags -const uint32_t UPDATE_HAS_NOT_CHANGED = 0x0001; // the video has not changed +constexpr u32 UPDATE_HAS_NOT_CHANGED = 0x0001; // the video has not changed /*! @defgroup flags for video_attributes @@ -72,12 +72,12 @@ const uint32_t UPDATE_HAS_NOT_CHANGED = 0x0001; // the video has not changed @} */ -#define VIDEO_UPDATE_BEFORE_VBLANK 0x0000 -#define VIDEO_UPDATE_AFTER_VBLANK 0x0004 +constexpr u32 VIDEO_UPDATE_BEFORE_VBLANK = 0x0000; +constexpr u32 VIDEO_UPDATE_AFTER_VBLANK = 0x0004; -#define VIDEO_SELF_RENDER 0x0008 -#define VIDEO_ALWAYS_UPDATE 0x0080 -#define VIDEO_UPDATE_SCANLINE 0x0100 +constexpr u32 VIDEO_SELF_RENDER = 0x0008; +constexpr u32 VIDEO_ALWAYS_UPDATE = 0x0080; +constexpr u32 VIDEO_UPDATE_SCANLINE = 0x0100; //************************************************************************** @@ -124,11 +124,11 @@ public: bitmap_rgb32 &as_rgb32() { assert(m_format == BITMAP_FORMAT_RGB32); return m_rgb32; } // getters - int32_t width() const { return live().width(); } - int32_t height() const { return live().height(); } - int32_t rowpixels() const { return live().rowpixels(); } - int32_t rowbytes() const { return live().rowbytes(); } - uint8_t bpp() const { return live().bpp(); } + s32 width() const { return live().width(); } + s32 height() const { return live().height(); } + s32 rowpixels() const { return live().rowpixels(); } + s32 rowbytes() const { return live().rowbytes(); } + u8 bpp() const { return live().bpp(); } bitmap_format format() const { return m_format; } texture_format texformat() const { return m_texformat; } bool valid() const { return live().valid(); } @@ -165,8 +165,8 @@ private: typedef delegate vblank_state_delegate; -typedef device_delegate screen_update_ind16_delegate; -typedef device_delegate screen_update_rgb32_delegate; +typedef device_delegate screen_update_ind16_delegate; +typedef device_delegate screen_update_rgb32_delegate; typedef device_delegate screen_vblank_delegate; @@ -181,7 +181,7 @@ class screen_device : public device_t public: // construction/destruction - screen_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + screen_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); ~screen_device(); // configuration readers @@ -202,17 +202,17 @@ public: // inline configuration helpers static void static_set_type(device_t &device, screen_type_enum type); - static void static_set_raw(device_t &device, uint32_t pixclock, uint16_t htotal, uint16_t hbend, uint16_t hbstart, uint16_t vtotal, uint16_t vbend, uint16_t vbstart); + static void static_set_raw(device_t &device, u32 pixclock, u16 htotal, u16 hbend, u16 hbstart, u16 vtotal, u16 vbend, u16 vbstart); static void static_set_refresh(device_t &device, attoseconds_t rate); static void static_set_vblank_time(device_t &device, attoseconds_t time); - static void static_set_size(device_t &device, uint16_t width, uint16_t height); - static void static_set_visarea(device_t &device, int16_t minx, int16_t maxx, int16_t miny, int16_t maxy); + static void static_set_size(device_t &device, u16 width, u16 height); + static void static_set_visarea(device_t &device, s16 minx, s16 maxx, s16 miny, s16 maxy); static void static_set_default_position(device_t &device, double xscale, double xoffs, double yscale, double yoffs); static void static_set_screen_update(device_t &device, screen_update_ind16_delegate callback); static void static_set_screen_update(device_t &device, screen_update_rgb32_delegate callback); static void static_set_screen_vblank(device_t &device, screen_vblank_delegate callback); static void static_set_palette(device_t &device, const char *tag); - static void static_set_video_attributes(device_t &device, uint32_t flags); + static void static_set_video_attributes(device_t &device, u32 flags); static void static_set_color(device_t &device, rgb_t color); static void static_set_svg_region(device_t &device, const char *region); @@ -226,7 +226,7 @@ public: void configure(int width, int height, const rectangle &visarea, attoseconds_t frame_period); void reset_origin(int beamy = 0, int beamx = 0); void set_visible_area(int min_x, int max_x, int min_y, int max_y); - void set_brightness(uint8_t brightness) { m_brightness = brightness; } + void set_brightness(u8 brightness) { m_brightness = brightness; } // beam positioning and state int vpos() const; @@ -242,7 +242,7 @@ public: attotime time_until_update() const { return (m_video_attributes & VIDEO_UPDATE_AFTER_VBLANK) ? time_until_vblank_end() : time_until_vblank_start(); } attotime scan_period() const { return attotime(0, m_scantime); } attotime frame_period() const { return attotime(0, m_frame_period); } - uint64_t frame_number() const { return m_frame_number; } + u64 frame_number() const { return m_frame_number; } // updating int partial_updates() const { return m_partial_updates_this_frame; } @@ -259,7 +259,7 @@ public: void update_burnin(); // globally accessible constants - static const int DEFAULT_FRAME_RATE = 60; + static constexpr int DEFAULT_FRAME_RATE = 60; static const attotime DEFAULT_FRAME_PERIOD; private: @@ -299,7 +299,7 @@ private: screen_update_rgb32_delegate m_screen_update_rgb32; // screen update callback (32-bit RGB) screen_vblank_delegate m_screen_vblank; // screen vblank callback optional_device m_palette; // our palette - uint32_t m_video_attributes; // flags describing the video system + u32 m_video_attributes; // flags describing the video system const char * m_svg_region; // the region in which the svg data is in // internal state @@ -316,15 +316,15 @@ private: screen_bitmap m_bitmap[2]; // 2x bitmaps for rendering bitmap_ind8 m_priority; // priority bitmap bitmap_ind64 m_burnin; // burn-in bitmap - uint8_t m_curbitmap; // current bitmap index - uint8_t m_curtexture; // current texture index + u8 m_curbitmap; // current bitmap index + u8 m_curtexture; // current texture index bool m_changed; // has this bitmap changed? - int32_t m_last_partial_scan; // scanline of last partial update - int32_t m_partial_scan_hpos; // horizontal pixel last rendered on this partial scanline + s32 m_last_partial_scan; // scanline of last partial update + s32 m_partial_scan_hpos; // horizontal pixel last rendered on this partial scanline bitmap_argb32 m_screen_overlay_bitmap; // screen overlay bitmap - uint32_t m_unique_id; // unique id for this screen_device + u32 m_unique_id; // unique id for this screen_device rgb_t m_color; // render color - uint8_t m_brightness; // global brightness + u8 m_brightness; // global brightness // screen timing attoseconds_t m_frame_period; // attoseconds per frame @@ -337,8 +337,8 @@ private: emu_timer * m_vblank_end_timer; // timer to signal VBLANK end emu_timer * m_scanline0_timer; // scanline 0 timer emu_timer * m_scanline_timer; // scanline timer - uint64_t m_frame_number; // the current frame number - uint32_t m_partial_updates_this_frame;// partial update counter this frame + u64 m_frame_number; // the current frame number + u32 m_partial_updates_this_frame;// partial update counter this frame // VBLANK callbacks class callback_item @@ -362,7 +362,7 @@ private: std::vector> m_auto_bitmap_list; // list of registered bitmaps // static data - static uint32_t m_id_counter; // incremented for each constructed screen_device, + static u32 m_id_counter; // incremented for each constructed screen_device, // used as a unique identifier during runtime }; @@ -524,16 +524,16 @@ typedef device_type_iterator<&device_creator, screen_device> scre //------------------------------------------------- template -inline screen_update_ind16_delegate screen_update_delegate_smart(uint32_t (_FunctionClass::*callback)(screen_device &, bitmap_ind16 &, const rectangle &), const char *name, const char *devname) +inline screen_update_ind16_delegate screen_update_delegate_smart(u32 (_FunctionClass::*callback)(screen_device &, bitmap_ind16 &, const rectangle &), const char *name, const char *devname) { return screen_update_ind16_delegate(callback, name, devname, (_FunctionClass *)nullptr); } template -inline screen_update_rgb32_delegate screen_update_delegate_smart(uint32_t (_FunctionClass::*callback)(screen_device &, bitmap_rgb32 &, const rectangle &), const char *name, const char *devname) +inline screen_update_rgb32_delegate screen_update_delegate_smart(u32 (_FunctionClass::*callback)(screen_device &, bitmap_rgb32 &, const rectangle &), const char *name, const char *devname) { return screen_update_rgb32_delegate(callback, name, devname, (_FunctionClass *)nullptr); } -#endif /* __SCREEN_H__ */ +#endif /* MAME_EMU_SCREEN_H */ diff --git a/src/emu/softlist.cpp b/src/emu/softlist.cpp index bb03a9e2800..5182881274a 100644 --- a/src/emu/softlist.cpp +++ b/src/emu/softlist.cpp @@ -204,7 +204,7 @@ softlist_parser::softlist_parser(util::core_file &file, const std::string &filen char buffer[1024]; while (!m_done) { - uint32_t length = m_file.read(buffer, sizeof(buffer)); + u32 length = m_file.read(buffer, sizeof(buffer)); m_done = m_file.eof(); if (XML_Parse(m_parser, buffer, length, m_done) == XML_STATUS_ERROR) { @@ -341,7 +341,7 @@ bool softlist_parser::parse_name_and_value(const char **attributes, std::string // current part's list //------------------------------------------------- -void softlist_parser::add_rom_entry(std::string &&name, std::string &&hashdata, uint32_t offset, uint32_t length, uint32_t flags) +void softlist_parser::add_rom_entry(std::string &&name, std::string &&hashdata, u32 offset, u32 length, u32 flags) { // get the current part if (m_current_part == nullptr) @@ -597,7 +597,7 @@ void softlist_parser::parse_part_start(const char *tagname, const char **attribu // handle region attributes const std::string &width = attrvalues[2]; const std::string &endianness = attrvalues[3]; - uint32_t regionflags = ROMENTRYTYPE_REGION; + u32 regionflags = ROMENTRYTYPE_REGION; if (!width.empty()) { @@ -689,8 +689,8 @@ void softlist_parser::parse_data_start(const char *tagname, const char **attribu const std::string &loadflag = attrvalues[7]; if (!sizestr.empty() && !offsetstr.empty()) { - uint32_t length = strtol(sizestr.c_str(), nullptr, 0); - uint32_t offset = strtol(offsetstr.c_str(), nullptr, 0); + u32 length = strtol(sizestr.c_str(), nullptr, 0); + u32 offset = strtol(offsetstr.c_str(), nullptr, 0); if (loadflag == "reload") add_rom_entry("", "", offset, length, ROMENTRYTYPE_RELOAD | ROM_INHERITFLAGS); @@ -740,7 +740,7 @@ void softlist_parser::parse_data_start(const char *tagname, const char **attribu } else if (!sizestr.empty() && !loadflag.empty() && loadflag == "ignore") { - uint32_t length = strtol(sizestr.c_str(), nullptr, 0); + u32 length = strtol(sizestr.c_str(), nullptr, 0); add_rom_entry("", "", 0, length, ROMENTRYTYPE_IGNORE | ROM_INHERITFLAGS); } else diff --git a/src/emu/softlist.h b/src/emu/softlist.h index 84face381bd..6d8db6fcd08 100644 --- a/src/emu/softlist.h +++ b/src/emu/softlist.h @@ -120,7 +120,7 @@ public: const std::string &publisher() const { return m_publisher; } const std::list &other_info() const { return m_other_info; } const std::list &shared_info() const { return m_shared_info; } - uint32_t supported() const { return m_supported; } + u32 supported() const { return m_supported; } const std::list &parts() const { return m_partdata; } // additional operations @@ -129,7 +129,7 @@ public: private: // internal state - uint32_t m_supported; + u32 m_supported; std::string m_shortname; std::string m_longname; std::string m_parentname; @@ -174,7 +174,7 @@ private: // internal helpers template std::vector parse_attributes(const char **attributes, const T &attrlist); bool parse_name_and_value(const char **attributes, std::string &name, std::string &value); - void add_rom_entry(std::string &&name, std::string &&hashdata, uint32_t offset, uint32_t length, uint32_t flags); + void add_rom_entry(std::string &&name, std::string &&hashdata, u32 offset, u32 length, u32 flags); // expat callbacks static void start_handler(void *data, const char *tagname, const char **attributes); diff --git a/src/emu/softlist_dev.cpp b/src/emu/softlist_dev.cpp index 8b3fe027cb0..9e492204643 100644 --- a/src/emu/softlist_dev.cpp +++ b/src/emu/softlist_dev.cpp @@ -78,7 +78,7 @@ bool image_software_list_loader::load_software(device_image_interface &device, s // software_list_device - constructor //------------------------------------------------- -software_list_device::software_list_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +software_list_device::software_list_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, SOFTWARE_LIST, "Software list", tag, owner, clock, "software_list", __FILE__), m_list_type(SOFTWARE_LIST_ORIGINAL_SYSTEM), m_filter(nullptr), @@ -505,7 +505,7 @@ void software_list_device::internal_validity_check(validity_checker &valid) // make sure the year is only digits, '?' or '+' for (char ch : swinfo.year()) - if (!isdigit(uint8_t(ch)) && (ch != '?') && (ch != '+')) + if (!isdigit(u8(ch)) && (ch != '?') && (ch != '+')) { osd_printf_error("%s: %s has an invalid year '%s'\n", filename(), shortname.c_str(), swinfo.year().c_str()); break; diff --git a/src/emu/softlist_dev.h b/src/emu/softlist_dev.h index 384f0b2a22e..1c4b493ad50 100644 --- a/src/emu/softlist_dev.h +++ b/src/emu/softlist_dev.h @@ -132,7 +132,7 @@ class software_list_device : public device_t public: // construction/destruction - software_list_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + software_list_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); // inline configuration helpers static void static_set_type(device_t &device, const char *list, softlist_type list_type); diff --git a/src/emu/sound.cpp b/src/emu/sound.cpp index 06828789dc5..24fb330ebe4 100644 --- a/src/emu/sound.cpp +++ b/src/emu/sound.cpp @@ -265,7 +265,7 @@ void sound_stream::update() { // determine the number of samples since the start of this second attotime time = m_device.machine().time(); - int32_t update_sampindex = int32_t(time.attoseconds() / m_attoseconds_per_sample); + s32 update_sampindex = s32(time.attoseconds() / m_attoseconds_per_sample); // if we're ahead of the last update, then adjust upwards attotime last_update = m_device.machine().sound().last_update(); @@ -294,7 +294,7 @@ void sound_stream::update() } -void sound_stream::sync_update(void *, int32_t) +void sound_stream::sync_update(void *, s32) { update(); attotime time = m_device.machine().time(); @@ -384,7 +384,7 @@ void sound_stream::update_with_accounting(bool second_tick) // if we've ticked over another second, adjust all the counters that are relative to // the current second - int32_t output_bufindex = m_output_sampindex - m_output_base_sampindex; + s32 output_bufindex = m_output_sampindex - m_output_base_sampindex; if (second_tick) { m_output_sampindex -= m_sample_rate; @@ -398,7 +398,7 @@ void sound_stream::update_with_accounting(bool second_tick) // we need to shuffle things down if (m_output_bufalloc - output_bufindex < 2 * m_max_samples_per_update) { - int32_t samples_to_lose = output_bufindex - m_max_samples_per_update; + s32 samples_to_lose = output_bufindex - m_max_samples_per_update; if (samples_to_lose > 0) { // if we have samples to move, do so for each output @@ -427,7 +427,7 @@ void sound_stream::apply_sample_rate_changes() return; // update to the new rate and remember the old rate - uint32_t old_rate = m_sample_rate; + u32 old_rate = m_sample_rate; m_sample_rate = m_new_sample_rate; m_new_sample_rate = 0; @@ -435,8 +435,8 @@ void sound_stream::apply_sample_rate_changes() recompute_sample_rate_data(); // reset our sample indexes to the current time - m_output_sampindex = (int64_t)m_output_sampindex * (int64_t)m_sample_rate / old_rate; - m_output_update_sampindex = (int64_t)m_output_update_sampindex * (int64_t)m_sample_rate / old_rate; + m_output_sampindex = s64(m_output_sampindex) * s64(m_sample_rate) / old_rate; + m_output_update_sampindex = s64(m_output_update_sampindex) * s64(m_sample_rate) / old_rate; m_output_base_sampindex = m_output_sampindex - m_max_samples_per_update; // clear out the buffer @@ -527,7 +527,7 @@ void sound_stream::recompute_sample_rate_data() void sound_stream::allocate_resample_buffers() { // compute the target number of samples - int32_t bufsize = 2 * m_max_samples_per_update; + s32 bufsize = 2 * m_max_samples_per_update; // if we don't have enough room, allocate more if (m_resample_bufalloc < bufsize) @@ -553,7 +553,7 @@ void sound_stream::allocate_resample_buffers() void sound_stream::allocate_output_buffers() { // if we don't have enough room, allocate more - int32_t bufsize = OUTPUT_BUFFER_UPDATES * m_max_samples_per_update; + s32 bufsize = OUTPUT_BUFFER_UPDATES * m_max_samples_per_update; if (m_output_bufalloc < bufsize) { // this becomes the new allocation size @@ -647,7 +647,7 @@ void sound_stream::generate_samples(int samples) // resample buffer for a given input //------------------------------------------------- -stream_sample_t *sound_stream::generate_resampled_data(stream_input &input, uint32_t numsamples) +stream_sample_t *sound_stream::generate_resampled_data(stream_input &input, u32 numsamples) { // if we don't have an output to pull data from, generate silence stream_sample_t *dest = &input.m_resample[0]; @@ -660,14 +660,14 @@ stream_sample_t *sound_stream::generate_resampled_data(stream_input &input, uint // grab data from the output stream_output &output = *input.m_source; sound_stream &input_stream = *output.m_stream; - int64_t gain = (input.m_gain * input.m_user_gain * output.m_gain) >> 16; + s64 gain = (input.m_gain * input.m_user_gain * output.m_gain) >> 16; // determine the time at which the current sample begins, accounting for the // latency we calculated between the input and output streams attoseconds_t basetime = m_output_sampindex * m_attoseconds_per_sample - input.m_latency_attoseconds; // now convert that time into a sample in the input stream - int32_t basesample; + s32 basesample; if (basetime >= 0) basesample = basetime / input_stream.m_attoseconds_per_sample; else @@ -679,11 +679,11 @@ stream_sample_t *sound_stream::generate_resampled_data(stream_input &input, uint // determine the current fraction of a sample, expressed as a fraction of FRAC_ONE // (Note: this formula is valid as long as input_stream.m_attoseconds_per_sample signficantly exceeds FRAC_ONE > attoseconds = 4.2E-12 s) - uint32_t basefrac = (basetime - basesample * input_stream.m_attoseconds_per_sample) / ((input_stream.m_attoseconds_per_sample + FRAC_ONE - 1) >> FRAC_BITS); + u32 basefrac = (basetime - basesample * input_stream.m_attoseconds_per_sample) / ((input_stream.m_attoseconds_per_sample + FRAC_ONE - 1) >> FRAC_BITS); assert(basefrac < FRAC_ONE); // compute the stepping fraction - uint32_t step = (uint64_t(input_stream.m_sample_rate) << FRAC_BITS) / m_sample_rate; + u32 step = (u64(input_stream.m_sample_rate) << FRAC_BITS) / m_sample_rate; // if we have equal sample rates, we just need to copy if (step == FRAC_ONE) @@ -691,7 +691,7 @@ stream_sample_t *sound_stream::generate_resampled_data(stream_input &input, uint while (numsamples--) { // compute the sample - int64_t sample = *source++; + s64 sample = *source++; *dest++ = (sample * gain) >> 8; } } @@ -710,7 +710,7 @@ stream_sample_t *sound_stream::generate_resampled_data(stream_input &input, uint } // if we're done, we're done - if (int32_t(numsamples--) < 0) + if (s32(numsamples--) < 0) break; // compute starting and ending fractional positions @@ -718,7 +718,7 @@ stream_sample_t *sound_stream::generate_resampled_data(stream_input &input, uint int endfrac = nextfrac >> (FRAC_BITS - 12); // blend between the two samples accordingly - int64_t sample = ((int64_t) source[0] * (0x1000 - startfrac) + (int64_t) source[1] * (endfrac - 0x1000)) / (endfrac - startfrac); + s64 sample = (s64(source[0]) * (0x1000 - startfrac) + s64(source[1]) * (endfrac - 0x1000)) / (endfrac - startfrac); *dest++ = (sample * gain) >> 8; // advance @@ -734,19 +734,19 @@ stream_sample_t *sound_stream::generate_resampled_data(stream_input &input, uint int smallstep = step >> (FRAC_BITS - 8); while (numsamples--) { - int64_t remainder = smallstep; + s64 remainder = smallstep; int tpos = 0; // compute the sample - int64_t scale = (FRAC_ONE - basefrac) >> (FRAC_BITS - 8); - int64_t sample = (int64_t) source[tpos++] * scale; + s64 scale = (FRAC_ONE - basefrac) >> (FRAC_BITS - 8); + s64 sample = s64(source[tpos++]) * scale; remainder -= scale; while (remainder > 0x100) { - sample += (int64_t) source[tpos++] * (int64_t) 0x100; + sample += s64(source[tpos++]) * s64(0x100); remainder -= 0x100; } - sample += (int64_t) source[tpos] * remainder; + sample += s64(source[tpos]) * remainder; sample /= smallstep; *dest++ = (sample * gain) >> 8; @@ -941,7 +941,7 @@ bool sound_manager::indexed_mixer_input(int index, mixer_input &info) const // mute - mute sound output //------------------------------------------------- -void sound_manager::mute(bool mute, uint8_t reason) +void sound_manager::mute(bool mute, u8 reason) { if (mute) m_muted |= reason; @@ -1063,16 +1063,16 @@ void sound_manager::update(void *ptr, int param) speaker.mix(&m_leftmix[0], &m_rightmix[0], samples_this_update, (m_muted & MUTE_REASON_SYSTEM)); // now downmix the final result - uint32_t finalmix_step = machine().video().speed_factor(); - uint32_t finalmix_offset = 0; - int16_t *finalmix = &m_finalmix[0]; + u32 finalmix_step = machine().video().speed_factor(); + u32 finalmix_offset = 0; + s16 *finalmix = &m_finalmix[0]; int sample; for (sample = m_finalmix_leftover; sample < samples_this_update * 1000; sample += finalmix_step) { int sampindex = sample / 1000; // clamp the left side - int32_t samp = m_leftmix[sampindex]; + s32 samp = m_leftmix[sampindex]; if (samp < -32768) samp = -32768; else if (samp > 32767) diff --git a/src/emu/sound.h b/src/emu/sound.h index 7fe244b2694..d9b9a61b830 100644 --- a/src/emu/sound.h +++ b/src/emu/sound.h @@ -14,8 +14,8 @@ #error Dont include this file directly; include emu.h instead. #endif -#ifndef __SOUND_H__ -#define __SOUND_H__ +#ifndef MAME_EMU_SOUND_H +#define MAME_EMU_SOUND_H //************************************************************************** @@ -68,7 +68,7 @@ class sound_stream sound_stream * m_stream; // owning stream std::vector m_buffer; // output buffer int m_dependents; // number of dependents - int16_t m_gain; // gain to apply to the output + s16 m_gain; // gain to apply to the output }; // stream input class @@ -83,15 +83,15 @@ class sound_stream stream_output * m_source; // pointer to the sound_output for this source std::vector m_resample; // buffer for resampling to the stream's sample rate attoseconds_t m_latency_attoseconds; // latency between this stream and the input stream - int16_t m_gain; // gain to apply to this input - int16_t m_user_gain; // user-controlled gain to apply to this input + s16 m_gain; // gain to apply to this input + s16 m_user_gain; // user-controlled gain to apply to this input }; // constants - static const int OUTPUT_BUFFER_UPDATES = 5; - static const uint32_t FRAC_BITS = 22; - static const uint32_t FRAC_ONE = 1 << FRAC_BITS; - static const uint32_t FRAC_MASK = FRAC_ONE - 1; + static constexpr int OUTPUT_BUFFER_UPDATES = 5; + static constexpr u32 FRAC_BITS = 22; + static constexpr u32 FRAC_ONE = 1 << FRAC_BITS; + static constexpr u32 FRAC_MASK = FRAC_ONE - 1; public: // construction/destruction @@ -134,21 +134,21 @@ private: void allocate_output_buffers(); void postload(); void generate_samples(int samples); - stream_sample_t *generate_resampled_data(stream_input &input, uint32_t numsamples); - void sync_update(void *, int32_t); + stream_sample_t *generate_resampled_data(stream_input &input, u32 numsamples); + void sync_update(void *, s32); // linking information device_t & m_device; // owning device sound_stream * m_next; // next stream in the chain // general information - uint32_t m_sample_rate; // sample rate of this stream - uint32_t m_new_sample_rate; // newly-set sample rate for the stream + u32 m_sample_rate; // sample rate of this stream + u32 m_new_sample_rate; // newly-set sample rate for the stream bool m_synchronous; // synchronous stream that runs at the rate of its input // timing information attoseconds_t m_attoseconds_per_sample; // number of attoseconds per sample - int32_t m_max_samples_per_update; // maximum samples per update + s32 m_max_samples_per_update; // maximum samples per update emu_timer * m_sync_timer; // update timer for synchronous streams // input information @@ -156,17 +156,17 @@ private: std::vector m_input_array; // array of inputs for passing to the callback // resample buffer information - uint32_t m_resample_bufalloc; // allocated size of each resample buffer + u32 m_resample_bufalloc; // allocated size of each resample buffer // output information std::vector m_output; // list of streams which directly depend upon us std::vector m_output_array; // array of outputs for passing to the callback // output buffer information - uint32_t m_output_bufalloc; // allocated size of each output buffer - int32_t m_output_sampindex; // current position within each output buffer - int32_t m_output_update_sampindex; // position at time of last global update - int32_t m_output_base_sampindex; // sample at base of buffer, relative to the current emulated second + u32 m_output_bufalloc; // allocated size of each output buffer + s32 m_output_sampindex; // current position within each output buffer + s32 m_output_update_sampindex; // position at time of last global update + s32 m_output_base_sampindex; // sample at base of buffer, relative to the current emulated second // callback information stream_update_delegate m_callback; // callback function @@ -180,16 +180,16 @@ class sound_manager friend class sound_stream; // reasons for muting - static const uint8_t MUTE_REASON_PAUSE = 0x01; - static const uint8_t MUTE_REASON_UI = 0x02; - static const uint8_t MUTE_REASON_DEBUGGER = 0x04; - static const uint8_t MUTE_REASON_SYSTEM = 0x08; + static constexpr u8 MUTE_REASON_PAUSE = 0x01; + static constexpr u8 MUTE_REASON_UI = 0x02; + static constexpr u8 MUTE_REASON_DEBUGGER = 0x04; + static constexpr u8 MUTE_REASON_SYSTEM = 0x08; // stream updates static const attotime STREAMS_UPDATE_ATTOTIME; public: - static const int STREAMS_UPDATE_FREQUENCY = 50; + static constexpr int STREAMS_UPDATE_FREQUENCY = 50; // construction/destruction sound_manager(running_machine &machine); @@ -219,25 +219,25 @@ public: private: // internal helpers - void mute(bool mute, uint8_t reason); + void mute(bool mute, u8 reason); void reset(); void pause(); void resume(); void config_load(config_type cfg_type, xml_data_node *parentnode); void config_save(config_type cfg_type, xml_data_node *parentnode); - void update(void *ptr = nullptr, int32_t param = 0); + void update(void *ptr = nullptr, s32 param = 0); // internal state running_machine & m_machine; // reference to our machine emu_timer * m_update_timer; // timer to drive periodic updates - uint32_t m_finalmix_leftover; - std::vector m_finalmix; - std::vector m_leftmix; - std::vector m_rightmix; + u32 m_finalmix_leftover; + std::vector m_finalmix; + std::vector m_leftmix; + std::vector m_rightmix; - uint8_t m_muted; + u8 m_muted; int m_attenuation; int m_nosound_mode; @@ -250,4 +250,4 @@ private: }; -#endif /* __SOUND_H__ */ +#endif /* MAME_EMU_SOUND_H */ diff --git a/src/emu/speaker.cpp b/src/emu/speaker.cpp index 23a29217922..0fb2fd55605 100644 --- a/src/emu/speaker.cpp +++ b/src/emu/speaker.cpp @@ -39,7 +39,7 @@ const device_type SPEAKER = &device_creator; // speaker_device - constructor //------------------------------------------------- -speaker_device::speaker_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +speaker_device::speaker_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, SPEAKER, "Speaker", tag, owner, clock, "speaker", __FILE__), device_mixer_interface(mconfig, *this), m_x(0.0), @@ -87,7 +87,7 @@ void speaker_device::static_set_position(device_t &device, double x, double y, d // mix - mix in samples from the speaker's stream //------------------------------------------------- -void speaker_device::mix(int32_t *leftmix, int32_t *rightmix, int &samples_this_update, bool suppress) +void speaker_device::mix(s32 *leftmix, s32 *rightmix, int &samples_this_update, bool suppress) { // skip if no stream if (m_mixer_stream == nullptr) diff --git a/src/emu/speaker.h b/src/emu/speaker.h index 0260b5fe2ac..93183370642 100644 --- a/src/emu/speaker.h +++ b/src/emu/speaker.h @@ -14,8 +14,8 @@ #error Dont include this file directly; include emu.h instead. #endif -#ifndef __SPEAKER_H__ -#define __SPEAKER_H__ +#ifndef MAME_EMU_SPEAKER_H +#define MAME_EMU_SPEAKER_H //************************************************************************** @@ -57,14 +57,14 @@ class speaker_device : public device_t, public: // construction/destruction - speaker_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + speaker_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); virtual ~speaker_device(); // inline configuration helpers static void static_set_position(device_t &device, double x, double y, double z); // internally for use by the sound system - void mix(int32_t *leftmix, int32_t *rightmix, int &samples_this_update, bool suppress); + void mix(s32 *leftmix, s32 *rightmix, int &samples_this_update, bool suppress); protected: // device-level overrides @@ -77,9 +77,9 @@ protected: // internal state #ifdef MAME_DEBUG - int32_t m_max_sample; // largest sample value we've seen - int32_t m_clipped_samples; // total number of clipped samples - int32_t m_total_samples; // total number of samples + s32 m_max_sample; // largest sample value we've seen + s32 m_clipped_samples; // total number of clipped samples + s32 m_total_samples; // total number of samples #endif }; @@ -88,4 +88,4 @@ protected: typedef device_type_iterator<&device_creator, speaker_device> speaker_device_iterator; -#endif /* __SOUND_H__ */ +#endif /* MAME_EMU_SPEAKER_H */ diff --git a/src/emu/tilemap.cpp b/src/emu/tilemap.cpp index d8e5d1b0ea0..13531985467 100644 --- a/src/emu/tilemap.cpp +++ b/src/emu/tilemap.cpp @@ -21,14 +21,14 @@ // account tilemap flip states //------------------------------------------------- -inline int32_t tilemap_t::effective_rowscroll(int index, uint32_t screen_width) +inline s32 tilemap_t::effective_rowscroll(int index, u32 screen_width) { // if we're flipping vertically, adjust the row number if (m_attributes & TILEMAP_FLIPY) index = m_scrollrows - 1 - index; // adjust final result based on the horizontal flip and dx values - int32_t value; + s32 value; if (!(m_attributes & TILEMAP_FLIPX)) value = m_dx - m_rowscroll[index]; else @@ -49,14 +49,14 @@ inline int32_t tilemap_t::effective_rowscroll(int index, uint32_t screen_width) // account tilemap flip states //------------------------------------------------- -inline int32_t tilemap_t::effective_colscroll(int index, uint32_t screen_height) +inline s32 tilemap_t::effective_colscroll(int index, u32 screen_height) { // if we're flipping horizontally, adjust the column number if (m_attributes & TILEMAP_FLIPX) index = m_scrollcols - 1 - index; // adjust final result based on the vertical flip and dx values - int32_t value; + s32 value; if (!(m_attributes & TILEMAP_FLIPY)) value = m_dy - m_colscroll[index]; else @@ -79,7 +79,7 @@ inline int32_t tilemap_t::effective_colscroll(int index, uint32_t screen_height) inline bool tilemap_t::gfx_elements_changed() { - uint32_t usedmask = m_gfx_used; + u32 usedmask = m_gfx_used; bool isdirty = false; // iterate over all used gfx types and set the dirty flag if any of them have changed @@ -104,7 +104,7 @@ inline bool tilemap_t::gfx_elements_changed() // bitmap, setting priority only //------------------------------------------------- -inline void tilemap_t::scanline_draw_opaque_null(int count, uint8_t *pri, uint32_t pcode) +inline void tilemap_t::scanline_draw_opaque_null(int count, u8 *pri, u32 pcode) { // skip entirely if not changing priority if (pcode == 0xff00) @@ -121,7 +121,7 @@ inline void tilemap_t::scanline_draw_opaque_null(int count, uint8_t *pri, uint32 // bitmap using a mask, setting priority only //------------------------------------------------- -inline void tilemap_t::scanline_draw_masked_null(const uint8_t *maskptr, int mask, int value, int count, uint8_t *pri, uint32_t pcode) +inline void tilemap_t::scanline_draw_masked_null(const u8 *maskptr, int mask, int value, int count, u8 *pri, u32 pcode) { // skip entirely if not changing priority if (pcode == 0xff00) @@ -140,7 +140,7 @@ inline void tilemap_t::scanline_draw_masked_null(const uint8_t *maskptr, int mas // indexed bitmap //------------------------------------------------- -inline void tilemap_t::scanline_draw_opaque_ind16(uint16_t *dest, const uint16_t *source, int count, uint8_t *pri, uint32_t pcode) +inline void tilemap_t::scanline_draw_opaque_ind16(u16 *dest, const u16 *source, int count, u8 *pri, u32 pcode) { // special case for no palette offset int pal = pcode >> 16; @@ -182,7 +182,7 @@ inline void tilemap_t::scanline_draw_opaque_ind16(uint16_t *dest, const uint16_t // indexed bitmap using a mask //------------------------------------------------- -inline void tilemap_t::scanline_draw_masked_ind16(uint16_t *dest, const uint16_t *source, const uint8_t *maskptr, int mask, int value, int count, uint8_t *pri, uint32_t pcode) +inline void tilemap_t::scanline_draw_masked_ind16(u16 *dest, const u16 *source, const u8 *maskptr, int mask, int value, int count, u8 *pri, u32 pcode) { int pal = pcode >> 16; @@ -213,7 +213,7 @@ inline void tilemap_t::scanline_draw_masked_ind16(uint16_t *dest, const uint16_t // RGB bitmap //------------------------------------------------- -inline void tilemap_t::scanline_draw_opaque_rgb32(uint32_t *dest, const uint16_t *source, int count, const rgb_t *pens, uint8_t *pri, uint32_t pcode) +inline void tilemap_t::scanline_draw_opaque_rgb32(u32 *dest, const u16 *source, int count, const rgb_t *pens, u8 *pri, u32 pcode) { const rgb_t *clut = &pens[pcode >> 16]; @@ -241,7 +241,7 @@ inline void tilemap_t::scanline_draw_opaque_rgb32(uint32_t *dest, const uint16_t // RGB bitmap using a mask //------------------------------------------------- -inline void tilemap_t::scanline_draw_masked_rgb32(uint32_t *dest, const uint16_t *source, const uint8_t *maskptr, int mask, int value, int count, const rgb_t *pens, uint8_t *pri, uint32_t pcode) +inline void tilemap_t::scanline_draw_masked_rgb32(u32 *dest, const u16 *source, const u8 *maskptr, int mask, int value, int count, const rgb_t *pens, u8 *pri, u32 pcode) { const rgb_t *clut = &pens[pcode >> 16]; @@ -271,7 +271,7 @@ inline void tilemap_t::scanline_draw_masked_rgb32(uint32_t *dest, const uint16_t // 32bpp RGB bitmap with alpha blending //------------------------------------------------- -inline void tilemap_t::scanline_draw_opaque_rgb32_alpha(uint32_t *dest, const uint16_t *source, int count, const rgb_t *pens, uint8_t *pri, uint32_t pcode, uint8_t alpha) +inline void tilemap_t::scanline_draw_opaque_rgb32_alpha(u32 *dest, const u16 *source, int count, const rgb_t *pens, u8 *pri, u32 pcode, u8 alpha) { const rgb_t *clut = &pens[pcode >> 16]; @@ -300,7 +300,7 @@ inline void tilemap_t::scanline_draw_opaque_rgb32_alpha(uint32_t *dest, const ui // blending //------------------------------------------------- -inline void tilemap_t::scanline_draw_masked_rgb32_alpha(uint32_t *dest, const uint16_t *source, const uint8_t *maskptr, int mask, int value, int count, const rgb_t *pens, uint8_t *pri, uint32_t pcode, uint8_t alpha) +inline void tilemap_t::scanline_draw_masked_rgb32_alpha(u32 *dest, const u16 *source, const u8 *maskptr, int mask, int value, int count, const rgb_t *pens, u8 *pri, u32 pcode, u8 alpha) { const rgb_t *clut = &pens[pcode >> 16]; @@ -343,7 +343,7 @@ tilemap_t::tilemap_t() // init - initialize the tilemap //------------------------------------------------- -tilemap_t &tilemap_t::init(tilemap_manager &manager, device_gfx_interface &decoder, tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, uint16_t tilewidth, uint16_t tileheight, uint32_t cols, uint32_t rows) +tilemap_t &tilemap_t::init(tilemap_manager &manager, device_gfx_interface &decoder, tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, u16 tilewidth, u16 tileheight, u32 cols, u32 rows) { // populate managers and devices m_manager = &manager; @@ -463,7 +463,7 @@ void tilemap_t::mark_tile_dirty(tilemap_memory_index memindex) // a layer //------------------------------------------------- -void tilemap_t::map_pens_to_layer(int group, pen_t pen, pen_t mask, uint8_t layermask) +void tilemap_t::map_pens_to_layer(int group, pen_t pen, pen_t mask, u8 layermask) { assert(group < TILEMAP_NUM_GROUPS); assert((layermask & TILEMAP_PIXEL_CATEGORY_MASK) == 0); @@ -478,7 +478,7 @@ void tilemap_t::map_pens_to_layer(int group, pen_t pen, pen_t mask, uint8_t laye stop = std::min(stop, MAX_PEN_TO_FLAGS - 1); // iterate and set - uint8_t *array = m_pen_to_flags + group * MAX_PEN_TO_FLAGS; + u8 *array = m_pen_to_flags + group * MAX_PEN_TO_FLAGS; bool changed = false; for (pen_t cur = start; cur <= stop; cur++) if ((cur & mask) == pen && array[cur] != layermask) @@ -515,13 +515,13 @@ void tilemap_t::set_transparent_pen(pen_t pen) // background mask (mapping to layer 1) //------------------------------------------------- -void tilemap_t::set_transmask(int group, uint32_t fgmask, uint32_t bgmask) +void tilemap_t::set_transmask(int group, u32 fgmask, u32 bgmask) { // iterate over all 32 pens specified for (pen_t pen = 0; pen < 32; pen++) { - uint8_t fgbits = ((fgmask >> pen) & 1) ? TILEMAP_PIXEL_TRANSPARENT : TILEMAP_PIXEL_LAYER0; - uint8_t bgbits = ((bgmask >> pen) & 1) ? TILEMAP_PIXEL_TRANSPARENT : TILEMAP_PIXEL_LAYER1; + u8 fgbits = ((fgmask >> pen) & 1) ? TILEMAP_PIXEL_TRANSPARENT : TILEMAP_PIXEL_LAYER0; + u8 bgbits = ((bgmask >> pen) & 1) ? TILEMAP_PIXEL_TRANSPARENT : TILEMAP_PIXEL_LAYER1; map_pen_to_layer(group, pen, fgbits | bgbits); } } @@ -538,7 +538,7 @@ void tilemap_t::configure_groups(gfx_element &gfx, indirect_pen_t transcolor) assert(gfx.colors() <= TILEMAP_NUM_GROUPS); // iterate over all colors in the tilemap - for (uint32_t color = 0; color < gfx.colors(); color++) + for (u32 color = 0; color < gfx.colors(); color++) set_transmask(color, m_palette->transpen_mask(gfx, color, transcolor), 0); } @@ -556,22 +556,22 @@ void tilemap_t::configure_groups(gfx_element &gfx, indirect_pen_t transcolor) // order with optional flipping //------------------------------------------------- -tilemap_memory_index tilemap_t::scan_rows(uint32_t col, uint32_t row, uint32_t num_cols, uint32_t num_rows) +tilemap_memory_index tilemap_t::scan_rows(u32 col, u32 row, u32 num_cols, u32 num_rows) { return row * num_cols + col; } -tilemap_memory_index tilemap_t::scan_rows_flip_x(uint32_t col, uint32_t row, uint32_t num_cols, uint32_t num_rows) +tilemap_memory_index tilemap_t::scan_rows_flip_x(u32 col, u32 row, u32 num_cols, u32 num_rows) { return row * num_cols + (num_cols - 1 - col); } -tilemap_memory_index tilemap_t::scan_rows_flip_y(uint32_t col, uint32_t row, uint32_t num_cols, uint32_t num_rows) +tilemap_memory_index tilemap_t::scan_rows_flip_y(u32 col, u32 row, u32 num_cols, u32 num_rows) { return (num_rows - 1 - row) * num_cols + col; } -tilemap_memory_index tilemap_t::scan_rows_flip_xy(uint32_t col, uint32_t row, uint32_t num_cols, uint32_t num_rows) +tilemap_memory_index tilemap_t::scan_rows_flip_xy(u32 col, u32 row, u32 num_cols, u32 num_rows) { return (num_rows - 1 - row) * num_cols + (num_cols - 1 - col); } @@ -585,22 +585,22 @@ tilemap_memory_index tilemap_t::scan_rows_flip_xy(uint32_t col, uint32_t row, ui // major order with optional flipping //------------------------------------------------- -tilemap_memory_index tilemap_t::scan_cols(uint32_t col, uint32_t row, uint32_t num_cols, uint32_t num_rows) +tilemap_memory_index tilemap_t::scan_cols(u32 col, u32 row, u32 num_cols, u32 num_rows) { return col * num_rows + row; } -tilemap_memory_index tilemap_t::scan_cols_flip_x(uint32_t col, uint32_t row, uint32_t num_cols, uint32_t num_rows) +tilemap_memory_index tilemap_t::scan_cols_flip_x(u32 col, u32 row, u32 num_cols, u32 num_rows) { return (num_cols - 1 - col) * num_rows + row; } -tilemap_memory_index tilemap_t::scan_cols_flip_y(uint32_t col, uint32_t row, uint32_t num_cols, uint32_t num_rows) +tilemap_memory_index tilemap_t::scan_cols_flip_y(u32 col, u32 row, u32 num_cols, u32 num_rows) { return col * num_rows + (num_rows - 1 - row); } -tilemap_memory_index tilemap_t::scan_cols_flip_xy(uint32_t col, uint32_t row, uint32_t num_cols, uint32_t num_rows) +tilemap_memory_index tilemap_t::scan_cols_flip_xy(u32 col, u32 row, u32 num_cols, u32 num_rows) { return (num_cols - 1 - col) * num_rows + (num_rows - 1 - row); } @@ -634,8 +634,8 @@ void tilemap_t::mappings_create() // compute the maximum memory index tilemap_memory_index max_memory_index = 0; - for (uint32_t row = 0; row < m_rows; row++) - for (uint32_t col = 0; col < m_cols; col++) + for (u32 row = 0; row < m_rows; row++) + for (u32 col = 0; col < m_cols; col++) { tilemap_memory_index memindex = memory_index(col, row); max_memory_index = std::max(max_memory_index, memindex); @@ -665,8 +665,8 @@ void tilemap_t::mappings_update() // now iterate over all logical indexes and populate the memory index for (logical_index logindex = 0; logindex < m_logical_to_memory.size(); logindex++) { - uint32_t logical_col = logindex % m_cols; - uint32_t logical_row = logindex / m_cols; + u32 logical_col = logindex % m_cols; + u32 logical_row = logindex / m_cols; tilemap_memory_index memindex = memory_index(logical_col, logical_row); // apply tilemap flip to get the final location to store @@ -674,7 +674,7 @@ void tilemap_t::mappings_update() logical_col = (m_cols - 1) - logical_col; if (m_attributes & TILEMAP_FLIPY) logical_row = (m_rows - 1) - logical_row; - uint32_t flipped_logindex = logical_row * m_cols + logical_col; + u32 flipped_logindex = logical_row * m_cols + logical_col; // fill in entries in both arrays m_memory_to_logical[memindex] = flipped_logindex; @@ -724,8 +724,8 @@ g_profiler.start(PROFILER_TILEMAP_DRAW); // iterate over rows and columns logical_index logindex = 0; - for (uint32_t row = 0; row < m_rows; row++) - for (uint32_t col = 0; col < m_cols; col++, logindex++) + for (u32 row = 0; row < m_rows; row++) + for (u32 col = 0; col < m_cols; col++, logindex++) if (m_tileflags[logindex] == TILE_FLAG_DIRTY) tile_update(logindex, col, row); @@ -740,7 +740,7 @@ g_profiler.stop(); // tile_update - update a single dirty tile //------------------------------------------------- -void tilemap_t::tile_update(logical_index logindex, uint32_t col, uint32_t row) +void tilemap_t::tile_update(logical_index logindex, u32 col, u32 row) { g_profiler.start(PROFILER_TILEMAP_UPDATE); @@ -749,11 +749,11 @@ g_profiler.start(PROFILER_TILEMAP_UPDATE); m_tile_get_info(*this, m_tileinfo, memindex); // apply the global tilemap flip to the returned flip flags - uint32_t flags = m_tileinfo.flags ^ (m_attributes & 0x03); + u32 flags = m_tileinfo.flags ^ (m_attributes & 0x03); // draw the tile, using either direct or transparent - uint32_t x0 = m_tilewidth * col; - uint32_t y0 = m_tileheight * row; + u32 x0 = m_tilewidth * col; + u32 y0 = m_tileheight * row; m_tileflags[logindex] = tile_draw(m_tileinfo.pen_data, x0, y0, m_tileinfo.palette_base, m_tileinfo.category, m_tileinfo.group, flags, m_tileinfo.pen_mask); @@ -779,7 +779,7 @@ g_profiler.stop(); // the palette_base //------------------------------------------------- -uint8_t tilemap_t::tile_draw(const uint8_t *pendata, uint32_t x0, uint32_t y0, uint32_t palette_base, uint8_t category, uint8_t group, uint8_t flags, uint8_t pen_mask) +u8 tilemap_t::tile_draw(const u8 *pendata, u32 x0, u32 y0, u32 palette_base, u8 category, u8 group, u8 flags, u8 pen_mask) { // OR in the force layer flags category |= flags & (TILE_FORCE_LAYER0 | TILE_FORCE_LAYER1 | TILE_FORCE_LAYER2); @@ -801,22 +801,22 @@ uint8_t tilemap_t::tile_draw(const uint8_t *pendata, uint32_t x0, uint32_t y0, u } // iterate over rows - const uint8_t *penmap = m_pen_to_flags + group * MAX_PEN_TO_FLAGS; - uint8_t andmask = ~0, ormask = 0; - for (uint16_t ty = 0; ty < m_tileheight; ty++) + const u8 *penmap = m_pen_to_flags + group * MAX_PEN_TO_FLAGS; + u8 andmask = ~0, ormask = 0; + for (u16 ty = 0; ty < m_tileheight; ty++) { - uint16_t *pixptr = &m_pixmap.pix16(y0, x0); - uint8_t *flagsptr = &m_flagsmap.pix8(y0, x0); + u16 *pixptr = &m_pixmap.pix16(y0, x0); + u8 *flagsptr = &m_flagsmap.pix8(y0, x0); // pre-advance to the next row y0 += dy0; // 8bpp data int xoffs = 0; - for (uint16_t tx = 0; tx < m_tilewidth; tx++) + for (u16 tx = 0; tx < m_tilewidth; tx++) { - uint8_t pen = (*pendata++) & pen_mask; - uint8_t map = penmap[pen]; + u8 pen = (*pendata++) & pen_mask; + u8 map = penmap[pen]; pixptr[xoffs] = palette_base + pen; flagsptr[xoffs] = map | category; andmask &= map; @@ -834,7 +834,7 @@ uint8_t tilemap_t::tile_draw(const uint8_t *pendata, uint32_t x0, uint32_t y0, u // flagsmap appropriately //------------------------------------------------- -uint8_t tilemap_t::tile_apply_bitmask(const uint8_t *maskdata, uint32_t x0, uint32_t y0, uint8_t category, uint8_t flags) +u8 tilemap_t::tile_apply_bitmask(const u8 *maskdata, u32 x0, u32 y0, u8 category, u8 flags) { // if we're vertically flipped, point to the bottom row and work backwards int dy0 = 1; @@ -853,19 +853,19 @@ uint8_t tilemap_t::tile_apply_bitmask(const uint8_t *maskdata, uint32_t x0, uint } // iterate over rows - uint8_t andmask = ~0, ormask = 0; + u8 andmask = ~0, ormask = 0; int bitoffs = 0; - for (uint16_t ty = 0; ty < m_tileheight; ty++) + for (u16 ty = 0; ty < m_tileheight; ty++) { // pre-advance to the next row - uint8_t *flagsptr = &m_flagsmap.pix8(y0, x0); + u8 *flagsptr = &m_flagsmap.pix8(y0, x0); y0 += dy0; // anywhere the bitmask is 0 should be transparent int xoffs = 0; - for (uint16_t tx = 0; tx < m_tilewidth; tx++) + for (u16 tx = 0; tx < m_tilewidth; tx++) { - uint8_t map = flagsptr[xoffs]; + u8 map = flagsptr[xoffs]; if ((maskdata[bitoffs / 8] & (0x80 >> (bitoffs & 7))) == 0) map = flagsptr[xoffs] = TILEMAP_PIXEL_TRANSPARENT | category; @@ -891,7 +891,7 @@ uint8_t tilemap_t::tile_apply_bitmask(const uint8_t *maskdata, uint32_t x0, uint // and indexed drawing code //------------------------------------------------- -void tilemap_t::configure_blit_parameters(blit_parameters &blit, bitmap_ind8 &priority_bitmap, const rectangle &cliprect, uint32_t flags, uint8_t priority, uint8_t priority_mask) +void tilemap_t::configure_blit_parameters(blit_parameters &blit, bitmap_ind8 &priority_bitmap, const rectangle &cliprect, u32 flags, u8 priority, u8 priority_mask) { // set the target bitmap blit.priority = &priority_bitmap; @@ -936,7 +936,7 @@ void tilemap_t::configure_blit_parameters(blit_parameters &blit, bitmap_ind8 &pr //------------------------------------------------- template -void tilemap_t::draw_common(screen_device &screen, _BitmapClass &dest, const rectangle &cliprect, uint32_t flags, uint8_t priority, uint8_t priority_mask) +void tilemap_t::draw_common(screen_device &screen, _BitmapClass &dest, const rectangle &cliprect, u32 flags, u8 priority, u8 priority_mask) { // skip if disabled if (!m_enable) @@ -952,8 +952,8 @@ g_profiler.start(PROFILER_TILEMAP_DRAW); // flip the tilemap around the center of the visible area rectangle visarea = screen.visible_area(); - uint32_t width = visarea.min_x + visarea.max_x + 1; - uint32_t height = visarea.min_y + visarea.max_y + 1; + u32 width = visarea.min_x + visarea.max_x + 1; + u32 height = visarea.min_y + visarea.max_y + 1; // XY scrolling playfield if (m_scrollrows == 1 && m_scrollcols == 1) @@ -977,7 +977,7 @@ g_profiler.start(PROFILER_TILEMAP_DRAW); for (int ypos = scrolly - m_height; ypos <= original_cliprect.max_y; ypos += m_height) { int const firstrow = std::max((original_cliprect.min_y - ypos) / rowheight, 0); - int const lastrow = std::min((original_cliprect.max_y - ypos) / rowheight, int32_t(m_scrollrows) - 1); + int const lastrow = std::min((original_cliprect.max_y - ypos) / rowheight, s32(m_scrollrows) - 1); // iterate over rows in the tilemap int nextrow; @@ -1043,10 +1043,10 @@ g_profiler.start(PROFILER_TILEMAP_DRAW); g_profiler.stop(); } -void tilemap_t::draw(screen_device &screen, bitmap_ind16 &dest, const rectangle &cliprect, uint32_t flags, uint8_t priority, uint8_t priority_mask) +void tilemap_t::draw(screen_device &screen, bitmap_ind16 &dest, const rectangle &cliprect, u32 flags, u8 priority, u8 priority_mask) { draw_common(screen, dest, cliprect, flags, priority, priority_mask); } -void tilemap_t::draw(screen_device &screen, bitmap_rgb32 &dest, const rectangle &cliprect, uint32_t flags, uint8_t priority, uint8_t priority_mask) +void tilemap_t::draw(screen_device &screen, bitmap_rgb32 &dest, const rectangle &cliprect, u32 flags, u8 priority, u8 priority_mask) { draw_common(screen, dest, cliprect, flags, priority, priority_mask); } @@ -1059,11 +1059,11 @@ void tilemap_t::draw(screen_device &screen, bitmap_rgb32 &dest, const rectangle template void tilemap_t::draw_roz_common(screen_device &screen, _BitmapClass &dest, const rectangle &cliprect, - uint32_t startx, uint32_t starty, int incxx, int incxy, int incyx, int incyy, - bool wraparound, uint32_t flags, uint8_t priority, uint8_t priority_mask) + u32 startx, u32 starty, int incxx, int incxy, int incyx, int incyy, + bool wraparound, u32 flags, u8 priority, u8 priority_mask) { // notes: -// - startx and starty MUST be uint32_t for calculations to work correctly +// - startx and starty MUST be u32 for calculations to work correctly // - srcbim_width and height are assumed to be a power of 2 to speed up wraparound // skip if disabled @@ -1093,13 +1093,13 @@ g_profiler.stop(); } void tilemap_t::draw_roz(screen_device &screen, bitmap_ind16 &dest, const rectangle &cliprect, - uint32_t startx, uint32_t starty, int incxx, int incxy, int incyx, int incyy, - bool wraparound, uint32_t flags, uint8_t priority, uint8_t priority_mask) + u32 startx, u32 starty, int incxx, int incxy, int incyx, int incyy, + bool wraparound, u32 flags, u8 priority, u8 priority_mask) { draw_roz_common(screen, dest, cliprect, startx, starty, incxx, incxy, incyx, incyy, wraparound, flags, priority, priority_mask); } void tilemap_t::draw_roz(screen_device &screen, bitmap_rgb32 &dest, const rectangle &cliprect, - uint32_t startx, uint32_t starty, int incxx, int incxy, int incyx, int incyy, - bool wraparound, uint32_t flags, uint8_t priority, uint8_t priority_mask) + u32 startx, u32 starty, int incxx, int incxy, int incyx, int incyy, + bool wraparound, u32 flags, u8 priority, u8 priority_mask) { draw_roz_common(screen, dest, cliprect, startx, starty, incxx, incxy, incyx, incyy, wraparound, flags, priority, priority_mask); } @@ -1125,7 +1125,7 @@ void tilemap_t::draw_instance(screen_device &screen, _BitmapClass &dest, const b // look up priority and destination base addresses for y1 bitmap_ind8 &priority_bitmap = *blit.priority; - uint8_t *priority_baseaddr = &priority_bitmap.pix8(y1, xpos); + u8 *priority_baseaddr = &priority_bitmap.pix8(y1, xpos); typename _BitmapClass::pixel_t *dest_baseaddr = nullptr; int dest_rowpixels = 0; if (dest.valid()) @@ -1141,8 +1141,8 @@ void tilemap_t::draw_instance(screen_device &screen, _BitmapClass &dest, const b y2 -= ypos; // get tilemap pixels - const uint16_t *source_baseaddr = &m_pixmap.pix16(y1); - const uint8_t *mask_baseaddr = &m_flagsmap.pix8(y1); + const u16 *source_baseaddr = &m_pixmap.pix16(y1); + const u8 *mask_baseaddr = &m_flagsmap.pix8(y1); // get start/stop columns, rounding outward int mincol = x1 / m_tilewidth; @@ -1201,9 +1201,9 @@ void tilemap_t::draw_instance(screen_device &screen, _BitmapClass &dest, const b const rgb_t *clut = m_palette->palette()->entry_list_adjusted(); if (prev_trans != WHOLLY_TRANSPARENT) { - const uint16_t *source0 = source_baseaddr + x_start; + const u16 *source0 = source_baseaddr + x_start; typename _BitmapClass::pixel_t *dest0 = dest_baseaddr + x_start; - uint8_t *pmap0 = priority_baseaddr + x_start; + u8 *pmap0 = priority_baseaddr + x_start; // if we were opaque, use the opaque renderer if (prev_trans == WHOLLY_OPAQUE) @@ -1213,11 +1213,11 @@ void tilemap_t::draw_instance(screen_device &screen, _BitmapClass &dest, const b if (dest_baseaddr == nullptr) scanline_draw_opaque_null(x_end - x_start, pmap0, blit.tilemap_priority_code); else if (sizeof(*dest0) == 2) - scanline_draw_opaque_ind16(reinterpret_cast(dest0), source0, x_end - x_start, pmap0, blit.tilemap_priority_code); + scanline_draw_opaque_ind16(reinterpret_cast(dest0), source0, x_end - x_start, pmap0, blit.tilemap_priority_code); else if (sizeof(*dest0) == 4 && blit.alpha >= 0xff) - scanline_draw_opaque_rgb32(reinterpret_cast(dest0), source0, x_end - x_start, clut, pmap0, blit.tilemap_priority_code); + scanline_draw_opaque_rgb32(reinterpret_cast(dest0), source0, x_end - x_start, clut, pmap0, blit.tilemap_priority_code); else if (sizeof(*dest0) == 4) - scanline_draw_opaque_rgb32_alpha(reinterpret_cast(dest0), source0, x_end - x_start, clut, pmap0, blit.tilemap_priority_code, blit.alpha); + scanline_draw_opaque_rgb32_alpha(reinterpret_cast(dest0), source0, x_end - x_start, clut, pmap0, blit.tilemap_priority_code, blit.alpha); dest0 += dest_rowpixels; source0 += m_pixmap.rowpixels(); @@ -1228,17 +1228,17 @@ void tilemap_t::draw_instance(screen_device &screen, _BitmapClass &dest, const b // otherwise use the masked renderer else { - const uint8_t *mask0 = mask_baseaddr + x_start; + const u8 *mask0 = mask_baseaddr + x_start; for (int cury = y; cury < nexty; cury++) { if (dest_baseaddr == nullptr) scanline_draw_masked_null(mask0, blit.mask, blit.value, x_end - x_start, pmap0, blit.tilemap_priority_code); else if (sizeof(*dest0) == 2) - scanline_draw_masked_ind16(reinterpret_cast(dest0), source0, mask0, blit.mask, blit.value, x_end - x_start, pmap0, blit.tilemap_priority_code); + scanline_draw_masked_ind16(reinterpret_cast(dest0), source0, mask0, blit.mask, blit.value, x_end - x_start, pmap0, blit.tilemap_priority_code); else if (sizeof(*dest0) == 4 && blit.alpha >= 0xff) - scanline_draw_masked_rgb32(reinterpret_cast(dest0), source0, mask0, blit.mask, blit.value, x_end - x_start, clut, pmap0, blit.tilemap_priority_code); + scanline_draw_masked_rgb32(reinterpret_cast(dest0), source0, mask0, blit.mask, blit.value, x_end - x_start, clut, pmap0, blit.tilemap_priority_code); else if (sizeof(*dest0) == 4) - scanline_draw_masked_rgb32_alpha(reinterpret_cast(dest0), source0, mask0, blit.mask, blit.value, x_end - x_start, clut, pmap0, blit.tilemap_priority_code, blit.alpha); + scanline_draw_masked_rgb32_alpha(reinterpret_cast(dest0), source0, mask0, blit.mask, blit.value, x_end - x_start, clut, pmap0, blit.tilemap_priority_code, blit.alpha); dest0 += dest_rowpixels; source0 += m_pixmap.rowpixels(); @@ -1289,7 +1289,7 @@ do { \ template void tilemap_t::draw_roz_core(screen_device &screen, _BitmapClass &destbitmap, const blit_parameters &blit, - uint32_t startx, uint32_t starty, int incxx, int incxy, int incyx, int incyy, bool wraparound) + u32 startx, u32 starty, int incxx, int incxy, int incyx, int incyy, bool wraparound) { // pre-cache all the inner loop values const rgb_t *clut = m_palette->palette()->entry_list_adjusted() + (blit.tilemap_priority_code >> 16); @@ -1298,10 +1298,10 @@ void tilemap_t::draw_roz_core(screen_device &screen, _BitmapClass &destbitmap, c const int ymask = m_pixmap.height() - 1; const int widthshifted = m_pixmap.width() << 16; const int heightshifted = m_pixmap.height() << 16; - uint32_t priority = blit.tilemap_priority_code; - uint8_t mask = blit.mask; - uint8_t value = blit.value; - uint8_t alpha = blit.alpha; + u32 priority = blit.tilemap_priority_code; + u8 mask = blit.mask; + u8 value = blit.value; + u8 alpha = blit.alpha; // pre-advance based on the cliprect startx += blit.cliprect.min_x * incxx + blit.cliprect.min_y * incyx; @@ -1335,13 +1335,13 @@ void tilemap_t::draw_roz_core(screen_device &screen, _BitmapClass &destbitmap, c { // initialize X counters int x = sx; - uint32_t cx = startx; - uint32_t cy = starty >> 16; + u32 cx = startx; + u32 cy = starty >> 16; // get source and priority pointers - uint8_t *pri = &priority_bitmap.pix8(sy, sx); - const uint16_t *src = &m_pixmap.pix16(cy); - const uint8_t *maskptr = &m_flagsmap.pix8(cy); + u8 *pri = &priority_bitmap.pix8(sy, sx); + const u16 *src = &m_pixmap.pix16(cy); + const u8 *maskptr = &m_flagsmap.pix8(cy); typename _BitmapClass::pixel_t *dest = &destbitmap.pix(sy, sx); // loop over columns @@ -1376,12 +1376,12 @@ void tilemap_t::draw_roz_core(screen_device &screen, _BitmapClass &destbitmap, c { // initialize X counters int x = sx; - uint32_t cx = startx; - uint32_t cy = starty; + u32 cx = startx; + u32 cy = starty; // get dest and priority pointers typename _BitmapClass::pixel_t *dest = &destbitmap.pix(sy, sx); - uint8_t *pri = &priority_bitmap.pix8(sy, sx); + u8 *pri = &priority_bitmap.pix8(sy, sx); // loop over columns while (x <= ex) @@ -1416,12 +1416,12 @@ void tilemap_t::draw_roz_core(screen_device &screen, _BitmapClass &destbitmap, c { // initialize X counters int x = sx; - uint32_t cx = startx; - uint32_t cy = starty; + u32 cx = startx; + u32 cy = starty; // get dest and priority pointers typename _BitmapClass::pixel_t *dest = &destbitmap.pix(sy, sx); - uint8_t *pri = &priority_bitmap.pix8(sy, sx); + u8 *pri = &priority_bitmap.pix8(sy, sx); // loop over columns while (x <= ex) @@ -1456,7 +1456,7 @@ void tilemap_t::draw_roz_core(screen_device &screen, _BitmapClass &destbitmap, c // rowscroll and with fixed parameters //------------------------------------------------- -void tilemap_t::draw_debug(screen_device &screen, bitmap_rgb32 &dest, uint32_t scrollx, uint32_t scrolly) +void tilemap_t::draw_debug(screen_device &screen, bitmap_rgb32 &dest, u32 scrollx, u32 scrolly) { // set up for the blit, using hard-coded parameters (no priority, etc) blit_parameters blit; @@ -1481,7 +1481,7 @@ void tilemap_t::draw_debug(screen_device &screen, bitmap_rgb32 &dest, uint32_t s // get_info_debug - extract info for one tile //------------------------------------------------- -void tilemap_t::get_info_debug(uint32_t col, uint32_t row, uint8_t &gfxnum, uint32_t &code, uint32_t &color) +void tilemap_t::get_info_debug(u32 col, u32 row, u8 &gfxnum, u32 &code, u32 &color) { // first map to the memory index tilemap_memory_index memindex = memory_index(col, row); @@ -1542,14 +1542,14 @@ tilemap_manager::~tilemap_manager() // tilemaps //------------------------------------------------- -tilemap_t &tilemap_manager::create(device_gfx_interface &decoder, tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, uint16_t tilewidth, uint16_t tileheight, uint32_t cols, uint32_t rows, tilemap_t *allocated) +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 == nullptr) allocated = global_alloc(tilemap_t); 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, uint16_t tilewidth, uint16_t tileheight, uint32_t cols, uint32_t rows, tilemap_t *allocated) +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 == nullptr) allocated = global_alloc(tilemap_t); @@ -1574,7 +1574,7 @@ tilemap_t &tilemap_manager::create(device_gfx_interface &decoder, tilemap_get_in // tilemaps //------------------------------------------------- -void tilemap_manager::set_flip_all(uint32_t attributes) +void tilemap_manager::set_flip_all(u32 attributes) { for (tilemap_t &tmap : m_tilemap_list) tmap.set_flip(attributes); @@ -1605,7 +1605,7 @@ const device_type TILEMAP = &device_creator; // tilemap_device - constructor //------------------------------------------------- -tilemap_device::tilemap_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +tilemap_device::tilemap_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, TILEMAP, "Tilemap", tag, owner, clock, "tilemap", __FILE__), m_gfxdecode(*this, finder_base::DUMMY_TAG), m_standard_mapper(TILEMAP_STANDARD_COUNT), @@ -1658,7 +1658,7 @@ void tilemap_device::static_set_info_callback(device_t &device, tilemap_get_info // layout //------------------------------------------------- -void tilemap_device::static_set_layout(device_t &device, tilemap_standard_mapper mapper, uint32_t columns, uint32_t rows) +void tilemap_device::static_set_layout(device_t &device, tilemap_standard_mapper mapper, u32 columns, u32 rows) { tilemap_device &target = downcast(device); target.m_standard_mapper = mapper; @@ -1666,7 +1666,7 @@ void tilemap_device::static_set_layout(device_t &device, tilemap_standard_mapper target.m_num_rows = rows; } -void tilemap_device::static_set_layout(device_t &device, tilemap_mapper_delegate mapper, uint32_t columns, uint32_t rows) +void tilemap_device::static_set_layout(device_t &device, tilemap_mapper_delegate mapper, u32 columns, u32 rows) { tilemap_device &target = downcast(device); target.m_standard_mapper = TILEMAP_STANDARD_COUNT; @@ -1680,7 +1680,7 @@ void tilemap_device::static_set_layout(device_t &device, tilemap_mapper_delegate // static_set_tile_size: Set the tile size //------------------------------------------------- -void tilemap_device::static_set_tile_size(device_t &device, uint16_t width, uint16_t height) +void tilemap_device::static_set_tile_size(device_t &device, u16 width, u16 height) { tilemap_device &target = downcast(device); target.m_tile_width = width; diff --git a/src/emu/tilemap.h b/src/emu/tilemap.h index 99e4b7c83ee..057cdca8c86 100644 --- a/src/emu/tilemap.h +++ b/src/emu/tilemap.h @@ -163,17 +163,17 @@ behind or in front of sprites. tilemap_t *tmap; - uint16_t *my_tmap_memory; + u16 *my_tmap_memory; required_device gfxdecode; TILE_GET_INFO_MEMBER( my_state::my_get_info ) { - uint16_t tiledata = my_tmap_memory[tile_index]; - uint8_t code = tiledata & 0xff; - uint8_t color = (tiledata >> 8) & 0x1f; - uint8_t flipx = (tiledata >> 13) & 1; - uint8_t flipy = (tiledata >> 14) & 1; - uint8_t category = (tiledata >> 15) & 1; + u16 tiledata = my_tmap_memory[tile_index]; + u8 code = tiledata & 0xff; + u8 color = (tiledata >> 8) & 0x1f; + u8 flipx = (tiledata >> 13) & 1; + u8 flipy = (tiledata >> 14) & 1; + u8 category = (tiledata >> 15) & 1; // set the common info for the tile tileinfo.set( @@ -204,7 +204,7 @@ tmap.set_transparent_pen(0); } - uint32_t my_state::screen_update_mydriver( + u32 my_state::screen_update_mydriver( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) @@ -304,8 +304,8 @@ #error Dont include this file directly; include emu.h instead. #endif -#ifndef __TILEMAP_H__ -#define __TILEMAP_H__ +#ifndef MAME_EMU_TILEMAP_H +#define MAME_EMU_TILEMAP_H //************************************************************************** @@ -313,38 +313,38 @@ //************************************************************************** // maximum number of groups -#define TILEMAP_NUM_GROUPS 256 +constexpr size_t TILEMAP_NUM_GROUPS = 256; // these flags control tilemap_t::draw() behavior -const uint32_t TILEMAP_DRAW_CATEGORY_MASK = 0x0f; // specify the category to draw -const uint32_t TILEMAP_DRAW_LAYER0 = 0x10; // draw layer 0 -const uint32_t TILEMAP_DRAW_LAYER1 = 0x20; // draw layer 1 -const uint32_t TILEMAP_DRAW_LAYER2 = 0x40; // draw layer 2 -const uint32_t TILEMAP_DRAW_OPAQUE = 0x80; // draw everything, even transparent stuff -const uint32_t TILEMAP_DRAW_ALPHA_FLAG = 0x100; // draw with alpha blending (in the upper 8 bits) -const uint32_t TILEMAP_DRAW_ALL_CATEGORIES = 0x200; // draw all categories +constexpr u32 TILEMAP_DRAW_CATEGORY_MASK = 0x0f; // specify the category to draw +constexpr u32 TILEMAP_DRAW_LAYER0 = 0x10; // draw layer 0 +constexpr u32 TILEMAP_DRAW_LAYER1 = 0x20; // draw layer 1 +constexpr u32 TILEMAP_DRAW_LAYER2 = 0x40; // draw layer 2 +constexpr u32 TILEMAP_DRAW_OPAQUE = 0x80; // draw everything, even transparent stuff +constexpr u32 TILEMAP_DRAW_ALPHA_FLAG = 0x100; // draw with alpha blending (in the upper 8 bits) +constexpr u32 TILEMAP_DRAW_ALL_CATEGORIES = 0x200; // draw all categories // per-pixel flags in the transparency_bitmap -const uint8_t TILEMAP_PIXEL_CATEGORY_MASK = 0x0f; // category is stored in the low 4 bits -const uint8_t TILEMAP_PIXEL_TRANSPARENT = 0x00; // transparent if in none of the layers below -const uint8_t TILEMAP_PIXEL_LAYER0 = 0x10; // pixel is opaque in layer 0 -const uint8_t TILEMAP_PIXEL_LAYER1 = 0x20; // pixel is opaque in layer 1 -const uint8_t TILEMAP_PIXEL_LAYER2 = 0x40; // pixel is opaque in layer 2 +constexpr u8 TILEMAP_PIXEL_CATEGORY_MASK = 0x0f; // category is stored in the low 4 bits +constexpr u8 TILEMAP_PIXEL_TRANSPARENT = 0x00; // transparent if in none of the layers below +constexpr u8 TILEMAP_PIXEL_LAYER0 = 0x10; // pixel is opaque in layer 0 +constexpr u8 TILEMAP_PIXEL_LAYER1 = 0x20; // pixel is opaque in layer 1 +constexpr u8 TILEMAP_PIXEL_LAYER2 = 0x40; // pixel is opaque in layer 2 // per-tile flags, set by get_tile_info callback -const uint8_t TILE_FLIPX = 0x01; // draw this tile horizontally flipped -const uint8_t TILE_FLIPY = 0x02; // draw this tile vertically flipped -const uint8_t TILE_FORCE_LAYER0 = TILEMAP_PIXEL_LAYER0; // force all pixels to be layer 0 (no transparency) -const uint8_t TILE_FORCE_LAYER1 = TILEMAP_PIXEL_LAYER1; // force all pixels to be layer 1 (no transparency) -const uint8_t TILE_FORCE_LAYER2 = TILEMAP_PIXEL_LAYER2; // force all pixels to be layer 2 (no transparency) +constexpr u8 TILE_FLIPX = 0x01; // draw this tile horizontally flipped +constexpr u8 TILE_FLIPY = 0x02; // draw this tile vertically flipped +constexpr u8 TILE_FORCE_LAYER0 = TILEMAP_PIXEL_LAYER0; // force all pixels to be layer 0 (no transparency) +constexpr u8 TILE_FORCE_LAYER1 = TILEMAP_PIXEL_LAYER1; // force all pixels to be layer 1 (no transparency) +constexpr u8 TILE_FORCE_LAYER2 = TILEMAP_PIXEL_LAYER2; // force all pixels to be layer 2 (no transparency) // tilemap global flags, used by tilemap_t::set_flip() -const uint32_t TILEMAP_FLIPX = TILE_FLIPX; // draw the tilemap horizontally flipped -const uint32_t TILEMAP_FLIPY = TILE_FLIPY; // draw the tilemap vertically flipped +constexpr u32 TILEMAP_FLIPX = TILE_FLIPX; // draw the tilemap horizontally flipped +constexpr u32 TILEMAP_FLIPY = TILE_FLIPY; // draw the tilemap vertically flipped // set this value for a scroll row/column to fully disable it -const uint32_t TILE_LINE_DISABLED = 0x80000000; +constexpr u32 TILE_LINE_DISABLED = 0x80000000; // standard mappers enum tilemap_standard_mapper @@ -433,24 +433,24 @@ class tilemap_device; // global types -typedef uint32_t tilemap_memory_index; +typedef u32 tilemap_memory_index; // tile_data is filled in by the get_tile_info callback struct tile_data { device_gfx_interface *decoder; // set in tilemap_t::init() - const uint8_t * pen_data; // required - const uint8_t * mask_data; // required + const u8 * pen_data; // required + const u8 * mask_data; // required pen_t palette_base; // defaults to 0 - uint8_t category; // defaults to 0; range from 0..15 - uint8_t group; // defaults to 0; range from 0..TILEMAP_NUM_GROUPS - uint8_t flags; // defaults to 0; one or more of TILE_* flags above - uint8_t pen_mask; // defaults to 0xff; mask to apply to pen_data while rendering the tile - uint8_t gfxnum; // defaults to 0xff; specify index of gfx for auto-invalidation on dirty - uint32_t code; + u8 category; // defaults to 0; range from 0..15 + u8 group; // defaults to 0; range from 0..TILEMAP_NUM_GROUPS + u8 flags; // defaults to 0; one or more of TILE_* flags above + u8 pen_mask; // defaults to 0xff; mask to apply to pen_data while rendering the tile + u8 gfxnum; // defaults to 0xff; specify index of gfx for auto-invalidation on dirty + u32 code; - void set(uint8_t _gfxnum, uint32_t rawcode, uint32_t rawcolor, uint8_t _flags) + void set(u8 _gfxnum, u32 rawcode, u32 rawcolor, u8 _flags) { gfx_element *gfx = decoder->gfx(_gfxnum); code = rawcode % gfx->elements(); @@ -464,7 +464,7 @@ struct tile_data // modern delegates typedef device_delegate tilemap_get_info_delegate; -typedef device_delegate tilemap_mapper_delegate; +typedef device_delegate tilemap_mapper_delegate; // ======================> tilemap_t @@ -480,10 +480,10 @@ class tilemap_t friend resource_pool_object::~resource_pool_object(); // logical index - typedef uint32_t logical_index; + typedef u32 logical_index; // internal usage to mark tiles dirty - static const uint8_t TILE_FLAG_DIRTY = 0xff; + static const u8 TILE_FLAG_DIRTY = 0xff; // invalid logical index static const logical_index INVALID_LOGICAL_INDEX = (logical_index)~0; @@ -496,7 +496,7 @@ protected: tilemap_t(); virtual ~tilemap_t(); - tilemap_t &init(tilemap_manager &manager, device_gfx_interface &decoder, tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, uint16_t tilewidth, uint16_t tileheight, uint32_t cols, uint32_t rows); + tilemap_t &init(tilemap_manager &manager, device_gfx_interface &decoder, tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, u16 tilewidth, u16 tileheight, u32 cols, u32 rows); public: // getters @@ -509,75 +509,75 @@ public: void *user_data() const { return m_user_data; } memory_array &basemem() { return m_basemem; } memory_array &extmem() { return m_extmem; } - uint32_t rows() const { return m_rows; } - uint32_t cols() const { return m_cols; } - uint16_t tilewidth() const { return m_tilewidth; } - uint16_t tileheight() const { return m_tileheight; } - uint32_t width() const { return m_width; } - uint32_t height() const { return m_height; } + u32 rows() const { return m_rows; } + u32 cols() const { return m_cols; } + u16 tilewidth() const { return m_tilewidth; } + u16 tileheight() const { return m_tileheight; } + u32 width() const { return m_width; } + u32 height() const { return m_height; } bool enabled() const { return m_enable; } - uint32_t palette_offset() const { return m_palette_offset; } + u32 palette_offset() const { return m_palette_offset; } int scrolldx() const { return (m_attributes & TILEMAP_FLIPX) ? m_dx_flipped : m_dx; } int scrolldy() const { return (m_attributes & TILEMAP_FLIPY) ? m_dy_flipped : m_dy; } int scrollx(int which = 0) const { return (which < m_scrollrows) ? m_rowscroll[which] : 0; } int scrolly(int which = 0) const { return (which < m_scrollcols) ? m_colscroll[which] : 0; } bitmap_ind16 &pixmap() { pixmap_update(); return m_pixmap; } bitmap_ind8 &flagsmap() { pixmap_update(); return m_flagsmap; } - uint8_t *tile_flags() { pixmap_update(); return &m_tileflags[0]; } - tilemap_memory_index memory_index(uint32_t col, uint32_t row) { return m_mapper(col, row, m_cols, m_rows); } - void get_info_debug(uint32_t col, uint32_t row, uint8_t &gfxnum, uint32_t &code, uint32_t &color); + u8 *tile_flags() { pixmap_update(); return &m_tileflags[0]; } + tilemap_memory_index memory_index(u32 col, u32 row) { return m_mapper(col, row, m_cols, m_rows); } + void get_info_debug(u32 col, u32 row, u8 &gfxnum, u32 &code, u32 &color); // setters void enable(bool enable = true) { m_enable = enable; } void set_user_data(void *user_data) { m_user_data = user_data; } void set_palette(palette_device &palette) { m_palette = &palette; } - void set_palette_offset(uint32_t offset) { m_palette_offset = offset; } + void set_palette_offset(u32 offset) { m_palette_offset = offset; } void set_scrolldx(int dx, int dx_flipped) { m_dx = dx; m_dx_flipped = dx_flipped; } void set_scrolldy(int dy, int dy_flipped) { m_dy = dy; m_dy_flipped = dy_flipped; } void set_scrollx(int which, int value) { if (which < m_scrollrows) m_rowscroll[which] = value; } void set_scrolly(int which, int value) { if (which < m_scrollcols) m_colscroll[which] = value; } void set_scrollx(int value) { set_scrollx(0, value); } void set_scrolly(int value) { set_scrolly(0, value); } - void set_scroll_rows(uint32_t scroll_rows) { assert(scroll_rows <= m_height); m_scrollrows = scroll_rows; } - void set_scroll_cols(uint32_t scroll_cols) { assert(scroll_cols <= m_width); m_scrollcols = scroll_cols; } - void set_flip(uint32_t attributes) { if (m_attributes != attributes) { m_attributes = attributes; mappings_update(); } } + void set_scroll_rows(u32 scroll_rows) { assert(scroll_rows <= m_height); m_scrollrows = scroll_rows; } + void set_scroll_cols(u32 scroll_cols) { assert(scroll_cols <= m_width); m_scrollcols = scroll_cols; } + void set_flip(u32 attributes) { if (m_attributes != attributes) { m_attributes = attributes; mappings_update(); } } // dirtying void mark_tile_dirty(tilemap_memory_index memindex); void mark_all_dirty() { m_all_tiles_dirty = true; m_all_tiles_clean = false; } // pen mapping - void map_pens_to_layer(int group, pen_t pen, pen_t mask, uint8_t layermask); - void map_pen_to_layer(int group, pen_t pen, uint8_t layermask) { map_pens_to_layer(group, pen, ~0, layermask); } + void map_pens_to_layer(int group, pen_t pen, pen_t mask, u8 layermask); + void map_pen_to_layer(int group, pen_t pen, u8 layermask) { map_pens_to_layer(group, pen, ~0, layermask); } void set_transparent_pen(pen_t pen); - void set_transmask(int group, uint32_t fgmask, uint32_t bgmask); + void set_transmask(int group, u32 fgmask, u32 bgmask); void configure_groups(gfx_element &gfx, indirect_pen_t transcolor); // drawing - void draw(screen_device &screen, bitmap_ind16 &dest, const rectangle &cliprect, uint32_t flags, uint8_t priority = 0, uint8_t priority_mask = 0xff); - void draw(screen_device &screen, bitmap_rgb32 &dest, const rectangle &cliprect, uint32_t flags, uint8_t priority = 0, uint8_t priority_mask = 0xff); - void draw_roz(screen_device &screen, bitmap_ind16 &dest, const rectangle &cliprect, uint32_t startx, uint32_t starty, int incxx, int incxy, int incyx, int incyy, bool wraparound, uint32_t flags, uint8_t priority = 0, uint8_t priority_mask = 0xff); - void draw_roz(screen_device &screen, bitmap_rgb32 &dest, const rectangle &cliprect, uint32_t startx, uint32_t starty, int incxx, int incxy, int incyx, int incyy, bool wraparound, uint32_t flags, uint8_t priority = 0, uint8_t priority_mask = 0xff); - void draw_debug(screen_device &screen, bitmap_rgb32 &dest, uint32_t scrollx, uint32_t scrolly); + void draw(screen_device &screen, bitmap_ind16 &dest, const rectangle &cliprect, u32 flags, u8 priority = 0, u8 priority_mask = 0xff); + void draw(screen_device &screen, bitmap_rgb32 &dest, const rectangle &cliprect, u32 flags, u8 priority = 0, u8 priority_mask = 0xff); + void draw_roz(screen_device &screen, bitmap_ind16 &dest, const rectangle &cliprect, u32 startx, u32 starty, int incxx, int incxy, int incyx, int incyy, bool wraparound, u32 flags, u8 priority = 0, u8 priority_mask = 0xff); + void draw_roz(screen_device &screen, bitmap_rgb32 &dest, const rectangle &cliprect, u32 startx, u32 starty, int incxx, int incxy, int incyx, int incyy, bool wraparound, u32 flags, u8 priority = 0, u8 priority_mask = 0xff); + void draw_debug(screen_device &screen, bitmap_rgb32 &dest, u32 scrollx, u32 scrolly); // mappers // scan in row-major order with optional flipping - tilemap_memory_index scan_rows(uint32_t col, uint32_t row, uint32_t num_cols, uint32_t num_rows); - tilemap_memory_index scan_rows_flip_x(uint32_t col, uint32_t row, uint32_t num_cols, uint32_t num_rows); - tilemap_memory_index scan_rows_flip_y(uint32_t col, uint32_t row, uint32_t num_cols, uint32_t num_rows); - tilemap_memory_index scan_rows_flip_xy(uint32_t col, uint32_t row, uint32_t num_cols, uint32_t num_rows); + tilemap_memory_index scan_rows(u32 col, u32 row, u32 num_cols, u32 num_rows); + tilemap_memory_index scan_rows_flip_x(u32 col, u32 row, u32 num_cols, u32 num_rows); + tilemap_memory_index scan_rows_flip_y(u32 col, u32 row, u32 num_cols, u32 num_rows); + tilemap_memory_index scan_rows_flip_xy(u32 col, u32 row, u32 num_cols, u32 num_rows); // scan in column-major order with optional flipping - tilemap_memory_index scan_cols(uint32_t col, uint32_t row, uint32_t num_cols, uint32_t num_rows); - tilemap_memory_index scan_cols_flip_x(uint32_t col, uint32_t row, uint32_t num_cols, uint32_t num_rows); - tilemap_memory_index scan_cols_flip_y(uint32_t col, uint32_t row, uint32_t num_cols, uint32_t num_rows); - tilemap_memory_index scan_cols_flip_xy(uint32_t col, uint32_t row, uint32_t num_cols, uint32_t num_rows); + tilemap_memory_index scan_cols(u32 col, u32 row, u32 num_cols, u32 num_rows); + tilemap_memory_index scan_cols_flip_x(u32 col, u32 row, u32 num_cols, u32 num_rows); + tilemap_memory_index scan_cols_flip_y(u32 col, u32 row, u32 num_cols, u32 num_rows); + tilemap_memory_index scan_cols_flip_xy(u32 col, u32 row, u32 num_cols, u32 num_rows); // optional memory accessors - uint32_t basemem_read(int index) { return m_basemem.read(index); } - uint32_t extmem_read(int index) { return m_extmem.read(index); } - void basemem_write(int index, uint32_t data) { m_basemem.write(index, data); mark_tile_dirty(index); } - void extmem_write(int index, uint32_t data) { m_extmem.write(index, data); mark_tile_dirty(index); } + u32 basemem_read(int index) { return m_basemem.read(index); } + u32 extmem_read(int index) { return m_extmem.read(index); } + void basemem_write(int index, u32 data) { m_basemem.write(index, data); mark_tile_dirty(index); } + void extmem_write(int index, u32 data) { m_extmem.write(index, data); mark_tile_dirty(index); } private: // internal set of transparency states for rendering @@ -593,26 +593,26 @@ private: { bitmap_ind8 * priority; rectangle cliprect; - uint32_t tilemap_priority_code; - uint8_t mask; - uint8_t value; - uint8_t alpha; + u32 tilemap_priority_code; + u8 mask; + u8 value; + u8 alpha; }; // inline helpers - int32_t effective_rowscroll(int index, uint32_t screen_width); - int32_t effective_colscroll(int index, uint32_t screen_height); + s32 effective_rowscroll(int index, u32 screen_width); + s32 effective_colscroll(int index, u32 screen_height); bool gfx_elements_changed(); // inline scanline rasterizers - void scanline_draw_opaque_null(int count, uint8_t *pri, uint32_t pcode); - void scanline_draw_masked_null(const uint8_t *maskptr, int mask, int value, int count, uint8_t *pri, uint32_t pcode); - void scanline_draw_opaque_ind16(uint16_t *dest, const uint16_t *source, int count, uint8_t *pri, uint32_t pcode); - void scanline_draw_masked_ind16(uint16_t *dest, const uint16_t *source, const uint8_t *maskptr, int mask, int value, int count, uint8_t *pri, uint32_t pcode); - void scanline_draw_opaque_rgb32(uint32_t *dest, const uint16_t *source, int count, const rgb_t *pens, uint8_t *pri, uint32_t pcode); - void scanline_draw_masked_rgb32(uint32_t *dest, const uint16_t *source, const uint8_t *maskptr, int mask, int value, int count, const rgb_t *pens, uint8_t *pri, uint32_t pcode); - void scanline_draw_opaque_rgb32_alpha(uint32_t *dest, const uint16_t *source, int count, const rgb_t *pens, uint8_t *pri, uint32_t pcode, uint8_t alpha); - void scanline_draw_masked_rgb32_alpha(uint32_t *dest, const uint16_t *source, const uint8_t *maskptr, int mask, int value, int count, const rgb_t *pens, uint8_t *pri, uint32_t pcode, uint8_t alpha); + void scanline_draw_opaque_null(int count, u8 *pri, u32 pcode); + void scanline_draw_masked_null(const u8 *maskptr, int mask, int value, int count, u8 *pri, u32 pcode); + void scanline_draw_opaque_ind16(u16 *dest, const u16 *source, int count, u8 *pri, u32 pcode); + void scanline_draw_masked_ind16(u16 *dest, const u16 *source, const u8 *maskptr, int mask, int value, int count, u8 *pri, u32 pcode); + void scanline_draw_opaque_rgb32(u32 *dest, const u16 *source, int count, const rgb_t *pens, u8 *pri, u32 pcode); + void scanline_draw_masked_rgb32(u32 *dest, const u16 *source, const u8 *maskptr, int mask, int value, int count, const rgb_t *pens, u8 *pri, u32 pcode); + void scanline_draw_opaque_rgb32_alpha(u32 *dest, const u16 *source, int count, const rgb_t *pens, u8 *pri, u32 pcode, u8 alpha); + void scanline_draw_masked_rgb32_alpha(u32 *dest, const u16 *source, const u8 *maskptr, int mask, int value, int count, const rgb_t *pens, u8 *pri, u32 pcode, u8 alpha); // internal helpers void postload(); @@ -622,14 +622,14 @@ private: // internal drawing void pixmap_update(); - void tile_update(logical_index logindex, uint32_t col, uint32_t row); - uint8_t tile_draw(const uint8_t *pendata, uint32_t x0, uint32_t y0, uint32_t palette_base, uint8_t category, uint8_t group, uint8_t flags, uint8_t pen_mask); - uint8_t tile_apply_bitmask(const uint8_t *maskdata, uint32_t x0, uint32_t y0, uint8_t category, uint8_t flags); - void configure_blit_parameters(blit_parameters &blit, bitmap_ind8 &priority_bitmap, const rectangle &cliprect, uint32_t flags, uint8_t priority, uint8_t priority_mask); - template void draw_common(screen_device &screen, _BitmapClass &dest, const rectangle &cliprect, uint32_t flags, uint8_t priority, uint8_t priority_mask); - template void draw_roz_common(screen_device &screen, _BitmapClass &dest, const rectangle &cliprect, uint32_t startx, uint32_t starty, int incxx, int incxy, int incyx, int incyy, bool wraparound, uint32_t flags, uint8_t priority, uint8_t priority_mask); + void tile_update(logical_index logindex, u32 col, u32 row); + u8 tile_draw(const u8 *pendata, u32 x0, u32 y0, u32 palette_base, u8 category, u8 group, u8 flags, u8 pen_mask); + u8 tile_apply_bitmask(const u8 *maskdata, u32 x0, u32 y0, u8 category, u8 flags); + void configure_blit_parameters(blit_parameters &blit, bitmap_ind8 &priority_bitmap, const rectangle &cliprect, u32 flags, u8 priority, u8 priority_mask); + template void draw_common(screen_device &screen, _BitmapClass &dest, const rectangle &cliprect, u32 flags, u8 priority, u8 priority_mask); + template void draw_roz_common(screen_device &screen, _BitmapClass &dest, const rectangle &cliprect, u32 startx, u32 starty, int incxx, int incxy, int incyx, int incyy, bool wraparound, u32 flags, u8 priority, u8 priority_mask); template void draw_instance(screen_device &screen, _BitmapClass &dest, const blit_parameters &blit, int xpos, int ypos); - template void draw_roz_core(screen_device &screen, _BitmapClass &destbitmap, const blit_parameters &blit, uint32_t startx, uint32_t starty, int incxx, int incxy, int incyx, int incyy, bool wraparound); + template void draw_roz_core(screen_device &screen, _BitmapClass &destbitmap, const blit_parameters &blit, u32 startx, u32 starty, int incxx, int incxy, int incyx, int incyy, bool wraparound); // managers and devices tilemap_manager * m_manager; // reference to the owning manager @@ -643,16 +643,16 @@ private: memory_array m_extmem; // info about extension memory // basic tilemap metrics - uint32_t m_rows; // number of tile rows - uint32_t m_cols; // number of tile columns - uint16_t m_tilewidth; // width of a single tile in pixels - uint16_t m_tileheight; // height of a single tile in pixels - uint32_t m_width; // width of the full tilemap in pixels - uint32_t m_height; // height of the full tilemap in pixels + u32 m_rows; // number of tile rows + u32 m_cols; // number of tile columns + u16 m_tilewidth; // width of a single tile in pixels + u16 m_tileheight; // height of a single tile in pixels + u32 m_width; // width of the full tilemap in pixels + u32 m_height; // height of the full tilemap in pixels // logical <-> memory mappings - tilemap_mapper_delegate m_mapper; // callback to map a row/column to a memory index - std::vector m_memory_to_logical; // map from memory index to logical index + tilemap_mapper_delegate m_mapper; // callback to map a row/column to a memory index + std::vector m_memory_to_logical; // map from memory index to logical index std::vector m_logical_to_memory; // map from logical index to memory index // callback to interpret video RAM for the tilemap @@ -661,30 +661,30 @@ private: // global tilemap states bool m_enable; // true if we are enabled - uint8_t m_attributes; // global attributes (flipx/y) + u8 m_attributes; // global attributes (flipx/y) bool m_all_tiles_dirty; // true if all tiles are dirty bool m_all_tiles_clean; // true if all tiles are clean - uint32_t m_palette_offset; // palette offset - uint32_t m_gfx_used; // bitmask of gfx items used - uint32_t m_gfx_dirtyseq[MAX_GFX_ELEMENTS]; // dirtyseq values from last check + u32 m_palette_offset; // palette offset + u32 m_gfx_used; // bitmask of gfx items used + u32 m_gfx_dirtyseq[MAX_GFX_ELEMENTS]; // dirtyseq values from last check // scroll information - uint32_t m_scrollrows; // number of independently scrolled rows - uint32_t m_scrollcols; // number of independently scrolled columns - std::vector m_rowscroll; // array of rowscroll values - std::vector m_colscroll; // array of colscroll values - int32_t m_dx; // global horizontal scroll offset - int32_t m_dx_flipped; // global horizontal scroll offset when flipped - int32_t m_dy; // global vertical scroll offset - int32_t m_dy_flipped; // global vertical scroll offset when flipped + u32 m_scrollrows; // number of independently scrolled rows + u32 m_scrollcols; // number of independently scrolled columns + std::vector m_rowscroll; // array of rowscroll values + std::vector m_colscroll; // array of colscroll values + s32 m_dx; // global horizontal scroll offset + s32 m_dx_flipped; // global horizontal scroll offset when flipped + s32 m_dy; // global vertical scroll offset + s32 m_dy_flipped; // global vertical scroll offset when flipped // pixel data bitmap_ind16 m_pixmap; // cached pixel data // transparency mapping bitmap_ind8 m_flagsmap; // per-pixel flags - std::vector m_tileflags; // per-tile flags - uint8_t m_pen_to_flags[MAX_PEN_TO_FLAGS * TILEMAP_NUM_GROUPS]; // mapping of pens to flags + std::vector m_tileflags; // per-tile flags + u8 m_pen_to_flags[MAX_PEN_TO_FLAGS * TILEMAP_NUM_GROUPS]; // mapping of pens to flags }; @@ -704,8 +704,8 @@ public: running_machine &machine() const { return m_machine; } // tilemap creation - tilemap_t &create(device_gfx_interface &decoder, tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, uint16_t tilewidth, uint16_t tileheight, uint32_t cols, uint32_t rows, tilemap_t *allocated = nullptr); - tilemap_t &create(device_gfx_interface &decoder, tilemap_get_info_delegate tile_get_info, tilemap_standard_mapper mapper, uint16_t tilewidth, uint16_t tileheight, uint32_t cols, uint32_t rows, tilemap_t *allocated = nullptr); + tilemap_t &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 = nullptr); + tilemap_t &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 = nullptr); // tilemap list information tilemap_t *find(int index) { return m_tilemap_list.find(index); } @@ -713,7 +713,7 @@ public: // global operations on all tilemaps void mark_all_dirty(); - void set_flip_all(uint32_t attributes); + void set_flip_all(u32 attributes); private: // allocate an instance index @@ -736,15 +736,15 @@ class tilemap_device : public device_t, { public: // construction/destruction - tilemap_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + tilemap_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); // static configuration static void static_set_gfxdecode_tag(device_t &device, const char *tag); static void static_set_bytes_per_entry(device_t &device, int bpe); static void static_set_info_callback(device_t &device, tilemap_get_info_delegate tile_get_info); - static void static_set_layout(device_t &device, tilemap_standard_mapper mapper, uint32_t columns, uint32_t rows); - static void static_set_layout(device_t &device, tilemap_mapper_delegate mapper, uint32_t columns, uint32_t rows); - static void static_set_tile_size(device_t &device, uint16_t width, uint16_t height); + static void static_set_layout(device_t &device, tilemap_standard_mapper mapper, u32 columns, u32 rows); + static void static_set_layout(device_t &device, tilemap_mapper_delegate mapper, u32 columns, u32 rows); + static void static_set_tile_size(device_t &device, u16 width, u16 height); static void static_set_transparent_pen(device_t &device, pen_t pen); // write handlers @@ -767,16 +767,16 @@ private: required_device m_gfxdecode; // configuration state - tilemap_get_info_delegate m_get_info; - tilemap_standard_mapper m_standard_mapper; - tilemap_mapper_delegate m_mapper; - int m_bytes_per_entry; - uint16_t m_tile_width; - uint16_t m_tile_height; - uint32_t m_num_columns; - uint32_t m_num_rows; - bool m_transparent_pen_set; - pen_t m_transparent_pen; + tilemap_get_info_delegate m_get_info; + tilemap_standard_mapper m_standard_mapper; + tilemap_mapper_delegate m_mapper; + int m_bytes_per_entry; + u16 m_tile_width; + u16 m_tile_height; + u32 m_num_columns; + u32 m_num_rows; + bool m_transparent_pen_set; + pen_t m_transparent_pen; }; @@ -793,7 +793,7 @@ private: #define TILE_GET_INFO_MEMBER(_name) void _name(tilemap_t &tilemap, tile_data &tileinfo, tilemap_memory_index tile_index) // function definition for a logical-to-memory mapper -#define TILEMAP_MAPPER_MEMBER(_name) tilemap_memory_index _name(uint32_t col, uint32_t row, uint32_t num_cols, uint32_t num_rows) +#define TILEMAP_MAPPER_MEMBER(_name) tilemap_memory_index _name(u32 col, u32 row, u32 num_cols, u32 num_rows) // useful macro inside of a TILE_GET_INFO callback to set tile information #define SET_TILE_INFO_MEMBER(GFX,CODE,COLOR,FLAGS) tileinfo.set(GFX, CODE, COLOR, FLAGS) @@ -816,4 +816,4 @@ inline running_machine &tilemap_t::machine() const } -#endif // __TILEMAP_H__ +#endif // MAME_EMU_TILEMAP_H diff --git a/src/emu/timer.cpp b/src/emu/timer.cpp index 29583c25e0a..2e9eb0edfaa 100644 --- a/src/emu/timer.cpp +++ b/src/emu/timer.cpp @@ -32,7 +32,7 @@ const device_type TIMER = &device_creator; // timer_device - constructor //------------------------------------------------- -timer_device::timer_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +timer_device::timer_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, TIMER, "Timer", tag, owner, clock, "timer", __FILE__), m_type(TIMER_TYPE_GENERIC), m_callback(timer_device_expired_delegate()), diff --git a/src/emu/timer.h b/src/emu/timer.h index c117c48084c..184131ca89c 100644 --- a/src/emu/timer.h +++ b/src/emu/timer.h @@ -14,8 +14,8 @@ #error Dont include this file directly; include emu.h instead. #endif -#ifndef __TIMER_H__ -#define __TIMER_H__ +#ifndef MAME_EMU_TIMER_H +#define MAME_EMU_TIMER_H @@ -24,7 +24,7 @@ //************************************************************************** // macros for a timer callback functions -#define TIMER_DEVICE_CALLBACK_MEMBER(name) void name(timer_device &timer, void *ptr, int32_t param) +#define TIMER_DEVICE_CALLBACK_MEMBER(name) void name(timer_device &timer, void *ptr, s32 param) //************************************************************************** // TIMER DEVICE CONFIGURATION MACROS @@ -73,7 +73,7 @@ class emu_timer; class timer_device; // a timer callbacks look like this -typedef device_delegate timer_device_expired_delegate; +typedef device_delegate timer_device_expired_delegate; // ======================> timer_device @@ -81,7 +81,7 @@ class timer_device : public device_t { public: // construction/destruction - timer_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + timer_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); // inline configuration helpers static void static_configure_generic(device_t &device, timer_device_expired_delegate callback); @@ -104,7 +104,7 @@ public: // adjustments void reset() { adjust(attotime::never, 0, attotime::never); } - void adjust(const attotime &duration, int32_t param = 0, const attotime &period = attotime::never) const { assert(m_type == TIMER_TYPE_GENERIC); m_timer->adjust(duration, param, period); } + void adjust(const attotime &duration, s32 param = 0, const attotime &period = attotime::never) const { assert(m_type == TIMER_TYPE_GENERIC); m_timer->adjust(duration, param, period); } // timing information attotime time_elapsed() const { return m_timer->elapsed(); } @@ -135,13 +135,13 @@ private: // periodic timers only attotime m_start_delay; // delay before the timer fires for the first time attotime m_period; // period of repeated timer firings - int32_t m_param; // the integer parameter passed to the timer callback + s32 m_param; // the integer parameter passed to the timer callback // scanline timers only const char * m_screen_tag; // the tag of the screen this timer tracks screen_device * m_screen; // pointer to the screen device - uint32_t m_first_vpos; // the first vertical scanline position the timer fires on - uint32_t m_increment; // the number of scanlines between firings + u32 m_first_vpos; // the first vertical scanline position the timer fires on + u32 m_increment; // the number of scanlines between firings // internal state emu_timer * m_timer; // the backing timer @@ -157,4 +157,4 @@ private: extern const device_type TIMER; -#endif /* __TIMER_H__ */ +#endif /* MAME_EMU_TIMER_H */ diff --git a/src/emu/ui/cmdrender.h b/src/emu/ui/cmdrender.h index de9ca58747e..905b681f746 100644 --- a/src/emu/ui/cmdrender.h +++ b/src/emu/ui/cmdrender.h @@ -90,22 +90,22 @@ void render_font::render_font_command_glyph() load_cached_cmd(ramfile, 0); } -bool render_font::load_cached_cmd(emu_file &file, uint32_t hash) +bool render_font::load_cached_cmd(emu_file &file, u32 hash) { - uint64_t filesize = file.size(); - uint8_t header[CACHED_HEADER_SIZE]; - uint32_t bytes_read = file.read(header, CACHED_HEADER_SIZE); + u64 filesize = file.size(); + u8 header[CACHED_HEADER_SIZE]; + u32 bytes_read = file.read(header, CACHED_HEADER_SIZE); if (bytes_read != CACHED_HEADER_SIZE) return false; if (header[0] != 'f' || header[1] != 'o' || header[2] != 'n' || header[3] != 't') return false; - if (header[4] != (uint8_t)(hash >> 24) || header[5] != (uint8_t)(hash >> 16) || header[6] != (uint8_t)(hash >> 8) || header[7] != (uint8_t)hash) + if (header[4] != u8(hash >> 24) || header[5] != u8(hash >> 16) || header[6] != u8(hash >> 8) || header[7] != u8(hash)) return false; m_height_cmd = (header[8] << 8) | header[9]; - m_yoffs_cmd = (int16_t)((header[10] << 8) | header[11]); - uint32_t numchars = (header[12] << 24) | (header[13] << 16) | (header[14] << 8) | header[15]; + m_yoffs_cmd = s16((header[10] << 8) | header[11]); + u32 numchars = (header[12] << 24) | (header[13] << 16) | (header[14] << 8) | header[15]; if (filesize - CACHED_HEADER_SIZE < numchars * CACHED_CHAR_SIZE) return false; @@ -117,10 +117,10 @@ bool render_font::load_cached_cmd(emu_file &file, uint32_t hash) return false; } - uint64_t offset = numchars * CACHED_CHAR_SIZE; + u64 offset = numchars * CACHED_CHAR_SIZE; for (int chindex = 0; chindex < numchars; chindex++) { - const uint8_t *info = reinterpret_cast(&m_rawdata_cmd[chindex * CACHED_CHAR_SIZE]); + const u8 *info = reinterpret_cast(&m_rawdata_cmd[chindex * CACHED_CHAR_SIZE]); int chnum = (info[0] << 8) | info[1]; if (!m_glyphs_cmd[chnum / 256]) @@ -132,8 +132,8 @@ bool render_font::load_cached_cmd(emu_file &file, uint32_t hash) gl.color = color_table[chnum - COMMAND_UNICODE]; gl.width = (info[2] << 8) | info[3]; - gl.xoffs = (int16_t)((info[4] << 8) | info[5]); - gl.yoffs = (int16_t)((info[6] << 8) | info[7]); + gl.xoffs = s16((info[4] << 8) | info[5]); + gl.yoffs = s16((info[6] << 8) | info[7]); gl.bmwidth = (info[8] << 8) | info[9]; gl.bmheight = (info[10] << 8) | info[11]; gl.rawdata = &m_rawdata_cmd[offset]; diff --git a/src/emu/uiinput.cpp b/src/emu/uiinput.cpp index de4435298b6..952a5b371b3 100644 --- a/src/emu/uiinput.cpp +++ b/src/emu/uiinput.cpp @@ -183,7 +183,7 @@ void ui_input_manager::reset() location of the mouse -------------------------------------------------*/ -render_target *ui_input_manager::find_mouse(int32_t *x, int32_t *y, bool *button) const +render_target *ui_input_manager::find_mouse(s32 *x, s32 *y, bool *button) const { if (x != nullptr) *x = m_current_mouse_x; @@ -284,7 +284,7 @@ g_profiler.stop(); move event to the specified render_target -------------------------------------------------*/ -void ui_input_manager::push_mouse_move_event(render_target* target, int32_t x, int32_t y) +void ui_input_manager::push_mouse_move_event(render_target* target, s32 x, s32 y) { ui_event event = { UI_EVENT_NONE }; event.event_type = UI_EVENT_MOUSE_MOVE; @@ -312,7 +312,7 @@ void ui_input_manager::push_mouse_leave_event(render_target* target) down event to the specified render_target -------------------------------------------------*/ -void ui_input_manager::push_mouse_down_event(render_target* target, int32_t x, int32_t y) +void ui_input_manager::push_mouse_down_event(render_target* target, s32 x, s32 y) { ui_event event = { UI_EVENT_NONE }; event.event_type = UI_EVENT_MOUSE_DOWN; @@ -327,7 +327,7 @@ void ui_input_manager::push_mouse_down_event(render_target* target, int32_t x, i down event to the specified render_target -------------------------------------------------*/ -void ui_input_manager::push_mouse_up_event(render_target* target, int32_t x, int32_t y) +void ui_input_manager::push_mouse_up_event(render_target* target, s32 x, s32 y) { ui_event event = { UI_EVENT_NONE }; event.event_type = UI_EVENT_MOUSE_UP; @@ -342,7 +342,7 @@ push_mouse_down_event - pushes a mouse down event to the specified render_target -------------------------------------------------*/ -void ui_input_manager::push_mouse_rdown_event(render_target* target, int32_t x, int32_t y) +void ui_input_manager::push_mouse_rdown_event(render_target* target, s32 x, s32 y) { ui_event event = { UI_EVENT_NONE }; event.event_type = UI_EVENT_MOUSE_RDOWN; @@ -357,7 +357,7 @@ push_mouse_down_event - pushes a mouse down event to the specified render_target -------------------------------------------------*/ -void ui_input_manager::push_mouse_rup_event(render_target* target, int32_t x, int32_t y) +void ui_input_manager::push_mouse_rup_event(render_target* target, s32 x, s32 y) { ui_event event = { UI_EVENT_NONE }; event.event_type = UI_EVENT_MOUSE_RUP; @@ -372,7 +372,7 @@ void ui_input_manager::push_mouse_rup_event(render_target* target, int32_t x, in a mouse double-click event to the specified render_target -------------------------------------------------*/ -void ui_input_manager::push_mouse_double_click_event(render_target* target, int32_t x, int32_t y) +void ui_input_manager::push_mouse_double_click_event(render_target* target, s32 x, s32 y) { ui_event event = { UI_EVENT_NONE }; event.event_type = UI_EVENT_MOUSE_DOUBLE_CLICK; @@ -400,7 +400,7 @@ void ui_input_manager::push_char_event(render_target* target, char32_t ch) wheel event to the specified render_target -------------------------------------------------*/ -void ui_input_manager::push_mouse_wheel_event(render_target *target, int32_t x, int32_t y, short delta, int ucNumLines) +void ui_input_manager::push_mouse_wheel_event(render_target *target, s32 x, s32 y, short delta, int ucNumLines) { ui_event event = { UI_EVENT_NONE }; event.event_type = UI_EVENT_MOUSE_WHEEL; diff --git a/src/emu/uiinput.h b/src/emu/uiinput.h index 861ca07c632..66cdd1f80b5 100644 --- a/src/emu/uiinput.h +++ b/src/emu/uiinput.h @@ -7,10 +7,10 @@ Internal MAME user interface input state. ***************************************************************************/ -#pragma once +#ifndef MAME_EMU_UIINPUT_H +#define MAME_EMU_UIINPUT_H -#ifndef __UIINPUT_H__ -#define __UIINPUT_H__ +#pragma once /*************************************************************************** @@ -43,10 +43,10 @@ struct ui_event { ui_event_type event_type; render_target * target; - int32_t mouse_x; - int32_t mouse_y; + s32 mouse_x; + s32 mouse_y; input_item_id key; - char32_t ch; + char32_t ch; short zdelta; int num_lines; }; @@ -71,7 +71,7 @@ public: void reset(); /* retrieves the current location of the mouse */ - render_target *find_mouse(int32_t *x, int32_t *y, bool *button) const; + render_target *find_mouse(s32 *x, s32 *y, bool *button) const; ioport_field *find_mouse_field() const; /* return true if a key down for the given user interface sequence is detected */ @@ -85,15 +85,15 @@ public: running_machine &machine() const { return m_machine; } - void push_mouse_move_event(render_target* target, int32_t x, int32_t y); + void push_mouse_move_event(render_target* target, s32 x, s32 y); void push_mouse_leave_event(render_target* target); - void push_mouse_down_event(render_target* target, int32_t x, int32_t y); - void push_mouse_up_event(render_target* target, int32_t x, int32_t y); - void push_mouse_rdown_event(render_target* target, int32_t x, int32_t y); - void push_mouse_rup_event(render_target* target, int32_t x, int32_t y); - void push_mouse_double_click_event(render_target* target, int32_t x, int32_t y); + void push_mouse_down_event(render_target* target, s32 x, s32 y); + void push_mouse_up_event(render_target* target, s32 x, s32 y); + void push_mouse_rdown_event(render_target* target, s32 x, s32 y); + void push_mouse_rup_event(render_target* target, s32 x, s32 y); + void push_mouse_double_click_event(render_target* target, s32 x, s32 y); void push_char_event(render_target* target, char32_t ch); - void push_mouse_wheel_event(render_target *target, int32_t x, int32_t y, short delta, int ucNumLines); + void push_mouse_wheel_event(render_target *target, s32 x, s32 y, short delta, int ucNumLines); void mark_all_as_pressed(); @@ -104,12 +104,12 @@ private: /* pressed states; retrieved with ui_input_pressed() */ osd_ticks_t m_next_repeat[IPT_COUNT]; - uint8_t m_seqpressed[IPT_COUNT]; + u8 m_seqpressed[IPT_COUNT]; /* mouse position/info */ render_target * m_current_mouse_target; - int32_t m_current_mouse_x; - int32_t m_current_mouse_y; + s32 m_current_mouse_x; + s32 m_current_mouse_y; bool m_current_mouse_down; ioport_field * m_current_mouse_field; @@ -119,4 +119,4 @@ private: int m_events_end; }; -#endif /* __UIINPUT_H__ */ +#endif /* MAME_EMU_UIINPUT_H */ diff --git a/src/emu/validity.cpp b/src/emu/validity.cpp index 740a9c6c6dd..c8201da63a1 100644 --- a/src/emu/validity.cpp +++ b/src/emu/validity.cpp @@ -30,7 +30,7 @@ // string from the I/O port system //------------------------------------------------- -inline const char *validity_checker::ioport_string_from_index(uint32_t index) +inline const char *validity_checker::ioport_string_from_index(u32 index) { return ioport_configurer::string_from_token((const char *)(uintptr_t)index); } @@ -59,10 +59,10 @@ inline int validity_checker::get_defstr_index(const char *string, bool suppress_ // random_s32 //------------------------------------------------- #undef rand -inline int32_t validity_checker::random_i32() { return int32_t(random_u32()); } -inline uint32_t validity_checker::random_u32() { return rand() ^ (rand() << 15); } -inline int64_t validity_checker::random_i64() { return int64_t(random_u64()); } -inline uint64_t validity_checker::random_u64() { return uint64_t(random_u32()) ^ (uint64_t(random_u32()) << 30); } +inline s32 validity_checker::random_i32() { return s32(random_u32()); } +inline u32 validity_checker::random_u32() { return rand() ^ (rand() << 15); } +inline s64 validity_checker::random_i64() { return s64(random_u64()); } +inline u64 validity_checker::random_u64() { return u64(random_u32()) ^ (u64(random_u32()) << 30); } @@ -82,7 +82,7 @@ void validity_checker::validate_tag(const char *tag) for (const char *p = tag; *p != 0; p++) { // only lower-case permitted - if (*p != tolower((uint8_t)*p)) + if (*p != tolower(u8(*p))) { osd_printf_error("Tag '%s' contains upper-case characters\n", tag); break; @@ -336,29 +336,29 @@ void validity_checker::validate_core() // basic system checks if (~0 != -1) osd_printf_error("Machine must be two's complement\n"); - uint8_t a = 0xff; - uint8_t b = a + 1; - if (b > a) osd_printf_error("uint8_t must be 8 bits\n"); + u8 a = 0xff; + u8 b = a + 1; + if (b > a) osd_printf_error("u8 must be 8 bits\n"); // check size of core integer types - if (sizeof(int8_t) != 1) osd_printf_error("int8_t must be 8 bits\n"); - if (sizeof(uint8_t) != 1) osd_printf_error("uint8_t must be 8 bits\n"); - if (sizeof(int16_t) != 2) osd_printf_error("int16_t must be 16 bits\n"); - if (sizeof(uint16_t) != 2) osd_printf_error("uint16_t must be 16 bits\n"); - if (sizeof(int32_t) != 4) osd_printf_error("int32_t must be 32 bits\n"); - if (sizeof(uint32_t) != 4) osd_printf_error("uint32_t must be 32 bits\n"); - if (sizeof(int64_t) != 8) osd_printf_error("int64_t must be 64 bits\n"); - if (sizeof(uint64_t) != 8) osd_printf_error("uint64_t must be 64 bits\n"); + if (sizeof(s8) != 1) osd_printf_error("s8 must be 8 bits\n"); + if (sizeof(u8) != 1) osd_printf_error("u8 must be 8 bits\n"); + if (sizeof(s16) != 2) osd_printf_error("s16 must be 16 bits\n"); + if (sizeof(u16) != 2) osd_printf_error("u16 must be 16 bits\n"); + if (sizeof(s32) != 4) osd_printf_error("s32 must be 32 bits\n"); + if (sizeof(u32) != 4) osd_printf_error("u32 must be 32 bits\n"); + if (sizeof(s64) != 8) osd_printf_error("s64 must be 64 bits\n"); + if (sizeof(u64) != 8) osd_printf_error("u64 must be 64 bits\n"); // check signed right shift - int8_t a8 = -3; - int16_t a16 = -3; - int32_t a32 = -3; - int64_t a64 = -3; - if (a8 >> 1 != -2) osd_printf_error("int8_t right shift must be arithmetic\n"); - if (a16 >> 1 != -2) osd_printf_error("int16_t right shift must be arithmetic\n"); - if (a32 >> 1 != -2) osd_printf_error("int32_t right shift must be arithmetic\n"); - if (a64 >> 1 != -2) osd_printf_error("int64_t right shift must be arithmetic\n"); + s8 a8 = -3; + s16 a16 = -3; + s32 a32 = -3; + s64 a64 = -3; + if (a8 >> 1 != -2) osd_printf_error("s8 right shift must be arithmetic\n"); + if (a16 >> 1 != -2) osd_printf_error("s16 right shift must be arithmetic\n"); + if (a32 >> 1 != -2) osd_printf_error("s32 right shift must be arithmetic\n"); + if (a64 >> 1 != -2) osd_printf_error("s64 right shift must be arithmetic\n"); // check pointer size #ifdef PTR64 @@ -369,8 +369,8 @@ void validity_checker::validate_core() // TODO: check if this is actually working // check endianness definition - uint16_t lsbtest = 0; - *(uint8_t *)&lsbtest = 0xff; + u16 lsbtest = 0; + *(u8 *)&lsbtest = 0xff; #ifdef LSB_FIRST if (lsbtest == 0xff00) osd_printf_error("LSB_FIRST specified, but running on a big-endian machine\n"); #else @@ -386,18 +386,18 @@ void validity_checker::validate_core() void validity_checker::validate_inlines() { - volatile uint64_t testu64a = random_u64(); - volatile int64_t testi64a = random_i64(); - volatile uint32_t testu32a = random_u32(); - volatile uint32_t testu32b = random_u32(); - volatile int32_t testi32a = random_i32(); - volatile int32_t testi32b = random_i32(); - int32_t resulti32, expectedi32; - uint32_t resultu32, expectedu32; - int64_t resulti64, expectedi64; - uint64_t resultu64, expectedu64; - int32_t remainder, expremainder; - uint32_t uremainder, expuremainder, bigu32 = 0xffffffff; + volatile u64 testu64a = random_u64(); + volatile s64 testi64a = random_i64(); + volatile u32 testu32a = random_u32(); + volatile u32 testu32b = random_u32(); + volatile s32 testi32a = random_i32(); + volatile s32 testi32b = random_i32(); + s32 resulti32, expectedi32; + u32 resultu32, expectedu32; + s64 resulti64, expectedi64; + u64 resultu64, expectedu64; + s32 remainder, expremainder; + u32 uremainder, expuremainder, bigu32 = 0xffffffff; // use only non-zero, positive numbers if (testu64a == 0) testu64a++; @@ -411,86 +411,86 @@ void validity_checker::validate_inlines() else if (testi32b < 0) testi32b = -testi32b; resulti64 = mul_32x32(testi32a, testi32b); - expectedi64 = (int64_t)testi32a * (int64_t)testi32b; + expectedi64 = s64(testi32a) * s64(testi32b); if (resulti64 != expectedi64) - osd_printf_error("Error testing mul_32x32 (%08X x %08X) = %08X%08X (expected %08X%08X)\n", testi32a, testi32b, (uint32_t)(resulti64 >> 32), (uint32_t)resulti64, (uint32_t)(expectedi64 >> 32), (uint32_t)expectedi64); + osd_printf_error("Error testing mul_32x32 (%08X x %08X) = %08X%08X (expected %08X%08X)\n", testi32a, testi32b, u32(resulti64 >> 32), u32(resulti64), u32(expectedi64 >> 32), u32(expectedi64)); resultu64 = mulu_32x32(testu32a, testu32b); - expectedu64 = (uint64_t)testu32a * (uint64_t)testu32b; + expectedu64 = u64(testu32a) * u64(testu32b); if (resultu64 != expectedu64) - osd_printf_error("Error testing mulu_32x32 (%08X x %08X) = %08X%08X (expected %08X%08X)\n", testu32a, testu32b, (uint32_t)(resultu64 >> 32), (uint32_t)resultu64, (uint32_t)(expectedu64 >> 32), (uint32_t)expectedu64); + osd_printf_error("Error testing mulu_32x32 (%08X x %08X) = %08X%08X (expected %08X%08X)\n", testu32a, testu32b, u32(resultu64 >> 32), u32(resultu64), u32(expectedu64 >> 32), u32(expectedu64)); resulti32 = mul_32x32_hi(testi32a, testi32b); - expectedi32 = ((int64_t)testi32a * (int64_t)testi32b) >> 32; + expectedi32 = (s64(testi32a) * s64(testi32b)) >> 32; if (resulti32 != expectedi32) osd_printf_error("Error testing mul_32x32_hi (%08X x %08X) = %08X (expected %08X)\n", testi32a, testi32b, resulti32, expectedi32); resultu32 = mulu_32x32_hi(testu32a, testu32b); - expectedu32 = ((int64_t)testu32a * (int64_t)testu32b) >> 32; + expectedu32 = (s64(testu32a) * s64(testu32b)) >> 32; if (resultu32 != expectedu32) osd_printf_error("Error testing mulu_32x32_hi (%08X x %08X) = %08X (expected %08X)\n", testu32a, testu32b, resultu32, expectedu32); resulti32 = mul_32x32_shift(testi32a, testi32b, 7); - expectedi32 = ((int64_t)testi32a * (int64_t)testi32b) >> 7; + expectedi32 = (s64(testi32a) * s64(testi32b)) >> 7; if (resulti32 != expectedi32) osd_printf_error("Error testing mul_32x32_shift (%08X x %08X) >> 7 = %08X (expected %08X)\n", testi32a, testi32b, resulti32, expectedi32); resultu32 = mulu_32x32_shift(testu32a, testu32b, 7); - expectedu32 = ((int64_t)testu32a * (int64_t)testu32b) >> 7; + expectedu32 = (s64(testu32a) * s64(testu32b)) >> 7; if (resultu32 != expectedu32) osd_printf_error("Error testing mulu_32x32_shift (%08X x %08X) >> 7 = %08X (expected %08X)\n", testu32a, testu32b, resultu32, expectedu32); - while ((int64_t)testi32a * (int64_t)0x7fffffff < testi64a) + while (s64(testi32a) * s64(0x7fffffff) < testi64a) testi64a /= 2; - while ((uint64_t)testu32a * (uint64_t)bigu32 < testu64a) + while (u64(testu32a) * u64(bigu32) < testu64a) testu64a /= 2; resulti32 = div_64x32(testi64a, testi32a); - expectedi32 = testi64a / (int64_t)testi32a; + expectedi32 = testi64a / s64(testi32a); if (resulti32 != expectedi32) - osd_printf_error("Error testing div_64x32 (%08X%08X / %08X) = %08X (expected %08X)\n", (uint32_t)(testi64a >> 32), (uint32_t)testi64a, testi32a, resulti32, expectedi32); + osd_printf_error("Error testing div_64x32 (%08X%08X / %08X) = %08X (expected %08X)\n", u32(testi64a >> 32), u32(testi64a), testi32a, resulti32, expectedi32); resultu32 = divu_64x32(testu64a, testu32a); - expectedu32 = testu64a / (uint64_t)testu32a; + expectedu32 = testu64a / u64(testu32a); if (resultu32 != expectedu32) - osd_printf_error("Error testing divu_64x32 (%08X%08X / %08X) = %08X (expected %08X)\n", (uint32_t)(testu64a >> 32), (uint32_t)testu64a, testu32a, resultu32, expectedu32); + osd_printf_error("Error testing divu_64x32 (%08X%08X / %08X) = %08X (expected %08X)\n", u32(testu64a >> 32), u32(testu64a), testu32a, resultu32, expectedu32); resulti32 = div_64x32_rem(testi64a, testi32a, &remainder); - expectedi32 = testi64a / (int64_t)testi32a; - expremainder = testi64a % (int64_t)testi32a; + expectedi32 = testi64a / s64(testi32a); + expremainder = testi64a % s64(testi32a); if (resulti32 != expectedi32 || remainder != expremainder) - osd_printf_error("Error testing div_64x32_rem (%08X%08X / %08X) = %08X,%08X (expected %08X,%08X)\n", (uint32_t)(testi64a >> 32), (uint32_t)testi64a, testi32a, resulti32, remainder, expectedi32, expremainder); + osd_printf_error("Error testing div_64x32_rem (%08X%08X / %08X) = %08X,%08X (expected %08X,%08X)\n", u32(testi64a >> 32), u32(testi64a), testi32a, resulti32, remainder, expectedi32, expremainder); resultu32 = divu_64x32_rem(testu64a, testu32a, &uremainder); - expectedu32 = testu64a / (uint64_t)testu32a; - expuremainder = testu64a % (uint64_t)testu32a; + expectedu32 = testu64a / u64(testu32a); + expuremainder = testu64a % u64(testu32a); if (resultu32 != expectedu32 || uremainder != expuremainder) - osd_printf_error("Error testing divu_64x32_rem (%08X%08X / %08X) = %08X,%08X (expected %08X,%08X)\n", (uint32_t)(testu64a >> 32), (uint32_t)testu64a, testu32a, resultu32, uremainder, expectedu32, expuremainder); + osd_printf_error("Error testing divu_64x32_rem (%08X%08X / %08X) = %08X,%08X (expected %08X,%08X)\n", u32(testu64a >> 32), u32(testu64a), testu32a, resultu32, uremainder, expectedu32, expuremainder); resulti32 = mod_64x32(testi64a, testi32a); - expectedi32 = testi64a % (int64_t)testi32a; + expectedi32 = testi64a % s64(testi32a); if (resulti32 != expectedi32) - osd_printf_error("Error testing mod_64x32 (%08X%08X / %08X) = %08X (expected %08X)\n", (uint32_t)(testi64a >> 32), (uint32_t)testi64a, testi32a, resulti32, expectedi32); + osd_printf_error("Error testing mod_64x32 (%08X%08X / %08X) = %08X (expected %08X)\n", u32(testi64a >> 32), u32(testi64a), testi32a, resulti32, expectedi32); resultu32 = modu_64x32(testu64a, testu32a); - expectedu32 = testu64a % (uint64_t)testu32a; + expectedu32 = testu64a % u64(testu32a); if (resultu32 != expectedu32) - osd_printf_error("Error testing modu_64x32 (%08X%08X / %08X) = %08X (expected %08X)\n", (uint32_t)(testu64a >> 32), (uint32_t)testu64a, testu32a, resultu32, expectedu32); + osd_printf_error("Error testing modu_64x32 (%08X%08X / %08X) = %08X (expected %08X)\n", u32(testu64a >> 32), u32(testu64a), testu32a, resultu32, expectedu32); - while ((int64_t)testi32a * (int64_t)0x7fffffff < ((int32_t)testi64a << 3)) + while (s64(testi32a) * s64(0x7fffffff) < (s32(testi64a) << 3)) testi64a /= 2; - while ((uint64_t)testu32a * (uint64_t)0xffffffff < ((uint32_t)testu64a << 3)) + while (u64(testu32a) * u64(0xffffffff) < (u32(testu64a) << 3)) testu64a /= 2; - resulti32 = div_32x32_shift((int32_t)testi64a, testi32a, 3); - expectedi32 = ((int64_t)(int32_t)testi64a << 3) / (int64_t)testi32a; + resulti32 = div_32x32_shift(s32(testi64a), testi32a, 3); + expectedi32 = (s64(s32(testi64a)) << 3) / s64(testi32a); if (resulti32 != expectedi32) - osd_printf_error("Error testing div_32x32_shift (%08X << 3) / %08X = %08X (expected %08X)\n", (int32_t)testi64a, testi32a, resulti32, expectedi32); + osd_printf_error("Error testing div_32x32_shift (%08X << 3) / %08X = %08X (expected %08X)\n", s32(testi64a), testi32a, resulti32, expectedi32); - resultu32 = divu_32x32_shift((uint32_t)testu64a, testu32a, 3); - expectedu32 = ((uint64_t)(uint32_t)testu64a << 3) / (uint64_t)testu32a; + resultu32 = divu_32x32_shift(u32(testu64a), testu32a, 3); + expectedu32 = (u64(u32(testu64a)) << 3) / u64(testu32a); if (resultu32 != expectedu32) - osd_printf_error("Error testing divu_32x32_shift (%08X << 3) / %08X = %08X (expected %08X)\n", (uint32_t)testu64a, testu32a, resultu32, expectedu32); + osd_printf_error("Error testing divu_32x32_shift (%08X << 3) / %08X = %08X (expected %08X)\n", u32(testu64a), testu32a, resultu32, expectedu32); if (fabsf(recip_approx(100.0f) - 0.01f) > 0.0001f) osd_printf_error("Error testing recip_approx\n"); @@ -527,38 +527,38 @@ void validity_checker::validate_rgb() The following functions are not tested yet: rgbaint_t() - clamp_and_clear(const uint32_t) - sign_extend(const uint32_t, const uint32_t) - min(const int32_t) - max(const int32_t) - blend(const rgbaint_t&, uint8_t) + clamp_and_clear(const u32) + sign_extend(const u32, const u32) + min(const s32) + max(const s32) + blend(const rgbaint_t&, u8) scale_and_clamp(const rgbaint_t&) - scale_imm_and_clamp(const int32_t) + scale_imm_and_clamp(const s32) scale2_add_and_clamp(const rgbaint_t&, const rgbaint_t&, const rgbaint_t&) scale_add_and_clamp(const rgbaint_t&, const rgbaint_t&); - scale_imm_add_and_clamp(const int32_t, const rgbaint_t&); - static bilinear_filter(uint32_t, uint32_t, uint32_t, uint32_t, uint8_t, uint8_t) - bilinear_filter_rgbaint(uint32_t, uint32_t, uint32_t, uint32_t, uint8_t, uint8_t) + scale_imm_add_and_clamp(const s32, const rgbaint_t&); + static bilinear_filter(u32, u32, u32, u32, u8, u8) + bilinear_filter_rgbaint(u32, u32, u32, u32, u8, u8) */ auto random_i32_nolimit = [this] { - int32_t result; - do { result = random_i32(); } while ((result == std::numeric_limits::min()) || (result == std::numeric_limits::max())); + s32 result; + do { result = random_i32(); } while ((result == std::numeric_limits::min()) || (result == std::numeric_limits::max())); return result; }; - volatile int32_t expected_a, expected_r, expected_g, expected_b; - volatile int32_t actual_a, actual_r, actual_g, actual_b; - volatile int32_t imm; + volatile s32 expected_a, expected_r, expected_g, expected_b; + volatile s32 actual_a, actual_r, actual_g, actual_b; + volatile s32 imm; rgbaint_t rgb, other; rgb_t packed; auto check_expected = [&] (const char *desc) { - const volatile int32_t a = rgb.get_a32(); - const volatile int32_t r = rgb.get_r32(); - const volatile int32_t g = rgb.get_g32(); - const volatile int32_t b = rgb.get_b32(); + const volatile s32 a = rgb.get_a32(); + const volatile s32 r = rgb.get_r32(); + const volatile s32 g = rgb.get_g32(); + const volatile s32 b = rgb.get_b32(); if (a != expected_a) osd_printf_error("Error testing %s get_a32() = %d (expected %d)\n", desc, a, expected_a); if (r != expected_r) osd_printf_error("Error testing %s get_r32() = %d (expected %d)\n", desc, r, expected_r); if (g != expected_g) osd_printf_error("Error testing %s get_g32() = %d (expected %d)\n", desc, g, expected_g); @@ -830,14 +830,14 @@ void validity_checker::validate_rgb() check_expected("rgbaint_t::xor_imm_rgba"); // test 8-bit get - expected_a = int32_t(uint32_t(expected_a) & 0x00ff); - expected_r = int32_t(uint32_t(expected_r) & 0x00ff); - expected_g = int32_t(uint32_t(expected_g) & 0x00ff); - expected_b = int32_t(uint32_t(expected_b) & 0x00ff); - actual_a = int32_t(uint32_t(rgb.get_a())); - actual_r = int32_t(uint32_t(rgb.get_r())); - actual_g = int32_t(uint32_t(rgb.get_g())); - actual_b = int32_t(uint32_t(rgb.get_b())); + expected_a = s32(u32(expected_a) & 0x00ff); + expected_r = s32(u32(expected_r) & 0x00ff); + expected_g = s32(u32(expected_g) & 0x00ff); + expected_b = s32(u32(expected_b) & 0x00ff); + actual_a = s32(u32(rgb.get_a())); + actual_r = s32(u32(rgb.get_r())); + actual_g = s32(u32(rgb.get_g())); + actual_b = s32(u32(rgb.get_b())); if (actual_a != expected_a) osd_printf_error("Error testing rgbaint_t::get_a() = %d (expected %d)\n", actual_a, expected_a); if (actual_r != expected_r) osd_printf_error("Error testing rgbaint_t::get_r() = %d (expected %d)\n", actual_r, expected_r); if (actual_g != expected_g) osd_printf_error("Error testing rgbaint_t::get_g() = %d (expected %d)\n", actual_g, expected_g); @@ -845,88 +845,88 @@ void validity_checker::validate_rgb() // test set from packed RGBA imm = random_i32(); - expected_a = int32_t((uint32_t(imm) >> 24) & 0x00ff); - expected_r = int32_t((uint32_t(imm) >> 16) & 0x00ff); - expected_g = int32_t((uint32_t(imm) >> 8) & 0x00ff); - expected_b = int32_t((uint32_t(imm) >> 0) & 0x00ff); - rgb.set(uint32_t(imm)); - check_expected("rgbaint_t::set(uint32_t)"); + expected_a = s32((u32(imm) >> 24) & 0x00ff); + expected_r = s32((u32(imm) >> 16) & 0x00ff); + expected_g = s32((u32(imm) >> 8) & 0x00ff); + expected_b = s32((u32(imm) >> 0) & 0x00ff); + rgb.set(u32(imm)); + check_expected("rgbaint_t::set(u32)"); // while we have a value loaded that we know doesn't exceed 8-bit range, check the non-clamping convert-to-rgba packed = rgb.to_rgba(); - if (uint32_t(imm) != uint32_t(packed)) - osd_printf_error("Error testing rgbaint_t::to_rgba() = %08x (expected %08x)\n", uint32_t(packed), uint32_t(imm)); + if (u32(imm) != u32(packed)) + osd_printf_error("Error testing rgbaint_t::to_rgba() = %08x (expected %08x)\n", u32(packed), u32(imm)); // test construct from packed RGBA and assign imm = random_i32(); - expected_a = int32_t((uint32_t(imm) >> 24) & 0x00ff); - expected_r = int32_t((uint32_t(imm) >> 16) & 0x00ff); - expected_g = int32_t((uint32_t(imm) >> 8) & 0x00ff); - expected_b = int32_t((uint32_t(imm) >> 0) & 0x00ff); - rgb = rgbaint_t(uint32_t(imm)); - check_expected("rgbaint_t(uint32_t)"); + expected_a = s32((u32(imm) >> 24) & 0x00ff); + expected_r = s32((u32(imm) >> 16) & 0x00ff); + expected_g = s32((u32(imm) >> 8) & 0x00ff); + expected_b = s32((u32(imm) >> 0) & 0x00ff); + rgb = rgbaint_t(u32(imm)); + check_expected("rgbaint_t(u32)"); // while we have a value loaded that we know doesn't exceed 8-bit range, check the non-clamping convert-to-rgba packed = rgb.to_rgba(); - if (uint32_t(imm) != uint32_t(packed)) - osd_printf_error("Error testing rgbaint_t::to_rgba() = %08x (expected %08x)\n", uint32_t(packed), uint32_t(imm)); + if (u32(imm) != u32(packed)) + osd_printf_error("Error testing rgbaint_t::to_rgba() = %08x (expected %08x)\n", u32(packed), u32(imm)); // test set with rgb_t packed = random_u32(); - expected_a = int32_t(uint32_t(packed.a())); - expected_r = int32_t(uint32_t(packed.r())); - expected_g = int32_t(uint32_t(packed.g())); - expected_b = int32_t(uint32_t(packed.b())); + expected_a = s32(u32(packed.a())); + expected_r = s32(u32(packed.r())); + expected_g = s32(u32(packed.g())); + expected_b = s32(u32(packed.b())); rgb.set(packed); check_expected("rgbaint_t::set(rgba_t)"); // test construct with rgb_t packed = random_u32(); - expected_a = int32_t(uint32_t(packed.a())); - expected_r = int32_t(uint32_t(packed.r())); - expected_g = int32_t(uint32_t(packed.g())); - expected_b = int32_t(uint32_t(packed.b())); + expected_a = s32(u32(packed.a())); + expected_r = s32(u32(packed.r())); + expected_g = s32(u32(packed.g())); + expected_b = s32(u32(packed.b())); rgb = rgbaint_t(packed); check_expected("rgbaint_t::set(rgba_t)"); // test clamping convert-to-rgba with hand-crafted values to catch edge cases - rgb.set(std::numeric_limits::min(), -1, 0, 1); + rgb.set(std::numeric_limits::min(), -1, 0, 1); packed = rgb.to_rgba_clamp(); - if (uint32_t(0x00000001) != uint32_t(packed)) - osd_printf_error("Error testing rgbaint_t::to_rgba_clamp() = %08x (expected 0x00000001)\n", uint32_t(packed)); - rgb.set(254, 255, 256, std::numeric_limits::max()); + if (u32(0x00000001) != u32(packed)) + osd_printf_error("Error testing rgbaint_t::to_rgba_clamp() = %08x (expected 0x00000001)\n", u32(packed)); + rgb.set(254, 255, 256, std::numeric_limits::max()); packed = rgb.to_rgba_clamp(); - if (uint32_t(0xfeffffff) != uint32_t(packed)) - osd_printf_error("Error testing rgbaint_t::to_rgba_clamp() = %08x (expected 0xfeffffff)\n", uint32_t(packed)); - rgb.set(std::numeric_limits::max(), std::numeric_limits::min(), 256, -1); + if (u32(0xfeffffff) != u32(packed)) + osd_printf_error("Error testing rgbaint_t::to_rgba_clamp() = %08x (expected 0xfeffffff)\n", u32(packed)); + rgb.set(std::numeric_limits::max(), std::numeric_limits::min(), 256, -1); packed = rgb.to_rgba_clamp(); - if (uint32_t(0xff00ff00) != uint32_t(packed)) - osd_printf_error("Error testing rgbaint_t::to_rgba_clamp() = %08x (expected 0xff00ff00)\n", uint32_t(packed)); + if (u32(0xff00ff00) != u32(packed)) + osd_printf_error("Error testing rgbaint_t::to_rgba_clamp() = %08x (expected 0xff00ff00)\n", u32(packed)); rgb.set(0, 255, 1, 254); packed = rgb.to_rgba_clamp(); - if (uint32_t(0x00ff01fe) != uint32_t(packed)) - osd_printf_error("Error testing rgbaint_t::to_rgba_clamp() = %08x (expected 0x00ff01fe)\n", uint32_t(packed)); + if (u32(0x00ff01fe) != u32(packed)) + osd_printf_error("Error testing rgbaint_t::to_rgba_clamp() = %08x (expected 0x00ff01fe)\n", u32(packed)); // test in-place clamping with hand-crafted values to catch edge cases expected_a = 0; expected_r = 0; expected_g = 0; expected_b = 1; - rgb.set(std::numeric_limits::min(), -1, 0, 1); + rgb.set(std::numeric_limits::min(), -1, 0, 1); rgb.clamp_to_uint8(); check_expected("rgbaint_t::clamp_to_uint8"); expected_a = 254; expected_r = 255; expected_g = 255; expected_b = 255; - rgb.set(254, 255, 256, std::numeric_limits::max()); + rgb.set(254, 255, 256, std::numeric_limits::max()); rgb.clamp_to_uint8(); check_expected("rgbaint_t::clamp_to_uint8"); expected_a = 255; expected_r = 0; expected_g = 255; expected_b = 0; - rgb.set(std::numeric_limits::max(), std::numeric_limits::min(), 256, -1); + rgb.set(std::numeric_limits::max(), std::numeric_limits::min(), 256, -1); rgb.clamp_to_uint8(); check_expected("rgbaint_t::clamp_to_uint8"); expected_a = 0; @@ -956,37 +956,37 @@ void validity_checker::validate_rgb() check_expected("rgbaint_t::shl_imm"); // test logical shift right - expected_a = int32_t(uint32_t(actual_a = random_i32()) >> 8); - expected_r = int32_t(uint32_t(actual_r = random_i32()) >> 18); - expected_g = int32_t(uint32_t(actual_g = random_i32()) >> 26); - expected_b = int32_t(uint32_t(actual_b = random_i32()) >> 4); + expected_a = s32(u32(actual_a = random_i32()) >> 8); + expected_r = s32(u32(actual_r = random_i32()) >> 18); + expected_g = s32(u32(actual_g = random_i32()) >> 26); + expected_b = s32(u32(actual_b = random_i32()) >> 4); rgb.set(actual_a, actual_r, actual_g, actual_b); rgb.shr(rgbaint_t(8, 18, 26, 4)); check_expected("rgbaint_t::shr"); // test logical shift right with opposite signs - expected_a = int32_t(uint32_t(actual_a = -actual_a) >> 21); - expected_r = int32_t(uint32_t(actual_r = -actual_r) >> 13); - expected_g = int32_t(uint32_t(actual_g = -actual_g) >> 11); - expected_b = int32_t(uint32_t(actual_b = -actual_b) >> 17); + expected_a = s32(u32(actual_a = -actual_a) >> 21); + expected_r = s32(u32(actual_r = -actual_r) >> 13); + expected_g = s32(u32(actual_g = -actual_g) >> 11); + expected_b = s32(u32(actual_b = -actual_b) >> 17); rgb.set(actual_a, actual_r, actual_g, actual_b); rgb.shr(rgbaint_t(21, 13, 11, 17)); check_expected("rgbaint_t::shr"); // test logical shift right immediate - expected_a = int32_t(uint32_t(actual_a = random_i32()) >> 5); - expected_r = int32_t(uint32_t(actual_r = random_i32()) >> 5); - expected_g = int32_t(uint32_t(actual_g = random_i32()) >> 5); - expected_b = int32_t(uint32_t(actual_b = random_i32()) >> 5); + expected_a = s32(u32(actual_a = random_i32()) >> 5); + expected_r = s32(u32(actual_r = random_i32()) >> 5); + expected_g = s32(u32(actual_g = random_i32()) >> 5); + expected_b = s32(u32(actual_b = random_i32()) >> 5); rgb.set(actual_a, actual_r, actual_g, actual_b); rgb.shr_imm(5); check_expected("rgbaint_t::shr_imm"); // test logical shift right immediate with opposite signs - expected_a = int32_t(uint32_t(actual_a = -actual_a) >> 15); - expected_r = int32_t(uint32_t(actual_r = -actual_r) >> 15); - expected_g = int32_t(uint32_t(actual_g = -actual_g) >> 15); - expected_b = int32_t(uint32_t(actual_b = -actual_b) >> 15); + expected_a = s32(u32(actual_a = -actual_a) >> 15); + expected_r = s32(u32(actual_r = -actual_r) >> 15); + expected_g = s32(u32(actual_g = -actual_g) >> 15); + expected_b = s32(u32(actual_b = -actual_b) >> 15); rgb.set(actual_a, actual_r, actual_g, actual_b); rgb.shr_imm(15); check_expected("rgbaint_t::shr_imm"); @@ -1050,19 +1050,19 @@ void validity_checker::validate_rgb() actual_r = random_i32_nolimit(); actual_g = random_i32_nolimit(); actual_b = random_i32_nolimit(); - expected_a = ~int32_t(0); + expected_a = ~s32(0); expected_r = 0; expected_g = 0; expected_b = 0; rgb.set(actual_a, actual_r, actual_g, actual_b); - rgb.cmpeq(rgbaint_t(actual_a, actual_r - 1, actual_g + 1, std::numeric_limits::min())); + rgb.cmpeq(rgbaint_t(actual_a, actual_r - 1, actual_g + 1, std::numeric_limits::min())); check_expected("rgbaint_t::cmpeq"); expected_a = 0; - expected_r = ~int32_t(0); + expected_r = ~s32(0); expected_g = 0; expected_b = 0; rgb.set(actual_a, actual_r, actual_g, actual_b); - rgb.cmpeq(rgbaint_t(std::numeric_limits::max(), actual_r, actual_g - 1, actual_b + 1)); + rgb.cmpeq(rgbaint_t(std::numeric_limits::max(), actual_r, actual_g - 1, actual_b + 1)); check_expected("rgbaint_t::cmpeq"); // test immediate equality comparison @@ -1070,31 +1070,31 @@ void validity_checker::validate_rgb() actual_r = random_i32_nolimit(); actual_g = random_i32_nolimit(); actual_b = random_i32_nolimit(); - expected_a = ~int32_t(0); - expected_r = (actual_r == actual_a) ? ~int32_t(0) : 0; - expected_g = (actual_g == actual_a) ? ~int32_t(0) : 0; - expected_b = (actual_b == actual_a) ? ~int32_t(0) : 0; + expected_a = ~s32(0); + expected_r = (actual_r == actual_a) ? ~s32(0) : 0; + expected_g = (actual_g == actual_a) ? ~s32(0) : 0; + expected_b = (actual_b == actual_a) ? ~s32(0) : 0; rgb.set(actual_a, actual_r, actual_g, actual_b); rgb.cmpeq_imm(actual_a); check_expected("rgbaint_t::cmpeq_imm"); - expected_a = (actual_a == actual_r) ? ~int32_t(0) : 0; - expected_r = ~int32_t(0); - expected_g = (actual_g == actual_r) ? ~int32_t(0) : 0; - expected_b = (actual_b == actual_r) ? ~int32_t(0) : 0; + expected_a = (actual_a == actual_r) ? ~s32(0) : 0; + expected_r = ~s32(0); + expected_g = (actual_g == actual_r) ? ~s32(0) : 0; + expected_b = (actual_b == actual_r) ? ~s32(0) : 0; rgb.set(actual_a, actual_r, actual_g, actual_b); rgb.cmpeq_imm(actual_r); check_expected("rgbaint_t::cmpeq_imm"); - expected_a = (actual_a == actual_g) ? ~int32_t(0) : 0; - expected_r = (actual_r == actual_g) ? ~int32_t(0) : 0; - expected_g = ~int32_t(0); - expected_b = (actual_b == actual_g) ? ~int32_t(0) : 0; + expected_a = (actual_a == actual_g) ? ~s32(0) : 0; + expected_r = (actual_r == actual_g) ? ~s32(0) : 0; + expected_g = ~s32(0); + expected_b = (actual_b == actual_g) ? ~s32(0) : 0; rgb.set(actual_a, actual_r, actual_g, actual_b); rgb.cmpeq_imm(actual_g); check_expected("rgbaint_t::cmpeq_imm"); - expected_a = (actual_a == actual_b) ? ~int32_t(0) : 0; - expected_r = (actual_r == actual_b) ? ~int32_t(0) : 0; - expected_g = (actual_g == actual_b) ? ~int32_t(0) : 0; - expected_b = ~int32_t(0); + expected_a = (actual_a == actual_b) ? ~s32(0) : 0; + expected_r = (actual_r == actual_b) ? ~s32(0) : 0; + expected_g = (actual_g == actual_b) ? ~s32(0) : 0; + expected_b = ~s32(0); rgb.set(actual_a, actual_r, actual_g, actual_b); rgb.cmpeq_imm(actual_b); check_expected("rgbaint_t::cmpeq_imm"); @@ -1103,12 +1103,12 @@ void validity_checker::validate_rgb() expected_g = 0; expected_b = 0; rgb.set(actual_a, actual_r, actual_g, actual_b); - rgb.cmpeq_imm(std::numeric_limits::min()); + rgb.cmpeq_imm(std::numeric_limits::min()); check_expected("rgbaint_t::cmpeq_imm"); - expected_a = !actual_a ? ~int32_t(0) : 0; - expected_r = !actual_r ? ~int32_t(0) : 0; - expected_g = !actual_g ? ~int32_t(0) : 0; - expected_b = !actual_b ? ~int32_t(0) : 0; + expected_a = !actual_a ? ~s32(0) : 0; + expected_r = !actual_r ? ~s32(0) : 0; + expected_g = !actual_g ? ~s32(0) : 0; + expected_b = !actual_b ? ~s32(0) : 0; rgb.set(actual_a, actual_r, actual_g, actual_b); rgb.cmpeq_imm(0); check_expected("rgbaint_t::cmpeq_imm"); @@ -1117,7 +1117,7 @@ void validity_checker::validate_rgb() expected_g = 0; expected_b = 0; rgb.set(actual_a, actual_r, actual_g, actual_b); - rgb.cmpeq_imm(std::numeric_limits::max()); + rgb.cmpeq_imm(std::numeric_limits::max()); check_expected("rgbaint_t::cmpeq_imm"); // test immediate RGB equality comparison @@ -1127,17 +1127,17 @@ void validity_checker::validate_rgb() actual_b = random_i32_nolimit(); expected_a = 0; expected_r = 0; - expected_g = ~int32_t(0); + expected_g = ~s32(0); expected_b = 0; rgb.set(actual_a, actual_r, actual_g, actual_b); - rgb.cmpeq_imm_rgba(std::numeric_limits::min(), std::numeric_limits::max(), actual_g, actual_b - 1); + rgb.cmpeq_imm_rgba(std::numeric_limits::min(), std::numeric_limits::max(), actual_g, actual_b - 1); check_expected("rgbaint_t::cmpeq_imm_rgba"); expected_a = 0; expected_r = 0; expected_g = 0; - expected_b = ~int32_t(0); + expected_b = ~s32(0); rgb.set(actual_a, actual_r, actual_g, actual_b); - rgb.cmpeq_imm_rgba(actual_a + 1, std::numeric_limits::min(), std::numeric_limits::max(), actual_b); + rgb.cmpeq_imm_rgba(actual_a + 1, std::numeric_limits::min(), std::numeric_limits::max(), actual_b); check_expected("rgbaint_t::cmpeq_imm_rgba"); // test RGB greater than comparison @@ -1146,18 +1146,18 @@ void validity_checker::validate_rgb() actual_g = random_i32_nolimit(); actual_b = random_i32_nolimit(); expected_a = 0; - expected_r = ~int32_t(0); + expected_r = ~s32(0); expected_g = 0; - expected_b = ~int32_t(0); + expected_b = ~s32(0); rgb.set(actual_a, actual_r, actual_g, actual_b); - rgb.cmpgt(rgbaint_t(actual_a, actual_r - 1, actual_g + 1, std::numeric_limits::min())); + rgb.cmpgt(rgbaint_t(actual_a, actual_r - 1, actual_g + 1, std::numeric_limits::min())); check_expected("rgbaint_t::cmpgt"); expected_a = 0; expected_r = 0; - expected_g = ~int32_t(0); + expected_g = ~s32(0); expected_b = 0; rgb.set(actual_a, actual_r, actual_g, actual_b); - rgb.cmpgt(rgbaint_t(std::numeric_limits::max(), actual_r, actual_g - 1, actual_b + 1)); + rgb.cmpgt(rgbaint_t(std::numeric_limits::max(), actual_r, actual_g - 1, actual_b + 1)); check_expected("rgbaint_t::cmpgt"); // test immediate greater than comparison @@ -1166,44 +1166,44 @@ void validity_checker::validate_rgb() actual_g = random_i32_nolimit(); actual_b = random_i32_nolimit(); expected_a = 0; - expected_r = (actual_r > actual_a) ? ~int32_t(0) : 0; - expected_g = (actual_g > actual_a) ? ~int32_t(0) : 0; - expected_b = (actual_b > actual_a) ? ~int32_t(0) : 0; + expected_r = (actual_r > actual_a) ? ~s32(0) : 0; + expected_g = (actual_g > actual_a) ? ~s32(0) : 0; + expected_b = (actual_b > actual_a) ? ~s32(0) : 0; rgb.set(actual_a, actual_r, actual_g, actual_b); rgb.cmpgt_imm(actual_a); check_expected("rgbaint_t::cmpgt_imm"); - expected_a = (actual_a > actual_r) ? ~int32_t(0) : 0; + expected_a = (actual_a > actual_r) ? ~s32(0) : 0; expected_r = 0; - expected_g = (actual_g > actual_r) ? ~int32_t(0) : 0; - expected_b = (actual_b > actual_r) ? ~int32_t(0) : 0; + expected_g = (actual_g > actual_r) ? ~s32(0) : 0; + expected_b = (actual_b > actual_r) ? ~s32(0) : 0; rgb.set(actual_a, actual_r, actual_g, actual_b); rgb.cmpgt_imm(actual_r); check_expected("rgbaint_t::cmpgt_imm"); - expected_a = (actual_a > actual_g) ? ~int32_t(0) : 0; - expected_r = (actual_r > actual_g) ? ~int32_t(0) : 0; + expected_a = (actual_a > actual_g) ? ~s32(0) : 0; + expected_r = (actual_r > actual_g) ? ~s32(0) : 0; expected_g =0; - expected_b = (actual_b > actual_g) ? ~int32_t(0) : 0; + expected_b = (actual_b > actual_g) ? ~s32(0) : 0; rgb.set(actual_a, actual_r, actual_g, actual_b); rgb.cmpgt_imm(actual_g); check_expected("rgbaint_t::cmpgt_imm"); - expected_a = (actual_a > actual_b) ? ~int32_t(0) : 0; - expected_r = (actual_r > actual_b) ? ~int32_t(0) : 0; - expected_g = (actual_g > actual_b) ? ~int32_t(0) : 0; + expected_a = (actual_a > actual_b) ? ~s32(0) : 0; + expected_r = (actual_r > actual_b) ? ~s32(0) : 0; + expected_g = (actual_g > actual_b) ? ~s32(0) : 0; expected_b = 0; rgb.set(actual_a, actual_r, actual_g, actual_b); rgb.cmpgt_imm(actual_b); check_expected("rgbaint_t::cmpgt_imm"); - expected_a = ~int32_t(0); - expected_r = ~int32_t(0); - expected_g = ~int32_t(0); - expected_b = ~int32_t(0); + expected_a = ~s32(0); + expected_r = ~s32(0); + expected_g = ~s32(0); + expected_b = ~s32(0); rgb.set(actual_a, actual_r, actual_g, actual_b); - rgb.cmpgt_imm(std::numeric_limits::min()); + rgb.cmpgt_imm(std::numeric_limits::min()); check_expected("rgbaint_t::cmpgt_imm"); - expected_a = (actual_a > 0) ? ~int32_t(0) : 0; - expected_r = (actual_r > 0) ? ~int32_t(0) : 0; - expected_g = (actual_g > 0) ? ~int32_t(0) : 0; - expected_b = (actual_b > 0) ? ~int32_t(0) : 0; + expected_a = (actual_a > 0) ? ~s32(0) : 0; + expected_r = (actual_r > 0) ? ~s32(0) : 0; + expected_g = (actual_g > 0) ? ~s32(0) : 0; + expected_b = (actual_b > 0) ? ~s32(0) : 0; rgb.set(actual_a, actual_r, actual_g, actual_b); rgb.cmpgt_imm(0); check_expected("rgbaint_t::cmpgt_imm"); @@ -1212,7 +1212,7 @@ void validity_checker::validate_rgb() expected_g = 0; expected_b = 0; rgb.set(actual_a, actual_r, actual_g, actual_b); - rgb.cmpgt_imm(std::numeric_limits::max()); + rgb.cmpgt_imm(std::numeric_limits::max()); check_expected("rgbaint_t::cmpgt_imm"); // test immediate RGB greater than comparison @@ -1220,19 +1220,19 @@ void validity_checker::validate_rgb() actual_r = random_i32_nolimit(); actual_g = random_i32_nolimit(); actual_b = random_i32_nolimit(); - expected_a = ~int32_t(0); + expected_a = ~s32(0); expected_r = 0; expected_g = 0; - expected_b = ~int32_t(0); + expected_b = ~s32(0); rgb.set(actual_a, actual_r, actual_g, actual_b); - rgb.cmpgt_imm_rgba(std::numeric_limits::min(), std::numeric_limits::max(), actual_g, actual_b - 1); + rgb.cmpgt_imm_rgba(std::numeric_limits::min(), std::numeric_limits::max(), actual_g, actual_b - 1); check_expected("rgbaint_t::cmpgt_imm_rgba"); expected_a = 0; - expected_r = ~int32_t(0); + expected_r = ~s32(0); expected_g = 0; expected_b = 0; rgb.set(actual_a, actual_r, actual_g, actual_b); - rgb.cmpgt_imm_rgba(actual_a + 1, std::numeric_limits::min(), std::numeric_limits::max(), actual_b); + rgb.cmpgt_imm_rgba(actual_a + 1, std::numeric_limits::min(), std::numeric_limits::max(), actual_b); check_expected("rgbaint_t::cmpgt_imm_rgba"); // test RGB less than comparison @@ -1242,17 +1242,17 @@ void validity_checker::validate_rgb() actual_b = random_i32_nolimit(); expected_a = 0; expected_r = 0; - expected_g = ~int32_t(0); + expected_g = ~s32(0); expected_b = 0; rgb.set(actual_a, actual_r, actual_g, actual_b); - rgb.cmplt(rgbaint_t(actual_a, actual_r - 1, actual_g + 1, std::numeric_limits::min())); + rgb.cmplt(rgbaint_t(actual_a, actual_r - 1, actual_g + 1, std::numeric_limits::min())); check_expected("rgbaint_t::cmplt"); - expected_a = ~int32_t(0); + expected_a = ~s32(0); expected_r = 0; expected_g = 0; - expected_b = ~int32_t(0); + expected_b = ~s32(0); rgb.set(actual_a, actual_r, actual_g, actual_b); - rgb.cmplt(rgbaint_t(std::numeric_limits::max(), actual_r, actual_g - 1, actual_b + 1)); + rgb.cmplt(rgbaint_t(std::numeric_limits::max(), actual_r, actual_g - 1, actual_b + 1)); check_expected("rgbaint_t::cmplt"); // test immediate less than comparison @@ -1261,29 +1261,29 @@ void validity_checker::validate_rgb() actual_g = random_i32_nolimit(); actual_b = random_i32_nolimit(); expected_a = 0; - expected_r = (actual_r < actual_a) ? ~int32_t(0) : 0; - expected_g = (actual_g < actual_a) ? ~int32_t(0) : 0; - expected_b = (actual_b < actual_a) ? ~int32_t(0) : 0; + expected_r = (actual_r < actual_a) ? ~s32(0) : 0; + expected_g = (actual_g < actual_a) ? ~s32(0) : 0; + expected_b = (actual_b < actual_a) ? ~s32(0) : 0; rgb.set(actual_a, actual_r, actual_g, actual_b); rgb.cmplt_imm(actual_a); check_expected("rgbaint_t::cmplt_imm"); - expected_a = (actual_a < actual_r) ? ~int32_t(0) : 0; + expected_a = (actual_a < actual_r) ? ~s32(0) : 0; expected_r = 0; - expected_g = (actual_g < actual_r) ? ~int32_t(0) : 0; - expected_b = (actual_b < actual_r) ? ~int32_t(0) : 0; + expected_g = (actual_g < actual_r) ? ~s32(0) : 0; + expected_b = (actual_b < actual_r) ? ~s32(0) : 0; rgb.set(actual_a, actual_r, actual_g, actual_b); rgb.cmplt_imm(actual_r); check_expected("rgbaint_t::cmplt_imm"); - expected_a = (actual_a < actual_g) ? ~int32_t(0) : 0; - expected_r = (actual_r < actual_g) ? ~int32_t(0) : 0; + expected_a = (actual_a < actual_g) ? ~s32(0) : 0; + expected_r = (actual_r < actual_g) ? ~s32(0) : 0; expected_g =0; - expected_b = (actual_b < actual_g) ? ~int32_t(0) : 0; + expected_b = (actual_b < actual_g) ? ~s32(0) : 0; rgb.set(actual_a, actual_r, actual_g, actual_b); rgb.cmplt_imm(actual_g); check_expected("rgbaint_t::cmplt_imm"); - expected_a = (actual_a < actual_b) ? ~int32_t(0) : 0; - expected_r = (actual_r < actual_b) ? ~int32_t(0) : 0; - expected_g = (actual_g < actual_b) ? ~int32_t(0) : 0; + expected_a = (actual_a < actual_b) ? ~s32(0) : 0; + expected_r = (actual_r < actual_b) ? ~s32(0) : 0; + expected_g = (actual_g < actual_b) ? ~s32(0) : 0; expected_b = 0; rgb.set(actual_a, actual_r, actual_g, actual_b); rgb.cmplt_imm(actual_b); @@ -1293,21 +1293,21 @@ void validity_checker::validate_rgb() expected_g = 0; expected_b = 0; rgb.set(actual_a, actual_r, actual_g, actual_b); - rgb.cmplt_imm(std::numeric_limits::min()); + rgb.cmplt_imm(std::numeric_limits::min()); check_expected("rgbaint_t::cmplt_imm"); - expected_a = (actual_a < 0) ? ~int32_t(0) : 0; - expected_r = (actual_r < 0) ? ~int32_t(0) : 0; - expected_g = (actual_g < 0) ? ~int32_t(0) : 0; - expected_b = (actual_b < 0) ? ~int32_t(0) : 0; + expected_a = (actual_a < 0) ? ~s32(0) : 0; + expected_r = (actual_r < 0) ? ~s32(0) : 0; + expected_g = (actual_g < 0) ? ~s32(0) : 0; + expected_b = (actual_b < 0) ? ~s32(0) : 0; rgb.set(actual_a, actual_r, actual_g, actual_b); rgb.cmplt_imm(0); check_expected("rgbaint_t::cmplt_imm"); - expected_a = ~int32_t(0); - expected_r = ~int32_t(0); - expected_g = ~int32_t(0); - expected_b = ~int32_t(0); + expected_a = ~s32(0); + expected_r = ~s32(0); + expected_g = ~s32(0); + expected_b = ~s32(0); rgb.set(actual_a, actual_r, actual_g, actual_b); - rgb.cmplt_imm(std::numeric_limits::max()); + rgb.cmplt_imm(std::numeric_limits::max()); check_expected("rgbaint_t::cmplt_imm"); // test immediate RGB less than comparison @@ -1316,18 +1316,18 @@ void validity_checker::validate_rgb() actual_g = random_i32_nolimit(); actual_b = random_i32_nolimit(); expected_a = 0; - expected_r = ~int32_t(0); + expected_r = ~s32(0); expected_g = 0; expected_b = 0; rgb.set(actual_a, actual_r, actual_g, actual_b); - rgb.cmplt_imm_rgba(std::numeric_limits::min(), std::numeric_limits::max(), actual_g, actual_b - 1); + rgb.cmplt_imm_rgba(std::numeric_limits::min(), std::numeric_limits::max(), actual_g, actual_b - 1); check_expected("rgbaint_t::cmplt_imm_rgba"); - expected_a = ~int32_t(0); + expected_a = ~s32(0); expected_r = 0; - expected_g = ~int32_t(0); + expected_g = ~s32(0); expected_b = 0; rgb.set(actual_a, actual_r, actual_g, actual_b); - rgb.cmplt_imm_rgba(actual_a + 1, std::numeric_limits::min(), std::numeric_limits::max(), actual_b); + rgb.cmplt_imm_rgba(actual_a + 1, std::numeric_limits::min(), std::numeric_limits::max(), actual_b); check_expected("rgbaint_t::cmplt_imm_rgba"); } @@ -1388,7 +1388,7 @@ void validity_checker::validate_driver() // make sure the year is only digits, '?' or '+' for (const char *s = m_current_driver->year; *s != 0; s++) - if (!isdigit((uint8_t)*s) && *s != '?' && *s != '+') + if (!isdigit(u8(*s)) && *s != '?' && *s != '+') { osd_printf_error("Driver has an invalid year '%s'\n", m_current_driver->year); break; @@ -1437,7 +1437,7 @@ void validity_checker::validate_roms() // scan the ROM entries for this device const char *last_region_name = "???"; const char *last_name = "???"; - uint32_t current_length = 0; + u32 current_length = 0; int items_since_region = 1; int last_bios = 0; int total_files = 0; @@ -1538,7 +1538,7 @@ void validity_checker::validate_analog_input_field(ioport_field &field) for (shift = 0; shift <= 31 && (~field.mask() & (1 << shift)) != 0; shift++) { } // convert the positional max value to be in the bitmask for testing - //int32_t analog_max = field.maxval(); + //s32 analog_max = field.maxval(); //analog_max = (analog_max - 1) << shift; // positional port size must fit in bits used @@ -1550,9 +1550,9 @@ void validity_checker::validate_analog_input_field(ioport_field &field) else if (field.type() > IPT_ANALOG_ABSOLUTE_FIRST && field.type() < IPT_ANALOG_ABSOLUTE_LAST) { // adjust for signed values - int32_t default_value = field.defvalue(); - int32_t analog_min = field.minval(); - int32_t analog_max = field.maxval(); + s32 default_value = field.defvalue(); + s32 analog_min = field.minval(); + s32 analog_max = field.maxval(); if (analog_min > analog_max) { analog_min = -analog_min; @@ -1606,7 +1606,7 @@ void validity_checker::validate_dip_settings(ioport_field &field) { const char *demo_sounds = ioport_string_from_index(INPUT_STRING_Demo_Sounds); const char *flipscreen = ioport_string_from_index(INPUT_STRING_Flip_Screen); - uint8_t coin_list[__input_string_coinage_end + 1 - __input_string_coinage_start] = { 0 }; + u8 coin_list[__input_string_coinage_end + 1 - __input_string_coinage_start] = { 0 }; bool coin_error = false; // iterate through the settings diff --git a/src/emu/validity.h b/src/emu/validity.h index f74b25599ff..7dcb741dc4c 100644 --- a/src/emu/validity.h +++ b/src/emu/validity.h @@ -64,7 +64,7 @@ private: typedef std::unordered_map int_map; // internal helpers - const char *ioport_string_from_index(uint32_t index); + const char *ioport_string_from_index(u32 index); int get_defstr_index(const char *string, bool suppress_error = false); // core helpers @@ -90,10 +90,10 @@ private: void output_indented_errors(std::string &text, const char *header); // random number generation - int32_t random_i32(); - uint32_t random_u32(); - int64_t random_i64(); - uint64_t random_u64(); + s32 random_i32(); + u32 random_u32(); + s64 random_i64(); + u64 random_u64(); // internal driver list driver_enumerator m_drivlist; diff --git a/src/emu/video.cpp b/src/emu/video.cpp index f25da887e03..a1c246f70f2 100644 --- a/src/emu/video.cpp +++ b/src/emu/video.cpp @@ -37,18 +37,18 @@ // frameskipping tables const bool video_manager::s_skiptable[FRAMESKIP_LEVELS][FRAMESKIP_LEVELS] = { - { false,false,false,false,false,false,false,false,false,false,false,false }, - { false,false,false,false,false,false,false,false,false,false,false,true }, - { false,false,false,false,false,true ,false,false,false,false,false,true }, - { false,false,false,true ,false,false,false,true ,false,false,false,true }, - { false,false,true ,false,false,true ,false,false,true ,false,false,true }, - { false,true ,false,false,true ,false,true ,false,false,true ,false,true }, - { false,true ,false,true ,false,true ,false,true ,false,true ,false,true }, - { false,true ,false,true ,true ,false,true ,false,true ,true ,false,true }, - { false,true ,true ,false,true ,true ,false,true ,true ,false,true ,true }, - { false,true ,true ,true ,false,true ,true ,true ,false,true ,true ,true }, - { false,true ,true ,true ,true ,true ,false,true ,true ,true ,true ,true }, - { false,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true } + { false, false, false, false, false, false, false, false, false, false, false, false }, + { false, false, false, false, false, false, false, false, false, false, false, true }, + { false, false, false, false, false, true , false, false, false, false, false, true }, + { false, false, false, true , false, false, false, true , false, false, false, true }, + { false, false, true , false, false, true , false, false, true , false, false, true }, + { false, true , false, false, true , false, true , false, false, true , false, true }, + { false, true , false, true , false, true , false, true , false, true , false, true }, + { false, true , false, true , true , false, true , false, true , true , false, true }, + { false, true , true , false, true , true , false, true , true , false, true , true }, + { false, true , true , true , false, true , true , true , false, true , true , true }, + { false, true , true , true , true , true , false, true , true , true , true , true }, + { false, true , true , true , true , true , true , true , true , true , true , true } }; @@ -57,7 +57,7 @@ const bool video_manager::s_skiptable[FRAMESKIP_LEVELS][FRAMESKIP_LEVELS] = // VIDEO MANAGER //************************************************************************** -static void video_notifier_callback(const char *outname, int32_t value, void *param) +static void video_notifier_callback(const char *outname, s32 value, void *param) { video_manager *vm = (video_manager *)param; @@ -553,7 +553,7 @@ void video_manager::end_recording(movie_format format) // recording //------------------------------------------------- -void video_manager::add_sound_to_recording(const int16_t *sound, int numsamples) +void video_manager::add_sound_to_recording(const s16 *sound, int numsamples) { // only record if we have a file if (m_avi_file != nullptr) @@ -770,7 +770,7 @@ void video_manager::update_throttle(attotime emutime) restoring from a saved state */ - static const uint8_t popcount[256] = + static const u8 popcount[256] = { 0,1,1,2,1,2,2,3, 1,2,2,3,2,3,3,4, 1,2,2,3,2,3,3,4, 2,3,3,4,3,4,4,5, 1,2,2,3,2,3,3,4, 2,3,3,4,3,4,4,5, 2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6, @@ -1017,8 +1017,8 @@ void video_manager::update_refresh_speed() // compute a target speed as an integral percentage // note that we lop 0.25Hz off of the minrefresh when doing the computation to allow for // the fact that most refresh rates are not accurate to 10 digits... - uint32_t target_speed = floor((minrefresh - 0.25) * 1000.0 / ATTOSECONDS_TO_HZ(min_frame_period)); - uint32_t original_speed = original_speed_setting(); + u32 target_speed = floor((minrefresh - 0.25) * 1000.0 / ATTOSECONDS_TO_HZ(min_frame_period)); + u32 original_speed = original_speed_setting(); target_speed = std::min(target_speed, original_speed); // if we changed, log that verbosely @@ -1102,8 +1102,8 @@ void video_manager::recompute_speed(const attotime &emutime) // given screen //------------------------------------------------- -typedef software_renderer snap_renderer_bilinear; -typedef software_renderer snap_renderer; +typedef software_renderer snap_renderer_bilinear; +typedef software_renderer snap_renderer; void video_manager::create_snapshot_bitmap(screen_device *screen) { @@ -1117,8 +1117,8 @@ void video_manager::create_snapshot_bitmap(screen_device *screen) } // get the minimum width/height and set it on the target - int32_t width = m_snap_width; - int32_t height = m_snap_height; + s32 width = m_snap_width; + s32 height = m_snap_height; if (width == 0 || height == 0) m_snap_target->compute_minimum_size(width, height); m_snap_target->set_bounds(width, height); @@ -1146,7 +1146,7 @@ void video_manager::create_snapshot_bitmap(screen_device *screen) osd_file::error video_manager::open_next(emu_file &file, const char *extension) { - uint32_t origflags = file.openflags(); + u32 origflags = file.openflags(); // handle defaults const char *snapname = machine().options().snap_name(); diff --git a/src/emu/video.h b/src/emu/video.h index bd4ae3b0437..f783ed6b383 100644 --- a/src/emu/video.h +++ b/src/emu/video.h @@ -95,7 +95,7 @@ public: // movies void begin_recording(const char *name, movie_format format); void end_recording(movie_format format); - void add_sound_to_recording(const int16_t *sound, int numsamples); + void add_sound_to_recording(const s16 *sound, int numsamples); void set_timecode_enabled(bool value) { m_timecode_enabled = value; } bool get_timecode_enabled() { return m_timecode_enabled; } @@ -143,7 +143,7 @@ private: osd_ticks_t m_throttle_last_ticks; // osd_ticks the last call to throttle attotime m_throttle_realtime; // real time the last call to throttle attotime m_throttle_emutime; // emulated time the last call to throttle - uint32_t m_throttle_history; // history of frames where we were fast enough + u32 m_throttle_history; // history of frames where we were fast enough // dynamic speed computation osd_ticks_t m_speed_last_realtime; // real time at the last speed calculation @@ -151,24 +151,24 @@ private: double m_speed_percent; // most recent speed percentage // overall speed computation - uint32_t m_overall_real_seconds; // accumulated real seconds at normal speed + u32 m_overall_real_seconds; // accumulated real seconds at normal speed osd_ticks_t m_overall_real_ticks; // accumulated real ticks at normal speed attotime m_overall_emutime; // accumulated emulated time at normal speed - uint32_t m_overall_valid_counter; // number of consecutive valid time periods + u32 m_overall_valid_counter; // number of consecutive valid time periods // configuration bool m_throttled; // flag: true if we're currently throttled float m_throttle_rate; // target rate for throttling bool m_fastforward; // flag: true if we're currently fast-forwarding - uint32_t m_seconds_to_run; // number of seconds to run before quitting + u32 m_seconds_to_run; // number of seconds to run before quitting bool m_auto_frameskip; // flag: true if we're automatically frameskipping - uint32_t m_speed; // overall speed (*1000) + u32 m_speed; // overall speed (*1000) // frameskipping - uint8_t m_empty_skip_count; // number of empty frames we have skipped - uint8_t m_frameskip_level; // current frameskip level - uint8_t m_frameskip_counter; // counter that counts through the frameskip steps - int8_t m_frameskip_adjust; + u8 m_empty_skip_count; // number of empty frames we have skipped + u8 m_frameskip_level; // current frameskip level + u8 m_frameskip_counter; // counter that counts through the frameskip steps + s8 m_frameskip_adjust; bool m_skipping_this_frame; // flag: true if we are skipping the current frame osd_ticks_t m_average_oversleep; // average number of ticks the OSD oversleeps @@ -176,34 +176,34 @@ private: render_target * m_snap_target; // screen shapshot target bitmap_rgb32 m_snap_bitmap; // screen snapshot bitmap bool m_snap_native; // are we using native per-screen layouts? - int32_t m_snap_width; // width of snapshots (0 == auto) - int32_t m_snap_height; // height of snapshots (0 == auto) + s32 m_snap_width; // width of snapshots (0 == auto) + s32 m_snap_height; // height of snapshots (0 == auto) // movie recording - MNG std::unique_ptr m_mng_file; // handle to the open movie file attotime m_mng_frame_period; // period of a single movie frame attotime m_mng_next_frame_time; // time of next frame - uint32_t m_mng_frame; // current movie frame number + u32 m_mng_frame; // current movie frame number // movie recording - AVI avi_file::ptr m_avi_file; // handle to the open movie file attotime m_avi_frame_period; // period of a single movie frame attotime m_avi_next_frame_time; // time of next frame - uint32_t m_avi_frame; // current movie frame number + u32 m_avi_frame; // current movie frame number // movie recording - dummy bool m_dummy_recording; // indicates if snapshot should be created of every frame - static const bool s_skiptable[FRAMESKIP_LEVELS][FRAMESKIP_LEVELS]; + static const bool s_skiptable[FRAMESKIP_LEVELS][FRAMESKIP_LEVELS]; static const attoseconds_t ATTOSECONDS_PER_SPEED_UPDATE = ATTOSECONDS_PER_SECOND / 4; static const int PAUSED_REFRESH_RATE = 30; - bool m_timecode_enabled; // inp.timecode record enabled - bool m_timecode_write; // Show/hide timer at right (partial time) - std::string m_timecode_text; // Message for that video part (intro, gameplay, extra) - attotime m_timecode_start; // Starting timer for that video part (intro, gameplay, extra) - attotime m_timecode_total; // Show/hide timer at left (total elapsed on resulting video preview) + bool m_timecode_enabled; // inp.timecode record enabled + bool m_timecode_write; // Show/hide timer at right (partial time) + std::string m_timecode_text; // Message for that video part (intro, gameplay, extra) + attotime m_timecode_start; // Starting timer for that video part (intro, gameplay, extra) + attotime m_timecode_total; // Show/hide timer at left (total elapsed on resulting video preview) }; diff --git a/src/emu/video/generic.h b/src/emu/video/generic.h index 5f2ef27966c..3dbb717018d 100644 --- a/src/emu/video/generic.h +++ b/src/emu/video/generic.h @@ -8,10 +8,10 @@ *********************************************************************/ -#pragma once +#ifndef MAME_EMU_VIDEO_GENERIC_H +#define MAME_EMU_VIDEO_GENERIC_H -#ifndef __VIDEO_GENERIC_H__ -#define __VIDEO_GENERIC_H__ +#pragma once @@ -28,4 +28,4 @@ extern const gfx_layout gfx_8x8x6_planar; extern const gfx_layout gfx_16x16x4_planar; -#endif /* __VIDEO_GENERIC_H__ */ +#endif /* MAME_EMU_VIDEO_GENERIC_H */ diff --git a/src/emu/video/resnet.cpp b/src/emu/video/resnet.cpp index 1b467d016c4..f746f8448d6 100644 --- a/src/emu/video/resnet.cpp +++ b/src/emu/video/resnet.cpp @@ -449,7 +449,7 @@ int compute_res_net(int inputs, int channel, const res_net_info &di) { double rTotal=0.0; double v = 0; - int i; + int i; double vBias = di.rgb[channel].vBias; double vOH = di.vOH; @@ -459,7 +459,7 @@ int compute_res_net(int inputs, int channel, const res_net_info &di) double vcc = di.vcc; double ttlHRes = 0; double rGnd = di.rgb[channel].rGnd; - uint8_t OpenCol = di.OpenCol; + u8 OpenCol = di.OpenCol; /* Global options */ @@ -692,15 +692,15 @@ int compute_res_net(int inputs, int channel, const res_net_info &di) return (int) (v * 255 / vcc + 0.4); } -void compute_res_net_all(std::vector &rgb, const uint8_t *prom, const res_net_decode_info &rdi, const res_net_info &di) +void compute_res_net_all(std::vector &rgb, const u8 *prom, const res_net_decode_info &rdi, const res_net_info &di) { - uint8_t r,g,b; + u8 r,g,b; int i,j,k; rgb.resize(rdi.end - rdi.start + 1); for (i=rdi.start; i<=rdi.end; i++) { - uint8_t t[3] = {0,0,0}; + u8 t[3] = {0,0,0}; int s; for (j=0;j &rgb, const uint8_t *prom, const res_net_decode_info &rdi, const res_net_info &di); +void compute_res_net_all(std::vector &rgb, const u8 *prom, const res_net_decode_info &rdi, const res_net_info &di); /* legacy interface */ @@ -196,4 +196,4 @@ double compute_resistor_net_outputs( -#endif /*_RESNET_H_*/ +#endif /* MAME_EMU_VIDEO_RESNET_H */ diff --git a/src/emu/video/rgbgen.cpp b/src/emu/video/rgbgen.cpp index ef55504d90c..09b27090887 100644 --- a/src/emu/video/rgbgen.cpp +++ b/src/emu/video/rgbgen.cpp @@ -22,10 +22,10 @@ scale factor -------------------------------------------------*/ -void rgbaint_t::blend(const rgbaint_t& color2, uint8_t color1scale) +void rgbaint_t::blend(const rgbaint_t& color2, u8 color1scale) { - int32_t scale1 = (int32_t)color1scale; - int32_t scale2 = 256 - scale1; + s32 scale1 = s32(color1scale); + s32 scale2 = 256 - scale1; m_a = (m_a * scale1 + color2.m_a * scale2) >> 8; m_r = (m_r * scale1 + color2.m_r * scale2) >> 8; @@ -44,7 +44,7 @@ void rgbaint_t::blend(const rgbaint_t& color2, uint8_t color1scale) per channel, and clamp to byte values -------------------------------------------------*/ -void rgbaint_t::scale_imm_and_clamp(int32_t scale) +void rgbaint_t::scale_imm_and_clamp(s32 scale) { m_a = (m_a * scale) >> 8; m_r = (m_r * scale) >> 8; @@ -54,10 +54,10 @@ void rgbaint_t::scale_imm_and_clamp(int32_t scale) m_r |= (m_r & 0x00800000) ? 0xff000000 : 0; m_g |= (m_g & 0x00800000) ? 0xff000000 : 0; m_b |= (m_b & 0x00800000) ? 0xff000000 : 0; - if ((uint32_t)m_a > 255) { m_a = (m_a < 0) ? 0 : 255; } - if ((uint32_t)m_r > 255) { m_r = (m_r < 0) ? 0 : 255; } - if ((uint32_t)m_g > 255) { m_g = (m_g < 0) ? 0 : 255; } - if ((uint32_t)m_b > 255) { m_b = (m_b < 0) ? 0 : 255; } + if (u32(m_a) > 255) { m_a = (m_a < 0) ? 0 : 255; } + if (u32(m_r) > 255) { m_r = (m_r < 0) ? 0 : 255; } + if (u32(m_g) > 255) { m_g = (m_g < 0) ? 0 : 255; } + if (u32(m_b) > 255) { m_b = (m_b < 0) ? 0 : 255; } } void rgbaint_t::scale_and_clamp(const rgbaint_t& scale) @@ -70,14 +70,14 @@ void rgbaint_t::scale_and_clamp(const rgbaint_t& scale) m_r |= (m_r & 0x00800000) ? 0xff000000 : 0; m_g |= (m_g & 0x00800000) ? 0xff000000 : 0; m_b |= (m_b & 0x00800000) ? 0xff000000 : 0; - if ((uint32_t)m_a > 255) { m_a = (m_a < 0) ? 0 : 255; } - if ((uint32_t)m_r > 255) { m_r = (m_r < 0) ? 0 : 255; } - if ((uint32_t)m_g > 255) { m_g = (m_g < 0) ? 0 : 255; } - if ((uint32_t)m_b > 255) { m_b = (m_b < 0) ? 0 : 255; } + if (u32(m_a) > 255) { m_a = (m_a < 0) ? 0 : 255; } + if (u32(m_r) > 255) { m_r = (m_r < 0) ? 0 : 255; } + if (u32(m_g) > 255) { m_g = (m_g < 0) ? 0 : 255; } + if (u32(m_b) > 255) { m_b = (m_b < 0) ? 0 : 255; } } -void rgbaint_t::scale_imm_add_and_clamp(int32_t scale, const rgbaint_t& other) +void rgbaint_t::scale_imm_add_and_clamp(s32 scale, const rgbaint_t& other) { m_a = (m_a * scale) >> 8; m_r = (m_r * scale) >> 8; @@ -91,10 +91,10 @@ void rgbaint_t::scale_imm_add_and_clamp(int32_t scale, const rgbaint_t& other) m_r += other.m_r; m_g += other.m_g; m_b += other.m_b; - if ((uint32_t)m_a > 255) { m_a = (m_a < 0) ? 0 : 255; } - if ((uint32_t)m_r > 255) { m_r = (m_r < 0) ? 0 : 255; } - if ((uint32_t)m_g > 255) { m_g = (m_g < 0) ? 0 : 255; } - if ((uint32_t)m_b > 255) { m_b = (m_b < 0) ? 0 : 255; } + if (u32(m_a) > 255) { m_a = (m_a < 0) ? 0 : 255; } + if (u32(m_r) > 255) { m_r = (m_r < 0) ? 0 : 255; } + if (u32(m_g) > 255) { m_g = (m_g < 0) ? 0 : 255; } + if (u32(m_b) > 255) { m_b = (m_b < 0) ? 0 : 255; } } void rgbaint_t::scale_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& other) @@ -111,10 +111,10 @@ void rgbaint_t::scale_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& oth m_r += other.m_r; m_g += other.m_g; m_b += other.m_b; - if ((uint32_t)m_a > 255) { m_a = (m_a < 0) ? 0 : 255; } - if ((uint32_t)m_r > 255) { m_r = (m_r < 0) ? 0 : 255; } - if ((uint32_t)m_g > 255) { m_g = (m_g < 0) ? 0 : 255; } - if ((uint32_t)m_b > 255) { m_b = (m_b < 0) ? 0 : 255; } + if (u32(m_a) > 255) { m_a = (m_a < 0) ? 0 : 255; } + if (u32(m_r) > 255) { m_r = (m_r < 0) ? 0 : 255; } + if (u32(m_g) > 255) { m_g = (m_g < 0) ? 0 : 255; } + if (u32(m_b) > 255) { m_b = (m_b < 0) ? 0 : 255; } } void rgbaint_t::scale2_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& other, const rgbaint_t& scale2) @@ -127,10 +127,10 @@ void rgbaint_t::scale2_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& ot m_r |= (m_r & 0x00800000) ? 0xff000000 : 0; m_g |= (m_g & 0x00800000) ? 0xff000000 : 0; m_b |= (m_b & 0x00800000) ? 0xff000000 : 0; - if ((uint32_t)m_a > 255) { m_a = (m_a < 0) ? 0 : 255; } - if ((uint32_t)m_r > 255) { m_r = (m_r < 0) ? 0 : 255; } - if ((uint32_t)m_g > 255) { m_g = (m_g < 0) ? 0 : 255; } - if ((uint32_t)m_b > 255) { m_b = (m_b < 0) ? 0 : 255; } + if (u32(m_a) > 255) { m_a = (m_a < 0) ? 0 : 255; } + if (u32(m_r) > 255) { m_r = (m_r < 0) ? 0 : 255; } + if (u32(m_g) > 255) { m_g = (m_g < 0) ? 0 : 255; } + if (u32(m_b) > 255) { m_b = (m_b < 0) ? 0 : 255; } } #endif // !defined(__ALTIVEC__) diff --git a/src/emu/video/rgbgen.h b/src/emu/video/rgbgen.h index 66dac76aa53..197769946a8 100644 --- a/src/emu/video/rgbgen.h +++ b/src/emu/video/rgbgen.h @@ -20,16 +20,16 @@ class rgbaint_t { public: rgbaint_t(): m_a(0), m_r(0), m_g(0), m_b(0) { } - explicit rgbaint_t(uint32_t rgba) { set(rgba); } - rgbaint_t(int32_t a, int32_t r, int32_t g, int32_t b) { set(a, r, g, b); } + explicit rgbaint_t(u32 rgba) { set(rgba); } + rgbaint_t(s32 a, s32 r, s32 g, s32 b) { set(a, r, g, b); } explicit rgbaint_t(const rgb_t& rgba) { set(rgba); } rgbaint_t(const rgbaint_t& other) = default; rgbaint_t &operator=(const rgbaint_t& other) = default; void set(const rgbaint_t& other) { set(other.m_a, other.m_r, other.m_g, other.m_b); } - void set(uint32_t rgba) { set((rgba >> 24) & 0xff, (rgba >> 16) & 0xff, (rgba >> 8) & 0xff, rgba & 0xff); } - void set(int32_t a, int32_t r, int32_t g, int32_t b) + void set(u32 rgba) { set((rgba >> 24) & 0xff, (rgba >> 16) & 0xff, (rgba >> 8) & 0xff, rgba & 0xff); } + void set(s32 a, s32 r, s32 g, s32 b) { m_a = a; m_r = r; @@ -42,39 +42,39 @@ public: rgb_t to_rgba_clamp() const { - const uint8_t a = (m_a < 0) ? 0 : (m_a > 255) ? 255 : m_a; - const uint8_t r = (m_r < 0) ? 0 : (m_r > 255) ? 255 : m_r; - const uint8_t g = (m_g < 0) ? 0 : (m_g > 255) ? 255 : m_g; - const uint8_t b = (m_b < 0) ? 0 : (m_b > 255) ? 255 : m_b; + const u8 a = (m_a < 0) ? 0 : (m_a > 255) ? 255 : m_a; + const u8 r = (m_r < 0) ? 0 : (m_r > 255) ? 255 : m_r; + const u8 g = (m_g < 0) ? 0 : (m_g > 255) ? 255 : m_g; + const u8 b = (m_b < 0) ? 0 : (m_b > 255) ? 255 : m_b; return rgb_t(a, r, g, b); } - void set_a(const int32_t value) { m_a = value; } - void set_r(const int32_t value) { m_r = value; } - void set_g(const int32_t value) { m_g = value; } - void set_b(const int32_t value) { m_b = value; } + void set_a(const s32 value) { m_a = value; } + void set_r(const s32 value) { m_r = value; } + void set_g(const s32 value) { m_g = value; } + void set_b(const s32 value) { m_b = value; } - uint8_t get_a() const { return uint8_t(uint32_t(m_a)); } - uint8_t get_r() const { return uint8_t(uint32_t(m_r)); } - uint8_t get_g() const { return uint8_t(uint32_t(m_g)); } - uint8_t get_b() const { return uint8_t(uint32_t(m_b)); } + u8 get_a() const { return u8(u32(m_a)); } + u8 get_r() const { return u8(u32(m_r)); } + u8 get_g() const { return u8(u32(m_g)); } + u8 get_b() const { return u8(u32(m_b)); } - int32_t get_a32() const { return m_a; } - int32_t get_r32() const { return m_r; } - int32_t get_g32() const { return m_g; } - int32_t get_b32() const { return m_b; } + s32 get_a32() const { return m_a; } + s32 get_r32() const { return m_r; } + s32 get_g32() const { return m_g; } + s32 get_b32() const { return m_b; } inline void add(const rgbaint_t& color) { add_imm_rgba(color.m_a, color.m_r, color.m_g, color.m_b); } - inline void add_imm(const int32_t imm) + inline void add_imm(const s32 imm) { add_imm_rgba(imm, imm, imm, imm); } - inline void add_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void add_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { m_a += a; m_r += r; @@ -87,12 +87,12 @@ public: sub_imm_rgba(color.m_a, color.m_r, color.m_g, color.m_b); } - inline void sub_imm(const int32_t imm) + inline void sub_imm(const s32 imm) { sub_imm_rgba(imm, imm, imm, imm); } - inline void sub_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void sub_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { m_a -= a; m_r -= r; @@ -105,12 +105,12 @@ public: subr_imm_rgba(color.m_a, color.m_r, color.m_g, color.m_b); } - inline void subr_imm(const int32_t imm) + inline void subr_imm(const s32 imm) { subr_imm_rgba(imm, imm, imm, imm); } - inline void subr_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void subr_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { m_a = a - m_a; m_r = r - m_r; @@ -123,12 +123,12 @@ public: mul_imm_rgba(color.m_a, color.m_r, color.m_g, color.m_b); } - inline void mul_imm(const int32_t imm) + inline void mul_imm(const s32 imm) { mul_imm_rgba(imm, imm, imm, imm); } - inline void mul_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void mul_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { m_a *= a; m_r *= r; @@ -144,7 +144,7 @@ public: m_b <<= shift.m_b; } - inline void shl_imm(const uint8_t shift) + inline void shl_imm(const u8 shift) { if (shift == 0) return; @@ -157,21 +157,21 @@ public: inline void shr(const rgbaint_t& shift) { - m_a = int32_t(uint32_t(m_a) >> shift.m_a); - m_r = int32_t(uint32_t(m_r) >> shift.m_r); - m_g = int32_t(uint32_t(m_g) >> shift.m_g); - m_b = int32_t(uint32_t(m_b) >> shift.m_b); + m_a = s32(u32(m_a) >> shift.m_a); + m_r = s32(u32(m_r) >> shift.m_r); + m_g = s32(u32(m_g) >> shift.m_g); + m_b = s32(u32(m_b) >> shift.m_b); } - inline void shr_imm(const uint8_t shift) + inline void shr_imm(const u8 shift) { if (shift == 0) return; - m_a = int32_t(uint32_t(m_a) >> shift); - m_r = int32_t(uint32_t(m_r) >> shift); - m_g = int32_t(uint32_t(m_g) >> shift); - m_b = int32_t(uint32_t(m_b) >> shift); + m_a = s32(u32(m_a) >> shift); + m_r = s32(u32(m_r) >> shift); + m_g = s32(u32(m_g) >> shift); + m_b = s32(u32(m_b) >> shift); } inline void sra(const rgbaint_t& shift) @@ -193,10 +193,10 @@ public: m_b |= ~0 << (32 - shift.m_b); } - inline void sra_imm(const uint8_t shift) + inline void sra_imm(const u8 shift) { - const uint32_t high_bit = 1 << (31 - shift); - const uint32_t high_mask = ~0 << (32 - shift); + const u32 high_bit = 1 << (31 - shift); + const u32 high_mask = ~0 << (32 - shift); m_a >>= shift; if (m_a & high_bit) @@ -221,11 +221,11 @@ public: void andnot_reg(const rgbaint_t& color) { and_imm_rgba(~color.m_a, ~color.m_r, ~color.m_g, ~color.m_b); } - void or_imm(int32_t imm) { or_imm_rgba(imm, imm, imm, imm); } - void and_imm(int32_t imm) { and_imm_rgba(imm, imm, imm, imm); } - void xor_imm(int32_t imm) { xor_imm_rgba(imm, imm, imm, imm); } + void or_imm(s32 imm) { or_imm_rgba(imm, imm, imm, imm); } + void and_imm(s32 imm) { and_imm_rgba(imm, imm, imm, imm); } + void xor_imm(s32 imm) { xor_imm_rgba(imm, imm, imm, imm); } - inline void or_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void or_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { m_a |= a; m_r |= r; @@ -233,7 +233,7 @@ public: m_b |= b; } - inline void and_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void and_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { m_a &= a; m_r &= r; @@ -241,7 +241,7 @@ public: m_b &= b; } - inline void xor_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void xor_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { m_a ^= a; m_r ^= r; @@ -249,7 +249,7 @@ public: m_b ^= b; } - inline void clamp_and_clear(const uint32_t sign) + inline void clamp_and_clear(const u32 sign) { if (m_a & sign) m_a = 0; if (m_r & sign) m_r = 0; @@ -267,7 +267,7 @@ public: m_b = (m_b < 0) ? 0 : (m_b > 255) ? 255 : m_b; } - inline void sign_extend(const uint32_t compare, const uint32_t sign) + inline void sign_extend(const u32 compare, const u32 sign) { if ((m_a & compare) == compare) m_a |= sign; @@ -282,7 +282,7 @@ public: m_b |= sign; } - inline void min(const int32_t value) + inline void min(const s32 value) { m_a = (m_a > value) ? value : m_a; m_r = (m_r > value) ? value : m_r; @@ -290,7 +290,7 @@ public: m_b = (m_b > value) ? value : m_b; } - inline void max(const int32_t value) + inline void max(const s32 value) { m_a = (m_a < value) ? value : m_a; m_r = (m_r < value) ? value : m_r; @@ -298,23 +298,23 @@ public: m_b = (m_b < value) ? value : m_b; } - void blend(const rgbaint_t& other, uint8_t factor); + void blend(const rgbaint_t& other, u8 factor); void scale_and_clamp(const rgbaint_t& scale); - void scale_imm_and_clamp(const int32_t scale); + void scale_imm_and_clamp(const s32 scale); void scale2_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& other, const rgbaint_t& scale2); void scale_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& other); - void scale_imm_add_and_clamp(const int32_t scale, const rgbaint_t& other); + void scale_imm_add_and_clamp(const s32 scale, const rgbaint_t& other); void cmpeq(const rgbaint_t& value) { cmpeq_imm_rgba(value.m_a, value.m_r, value.m_g, value.m_b); } void cmpgt(const rgbaint_t& value) { cmpgt_imm_rgba(value.m_a, value.m_r, value.m_g, value.m_b); } void cmplt(const rgbaint_t& value) { cmplt_imm_rgba(value.m_a, value.m_r, value.m_g, value.m_b); } - void cmpeq_imm(int32_t value) { cmpeq_imm_rgba(value, value, value, value); } - void cmpgt_imm(int32_t value) { cmpgt_imm_rgba(value, value, value, value); } - void cmplt_imm(int32_t value) { cmplt_imm_rgba(value, value, value, value); } + void cmpeq_imm(s32 value) { cmpeq_imm_rgba(value, value, value, value); } + void cmpgt_imm(s32 value) { cmpgt_imm_rgba(value, value, value, value); } + void cmplt_imm(s32 value) { cmplt_imm_rgba(value, value, value, value); } - void cmpeq_imm_rgba(int32_t a, int32_t r, int32_t g, int32_t b) + void cmpeq_imm_rgba(s32 a, s32 r, s32 g, s32 b) { m_a = (m_a == a) ? 0xffffffff : 0; m_r = (m_r == r) ? 0xffffffff : 0; @@ -322,7 +322,7 @@ public: m_b = (m_b == b) ? 0xffffffff : 0; } - void cmpgt_imm_rgba(int32_t a, int32_t r, int32_t g, int32_t b) + void cmpgt_imm_rgba(s32 a, s32 r, s32 g, s32 b) { m_a = (m_a > a) ? 0xffffffff : 0; m_r = (m_r > r) ? 0xffffffff : 0; @@ -330,7 +330,7 @@ public: m_b = (m_b > b) ? 0xffffffff : 0; } - void cmplt_imm_rgba(int32_t a, int32_t r, int32_t g, int32_t b) + void cmplt_imm_rgba(s32 a, s32 r, s32 g, s32 b) { m_a = (m_a < a) ? 0xffffffff : 0; m_r = (m_r < r) ? 0xffffffff : 0; @@ -349,7 +349,7 @@ public: return *this; } - rgbaint_t& operator+=(const int32_t other) + rgbaint_t& operator+=(const s32 other) { add_imm_rgba(other, other, other, other); return *this; @@ -367,30 +367,30 @@ public: return *this; } - rgbaint_t& operator*=(const int32_t other) + rgbaint_t& operator*=(const s32 other) { mul_imm_rgba(other, other, other, other); return *this; } - rgbaint_t& operator>>=(const int32_t shift) + rgbaint_t& operator>>=(const s32 shift) { sra_imm(shift); return *this; } - static uint32_t bilinear_filter(uint32_t rgb00, uint32_t rgb01, uint32_t rgb10, uint32_t rgb11, uint8_t u, uint8_t v) + static u32 bilinear_filter(u32 rgb00, u32 rgb01, u32 rgb10, u32 rgb11, u8 u, u8 v) { - uint32_t rb0 = (rgb00 & 0x00ff00ff) + ((((rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff)) * u) >> 8); - uint32_t rb1 = (rgb10 & 0x00ff00ff) + ((((rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff)) * u) >> 8); + u32 rb0 = (rgb00 & 0x00ff00ff) + ((((rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff)) * u) >> 8); + u32 rb1 = (rgb10 & 0x00ff00ff) + ((((rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff)) * u) >> 8); rgb00 >>= 8; rgb01 >>= 8; rgb10 >>= 8; rgb11 >>= 8; - uint32_t ag0 = (rgb00 & 0x00ff00ff) + ((((rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff)) * u) >> 8); - uint32_t ag1 = (rgb10 & 0x00ff00ff) + ((((rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff)) * u) >> 8); + u32 ag0 = (rgb00 & 0x00ff00ff) + ((((rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff)) * u) >> 8); + u32 ag1 = (rgb10 & 0x00ff00ff) + ((((rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff)) * u) >> 8); rb0 = (rb0 & 0x00ff00ff) + ((((rb1 & 0x00ff00ff) - (rb0 & 0x00ff00ff)) * v) >> 8); ag0 = (ag0 & 0x00ff00ff) + ((((ag1 & 0x00ff00ff) - (ag0 & 0x00ff00ff)) * v) >> 8); @@ -398,31 +398,31 @@ public: return ((ag0 << 8) & 0xff00ff00) | (rb0 & 0x00ff00ff); } - void bilinear_filter_rgbaint(uint32_t rgb00, uint32_t rgb01, uint32_t rgb10, uint32_t rgb11, uint8_t u, uint8_t v) + void bilinear_filter_rgbaint(u32 rgb00, u32 rgb01, u32 rgb10, u32 rgb11, u8 u, u8 v) { - uint32_t rb0 = (rgb00 & 0x00ff00ff) + ((((rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff)) * u) >> 8); - uint32_t rb1 = (rgb10 & 0x00ff00ff) + ((((rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff)) * u) >> 8); + u32 rb0 = (rgb00 & 0x00ff00ff) + ((((rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff)) * u) >> 8); + u32 rb1 = (rgb10 & 0x00ff00ff) + ((((rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff)) * u) >> 8); rgb00 >>= 8; rgb01 >>= 8; rgb10 >>= 8; rgb11 >>= 8; - uint32_t ag0 = (rgb00 & 0x00ff00ff) + ((((rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff)) * u) >> 8); - uint32_t ag1 = (rgb10 & 0x00ff00ff) + ((((rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff)) * u) >> 8); + u32 ag0 = (rgb00 & 0x00ff00ff) + ((((rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff)) * u) >> 8); + u32 ag1 = (rgb10 & 0x00ff00ff) + ((((rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff)) * u) >> 8); rb0 = (rb0 & 0x00ff00ff) + ((((rb1 & 0x00ff00ff) - (rb0 & 0x00ff00ff)) * v) >> 8); ag0 = (ag0 & 0x00ff00ff) + ((((ag1 & 0x00ff00ff) - (ag0 & 0x00ff00ff)) * v) >> 8); - uint32_t result = ((ag0 << 8) & 0xff00ff00) | (rb0 & 0x00ff00ff); + u32 result = ((ag0 << 8) & 0xff00ff00) | (rb0 & 0x00ff00ff); this->set(result); } protected: - int32_t m_a; - int32_t m_r; - int32_t m_g; - int32_t m_b; + s32 m_a; + s32 m_r; + s32 m_g; + s32 m_b; }; #endif // MAME_EMU_VIDEO_RGBGEN_H diff --git a/src/emu/video/rgbsse.cpp b/src/emu/video/rgbsse.cpp index 87c4f7b33e0..35ea6a1948f 100644 --- a/src/emu/video/rgbsse.cpp +++ b/src/emu/video/rgbsse.cpp @@ -164,7 +164,7 @@ const struct rgbaint_t::_statics rgbaint_t::statics = HIGHER LEVEL OPERATIONS ***************************************************************************/ -void rgbaint_t::blend(const rgbaint_t& other, uint8_t factor) +void rgbaint_t::blend(const rgbaint_t& other, u8 factor) { const __m128i scale1 = _mm_set1_epi32(factor); const rgbaint_t scale2(_mm_sub_epi32(_mm_set1_epi32(0x100), scale1)); @@ -184,7 +184,7 @@ void rgbaint_t::scale_and_clamp(const rgbaint_t& scale) clamp_to_uint8(); } -void rgbaint_t::scale_imm_and_clamp(const int32_t scale) +void rgbaint_t::scale_imm_and_clamp(const s32 scale) { mul_imm(scale); sra_imm(8); diff --git a/src/emu/video/rgbsse.h b/src/emu/video/rgbsse.h index 521000f4488..83028f894d2 100644 --- a/src/emu/video/rgbsse.h +++ b/src/emu/video/rgbsse.h @@ -29,8 +29,8 @@ class rgbaint_t { public: rgbaint_t() { } - explicit rgbaint_t(uint32_t rgba) { set(rgba); } - rgbaint_t(int32_t a, int32_t r, int32_t g, int32_t b) { set(a, r, g, b); } + explicit rgbaint_t(u32 rgba) { set(rgba); } + rgbaint_t(s32 a, s32 r, s32 g, s32 b) { set(a, r, g, b); } explicit rgbaint_t(const rgb_t& rgb) { set(rgb); } explicit rgbaint_t(__m128i rgba) { m_value = rgba; } @@ -38,8 +38,8 @@ public: rgbaint_t &operator=(const rgbaint_t& other) = default; void set(const rgbaint_t& other) { m_value = other.m_value; } - void set(uint32_t rgba) { m_value = _mm_and_si128(_mm_set1_epi32(0xff), _mm_set_epi32(rgba >> 24, rgba >> 16, rgba >> 8, rgba)); } - void set(int32_t a, int32_t r, int32_t g, int32_t b) { m_value = _mm_set_epi32(a, r, g, b); } + void set(u32 rgba) { m_value = _mm_and_si128(_mm_set1_epi32(0xff), _mm_set_epi32(rgba >> 24, rgba >> 16, rgba >> 8, rgba)); } + void set(s32 a, s32 r, s32 g, s32 b) { m_value = _mm_set_epi32(a, r, g, b); } void set(const rgb_t& rgb) { m_value = _mm_unpacklo_epi16(_mm_unpacklo_epi8(_mm_cvtsi32_si128(rgb), _mm_setzero_si128()), _mm_setzero_si128()); } inline rgb_t to_rgba() const @@ -53,32 +53,32 @@ public: } #ifdef __SSE4_1__ - void set_a(const int32_t value) { m_value = _mm_insert_epi32(m_value, value, 3); } - void set_r(const int32_t value) { m_value = _mm_insert_epi32(m_value, value, 2); } - void set_g(const int32_t value) { m_value = _mm_insert_epi32(m_value, value, 1); } - void set_b(const int32_t value) { m_value = _mm_insert_epi32(m_value, value, 0); } + void set_a(const s32 value) { m_value = _mm_insert_epi32(m_value, value, 3); } + void set_r(const s32 value) { m_value = _mm_insert_epi32(m_value, value, 2); } + void set_g(const s32 value) { m_value = _mm_insert_epi32(m_value, value, 1); } + void set_b(const s32 value) { m_value = _mm_insert_epi32(m_value, value, 0); } #else - void set_a(const int32_t value) { m_value = _mm_or_si128(_mm_and_si128(m_value, alpha_mask()), _mm_set_epi32(value, 0, 0, 0)); } - void set_r(const int32_t value) { m_value = _mm_or_si128(_mm_and_si128(m_value, red_mask()), _mm_set_epi32(0, value, 0, 0)); } - void set_g(const int32_t value) { m_value = _mm_or_si128(_mm_and_si128(m_value, green_mask()), _mm_set_epi32(0, 0, value, 0)); } - void set_b(const int32_t value) { m_value = _mm_or_si128(_mm_and_si128(m_value, blue_mask()), _mm_set_epi32(0, 0, 0, value)); } + void set_a(const s32 value) { m_value = _mm_or_si128(_mm_and_si128(m_value, alpha_mask()), _mm_set_epi32(value, 0, 0, 0)); } + void set_r(const s32 value) { m_value = _mm_or_si128(_mm_and_si128(m_value, red_mask()), _mm_set_epi32(0, value, 0, 0)); } + void set_g(const s32 value) { m_value = _mm_or_si128(_mm_and_si128(m_value, green_mask()), _mm_set_epi32(0, 0, value, 0)); } + void set_b(const s32 value) { m_value = _mm_or_si128(_mm_and_si128(m_value, blue_mask()), _mm_set_epi32(0, 0, 0, value)); } #endif - uint8_t get_a() const { return uint8_t(unsigned(_mm_extract_epi16(m_value, 6))); } - uint8_t get_r() const { return uint8_t(unsigned(_mm_extract_epi16(m_value, 4))); } - uint8_t get_g() const { return uint8_t(unsigned(_mm_extract_epi16(m_value, 2))); } - uint8_t get_b() const { return uint8_t(unsigned(_mm_extract_epi16(m_value, 0))); } + u8 get_a() const { return u8(unsigned(_mm_extract_epi16(m_value, 6))); } + u8 get_r() const { return u8(unsigned(_mm_extract_epi16(m_value, 4))); } + u8 get_g() const { return u8(unsigned(_mm_extract_epi16(m_value, 2))); } + u8 get_b() const { return u8(unsigned(_mm_extract_epi16(m_value, 0))); } #ifdef __SSE4_1__ - int32_t get_a32() const { return _mm_extract_epi32(m_value, 3); } - int32_t get_r32() const { return _mm_extract_epi32(m_value, 2); } - int32_t get_g32() const { return _mm_extract_epi32(m_value, 1); } - int32_t get_b32() const { return _mm_extract_epi32(m_value, 0); } + s32 get_a32() const { return _mm_extract_epi32(m_value, 3); } + s32 get_r32() const { return _mm_extract_epi32(m_value, 2); } + s32 get_g32() const { return _mm_extract_epi32(m_value, 1); } + s32 get_b32() const { return _mm_extract_epi32(m_value, 0); } #else - int32_t get_a32() const { return (_mm_extract_epi16(m_value, 7) << 16) | _mm_extract_epi16(m_value, 6); } - int32_t get_r32() const { return (_mm_extract_epi16(m_value, 5) << 16) | _mm_extract_epi16(m_value, 4); } - int32_t get_g32() const { return (_mm_extract_epi16(m_value, 3) << 16) | _mm_extract_epi16(m_value, 2); } - int32_t get_b32() const { return (_mm_extract_epi16(m_value, 1) << 16) | _mm_extract_epi16(m_value, 0); } + s32 get_a32() const { return (_mm_extract_epi16(m_value, 7) << 16) | _mm_extract_epi16(m_value, 6); } + s32 get_r32() const { return (_mm_extract_epi16(m_value, 5) << 16) | _mm_extract_epi16(m_value, 4); } + s32 get_g32() const { return (_mm_extract_epi16(m_value, 3) << 16) | _mm_extract_epi16(m_value, 2); } + s32 get_b32() const { return (_mm_extract_epi16(m_value, 1) << 16) | _mm_extract_epi16(m_value, 0); } #endif inline void add(const rgbaint_t& color2) @@ -86,12 +86,12 @@ public: m_value = _mm_add_epi32(m_value, color2.m_value); } - inline void add_imm(const int32_t imm) + inline void add_imm(const s32 imm) { m_value = _mm_add_epi32(m_value, _mm_set1_epi32(imm)); } - inline void add_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void add_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { m_value = _mm_add_epi32(m_value, _mm_set_epi32(a, r, g, b)); } @@ -101,12 +101,12 @@ public: m_value = _mm_sub_epi32(m_value, color2.m_value); } - inline void sub_imm(const int32_t imm) + inline void sub_imm(const s32 imm) { m_value = _mm_sub_epi32(m_value, _mm_set1_epi32(imm)); } - inline void sub_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void sub_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { m_value = _mm_sub_epi32(m_value, _mm_set_epi32(a, r, g, b)); } @@ -116,12 +116,12 @@ public: m_value = _mm_sub_epi32(color2.m_value, m_value); } - inline void subr_imm(const int32_t imm) + inline void subr_imm(const s32 imm) { m_value = _mm_sub_epi32(_mm_set1_epi32(imm), m_value); } - inline void subr_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void subr_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { m_value = _mm_sub_epi32(_mm_set_epi32(a, r, g, b), m_value); } @@ -133,7 +133,7 @@ public: m_value = _mm_unpacklo_epi32(_mm_shuffle_epi32(tmp1, _MM_SHUFFLE(0, 0, 2, 0)), _mm_shuffle_epi32(tmp2, _MM_SHUFFLE(0, 0, 2, 0))); } - inline void mul_imm(const int32_t imm) + inline void mul_imm(const s32 imm) { __m128i immv = _mm_set1_epi32(imm); __m128i tmp1 = _mm_mul_epu32(m_value, immv); @@ -141,7 +141,7 @@ public: m_value = _mm_unpacklo_epi32(_mm_shuffle_epi32(tmp1, _MM_SHUFFLE(0, 0, 2, 0)), _mm_shuffle_epi32(tmp2, _MM_SHUFFLE(0, 0, 2, 0))); } - inline void mul_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void mul_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { __m128i immv = _mm_set_epi32(a, r, g, b); __m128i tmp1 = _mm_mul_epu32(m_value, immv); @@ -166,7 +166,7 @@ public: set(areg.get_a32(), rreg.get_r32(), greg.get_g32(), breg.get_b32()); } - inline void shl_imm(const uint8_t shift) + inline void shl_imm(const u8 shift) { m_value = _mm_slli_epi32(m_value, shift); } @@ -188,7 +188,7 @@ public: set(areg.get_a32(), rreg.get_r32(), greg.get_g32(), breg.get_b32()); } - inline void shr_imm(const uint8_t shift) + inline void shr_imm(const u8 shift) { m_value = _mm_srli_epi32(m_value, shift); } @@ -210,7 +210,7 @@ public: set(areg.get_a32(), rreg.get_r32(), greg.get_g32(), breg.get_b32()); } - inline void sra_imm(const uint8_t shift) + inline void sra_imm(const u8 shift) { m_value = _mm_srai_epi32(m_value, shift); } @@ -221,15 +221,15 @@ public: void andnot_reg(const rgbaint_t& color2) { m_value = _mm_andnot_si128(color2.m_value, m_value); } - void or_imm(int32_t value) { m_value = _mm_or_si128(m_value, _mm_set1_epi32(value)); } - void and_imm(int32_t value) { m_value = _mm_and_si128(m_value, _mm_set1_epi32(value)); } - void xor_imm(int32_t value) { m_value = _mm_xor_si128(m_value, _mm_set1_epi32(value)); } + void or_imm(s32 value) { m_value = _mm_or_si128(m_value, _mm_set1_epi32(value)); } + void and_imm(s32 value) { m_value = _mm_and_si128(m_value, _mm_set1_epi32(value)); } + void xor_imm(s32 value) { m_value = _mm_xor_si128(m_value, _mm_set1_epi32(value)); } - void or_imm_rgba(int32_t a, int32_t r, int32_t g, int32_t b) { m_value = _mm_or_si128(m_value, _mm_set_epi32(a, r, g, b)); } - void and_imm_rgba(int32_t a, int32_t r, int32_t g, int32_t b) { m_value = _mm_and_si128(m_value, _mm_set_epi32(a, r, g, b)); } - void xor_imm_rgba(int32_t a, int32_t r, int32_t g, int32_t b) { m_value = _mm_xor_si128(m_value, _mm_set_epi32(a, r, g, b)); } + void or_imm_rgba(s32 a, s32 r, s32 g, s32 b) { m_value = _mm_or_si128(m_value, _mm_set_epi32(a, r, g, b)); } + void and_imm_rgba(s32 a, s32 r, s32 g, s32 b) { m_value = _mm_and_si128(m_value, _mm_set_epi32(a, r, g, b)); } + void xor_imm_rgba(s32 a, s32 r, s32 g, s32 b) { m_value = _mm_xor_si128(m_value, _mm_set_epi32(a, r, g, b)); } - inline void clamp_and_clear(const uint32_t sign) + inline void clamp_and_clear(const u32 sign) { __m128i vsign = _mm_set1_epi32(sign); m_value = _mm_and_si128(m_value, _mm_cmpeq_epi32(_mm_and_si128(m_value, vsign), _mm_setzero_si128())); @@ -247,7 +247,7 @@ public: m_value = _mm_unpacklo_epi16(m_value, _mm_setzero_si128()); } - inline void sign_extend(const uint32_t compare, const uint32_t sign) + inline void sign_extend(const u32 compare, const u32 sign) { __m128i compare_vec = _mm_set1_epi32(compare); __m128i compare_mask = _mm_cmpeq_epi32(_mm_and_si128(m_value, compare_vec), compare_vec); @@ -255,7 +255,7 @@ public: m_value = _mm_or_si128(m_value, compared); } - inline void min(const int32_t value) + inline void min(const s32 value) { __m128i val = _mm_set1_epi32(value); __m128i is_greater_than = _mm_cmpgt_epi32(m_value, val); @@ -267,7 +267,7 @@ public: m_value = _mm_or_si128(val_to_set, m_value); } - inline void max(const int32_t value) + inline void max(const s32 value) { __m128i val = _mm_set1_epi32(value); __m128i is_less_than = _mm_cmplt_epi32(m_value, val); @@ -279,12 +279,12 @@ public: m_value = _mm_or_si128(val_to_set, m_value); } - void blend(const rgbaint_t& other, uint8_t factor); + void blend(const rgbaint_t& other, u8 factor); void scale_and_clamp(const rgbaint_t& scale); - void scale_imm_and_clamp(const int32_t scale); + void scale_imm_and_clamp(const s32 scale); - inline void scale_imm_add_and_clamp(const int32_t scale, const rgbaint_t& other) + inline void scale_imm_add_and_clamp(const s32 scale, const rgbaint_t& other) { mul_imm(scale); sra_imm(8); @@ -315,13 +315,13 @@ public: void cmpgt(const rgbaint_t& value) { m_value = _mm_cmpgt_epi32(m_value, value.m_value); } void cmplt(const rgbaint_t& value) { m_value = _mm_cmplt_epi32(m_value, value.m_value); } - void cmpeq_imm(int32_t value) { m_value = _mm_cmpeq_epi32(m_value, _mm_set1_epi32(value)); } - void cmpgt_imm(int32_t value) { m_value = _mm_cmpgt_epi32(m_value, _mm_set1_epi32(value)); } - void cmplt_imm(int32_t value) { m_value = _mm_cmplt_epi32(m_value, _mm_set1_epi32(value)); } + void cmpeq_imm(s32 value) { m_value = _mm_cmpeq_epi32(m_value, _mm_set1_epi32(value)); } + void cmpgt_imm(s32 value) { m_value = _mm_cmpgt_epi32(m_value, _mm_set1_epi32(value)); } + void cmplt_imm(s32 value) { m_value = _mm_cmplt_epi32(m_value, _mm_set1_epi32(value)); } - void cmpeq_imm_rgba(int32_t a, int32_t r, int32_t g, int32_t b) { m_value = _mm_cmpeq_epi32(m_value, _mm_set_epi32(a, r, g, b)); } - void cmpgt_imm_rgba(int32_t a, int32_t r, int32_t g, int32_t b) { m_value = _mm_cmpgt_epi32(m_value, _mm_set_epi32(a, r, g, b)); } - void cmplt_imm_rgba(int32_t a, int32_t r, int32_t g, int32_t b) { m_value = _mm_cmplt_epi32(m_value, _mm_set_epi32(a, r, g, b)); } + void cmpeq_imm_rgba(s32 a, s32 r, s32 g, s32 b) { m_value = _mm_cmpeq_epi32(m_value, _mm_set_epi32(a, r, g, b)); } + void cmpgt_imm_rgba(s32 a, s32 r, s32 g, s32 b) { m_value = _mm_cmpgt_epi32(m_value, _mm_set_epi32(a, r, g, b)); } + void cmplt_imm_rgba(s32 a, s32 r, s32 g, s32 b) { m_value = _mm_cmplt_epi32(m_value, _mm_set_epi32(a, r, g, b)); } inline rgbaint_t& operator+=(const rgbaint_t& other) { @@ -329,7 +329,7 @@ public: return *this; } - inline rgbaint_t& operator+=(const int32_t other) + inline rgbaint_t& operator+=(const s32 other) { m_value = _mm_add_epi32(m_value, _mm_set1_epi32(other)); return *this; @@ -347,14 +347,14 @@ public: return *this; } - inline rgbaint_t& operator*=(const int32_t other) + inline rgbaint_t& operator*=(const s32 other) { const __m128i immv = _mm_set1_epi32(other); m_value = _mm_unpacklo_epi32(_mm_shuffle_epi32(_mm_mul_epu32(m_value, immv), _MM_SHUFFLE(0, 0, 2, 0)), _mm_shuffle_epi32(_mm_mul_epu32(_mm_srli_si128(m_value, 4), _mm_srli_si128(immv, 4)), _MM_SHUFFLE(0, 0, 2, 0))); return *this; } - inline rgbaint_t& operator>>=(const int32_t shift) + inline rgbaint_t& operator>>=(const s32 shift) { m_value = _mm_srai_epi32(m_value, shift); return *this; @@ -370,7 +370,7 @@ public: #endif } - static uint32_t bilinear_filter(uint32_t rgb00, uint32_t rgb01, uint32_t rgb10, uint32_t rgb11, uint8_t u, uint8_t v) + static u32 bilinear_filter(u32 rgb00, u32 rgb01, u32 rgb10, u32 rgb11, u8 u, u8 v) { __m128i color00 = _mm_cvtsi32_si128(rgb00); __m128i color01 = _mm_cvtsi32_si128(rgb01); @@ -394,7 +394,7 @@ public: return _mm_cvtsi128_si32(color01); } - void bilinear_filter_rgbaint(uint32_t rgb00, uint32_t rgb01, uint32_t rgb10, uint32_t rgb11, uint8_t u, uint8_t v) + void bilinear_filter_rgbaint(u32 rgb00, u32 rgb01, u32 rgb10, u32 rgb11, u8 u, u8 v) { __m128i color00 = _mm_cvtsi32_si128(rgb00); __m128i color01 = _mm_cvtsi32_si128(rgb01); @@ -419,18 +419,18 @@ protected: struct _statics { __m128 dummy_for_alignment; - uint16_t alpha_mask[8]; - uint16_t red_mask[8]; - uint16_t green_mask[8]; - uint16_t blue_mask[8]; - int16_t scale_table[256][8]; + u16 alpha_mask[8]; + u16 red_mask[8]; + u16 green_mask[8]; + u16 blue_mask[8]; + s16 scale_table[256][8]; }; static __m128i alpha_mask() { return *(__m128i *)&statics.alpha_mask[0]; } static __m128i red_mask() { return *(__m128i *)&statics.red_mask[0]; } static __m128i green_mask() { return *(__m128i *)&statics.green_mask[0]; } static __m128i blue_mask() { return *(__m128i *)&statics.blue_mask[0]; } - static __m128i scale_factor(uint8_t index) { return *(__m128i *)&statics.scale_table[index][0]; } + static __m128i scale_factor(u8 index) { return *(__m128i *)&statics.scale_table[index][0]; } __m128i m_value; @@ -438,4 +438,4 @@ protected: }; -#endif /* __RGBSSE__ */ +#endif /* MAME_EMU_VIDEO_RGBSSE_H */ diff --git a/src/emu/video/rgbvmx.cpp b/src/emu/video/rgbvmx.cpp index e7c035fa53c..5673e82a7bf 100644 --- a/src/emu/video/rgbvmx.cpp +++ b/src/emu/video/rgbvmx.cpp @@ -164,7 +164,7 @@ const rgbaint_t::VECS16 rgbaint_t::scale_table[256] = { HIGHER LEVEL OPERATIONS ***************************************************************************/ -void rgbaint_t::blend(const rgbaint_t& other, uint8_t factor) +void rgbaint_t::blend(const rgbaint_t& other, u8 factor) { const VECU32 shift = vec_splat_u32(-16); const VECS32 scale1 = { factor, factor, factor, factor }; @@ -189,7 +189,7 @@ void rgbaint_t::scale_and_clamp(const rgbaint_t& scale) clamp_to_uint8(); } -void rgbaint_t::scale_imm_and_clamp(const int32_t scale) +void rgbaint_t::scale_imm_and_clamp(const s32 scale) { mul_imm(scale); sra_imm(8); diff --git a/src/emu/video/rgbvmx.h b/src/emu/video/rgbvmx.h index 302e42af998..1686f0d0b6b 100644 --- a/src/emu/video/rgbvmx.h +++ b/src/emu/video/rgbvmx.h @@ -29,8 +29,8 @@ protected: public: rgbaint_t() { set(0, 0, 0, 0); } - explicit rgbaint_t(uint32_t rgba) { set(rgba); } - rgbaint_t(int32_t a, int32_t r, int32_t g, int32_t b) { set(a, r, g, b); } + explicit rgbaint_t(u32 rgba) { set(rgba); } + rgbaint_t(s32 a, s32 r, s32 g, s32 b) { set(a, r, g, b); } explicit rgbaint_t(const rgb_t& rgb) { set(rgb); } explicit rgbaint_t(VECS32 rgba) : m_value(rgba) { } @@ -39,7 +39,7 @@ public: void set(const rgbaint_t& other) { m_value = other.m_value; } - void set(uint32_t rgba) + void set(u32 rgba) { const VECU32 zero = { 0, 0, 0, 0 }; #ifdef __LITTLE_ENDIAN__ @@ -51,7 +51,7 @@ public: #endif } - void set(int32_t a, int32_t r, int32_t g, int32_t b) + void set(s32 a, s32 r, s32 g, s32 b) { #ifdef __LITTLE_ENDIAN__ const VECS32 result = { b, g, r, a }; @@ -77,7 +77,7 @@ public: { VECU32 temp = VECU32(vec_packs(m_value, m_value)); temp = VECU32(vec_packsu(VECS16(temp), VECS16(temp))); - uint32_t result; + u32 result; vec_ste(temp, 0, &result); return result; } @@ -86,38 +86,38 @@ public: { VECU32 temp = VECU32(vec_packs(m_value, m_value)); temp = VECU32(vec_packsu(VECS16(temp), VECS16(temp))); - uint32_t result; + u32 result; vec_ste(temp, 0, &result); return result; } - void set_a(const int32_t value) + void set_a(const s32 value) { const VECS32 temp = { value, value, value, value }; m_value = vec_perm(m_value, temp, alpha_perm); } - void set_r(const int32_t value) + void set_r(const s32 value) { const VECS32 temp = { value, value, value, value }; m_value = vec_perm(m_value, temp, red_perm); } - void set_g(const int32_t value) + void set_g(const s32 value) { const VECS32 temp = { value, value, value, value }; m_value = vec_perm(m_value, temp, green_perm); } - void set_b(const int32_t value) + void set_b(const s32 value) { const VECS32 temp = { value, value, value, value }; m_value = vec_perm(m_value, temp, blue_perm); } - uint8_t get_a() const + u8 get_a() const { - uint8_t result; + u8 result; #ifdef __LITTLE_ENDIAN__ vec_ste(vec_splat(VECU8(m_value), 12), 0, &result); #else @@ -126,9 +126,9 @@ public: return result; } - uint8_t get_r() const + u8 get_r() const { - uint8_t result; + u8 result; #ifdef __LITTLE_ENDIAN__ vec_ste(vec_splat(VECU8(m_value), 8), 0, &result); #else @@ -137,9 +137,9 @@ public: return result; } - uint8_t get_g() const + u8 get_g() const { - uint8_t result; + u8 result; #ifdef __LITTLE_ENDIAN__ vec_ste(vec_splat(VECU8(m_value), 4), 0, &result); #else @@ -148,9 +148,9 @@ public: return result; } - uint8_t get_b() const + u8 get_b() const { - uint8_t result; + u8 result; #ifdef __LITTLE_ENDIAN__ vec_ste(vec_splat(VECU8(m_value), 0), 0, &result); #else @@ -159,9 +159,9 @@ public: return result; } - int32_t get_a32() const + s32 get_a32() const { - int32_t result; + s32 result; #ifdef __LITTLE_ENDIAN__ vec_ste(vec_splat(m_value, 3), 0, &result); #else @@ -170,9 +170,9 @@ public: return result; } - int32_t get_r32() const + s32 get_r32() const { - int32_t result; + s32 result; #ifdef __LITTLE_ENDIAN__ vec_ste(vec_splat(m_value, 2), 0, &result); #else @@ -181,9 +181,9 @@ public: return result; } - int32_t get_g32() const + s32 get_g32() const { - int32_t result; + s32 result; #ifdef __LITTLE_ENDIAN__ vec_ste(vec_splat(m_value, 1), 0, &result); #else @@ -192,9 +192,9 @@ public: return result; } - int32_t get_b32() const + s32 get_b32() const { - int32_t result; + s32 result; #ifdef __LITTLE_ENDIAN__ vec_ste(vec_splat(m_value, 0), 0, &result); #else @@ -208,13 +208,13 @@ public: m_value = vec_add(m_value, color2.m_value); } - inline void add_imm(const int32_t imm) + inline void add_imm(const s32 imm) { const VECS32 temp = { imm, imm, imm, imm }; m_value = vec_add(m_value, temp); } - inline void add_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void add_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { #ifdef __LITTLE_ENDIAN__ const VECS32 temp = { b, g, r, a }; @@ -229,13 +229,13 @@ public: m_value = vec_sub(m_value, color2.m_value); } - inline void sub_imm(const int32_t imm) + inline void sub_imm(const s32 imm) { const VECS32 temp = { imm, imm, imm, imm }; m_value = vec_sub(m_value, temp); } - inline void sub_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void sub_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { #ifdef __LITTLE_ENDIAN__ const VECS32 temp = { b, g, r, a }; @@ -250,13 +250,13 @@ public: m_value = vec_sub(color2.m_value, m_value); } - inline void subr_imm(const int32_t imm) + inline void subr_imm(const s32 imm) { const VECS32 temp = { imm, imm, imm, imm }; m_value = vec_sub(temp, m_value); } - inline void subr_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void subr_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { #ifdef __LITTLE_ENDIAN__ const VECS32 temp = { b, g, r, a }; @@ -277,9 +277,9 @@ public: #endif } - inline void mul_imm(const int32_t imm) + inline void mul_imm(const s32 imm) { - const VECU32 value = { uint32_t(imm), uint32_t(imm), uint32_t(imm), uint32_t(imm) }; + const VECU32 value = { u32(imm), u32(imm), u32(imm), u32(imm) }; const VECU32 shift = vec_splat_u32(-16); const VECU32 temp = vec_msum(VECU16(m_value), VECU16(vec_rl(value, shift)), vec_splat_u32(0)); #ifdef __LITTLE_ENDIAN__ @@ -289,12 +289,12 @@ public: #endif } - inline void mul_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void mul_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { #ifdef __LITTLE_ENDIAN__ - const VECU32 value = { uint32_t(b), uint32_t(g), uint32_t(r), uint32_t(a) }; + const VECU32 value = { u32(b), u32(g), u32(r), u32(a) }; #else - const VECU32 value = { uint32_t(a), uint32_t(r), uint32_t(g), uint32_t(b) }; + const VECU32 value = { u32(a), u32(r), u32(g), u32(b) }; #endif const VECU32 shift = vec_splat_u32(-16); const VECU32 temp = vec_msum(VECU16(m_value), VECU16(vec_rl(value, shift)), vec_splat_u32(0)); @@ -311,7 +311,7 @@ public: m_value = vec_and(vec_sl(m_value, VECU32(shift.m_value)), vec_cmpgt(limit, VECU32(shift.m_value))); } - inline void shl_imm(const uint8_t shift) + inline void shl_imm(const u8 shift) { const VECU32 temp = { shift, shift, shift, shift }; m_value = vec_sl(m_value, temp); @@ -323,7 +323,7 @@ public: m_value = vec_and(vec_sr(m_value, VECU32(shift.m_value)), vec_cmpgt(limit, VECU32(shift.m_value))); } - inline void shr_imm(const uint8_t shift) + inline void shr_imm(const u8 shift) { const VECU32 temp = { shift, shift, shift, shift }; m_value = vec_sr(m_value, temp); @@ -335,7 +335,7 @@ public: m_value = vec_sra(m_value, vec_min(VECU32(shift.m_value), limit)); } - inline void sra_imm(const uint8_t shift) + inline void sra_imm(const u8 shift) { const VECU32 temp = { shift, shift, shift, shift }; m_value = vec_sra(m_value, temp); @@ -346,13 +346,13 @@ public: m_value = vec_or(m_value, color2.m_value); } - inline void or_imm(const int32_t value) + inline void or_imm(const s32 value) { const VECS32 temp = { value, value, value, value }; m_value = vec_or(m_value, temp); } - inline void or_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void or_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { #ifdef __LITTLE_ENDIAN__ const VECS32 temp = { b, g, r, a }; @@ -372,13 +372,13 @@ public: m_value = vec_andc(m_value, color.m_value); } - inline void and_imm(const int32_t value) + inline void and_imm(const s32 value) { const VECS32 temp = { value, value, value, value }; m_value = vec_and(m_value, temp); } - inline void and_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void and_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { #ifdef __LITTLE_ENDIAN__ const VECS32 temp = { b, g, r, a }; @@ -393,13 +393,13 @@ public: m_value = vec_xor(m_value, color2.m_value); } - inline void xor_imm(const int32_t value) + inline void xor_imm(const s32 value) { const VECS32 temp = { value, value, value, value }; m_value = vec_xor(m_value, temp); } - inline void xor_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void xor_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { #ifdef __LITTLE_ENDIAN__ const VECS32 temp = { b, g, r, a }; @@ -409,10 +409,10 @@ public: m_value = vec_xor(m_value, temp); } - inline void clamp_and_clear(const uint32_t sign) + inline void clamp_and_clear(const u32 sign) { const VECS32 vzero = { 0, 0, 0, 0 }; - VECS32 vsign = { int32_t(sign), int32_t(sign), int32_t(sign), int32_t(sign) }; + VECS32 vsign = { s32(sign), s32(sign), s32(sign), s32(sign) }; m_value = vec_and(m_value, vec_cmpeq(vec_and(m_value, vsign), vzero)); vsign = vec_nor(vec_sra(vsign, vec_splat_u32(1)), vzero); const VECS32 mask = VECS32(vec_cmpgt(m_value, vsign)); @@ -433,32 +433,32 @@ public: #endif } - inline void sign_extend(const uint32_t compare, const uint32_t sign) + inline void sign_extend(const u32 compare, const u32 sign) { - const VECS32 compare_vec = { int32_t(compare), int32_t(compare), int32_t(compare), int32_t(compare) }; + const VECS32 compare_vec = { s32(compare), s32(compare), s32(compare), s32(compare) }; const VECS32 compare_mask = VECS32(vec_cmpeq(vec_and(m_value, compare_vec), compare_vec)); - const VECS32 sign_vec = { int32_t(sign), int32_t(sign), int32_t(sign), int32_t(sign) }; + const VECS32 sign_vec = { s32(sign), s32(sign), s32(sign), s32(sign) }; m_value = vec_or(m_value, vec_and(sign_vec, compare_mask)); } - inline void min(const int32_t value) + inline void min(const s32 value) { const VECS32 temp = { value, value, value, value }; m_value = vec_min(m_value, temp); } - inline void max(const int32_t value) + inline void max(const s32 value) { const VECS32 temp = { value, value, value, value }; m_value = vec_max(m_value, temp); } - void blend(const rgbaint_t& other, uint8_t factor); + void blend(const rgbaint_t& other, u8 factor); void scale_and_clamp(const rgbaint_t& scale); - void scale_imm_and_clamp(const int32_t scale); + void scale_imm_and_clamp(const s32 scale); - void scale_imm_add_and_clamp(const int32_t scale, const rgbaint_t& other) + void scale_imm_add_and_clamp(const s32 scale, const rgbaint_t& other) { mul_imm(scale); sra_imm(8); @@ -490,13 +490,13 @@ public: m_value = VECS32(vec_cmpeq(m_value, value.m_value)); } - inline void cmpeq_imm(const int32_t value) + inline void cmpeq_imm(const s32 value) { const VECS32 temp = { value, value, value, value }; m_value = VECS32(vec_cmpeq(m_value, temp)); } - inline void cmpeq_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void cmpeq_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { #ifdef __LITTLE_ENDIAN__ const VECS32 temp = { b, g, r, a }; @@ -511,13 +511,13 @@ public: m_value = VECS32(vec_cmpgt(m_value, value.m_value)); } - inline void cmpgt_imm(const int32_t value) + inline void cmpgt_imm(const s32 value) { const VECS32 temp = { value, value, value, value }; m_value = VECS32(vec_cmpgt(m_value, temp)); } - inline void cmpgt_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void cmpgt_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { #ifdef __LITTLE_ENDIAN__ const VECS32 temp = { b, g, r, a }; @@ -532,13 +532,13 @@ public: m_value = VECS32(vec_cmplt(m_value, value.m_value)); } - inline void cmplt_imm(const int32_t value) + inline void cmplt_imm(const s32 value) { const VECS32 temp = { value, value, value, value }; m_value = VECS32(vec_cmplt(m_value, temp)); } - inline void cmplt_imm_rgba(const int32_t a, const int32_t r, const int32_t g, const int32_t b) + inline void cmplt_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) { #ifdef __LITTLE_ENDIAN__ const VECS32 temp = { b, g, r, a }; @@ -554,7 +554,7 @@ public: return *this; } - inline rgbaint_t& operator+=(const int32_t other) + inline rgbaint_t& operator+=(const s32 other) { const VECS32 temp = { other, other, other, other }; m_value = vec_add(m_value, temp); @@ -579,7 +579,7 @@ public: return *this; } - inline rgbaint_t& operator*=(const int32_t other) + inline rgbaint_t& operator*=(const s32 other) { const VECS32 value = { other, other, other, other }; const VECU32 shift = vec_splat_u32(-16); @@ -592,9 +592,9 @@ public: return *this; } - inline rgbaint_t& operator>>=(const int32_t shift) + inline rgbaint_t& operator>>=(const s32 shift) { - const VECU32 temp = { uint32_t(shift), uint32_t(shift), uint32_t(shift), uint32_t(shift) }; + const VECU32 temp = { u32(shift), u32(shift), u32(shift), u32(shift) }; m_value = vec_sra(m_value, temp); return *this; } @@ -604,7 +604,7 @@ public: m_value = vec_perm(m_value, alpha.m_value, alpha_perm); } - static uint32_t bilinear_filter(const uint32_t &rgb00, const uint32_t &rgb01, const uint32_t &rgb10, const uint32_t &rgb11, uint8_t u, uint8_t v) + static u32 bilinear_filter(const u32 &rgb00, const u32 &rgb01, const u32 &rgb10, const u32 &rgb11, u8 u, u8 v) { const VECS32 zero = vec_splat_s32(0); @@ -642,12 +642,12 @@ public: color01 = VECS32(vec_packs(color01, color01)); color01 = VECS32(vec_packsu(VECS16(color01), VECS16(color01))); - uint32_t result; + u32 result; vec_ste(VECU32(color01), 0, &result); return result; } - void bilinear_filter_rgbaint(const uint32_t &rgb00, const uint32_t &rgb01, const uint32_t &rgb10, const uint32_t &rgb11, uint8_t u, uint8_t v) + void bilinear_filter_rgbaint(const u32 &rgb00, const u32 &rgb01, const u32 &rgb10, const u32 &rgb11, u8 u, u8 v) { const VECS32 zero = vec_splat_s32(0); diff --git a/src/frontend/mame/luaengine.cpp b/src/frontend/mame/luaengine.cpp index 274125b7775..6de0335fa77 100644 --- a/src/frontend/mame/luaengine.cpp +++ b/src/frontend/mame/luaengine.cpp @@ -428,9 +428,9 @@ T lua_engine::region_read(memory_region ®ion, offs_t address) continue; mem_content <<= 8; if(region.endianness() == ENDIANNESS_BIG) - mem_content |= region.u8((BYTE8_XOR_BE(addr) & lowmask) | (addr & ~lowmask)); + mem_content |= region.as_u8((BYTE8_XOR_BE(addr) & lowmask) | (addr & ~lowmask)); else - mem_content |= region.u8((BYTE8_XOR_LE(addr) & lowmask) | (addr & ~lowmask)); + mem_content |= region.as_u8((BYTE8_XOR_LE(addr) & lowmask) | (addr & ~lowmask)); } return mem_content; diff --git a/src/frontend/mame/ui/miscmenu.cpp b/src/frontend/mame/ui/miscmenu.cpp index cdec8a2f5ac..e991b4a8f06 100644 --- a/src/frontend/mame/ui/miscmenu.cpp +++ b/src/frontend/mame/ui/miscmenu.cpp @@ -250,7 +250,7 @@ void menu_bookkeeping::populate() util::stream_format(tempstring, _("Tickets dispensed: %1$d\n\n"), tickets); /* loop over coin counters */ - for (ctrnum = 0; ctrnum < COIN_COUNTERS; ctrnum++) + for (ctrnum = 0; ctrnum < bookkeeping_manager::COIN_COUNTERS; ctrnum++) { int count = machine().bookkeeping().coin_counter_get_count(ctrnum); diff --git a/src/lib/formats/ap2_dsk.cpp b/src/lib/formats/ap2_dsk.cpp index 319535b4687..df391194878 100644 --- a/src/lib/formats/ap2_dsk.cpp +++ b/src/lib/formats/ap2_dsk.cpp @@ -1633,7 +1633,7 @@ bool a2_edd_format::load(io_generic *io, uint32_t form_factor, floppy_image *ima stream[splice >> 3] ^= 0x80 >> (splice & 7); generate_track_from_bitstream(i >> 2, 0, stream, len, image, i & 3); - image->set_write_splice_position(i >> 2, 0, uint32_t(U64(200000000)*splice/len), i & 3); + image->set_write_splice_position(i >> 2, 0, uint32_t(uint64_t(200'000'000)*splice/len), i & 3); } free(img); return true; diff --git a/src/lib/util/chdcd.cpp b/src/lib/util/chdcd.cpp index f6176cd4cd9..b8d5eb80539 100644 --- a/src/lib/util/chdcd.cpp +++ b/src/lib/util/chdcd.cpp @@ -416,7 +416,7 @@ uint32_t read_uint32(FILE *infile) uint64_t read_uint64(FILE *infile) { - uint64_t res0 = U64(0), res1 = U64(0); + uint64_t res0(0), res1(0); uint64_t res; unsigned char buffer[8]; diff --git a/src/lib/util/coretmpl.h b/src/lib/util/coretmpl.h index 86f242422ac..5c29d97f89f 100644 --- a/src/lib/util/coretmpl.h +++ b/src/lib/util/coretmpl.h @@ -12,6 +12,7 @@ #pragma once +#include "osdcomm.h" #include "osdcore.h" #include "corealloc.h" @@ -354,6 +355,17 @@ private: namespace util { +using osd::u8; +using osd::u16; +using osd::u32; +using osd::u64; + +using osd::s8; +using osd::s16; +using osd::s32; +using osd::s64; + + // wraps an existing sequence of values template class contiguous_sequence_wrapper diff --git a/src/mame/drivers/altos486.cpp b/src/mame/drivers/altos486.cpp index c2e132aec05..59ebf8fab11 100644 --- a/src/mame/drivers/altos486.cpp +++ b/src/mame/drivers/altos486.cpp @@ -51,15 +51,15 @@ READ8_MEMBER(altos486_state::read_rmx_ack) READ16_MEMBER(altos486_state::mmu_ram_r) { - if(offset < 0x7e000) + if (offset < 0x7e000) return m_ram[offset]; // TODO else - return m_rom->u16(offset - 0x7e000); + return m_rom->as_u16(offset - 0x7e000); } READ16_MEMBER(altos486_state::mmu_io_r) { - if(!m_sys_mode) + if (!m_sys_mode) { m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); return 0; diff --git a/src/mame/drivers/aristmk6.cpp b/src/mame/drivers/aristmk6.cpp index 243d6c0b9bf..45ac58034c5 100644 --- a/src/mame/drivers/aristmk6.cpp +++ b/src/mame/drivers/aristmk6.cpp @@ -185,9 +185,9 @@ static ADDRESS_MAP_START( aristmk6_map, AS_PROGRAM, 64, aristmk6_state ) AM_RANGE(0x12000078, 0x1200007f) AM_WRITENOP // watchdog ?? AM_RANGE(0x12000080, 0x12000087) AM_WRITENOP // 0-1-2 written here repeatedly, diag LED or smth ? AM_RANGE(0x120000E0, 0x120000E7) AM_READ(hwver_r) - AM_RANGE(0x12400010, 0x12400017) AM_DEVREADWRITE8("uart1", ns16550_device, ins8250_r, ins8250_w, U64(0xffffffffffffffff)) - AM_RANGE(0x12400018, 0x1240001f) AM_DEVREADWRITE8("uart0", ns16550_device, ins8250_r, ins8250_w, U64(0xffffffffffffffff)) - AM_RANGE(0x13800000, 0x13800007) AM_READ8(test_r, U64(0xffffffffffffffff)) + AM_RANGE(0x12400010, 0x12400017) AM_DEVREADWRITE8("uart1", ns16550_device, ins8250_r, ins8250_w, 0xffffffffffffffffU) + AM_RANGE(0x12400018, 0x1240001f) AM_DEVREADWRITE8("uart0", ns16550_device, ins8250_r, ins8250_w, 0xffffffffffffffffU) + AM_RANGE(0x13800000, 0x13800007) AM_READ8(test_r, 0xffffffffffffffffU) ADDRESS_MAP_END static ADDRESS_MAP_START( aristmk6_port, AS_IO, 64, aristmk6_state ) diff --git a/src/mame/drivers/atvtrack.cpp b/src/mame/drivers/atvtrack.cpp index d0c9026e02f..398200c7fff 100644 --- a/src/mame/drivers/atvtrack.cpp +++ b/src/mame/drivers/atvtrack.cpp @@ -215,7 +215,7 @@ READ64_MEMBER(atvtrack_state::area2_r) for (c = 3;c >= 0;c--) { if (m_nandcommand[c] <= 0x50) { addr = m_nandaddress[c]+m_nandoffset[c]; - dat = (dat << 8) | m_nandregion->u8(addr+c); + dat = (dat << 8) | m_nandregion->as_u8(addr+c); m_nandoffset[c] += 4; } else dat = (dat << 8) | 0xc0; diff --git a/src/mame/drivers/bebox.cpp b/src/mame/drivers/bebox.cpp index 905e8b01273..ffc715efa9a 100644 --- a/src/mame/drivers/bebox.cpp +++ b/src/mame/drivers/bebox.cpp @@ -38,33 +38,33 @@ static ADDRESS_MAP_START( bebox_mem, AS_PROGRAM, 64, bebox_state ) AM_RANGE(0x7FFFF3F0, 0x7FFFF3F7) AM_READWRITE(bebox_crossproc_interrupts_r, bebox_crossproc_interrupts_w ) AM_RANGE(0x7FFFF4F0, 0x7FFFF4F7) AM_WRITE(bebox_processor_resets_w ) - AM_RANGE(0x80000000, 0x8000001F) AM_DEVREADWRITE8("dma8237_1", am9517a_device, read, write, U64(0xffffffffffffffff) ) - AM_RANGE(0x80000020, 0x8000003F) AM_DEVREADWRITE8("pic8259_1", pic8259_device, read, write, U64(0xffffffffffffffff) ) - AM_RANGE(0x80000040, 0x8000005f) AM_DEVREADWRITE8("pit8254", pit8254_device, read, write, U64(0xffffffffffffffff) ) - AM_RANGE(0x80000060, 0x8000006F) AM_DEVREADWRITE8("kbdc", kbdc8042_device, data_r, data_w, U64(0xffffffffffffffff) ) - AM_RANGE(0x80000070, 0x8000007F) AM_DEVREADWRITE8("rtc", mc146818_device, read, write , U64(0xffffffffffffffff) ) - AM_RANGE(0x80000080, 0x8000009F) AM_READWRITE8(bebox_page_r, bebox_page_w, U64(0xffffffffffffffff) ) - AM_RANGE(0x800000A0, 0x800000BF) AM_DEVREADWRITE8("pic8259_2", pic8259_device, read, write, U64(0xffffffffffffffff) ) - AM_RANGE(0x800000C0, 0x800000DF) AM_READWRITE8(at_dma8237_1_r, at_dma8237_1_w, U64(0xffffffffffffffff)) - AM_RANGE(0x800001F0, 0x800001F7) AM_DEVREADWRITE16("ide", ide_controller_device, read_cs0, write_cs0, U64(0xffffffffffffffff) ) - AM_RANGE(0x800002F8, 0x800002FF) AM_DEVREADWRITE8( "ns16550_1", ns16550_device, ins8250_r, ins8250_w, U64(0xffffffffffffffff) ) - AM_RANGE(0x80000380, 0x80000387) AM_DEVREADWRITE8( "ns16550_2", ns16550_device, ins8250_r, ins8250_w, U64(0xffffffffffffffff) ) - AM_RANGE(0x80000388, 0x8000038F) AM_DEVREADWRITE8( "ns16550_3", ns16550_device, ins8250_r, ins8250_w, U64(0xffffffffffffffff) ) - AM_RANGE(0x800003b0, 0x800003bf) AM_DEVREADWRITE8("vga", cirrus_gd5428_device, port_03b0_r, port_03b0_w, U64(0xffffffffffffffff)) - AM_RANGE(0x800003c0, 0x800003cf) AM_DEVREADWRITE8("vga", cirrus_gd5428_device, port_03c0_r, port_03c0_w, U64(0xffffffffffffffff)) - AM_RANGE(0x800003d0, 0x800003df) AM_DEVREADWRITE8("vga", cirrus_gd5428_device, port_03d0_r, port_03d0_w, U64(0xffffffffffffffff)) - AM_RANGE(0x800003F0, 0x800003F7) AM_DEVREADWRITE16("ide", ide_controller_device, read_cs1, write_cs1, U64(0xffffffffffffffff) ) - AM_RANGE(0x800003F0, 0x800003F7) AM_DEVICE8( "smc37c78", smc37c78_device, map, U64(0xffffffffffffffff) ) - AM_RANGE(0x800003F8, 0x800003FF) AM_DEVREADWRITE8( "ns16550_0",ns16550_device, ins8250_r, ins8250_w, U64(0xffffffffffffffff) ) - AM_RANGE(0x80000480, 0x8000048F) AM_READWRITE8(bebox_80000480_r, bebox_80000480_w, U64(0xffffffffffffffff) ) + AM_RANGE(0x80000000, 0x8000001F) AM_DEVREADWRITE8("dma8237_1", am9517a_device, read, write, 0xffffffffffffffffU ) + AM_RANGE(0x80000020, 0x8000003F) AM_DEVREADWRITE8("pic8259_1", pic8259_device, read, write, 0xffffffffffffffffU ) + AM_RANGE(0x80000040, 0x8000005f) AM_DEVREADWRITE8("pit8254", pit8254_device, read, write, 0xffffffffffffffffU ) + AM_RANGE(0x80000060, 0x8000006F) AM_DEVREADWRITE8("kbdc", kbdc8042_device, data_r, data_w, 0xffffffffffffffffU ) + AM_RANGE(0x80000070, 0x8000007F) AM_DEVREADWRITE8("rtc", mc146818_device, read, write , 0xffffffffffffffffU ) + AM_RANGE(0x80000080, 0x8000009F) AM_READWRITE8(bebox_page_r, bebox_page_w, 0xffffffffffffffffU ) + AM_RANGE(0x800000A0, 0x800000BF) AM_DEVREADWRITE8("pic8259_2", pic8259_device, read, write, 0xffffffffffffffffU ) + AM_RANGE(0x800000C0, 0x800000DF) AM_READWRITE8(at_dma8237_1_r, at_dma8237_1_w, 0xffffffffffffffffU) + AM_RANGE(0x800001F0, 0x800001F7) AM_DEVREADWRITE16("ide", ide_controller_device, read_cs0, write_cs0, 0xffffffffffffffffU ) + AM_RANGE(0x800002F8, 0x800002FF) AM_DEVREADWRITE8( "ns16550_1", ns16550_device, ins8250_r, ins8250_w, 0xffffffffffffffffU ) + AM_RANGE(0x80000380, 0x80000387) AM_DEVREADWRITE8( "ns16550_2", ns16550_device, ins8250_r, ins8250_w, 0xffffffffffffffffU ) + AM_RANGE(0x80000388, 0x8000038F) AM_DEVREADWRITE8( "ns16550_3", ns16550_device, ins8250_r, ins8250_w, 0xffffffffffffffffU ) + AM_RANGE(0x800003b0, 0x800003bf) AM_DEVREADWRITE8("vga", cirrus_gd5428_device, port_03b0_r, port_03b0_w, 0xffffffffffffffffU) + AM_RANGE(0x800003c0, 0x800003cf) AM_DEVREADWRITE8("vga", cirrus_gd5428_device, port_03c0_r, port_03c0_w, 0xffffffffffffffffU) + AM_RANGE(0x800003d0, 0x800003df) AM_DEVREADWRITE8("vga", cirrus_gd5428_device, port_03d0_r, port_03d0_w, 0xffffffffffffffffU) + AM_RANGE(0x800003F0, 0x800003F7) AM_DEVREADWRITE16("ide", ide_controller_device, read_cs1, write_cs1, 0xffffffffffffffffU ) + AM_RANGE(0x800003F0, 0x800003F7) AM_DEVICE8( "smc37c78", smc37c78_device, map, 0xffffffffffffffffU ) + AM_RANGE(0x800003F8, 0x800003FF) AM_DEVREADWRITE8( "ns16550_0",ns16550_device, ins8250_r, ins8250_w, 0xffffffffffffffffU ) + AM_RANGE(0x80000480, 0x8000048F) AM_READWRITE8(bebox_80000480_r, bebox_80000480_w, 0xffffffffffffffffU ) AM_RANGE(0x80000CF8, 0x80000CFF) AM_DEVREADWRITE("pcibus", pci_bus_device, read_64be, write_64be ) - //AM_RANGE(0x800042E8, 0x800042EF) AM_DEVWRITE8("cirrus", cirrus_device, cirrus_42E8_w, U64(0xffffffffffffffff) ) + //AM_RANGE(0x800042E8, 0x800042EF) AM_DEVWRITE8("cirrus", cirrus_device, cirrus_42E8_w, 0xffffffffffffffffU ) AM_RANGE(0xBFFFFFF0, 0xBFFFFFFF) AM_READ(bebox_interrupt_ack_r ) - AM_RANGE(0xC00A0000, 0xC00BFFFF) AM_DEVREADWRITE8("vga", cirrus_gd5428_device, mem_r, mem_w, U64(0xffffffffffffffff) ) - AM_RANGE(0xC1000000, 0xC11FFFFF) AM_DEVREADWRITE8("vga", cirrus_gd5428_device, mem_linear_r, mem_linear_w, U64(0xffffffffffffffff) ) + AM_RANGE(0xC00A0000, 0xC00BFFFF) AM_DEVREADWRITE8("vga", cirrus_gd5428_device, mem_r, mem_w, 0xffffffffffffffffU ) + AM_RANGE(0xC1000000, 0xC11FFFFF) AM_DEVREADWRITE8("vga", cirrus_gd5428_device, mem_linear_r, mem_linear_w, 0xffffffffffffffffU ) AM_RANGE(0xFFF00000, 0xFFF03FFF) AM_ROMBANK("bank2") - AM_RANGE(0xFFF04000, 0xFFFFFFFF) AM_READWRITE8(bebox_flash_r, bebox_flash_w, U64(0xffffffffffffffff) ) + AM_RANGE(0xFFF04000, 0xFFFFFFFF) AM_READWRITE8(bebox_flash_r, bebox_flash_w, 0xffffffffffffffffU ) ADDRESS_MAP_END // The following is a gross hack to let the BeBox boot ROM identify the processors correctly. diff --git a/src/mame/drivers/bfm_sc4.cpp b/src/mame/drivers/bfm_sc4.cpp index be004c2f562..2d60baec04b 100644 --- a/src/mame/drivers/bfm_sc4.cpp +++ b/src/mame/drivers/bfm_sc4.cpp @@ -310,7 +310,7 @@ READ16_MEMBER(sc4_state::sc4_cs1_r) } - return m_cpuregion->u16(offset); + return m_cpuregion->as_u16(offset); } else logerror("%08x maincpu read access offset %08x mem_mask %04x cs %d\n", pc, offset*2, mem_mask, 1); diff --git a/src/mame/drivers/bloodbro.cpp b/src/mame/drivers/bloodbro.cpp index 354d9068285..1b766e0bfb4 100644 --- a/src/mame/drivers/bloodbro.cpp +++ b/src/mame/drivers/bloodbro.cpp @@ -698,8 +698,8 @@ DRIVER_INIT_MEMBER(bloodbro_state,weststry) { // Patch out jp nz,$3000; no code known to exist at that address memory_region *z80_rom = memregion("audiocpu"); - z80_rom->u8(0x160e) = 0x00; - z80_rom->u8(0x1610) = 0x00; + z80_rom->as_u8(0x160e) = 0x00; + z80_rom->as_u8(0x1610) = 0x00; } diff --git a/src/mame/drivers/cobra.cpp b/src/mame/drivers/cobra.cpp index 1af6d4aa3a3..762d4fcd6bd 100644 --- a/src/mame/drivers/cobra.cpp +++ b/src/mame/drivers/cobra.cpp @@ -3044,7 +3044,7 @@ WRITE64_MEMBER(cobra_state::gfx_buf_w) m_renderer->gfx_fifo_exec(); - if (data == U64(0x00a0000110500018)) + if (data == 0x00a0000110500018U) { m_gfxfifo_out->flush(); @@ -3055,7 +3055,7 @@ WRITE64_MEMBER(cobra_state::gfx_buf_w) m_gfxfifo_out->push(&space.device(), (uint32_t)(regdata >> 32)); m_gfxfifo_out->push(&space.device(), (uint32_t)(regdata)); } - else if (data == U64(0x00a0000110520800)) + else if (data == 0x00a0000110520800U) { // in teximage_load() // some kind of busy flag for mbuslib_tex_ints()... @@ -3067,7 +3067,7 @@ WRITE64_MEMBER(cobra_state::gfx_buf_w) m_gfx_unk_status &= ~0x400; } - else if (data != U64(0x00a0000110520200)) // mbuslib_regread() + else if (data != 0x00a0000110520200U) // mbuslib_regread() { // prc_read always expects a value... @@ -3375,8 +3375,8 @@ DRIVER_INIT_MEMBER(cobra_state, cobra) m_sound_dma_buffer_r = std::make_unique(DMA_SOUND_BUFFER_SIZE); // setup fake pagetable until we figure out what really maps there... - //m_gfx_pagetable[0x80 / 8] = U64(0x800001001e0001a8); - m_gfx_pagetable[0x80 / 8] = U64(0x80000100200001a8); // should this map to 0x1e000000? + //m_gfx_pagetable[0x80 / 8] = 0x800001001e0001a8U; + m_gfx_pagetable[0x80 / 8] = 0x80000100200001a8U; // should this map to 0x1e000000? } DRIVER_INIT_MEMBER(cobra_state,bujutsu) diff --git a/src/mame/drivers/cv1k.cpp b/src/mame/drivers/cv1k.cpp index e11cb22175f..361ee318e92 100644 --- a/src/mame/drivers/cv1k.cpp +++ b/src/mame/drivers/cv1k.cpp @@ -336,9 +336,9 @@ WRITE8_MEMBER( cv1k_state::serial_rtc_eeprom_w ) static ADDRESS_MAP_START( cv1k_map, AS_PROGRAM, 64, cv1k_state ) AM_RANGE(0x00000000, 0x003fffff) AM_ROM AM_REGION("maincpu", 0) AM_WRITENOP AM_SHARE("rombase") // mmmbanc writes here on startup for some reason.. AM_RANGE(0x0c000000, 0x0c7fffff) AM_RAM AM_SHARE("mainram") AM_MIRROR(0x800000) // work RAM - AM_RANGE(0x10000000, 0x10000007) AM_READWRITE8(flash_io_r, flash_io_w, U64(0xffffffffffffffff)) - AM_RANGE(0x10400000, 0x10400007) AM_DEVWRITE8("ymz770", ymz770_device, write, U64(0xffffffffffffffff)) - AM_RANGE(0x10C00000, 0x10C00007) AM_READWRITE8(serial_rtc_eeprom_r, serial_rtc_eeprom_w, U64(0xffffffffffffffff)) + AM_RANGE(0x10000000, 0x10000007) AM_READWRITE8(flash_io_r, flash_io_w, 0xffffffffffffffffU) + AM_RANGE(0x10400000, 0x10400007) AM_DEVWRITE8("ymz770", ymz770_device, write, 0xffffffffffffffffU) + AM_RANGE(0x10C00000, 0x10C00007) AM_READWRITE8(serial_rtc_eeprom_r, serial_rtc_eeprom_w, 0xffffffffffffffffU) // AM_RANGE(0x18000000, 0x18000057) // blitter, installed on reset AM_RANGE(0xf0000000, 0xf0ffffff) AM_RAM // mem mapped cache (sh3 internal?) ADDRESS_MAP_END @@ -346,9 +346,9 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( cv1k_d_map, AS_PROGRAM, 64, cv1k_state ) AM_RANGE(0x00000000, 0x003fffff) AM_ROM AM_REGION("maincpu", 0) AM_WRITENOP AM_SHARE("rombase") // mmmbanc writes here on startup for some reason.. AM_RANGE(0x0c000000, 0x0cffffff) AM_RAM AM_SHARE("mainram") // work RAM - AM_RANGE(0x10000000, 0x10000007) AM_READWRITE8(flash_io_r, flash_io_w, U64(0xffffffffffffffff)) - AM_RANGE(0x10400000, 0x10400007) AM_DEVWRITE8("ymz770", ymz770_device, write, U64(0xffffffffffffffff)) - AM_RANGE(0x10C00000, 0x10C00007) AM_READWRITE8(serial_rtc_eeprom_r, serial_rtc_eeprom_w, U64(0xffffffffffffffff)) + AM_RANGE(0x10000000, 0x10000007) AM_READWRITE8(flash_io_r, flash_io_w, 0xffffffffffffffffU) + AM_RANGE(0x10400000, 0x10400007) AM_DEVWRITE8("ymz770", ymz770_device, write, 0xffffffffffffffffU) + AM_RANGE(0x10C00000, 0x10C00007) AM_READWRITE8(serial_rtc_eeprom_r, serial_rtc_eeprom_w, 0xffffffffffffffffU) // AM_RANGE(0x18000000, 0x18000057) // blitter, installed on reset AM_RANGE(0xf0000000, 0xf0ffffff) AM_RAM // mem mapped cache (sh3 internal?) ADDRESS_MAP_END diff --git a/src/mame/drivers/dccons.cpp b/src/mame/drivers/dccons.cpp index 2c8978833d8..68f36b83194 100644 --- a/src/mame/drivers/dccons.cpp +++ b/src/mame/drivers/dccons.cpp @@ -371,18 +371,18 @@ WRITE8_MEMBER(dc_cons_state::dc_flash_w) static ADDRESS_MAP_START( dc_map, AS_PROGRAM, 64, dc_cons_state ) AM_RANGE(0x00000000, 0x001fffff) AM_ROM AM_WRITENOP // BIOS - AM_RANGE(0x00200000, 0x0021ffff) AM_ROM AM_REGION("dcflash",0)//AM_READWRITE8(dc_flash_r,dc_flash_w, U64(0xffffffffffffffff)) + AM_RANGE(0x00200000, 0x0021ffff) AM_ROM AM_REGION("dcflash",0)//AM_READWRITE8(dc_flash_r,dc_flash_w, 0xffffffffffffffffU) AM_RANGE(0x005f6800, 0x005f69ff) AM_READWRITE(dc_sysctrl_r, dc_sysctrl_w ) - AM_RANGE(0x005f6c00, 0x005f6cff) AM_DEVICE32( "maple_dc", maple_dc_device, amap, U64(0xffffffffffffffff) ) - AM_RANGE(0x005f7000, 0x005f701f) AM_DEVREADWRITE16("ata", ata_interface_device, read_cs1, write_cs1, U64(0x0000ffff0000ffff) ) - AM_RANGE(0x005f7080, 0x005f709f) AM_DEVREADWRITE16("ata", ata_interface_device, read_cs0, write_cs0, U64(0x0000ffff0000ffff) ) - AM_RANGE(0x005f7400, 0x005f74ff) AM_READWRITE32(dc_mess_g1_ctrl_r, dc_mess_g1_ctrl_w, U64(0xffffffffffffffff) ) + AM_RANGE(0x005f6c00, 0x005f6cff) AM_DEVICE32( "maple_dc", maple_dc_device, amap, 0xffffffffffffffffU ) + AM_RANGE(0x005f7000, 0x005f701f) AM_DEVREADWRITE16("ata", ata_interface_device, read_cs1, write_cs1, 0x0000ffff0000ffffU ) + AM_RANGE(0x005f7080, 0x005f709f) AM_DEVREADWRITE16("ata", ata_interface_device, read_cs0, write_cs0, 0x0000ffff0000ffffU ) + AM_RANGE(0x005f7400, 0x005f74ff) AM_READWRITE32(dc_mess_g1_ctrl_r, dc_mess_g1_ctrl_w, 0xffffffffffffffffU ) AM_RANGE(0x005f7800, 0x005f78ff) AM_READWRITE(dc_g2_ctrl_r, dc_g2_ctrl_w ) - AM_RANGE(0x005f7c00, 0x005f7cff) AM_DEVICE32("powervr2", powervr2_device, pd_dma_map, U64(0xffffffffffffffff)) - AM_RANGE(0x005f8000, 0x005f9fff) AM_DEVICE32("powervr2", powervr2_device, ta_map, U64(0xffffffffffffffff)) + AM_RANGE(0x005f7c00, 0x005f7cff) AM_DEVICE32("powervr2", powervr2_device, pd_dma_map, 0xffffffffffffffffU) + AM_RANGE(0x005f8000, 0x005f9fff) AM_DEVICE32("powervr2", powervr2_device, ta_map, 0xffffffffffffffffU) AM_RANGE(0x00600000, 0x006007ff) AM_READWRITE(dc_modem_r, dc_modem_w ) - AM_RANGE(0x00700000, 0x00707fff) AM_READWRITE32(dc_aica_reg_r, dc_aica_reg_w, U64(0xffffffffffffffff)) - AM_RANGE(0x00710000, 0x0071000f) AM_MIRROR(0x02000000) AM_DEVREADWRITE16("aicartc", aicartc_device, read, write, U64(0x0000ffff0000ffff) ) + AM_RANGE(0x00700000, 0x00707fff) AM_READWRITE32(dc_aica_reg_r, dc_aica_reg_w, 0xffffffffffffffffU) + AM_RANGE(0x00710000, 0x0071000f) AM_MIRROR(0x02000000) AM_DEVREADWRITE16("aicartc", aicartc_device, read, write, 0x0000ffff0000ffffU ) AM_RANGE(0x00800000, 0x009fffff) AM_READWRITE(dc_arm_r, dc_arm_w ) // AM_RANGE(0x01000000, 0x01ffffff) G2 Ext Device #1 // AM_RANGE(0x02700000, 0x02707fff) AICA reg mirror @@ -402,11 +402,11 @@ static ADDRESS_MAP_START( dc_map, AS_PROGRAM, 64, dc_cons_state ) /* Area 4 */ AM_RANGE(0x10000000, 0x107fffff) AM_DEVWRITE("powervr2", powervr2_device, ta_fifo_poly_w) - AM_RANGE(0x10800000, 0x10ffffff) AM_DEVWRITE8("powervr2", powervr2_device, ta_fifo_yuv_w, U64(0xffffffffffffffff)) + AM_RANGE(0x10800000, 0x10ffffff) AM_DEVWRITE8("powervr2", powervr2_device, ta_fifo_yuv_w, 0xffffffffffffffffU) AM_RANGE(0x11000000, 0x117fffff) AM_DEVWRITE("powervr2", powervr2_device, ta_texture_directpath0_w) AM_MIRROR(0x00800000) // access to texture / framebuffer memory (either 32-bit or 64-bit area depending on SB_LMMODE0 register - cannot be written directly, only through dma / store queue AM_RANGE(0x12000000, 0x127fffff) AM_DEVWRITE("powervr2", powervr2_device, ta_fifo_poly_w) - AM_RANGE(0x12800000, 0x12ffffff) AM_DEVWRITE8("powervr2", powervr2_device, ta_fifo_yuv_w, U64(0xffffffffffffffff)) + AM_RANGE(0x12800000, 0x12ffffff) AM_DEVWRITE8("powervr2", powervr2_device, ta_fifo_yuv_w, 0xffffffffffffffffU) AM_RANGE(0x13000000, 0x137fffff) AM_DEVWRITE("powervr2", powervr2_device, ta_texture_directpath1_w) AM_MIRROR(0x00800000) // access to texture / framebuffer memory (either 32-bit or 64-bit area depending on SB_LMMODE1 register - cannot be written directly, only through dma / store queue // AM_RANGE(0x14000000, 0x17ffffff) G2 Ext Device #3 diff --git a/src/mame/drivers/hh_hmcs40.cpp b/src/mame/drivers/hh_hmcs40.cpp index af875309e7c..82d98b65eb8 100644 --- a/src/mame/drivers/hh_hmcs40.cpp +++ b/src/mame/drivers/hh_hmcs40.cpp @@ -294,9 +294,9 @@ void hh_hmcs40_state::display_matrix(int maxx, int maxy, uint64_t setx, uint32_t set_display_size(maxx, maxy); // update current state - uint64_t mask = (U64(1) << maxx) - 1; + uint64_t mask = (u64(1) << maxx) - 1; for (int y = 0; y < maxy; y++) - m_display_state[y] = (sety >> y & 1) ? ((setx & mask) | (U64(1) << maxx)) : 0; + m_display_state[y] = (sety >> y & 1) ? ((setx & mask) | (u64(1) << maxx)) : 0; if (update) display_update(); diff --git a/src/mame/drivers/k28.cpp b/src/mame/drivers/k28.cpp index d7dda72a3bd..701ac2d08c7 100644 --- a/src/mame/drivers/k28.cpp +++ b/src/mame/drivers/k28.cpp @@ -284,7 +284,7 @@ WRITE8_MEMBER(k28_state::mcu_p0_w) // d5: VFD driver data enable m_vfd_data_enable = ~data >> 5 & 1; if (m_vfd_data_enable) - m_vfd_shiftreg = (m_vfd_shiftreg & U64(~1)) | m_vfd_data_in; + m_vfd_shiftreg = (m_vfd_shiftreg & ~u64(1)) | m_vfd_data_in; // d4: VSM chip enable // d6: VSM M0 @@ -325,7 +325,7 @@ WRITE8_MEMBER(k28_state::mcu_p2_w) // d0: VFD driver serial data m_vfd_data_in = data & 1; if (m_vfd_data_enable) - m_vfd_shiftreg = (m_vfd_shiftreg & U64(~1)) | m_vfd_data_in; + m_vfd_shiftreg = (m_vfd_shiftreg & ~u64(1)) | m_vfd_data_in; // d0-d3: VSM data, input mux and SC-01 phoneme lower nibble m_tms6100->add_w(space, 0, data); diff --git a/src/mame/drivers/konamim2.cpp b/src/mame/drivers/konamim2.cpp index ec9231b3f77..716f0bce1ff 100644 --- a/src/mame/drivers/konamim2.cpp +++ b/src/mame/drivers/konamim2.cpp @@ -334,7 +334,7 @@ READ64_MEMBER(konamim2_state::irq_active_r) READ64_MEMBER(konamim2_state::unk1_r) { - return U64(0xffffffffffffffff); + return 0xffffffffffffffffU; //return 0; } @@ -351,7 +351,7 @@ READ64_MEMBER(konamim2_state::unk2_r) READ64_MEMBER(konamim2_state::unk3_r) { - //return U64(0xffffffffffffffff); + //return 0xffffffffffffffffU; return m_unk3; } @@ -474,7 +474,7 @@ WRITE64_MEMBER(konamim2_state::reset_w) { if (ACCESSING_BITS_32_63) { - if (data & U64(0x100000000)) + if (data & 0x100000000U) { m_maincpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); m_unk3 = 0; @@ -1329,7 +1329,7 @@ ROM_END DRIVER_INIT_MEMBER(konamim2_state,m2) { - m_unk3 = U64(0xffffffffffffffff); + m_unk3 = 0xffffffffffffffffU; m_unk20004 = 0; cde_init(); } diff --git a/src/mame/drivers/mac.cpp b/src/mame/drivers/mac.cpp index e5d0c316b59..fc02ed09196 100644 --- a/src/mame/drivers/mac.cpp +++ b/src/mame/drivers/mac.cpp @@ -516,7 +516,7 @@ WRITE8_MEMBER(mac_state::hmc_w) } else { - uint64_t temp = (data & 1) ? U64(0x400000000) : U64(0x0); + uint64_t temp = (data & 1) ? 0x400000000U : 0x0U; m_hmc_reg >>= 1; m_hmc_reg |= temp; } @@ -827,23 +827,23 @@ static ADDRESS_MAP_START(pwrmac_map, AS_PROGRAM, 64, mac_state ) AM_RANGE(0x40000000, 0x403fffff) AM_ROM AM_REGION("bootrom", 0) AM_MIRROR(0x0fc00000) - AM_RANGE(0x50000000, 0x50001fff) AM_READWRITE16(mac_via_r, mac_via_w, U64(0xffffffffffffffff)) AM_MIRROR(0x00f00000) - AM_RANGE(0x50004000, 0x50005fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, U64(0xffffffffffffffff)) AM_MIRROR(0x00f00000) + AM_RANGE(0x50000000, 0x50001fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffffffffffffU) AM_MIRROR(0x00f00000) + AM_RANGE(0x50004000, 0x50005fff) AM_READWRITE16(mac_scc_r, mac_scc_2_w, 0xffffffffffffffffU) AM_MIRROR(0x00f00000) // 50008000 = ethernet ID PROM // 5000a000 = MACE ethernet controller - AM_RANGE(0x50010000, 0x50011fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, U64(0xffffffffffffffff)) AM_MIRROR(0x00f00000) + AM_RANGE(0x50010000, 0x50011fff) AM_READWRITE16(macplus_scsi_r, macii_scsi_w, 0xffffffffffffffffU) AM_MIRROR(0x00f00000) // 50014000 = sound registers (AWACS) - AM_RANGE(0x50014000, 0x50015fff) AM_DEVREADWRITE8("awacs", awacs_device, read, write, U64(0xffffffffffffffff)) AM_MIRROR(0x01f00000) - AM_RANGE(0x50016000, 0x50017fff) AM_READWRITE16(mac_iwm_r, mac_iwm_w, U64(0xffffffffffffffff)) AM_MIRROR(0x00f00000) - AM_RANGE(0x50024000, 0x50025fff) AM_WRITE32( ariel_ramdac_w, U64(0xffffffffffffffff) ) AM_MIRROR(0x00f00000) - AM_RANGE(0x50026000, 0x50027fff) AM_READWRITE16(mac_via2_r, mac_via2_w, U64(0xffffffffffffffff)) AM_MIRROR(0x00f00000) - AM_RANGE(0x50028000, 0x50028007) AM_READWRITE8(mac_sonora_vctl_r, mac_sonora_vctl_w, U64(0xffffffffffffffff)) AM_MIRROR(0x00f00000) + AM_RANGE(0x50014000, 0x50015fff) AM_DEVREADWRITE8("awacs", awacs_device, read, write, 0xffffffffffffffffU) AM_MIRROR(0x01f00000) + AM_RANGE(0x50016000, 0x50017fff) AM_READWRITE16(mac_iwm_r, mac_iwm_w, 0xffffffffffffffffU) AM_MIRROR(0x00f00000) + AM_RANGE(0x50024000, 0x50025fff) AM_WRITE32( ariel_ramdac_w, 0xffffffffffffffffU ) AM_MIRROR(0x00f00000) + AM_RANGE(0x50026000, 0x50027fff) AM_READWRITE16(mac_via2_r, mac_via2_w, 0xffffffffffffffffU) AM_MIRROR(0x00f00000) + AM_RANGE(0x50028000, 0x50028007) AM_READWRITE8(mac_sonora_vctl_r, mac_sonora_vctl_w, 0xffffffffffffffffU) AM_MIRROR(0x00f00000) // 5002a000 = interrupt controller // 5002c000 = diagnostic registers - AM_RANGE(0x5002c000, 0x5002dfff) AM_READ8(pmac_diag_r, U64(0xffffffffffffffff)) AM_MIRROR(0x00f00000) - AM_RANGE(0x50031000, 0x50032fff) AM_READWRITE8(amic_dma_r, amic_dma_w, U64(0xffffffffffffffff)) AM_MIRROR(0x00f00000) - AM_RANGE(0x50040000, 0x5004000f) AM_READWRITE8(hmc_r, hmc_w, U64(0xffffffffffffffff)) AM_MIRROR(0x00f00000) - AM_RANGE(0x5ffffff8, 0x5fffffff) AM_READ32(mac_read_id, U64(0xffffffffffffffff)) + AM_RANGE(0x5002c000, 0x5002dfff) AM_READ8(pmac_diag_r, 0xffffffffffffffffU) AM_MIRROR(0x00f00000) + AM_RANGE(0x50031000, 0x50032fff) AM_READWRITE8(amic_dma_r, amic_dma_w, 0xffffffffffffffffU) AM_MIRROR(0x00f00000) + AM_RANGE(0x50040000, 0x5004000f) AM_READWRITE8(hmc_r, hmc_w, 0xffffffffffffffffU) AM_MIRROR(0x00f00000) + AM_RANGE(0x5ffffff8, 0x5fffffff) AM_READ32(mac_read_id, 0xffffffffffffffffU) AM_RANGE(0xffc00000, 0xffffffff) AM_ROM AM_REGION("bootrom", 0) ADDRESS_MAP_END diff --git a/src/mame/drivers/macpci.cpp b/src/mame/drivers/macpci.cpp index 28e028f1e9f..ad87d2bd1e8 100644 --- a/src/mame/drivers/macpci.cpp +++ b/src/mame/drivers/macpci.cpp @@ -72,7 +72,7 @@ static ADDRESS_MAP_START(pippin_mem, AS_PROGRAM, 64, macpci_state) AM_RANGE(0xf00dfff8, 0xf00dffff) AM_READ(unk2_r) AM_RANGE(0xf3008800, 0xf3008807) AM_READ(unk1_r) - AM_RANGE(0xf3016000, 0xf3017fff) AM_READWRITE16(mac_via_r, mac_via_w, U64(0xffffffffffffffff)) + AM_RANGE(0xf3016000, 0xf3017fff) AM_READWRITE16(mac_via_r, mac_via_w, 0xffffffffffffffffU) AM_RANGE(0xffc00000, 0xffffffff) AM_ROM AM_REGION("bootrom",0) ADDRESS_MAP_END diff --git a/src/mame/drivers/mgavegas.cpp b/src/mame/drivers/mgavegas.cpp index e7a52b1f92e..d5efe2a703f 100644 --- a/src/mame/drivers/mgavegas.cpp +++ b/src/mame/drivers/mgavegas.cpp @@ -486,7 +486,7 @@ INPUT_PORTS_END void mgavegas_state::machine_reset() { m_int=1; - m_custom_data=U64(0xffffffffffffffff); + m_custom_data=0xffffffffffffffffU; m_old_ckmod=1; m_old_emod=0; diff --git a/src/mame/drivers/model2.cpp b/src/mame/drivers/model2.cpp index ea97f95c87c..94b37e4e9a6 100644 --- a/src/mame/drivers/model2.cpp +++ b/src/mame/drivers/model2.cpp @@ -691,12 +691,12 @@ WRITE32_MEMBER(model2_state::copro_prg_w) logerror("copro_prg_w: %08X: %08X\n", m_coprocnt, data); if (m_coprocnt & 1) { - m_tgpx4_program[m_coprocnt / 2] &= U64(0xffffffff); - m_tgpx4_program[m_coprocnt / 2] |= (uint64_t)(data) << 32; + m_tgpx4_program[m_coprocnt / 2] &= 0xffffffffU; + m_tgpx4_program[m_coprocnt / 2] |= u64(data) << 32; } else { - m_tgpx4_program[m_coprocnt / 2] &= U64(0xffffffff00000000); + m_tgpx4_program[m_coprocnt / 2] &= 0xffffffff00000000U; m_tgpx4_program[m_coprocnt / 2] |= data; } m_coprocnt++; diff --git a/src/mame/drivers/model3.cpp b/src/mame/drivers/model3.cpp index 2d06b5286d9..639e2f24338 100644 --- a/src/mame/drivers/model3.cpp +++ b/src/mame/drivers/model3.cpp @@ -1398,13 +1398,13 @@ READ64_MEMBER(model3_state::model3_ctrl_r) break; case 2: - return U64(0xffffffffffffffff); + return 0xffffffffffffffffU; case 3: - return U64(0xffffffffffffffff); /* Dip switches */ + return 0xffffffffffffffffU; /* Dip switches */ case 4: - return U64(0xffffffffffffffff); + return 0xffffffffffffffffU; case 5: if (ACCESSING_BITS_24_31) /* Serial comm RX FIFO 1 */ @@ -1664,13 +1664,13 @@ WRITE64_MEMBER(model3_state::model3_rtc_w) READ64_MEMBER(model3_state::real3d_status_r) { - m_real3d_status ^= U64(0xffffffffffffffff); + m_real3d_status ^= 0xffffffffffffffffU; if (offset == 0) { /* pretty sure this is VBLANK */ - m_real3d_status &= ~U64(0x0000000200000000); + m_real3d_status &= ~0x0000000200000000U; if (m_screen->vblank()) - m_real3d_status |= U64(0x0000000200000000); + m_real3d_status |= 0x0000000200000000U; return m_real3d_status; } return m_real3d_status; @@ -1732,7 +1732,7 @@ WRITE8_MEMBER(model3_state::model3_sound_w) READ64_MEMBER(model3_state::model3_5881prot_r) { - uint64_t retvalue = U64(0xffffffffffffffff); + uint64_t retvalue = 0xffffffffffffffffU; if (offset == 0x00 / 8) { @@ -1813,7 +1813,7 @@ static ADDRESS_MAP_START( model3_10_mem, AS_PROGRAM, 64, model3_state ) AM_RANGE(0x98000000, 0x980fffff) AM_WRITE(real3d_polygon_ram_w ) AM_RANGE(0xf0040000, 0xf004003f) AM_MIRROR(0x0e000000) AM_READWRITE(model3_ctrl_r, model3_ctrl_w ) - AM_RANGE(0xf0080000, 0xf008ffff) AM_MIRROR(0x0e000000) AM_READWRITE8(model3_sound_r, model3_sound_w, U64(0xffffffffffffffff) ) + AM_RANGE(0xf0080000, 0xf008ffff) AM_MIRROR(0x0e000000) AM_READWRITE8(model3_sound_r, model3_sound_w, 0xffffffffffffffffU ) AM_RANGE(0xf00c0000, 0xf00dffff) AM_MIRROR(0x0e000000) AM_RAM AM_SHARE("backup") /* backup SRAM */ AM_RANGE(0xf0100000, 0xf010003f) AM_MIRROR(0x0e000000) AM_READWRITE(model3_sys_r, model3_sys_w ) AM_RANGE(0xf0140000, 0xf014003f) AM_MIRROR(0x0e000000) AM_READWRITE(model3_rtc_r, model3_rtc_w ) @@ -1828,7 +1828,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( model3_mem, AS_PROGRAM, 64, model3_state ) AM_IMPORT_FROM( model3_10_mem ) - AM_RANGE(0xc0000000, 0xc003ffff) AM_DEVICE32("comm_board", m3comm_device, m3_map, U64(0xffffffffffffffff) ) + AM_RANGE(0xc0000000, 0xc003ffff) AM_DEVICE32("comm_board", m3comm_device, m3_map, 0xffffffffffffffffU ) ADDRESS_MAP_END static INPUT_PORTS_START( common ) diff --git a/src/mame/drivers/naomi.cpp b/src/mame/drivers/naomi.cpp index 3d75643a9e9..82ad769808b 100644 --- a/src/mame/drivers/naomi.cpp +++ b/src/mame/drivers/naomi.cpp @@ -1681,16 +1681,16 @@ static ADDRESS_MAP_START( naomi_map, AS_PROGRAM, 64, naomi_state ) AM_RANGE(0x00200000, 0x00207fff) AM_MIRROR(0x02000000) AM_RAM // bios uses it (battery backed ram ?) AM_RANGE(0x005f6800, 0x005f69ff) AM_MIRROR(0x02000000) AM_READWRITE(dc_sysctrl_r, dc_sysctrl_w ) - AM_RANGE(0x005f6c00, 0x005f6cff) AM_MIRROR(0x02000000) AM_DEVICE32( "maple_dc", maple_dc_device, amap, U64(0xffffffffffffffff) ) - AM_RANGE(0x005f7018, 0x005f702f) AM_MIRROR(0x02000000) AM_DEVREADWRITE16( "comm_board", m3comm_device, naomi_r, naomi_w, U64(0x0000ffff0000ffff) ) - AM_RANGE(0x005f7000, 0x005f70ff) AM_MIRROR(0x02000000) AM_DEVICE16( "rom_board", naomi_board, submap, U64(0x0000ffff0000ffff) ) - AM_RANGE(0x005f7400, 0x005f74ff) AM_MIRROR(0x02000000) AM_DEVICE32( "rom_board", naomi_g1_device, amap, U64(0xffffffffffffffff) ) + AM_RANGE(0x005f6c00, 0x005f6cff) AM_MIRROR(0x02000000) AM_DEVICE32( "maple_dc", maple_dc_device, amap, 0xffffffffffffffffU ) + AM_RANGE(0x005f7018, 0x005f702f) AM_MIRROR(0x02000000) AM_DEVREADWRITE16( "comm_board", m3comm_device, naomi_r, naomi_w, 0x0000ffff0000ffffU ) + AM_RANGE(0x005f7000, 0x005f70ff) AM_MIRROR(0x02000000) AM_DEVICE16( "rom_board", naomi_board, submap, 0x0000ffff0000ffffU ) + AM_RANGE(0x005f7400, 0x005f74ff) AM_MIRROR(0x02000000) AM_DEVICE32( "rom_board", naomi_g1_device, amap, 0xffffffffffffffffU ) AM_RANGE(0x005f7800, 0x005f78ff) AM_MIRROR(0x02000000) AM_READWRITE(dc_g2_ctrl_r, dc_g2_ctrl_w ) - AM_RANGE(0x005f7c00, 0x005f7cff) AM_MIRROR(0x02000000) AM_DEVICE32("powervr2", powervr2_device, pd_dma_map, U64(0xffffffffffffffff)) - AM_RANGE(0x005f8000, 0x005f9fff) AM_MIRROR(0x02000000) AM_DEVICE32("powervr2", powervr2_device, ta_map, U64(0xffffffffffffffff)) + AM_RANGE(0x005f7c00, 0x005f7cff) AM_MIRROR(0x02000000) AM_DEVICE32("powervr2", powervr2_device, pd_dma_map, 0xffffffffffffffffU) + AM_RANGE(0x005f8000, 0x005f9fff) AM_MIRROR(0x02000000) AM_DEVICE32("powervr2", powervr2_device, ta_map, 0xffffffffffffffffU) AM_RANGE(0x00600000, 0x006007ff) AM_MIRROR(0x02000000) AM_READWRITE(dc_modem_r, dc_modem_w ) - AM_RANGE(0x00700000, 0x00707fff) AM_MIRROR(0x02000000) AM_READWRITE32(dc_aica_reg_r, dc_aica_reg_w, U64(0xffffffffffffffff)) - AM_RANGE(0x00710000, 0x0071000f) AM_MIRROR(0x02000000) AM_DEVREADWRITE16("aicartc", aicartc_device, read, write, U64(0x0000ffff0000ffff) ) + AM_RANGE(0x00700000, 0x00707fff) AM_MIRROR(0x02000000) AM_READWRITE32(dc_aica_reg_r, dc_aica_reg_w, 0xffffffffffffffffU) + AM_RANGE(0x00710000, 0x0071000f) AM_MIRROR(0x02000000) AM_DEVREADWRITE16("aicartc", aicartc_device, read, write, 0x0000ffff0000ffffU ) AM_RANGE(0x00800000, 0x00ffffff) AM_MIRROR(0x02000000) AM_READWRITE(naomi_arm_r, naomi_arm_w ) // sound RAM (8 MB) /* External Device */ @@ -1709,7 +1709,7 @@ static ADDRESS_MAP_START( naomi_map, AS_PROGRAM, 64, naomi_state ) /* Area 4 */ AM_RANGE(0x10000000, 0x107fffff) AM_MIRROR(0x02000000) AM_DEVWRITE("powervr2", powervr2_device, ta_fifo_poly_w) - AM_RANGE(0x10800000, 0x10ffffff) AM_DEVWRITE8("powervr2", powervr2_device, ta_fifo_yuv_w, U64(0xffffffffffffffff)) + AM_RANGE(0x10800000, 0x10ffffff) AM_DEVWRITE8("powervr2", powervr2_device, ta_fifo_yuv_w, 0xffffffffffffffffU) AM_RANGE(0x11000000, 0x11ffffff) AM_DEVWRITE("powervr2", powervr2_device, ta_texture_directpath0_w) // access to texture / framebuffer memory (either 32-bit or 64-bit area depending on SB_LMMODE0 register - cannot be written directly, only through dma / store queue) /* 0x12000000 -0x13ffffff Mirror area of 0x10000000 -0x11ffffff */ AM_RANGE(0x13000000, 0x13ffffff) AM_DEVWRITE("powervr2", powervr2_device, ta_texture_directpath1_w) // access to texture / framebuffer memory (either 32-bit or 64-bit area depending on SB_LMMODE1 register - cannot be written directly, only through dma / store queue) @@ -1734,15 +1734,15 @@ static ADDRESS_MAP_START( naomi2_map, AS_PROGRAM, 64, naomi_state ) AM_RANGE(0x00200000, 0x00207fff) AM_MIRROR(0x02000000) AM_RAM // bios uses it (battery backed ram ?) AM_RANGE(0x005f6800, 0x005f69ff) AM_MIRROR(0x02000000) AM_READWRITE(dc_sysctrl_r, dc_sysctrl_w ) - AM_RANGE(0x005f6c00, 0x005f6cff) AM_MIRROR(0x02000000) AM_DEVICE32( "maple_dc", maple_dc_device, amap, U64(0xffffffffffffffff) ) - AM_RANGE(0x005f7000, 0x005f70ff) AM_MIRROR(0x02000000) AM_DEVICE16( "rom_board", naomi_board, submap, U64(0x0000ffff0000ffff) ) - AM_RANGE(0x005f7400, 0x005f74ff) AM_MIRROR(0x02000000) AM_DEVICE32( "rom_board", naomi_g1_device, amap, U64(0xffffffffffffffff) ) + AM_RANGE(0x005f6c00, 0x005f6cff) AM_MIRROR(0x02000000) AM_DEVICE32( "maple_dc", maple_dc_device, amap, 0xffffffffffffffffU ) + AM_RANGE(0x005f7000, 0x005f70ff) AM_MIRROR(0x02000000) AM_DEVICE16( "rom_board", naomi_board, submap, 0x0000ffff0000ffffU ) + AM_RANGE(0x005f7400, 0x005f74ff) AM_MIRROR(0x02000000) AM_DEVICE32( "rom_board", naomi_g1_device, amap, 0xffffffffffffffffU ) AM_RANGE(0x005f7800, 0x005f78ff) AM_MIRROR(0x02000000) AM_READWRITE(dc_g2_ctrl_r, dc_g2_ctrl_w ) - AM_RANGE(0x005f7c00, 0x005f7cff) AM_MIRROR(0x02000000) AM_DEVICE32("powervr2", powervr2_device, pd_dma_map, U64(0xffffffffffffffff)) - AM_RANGE(0x005f8000, 0x005f9fff) AM_MIRROR(0x02000000) AM_DEVICE32("powervr2", powervr2_device, ta_map, U64(0xffffffffffffffff)) + AM_RANGE(0x005f7c00, 0x005f7cff) AM_MIRROR(0x02000000) AM_DEVICE32("powervr2", powervr2_device, pd_dma_map, 0xffffffffffffffffU) + AM_RANGE(0x005f8000, 0x005f9fff) AM_MIRROR(0x02000000) AM_DEVICE32("powervr2", powervr2_device, ta_map, 0xffffffffffffffffU) AM_RANGE(0x00600000, 0x006007ff) AM_MIRROR(0x02000000) AM_READWRITE(dc_modem_r, dc_modem_w ) - AM_RANGE(0x00700000, 0x00707fff) AM_MIRROR(0x02000000) AM_READWRITE32(dc_aica_reg_r, dc_aica_reg_w, U64(0xffffffffffffffff)) - AM_RANGE(0x00710000, 0x0071000f) AM_MIRROR(0x02000000) AM_DEVREADWRITE16("aicartc", aicartc_device, read, write, U64(0x0000ffff0000ffff) ) + AM_RANGE(0x00700000, 0x00707fff) AM_MIRROR(0x02000000) AM_READWRITE32(dc_aica_reg_r, dc_aica_reg_w, 0xffffffffffffffffU) + AM_RANGE(0x00710000, 0x0071000f) AM_MIRROR(0x02000000) AM_DEVREADWRITE16("aicartc", aicartc_device, read, write, 0x0000ffff0000ffffU ) AM_RANGE(0x00800000, 0x00ffffff) AM_MIRROR(0x02000000) AM_READWRITE(naomi_arm_r, naomi_arm_w ) // sound RAM (8 MB) /* External Device */ @@ -1750,8 +1750,8 @@ static ADDRESS_MAP_START( naomi2_map, AS_PROGRAM, 64, naomi_state ) AM_RANGE(0x0103ff00, 0x0103ffff) AM_MIRROR(0x02000000) AM_READWRITE(naomi_unknown1_r, naomi_unknown1_w ) // bios uses it, actual start and end addresses not known // AM_RANGE(0x025f6800, 0x025f69ff) AM_READWRITE(dc_sysctrl_r, dc_sysctrl_w ) // second PVR DMA! -// AM_RANGE(0x025f7c00, 0x025f7cff) AM_DEVREADWRITE32("powervr2", powervr2_device, pvr_ctrl_r, pvr_ctrl_w, U64(0xffffffffffffffff)) - AM_RANGE(0x005f8000, 0x005f9fff) AM_MIRROR(0x02000000) AM_DEVICE32("powervr2", powervr2_device, ta_map, U64(0xffffffffffffffff)) +// AM_RANGE(0x025f7c00, 0x025f7cff) AM_DEVREADWRITE32("powervr2", powervr2_device, pvr_ctrl_r, pvr_ctrl_w, 0xffffffffffffffffU) + AM_RANGE(0x005f8000, 0x005f9fff) AM_MIRROR(0x02000000) AM_DEVICE32("powervr2", powervr2_device, ta_map, 0xffffffffffffffffU) /* Area 1 */ AM_RANGE(0x04000000, 0x04ffffff) AM_RAM AM_SHARE("dc_texture_ram") // texture memory 64 bit access @@ -1761,8 +1761,8 @@ static ADDRESS_MAP_START( naomi2_map, AS_PROGRAM, 64, naomi_state ) /* Area 2*/ AM_RANGE(0x085f6800, 0x085f69ff) AM_WRITE(dc_sysctrl_w ) // writes to BOTH PVRs - AM_RANGE(0x085f8000, 0x805f9fff) AM_DEVICE32("powervr2", powervr2_device, ta_map, U64(0xffffffffffffffff)) - AM_RANGE(0x08800000, 0x088000ff) AM_DEVREADWRITE32("powervr2", powervr2_device, elan_regs_r, elan_regs_w, U64(0xffffffffffffffff)) // T&L chip registers + AM_RANGE(0x085f8000, 0x805f9fff) AM_DEVICE32("powervr2", powervr2_device, ta_map, 0xffffffffffffffffU) + AM_RANGE(0x08800000, 0x088000ff) AM_DEVREADWRITE32("powervr2", powervr2_device, elan_regs_r, elan_regs_w, 0xffffffffffffffffU) // T&L chip registers // AM_RANGE(0x09000000, 0x09??????) T&L command processing AM_RANGE(0x0a000000, 0x0bffffff) AM_RAM AM_SHARE("elan_ram") // T&L chip RAM @@ -1771,7 +1771,7 @@ static ADDRESS_MAP_START( naomi2_map, AS_PROGRAM, 64, naomi_state ) /* Area 4 */ AM_RANGE(0x10000000, 0x107fffff) AM_DEVWRITE("powervr2", powervr2_device, ta_fifo_poly_w) - AM_RANGE(0x10800000, 0x10ffffff) AM_DEVWRITE8("powervr2", powervr2_device, ta_fifo_yuv_w, U64(0xffffffffffffffff)) + AM_RANGE(0x10800000, 0x10ffffff) AM_DEVWRITE8("powervr2", powervr2_device, ta_fifo_yuv_w, 0xffffffffffffffffU) AM_RANGE(0x11000000, 0x11ffffff) AM_DEVWRITE("powervr2", powervr2_device, ta_texture_directpath0_w) // access to texture / framebuffer memory (either 32-bit or 64-bit area depending on SB_LMMODE0 register - cannot be written directly, only through dma / store queue) /* 0x12000000 -0x13ffffff Mirror area of 0x10000000 -0x11ffffff */ AM_RANGE(0x13000000, 0x13ffffff) AM_DEVWRITE("powervr2", powervr2_device, ta_texture_directpath1_w) // access to texture / framebuffer memory (either 32-bit or 64-bit area depending on SB_LMMODE1 register - cannot be written directly, only through dma / store queue) @@ -1827,13 +1827,13 @@ inline int naomi_state::decode_reg32_64(uint32_t offset, uint64_t mem_mask, uint *shift = 0; // non 32-bit accesses have not yet been seen here, we need to know when they are - if ((mem_mask != U64(0xffffffff00000000)) && (mem_mask != U64(0x00000000ffffffff))) + if ((mem_mask != 0xffffffff00000000U) && (mem_mask != 0x00000000ffffffffU)) { osd_printf_verbose("%s:Wrong mask!\n", machine().describe_context()); //machine().debug_break(); } - if (mem_mask == U64(0xffffffff00000000)) + if (mem_mask == 0xffffffff00000000U) { reg++; *shift = 32; @@ -1858,10 +1858,10 @@ READ64_MEMBER(naomi_state::aw_modem_r ) (ab == 0) -> BIOS skip RAM test */ - return U64(0xffffffff00000000) | (ioport("COINS")->read() & 0x0F); + return 0xffffffff00000000U | (ioport("COINS")->read() & 0x0F); } else if (reg == 0x284/4) - return U64(0xffffffff00000000) | aw_ctrl_type; + return 0xffffffff00000000U | aw_ctrl_type; osd_printf_verbose("MODEM: Unmapped read %08x\n", 0x600000+reg*4); @@ -1907,15 +1907,15 @@ static ADDRESS_MAP_START( aw_map, AS_PROGRAM, 64, naomi_state ) AM_RANGE(0x00200000, 0x0021ffff) AM_RAM // battery backed up RAM AM_RANGE(0x005f6800, 0x005f69ff) AM_READWRITE(dc_sysctrl_r, dc_sysctrl_w ) - AM_RANGE(0x005f6c00, 0x005f6cff) AM_MIRROR(0x02000000) AM_DEVICE32( "maple_dc", maple_dc_device, amap, U64(0xffffffffffffffff) ) - AM_RANGE(0x005f7000, 0x005f70ff) AM_MIRROR(0x02000000) AM_DEVICE16( "rom_board", aw_rom_board, submap, U64(0x0000ffff0000ffff) ) - AM_RANGE(0x005f7400, 0x005f74ff) AM_MIRROR(0x02000000) AM_DEVICE32( "rom_board", naomi_g1_device, amap, U64(0xffffffffffffffff) ) + AM_RANGE(0x005f6c00, 0x005f6cff) AM_MIRROR(0x02000000) AM_DEVICE32( "maple_dc", maple_dc_device, amap, 0xffffffffffffffffU ) + AM_RANGE(0x005f7000, 0x005f70ff) AM_MIRROR(0x02000000) AM_DEVICE16( "rom_board", aw_rom_board, submap, 0x0000ffff0000ffffU ) + AM_RANGE(0x005f7400, 0x005f74ff) AM_MIRROR(0x02000000) AM_DEVICE32( "rom_board", naomi_g1_device, amap, 0xffffffffffffffffU ) AM_RANGE(0x005f7800, 0x005f78ff) AM_READWRITE(dc_g2_ctrl_r, dc_g2_ctrl_w ) - AM_RANGE(0x005f7c00, 0x005f7cff) AM_MIRROR(0x02000000) AM_DEVICE32("powervr2", powervr2_device, pd_dma_map, U64(0xffffffffffffffff)) - AM_RANGE(0x005f8000, 0x005f9fff) AM_MIRROR(0x02000000) AM_DEVICE32("powervr2", powervr2_device, ta_map, U64(0xffffffffffffffff)) + AM_RANGE(0x005f7c00, 0x005f7cff) AM_MIRROR(0x02000000) AM_DEVICE32("powervr2", powervr2_device, pd_dma_map, 0xffffffffffffffffU) + AM_RANGE(0x005f8000, 0x005f9fff) AM_MIRROR(0x02000000) AM_DEVICE32("powervr2", powervr2_device, ta_map, 0xffffffffffffffffU) AM_RANGE(0x00600000, 0x006007ff) AM_READWRITE(aw_modem_r, aw_modem_w ) - AM_RANGE(0x00700000, 0x00707fff) AM_READWRITE32(dc_aica_reg_r, dc_aica_reg_w, U64(0xffffffffffffffff)) - AM_RANGE(0x00710000, 0x0071000f) AM_MIRROR(0x02000000) AM_DEVREADWRITE16("aicartc", aicartc_device, read, write, U64(0x0000ffff0000ffff) ) + AM_RANGE(0x00700000, 0x00707fff) AM_READWRITE32(dc_aica_reg_r, dc_aica_reg_w, 0xffffffffffffffffU) + AM_RANGE(0x00710000, 0x0071000f) AM_MIRROR(0x02000000) AM_DEVREADWRITE16("aicartc", aicartc_device, read, write, 0x0000ffff0000ffffU ) AM_RANGE(0x00800000, 0x00ffffff) AM_READWRITE(naomi_arm_r, naomi_arm_w ) // sound RAM (8 MB) @@ -1939,7 +1939,7 @@ static ADDRESS_MAP_START( aw_map, AS_PROGRAM, 64, naomi_state ) /* Area 4 - half the texture memory, like dreamcast, not naomi */ AM_RANGE(0x10000000, 0x107fffff) AM_MIRROR(0x02000000) AM_DEVWRITE("powervr2", powervr2_device, ta_fifo_poly_w) - AM_RANGE(0x10800000, 0x10ffffff) AM_DEVWRITE8("powervr2", powervr2_device, ta_fifo_yuv_w, U64(0xffffffffffffffff)) + AM_RANGE(0x10800000, 0x10ffffff) AM_DEVWRITE8("powervr2", powervr2_device, ta_fifo_yuv_w, 0xffffffffffffffffU) AM_RANGE(0x11000000, 0x117fffff) AM_DEVWRITE("powervr2", powervr2_device, ta_texture_directpath0_w) AM_MIRROR(0x00800000) // access to texture / framebuffer memory (either 32-bit or 64-bit area depending on SB_LMMODE0 register - cannot be written directly, only through dma / store queue /* 0x12000000 -0x13ffffff Mirror area of 0x10000000 -0x11ffffff */ AM_RANGE(0x13000000, 0x137fffff) AM_DEVWRITE("powervr2", powervr2_device, ta_texture_directpath1_w) AM_MIRROR(0x00800000) // access to texture / framebuffer memory (either 32-bit or 64-bit area depending on SB_LMMODE1 register - cannot be written directly, only through dma / store queue @@ -8990,7 +8990,7 @@ DRIVER_INIT_MEMBER(naomi_state,atomiswave) uint64_t *ROM = (uint64_t *)memregion("awflash")->base(); // patch out long startup delay - ROM[0x98e/8] = (ROM[0x98e/8] & U64(0xffffffffffff)) | (uint64_t)0x0009<<48; + ROM[0x98e/8] = (ROM[0x98e/8] & 0xffffffffffffU) | (uint64_t)0x0009<<48; aw_ctrl_type = 0; } @@ -9006,7 +9006,7 @@ READ64_MEMBER(naomi_state::xtrmhnt2_hack_r) dc_ram[0x38bee/8] |= (uint64_t)0x200 << 48; } if (space.device().safe_pc() == 0xc108240) - dc_ram[0x9acc8/8] = (dc_ram[0x9acc8/8] & U64(0xffffffffffff0000)) | (uint64_t)0x0009; + dc_ram[0x9acc8/8] = (dc_ram[0x9acc8/8] & 0xffffffffffff0000U) | (uint64_t)0x0009; return 0; } diff --git a/src/mame/drivers/segasp.cpp b/src/mame/drivers/segasp.cpp index a5f4fb905c2..761cd8fa34e 100644 --- a/src/mame/drivers/segasp.cpp +++ b/src/mame/drivers/segasp.cpp @@ -180,15 +180,15 @@ static ADDRESS_MAP_START( segasp_map, AS_PROGRAM, 64, segasp_state ) AM_RANGE(0x00000000, 0x001fffff) AM_MIRROR(0xa2000000) AM_ROM AM_REGION("maincpu", 0) // BIOS AM_RANGE(0x005f6800, 0x005f69ff) AM_MIRROR(0x02000000) AM_READWRITE(dc_sysctrl_r, dc_sysctrl_w ) - AM_RANGE(0x005f6c00, 0x005f6cff) AM_MIRROR(0x02000000) AM_DEVICE32( "maple_dc", maple_dc_device, amap, U64(0xffffffffffffffff) ) - AM_RANGE(0x005f7000, 0x005f70ff) AM_MIRROR(0x02000000) AM_DEVICE16( "rom_board", naomi_board, submap, U64(0x0000ffff0000ffff) ) - AM_RANGE(0x005f7400, 0x005f74ff) AM_MIRROR(0x02000000) AM_DEVICE32( "rom_board", naomi_g1_device, amap, U64(0xffffffffffffffff) ) + AM_RANGE(0x005f6c00, 0x005f6cff) AM_MIRROR(0x02000000) AM_DEVICE32( "maple_dc", maple_dc_device, amap, 0xffffffffffffffffU ) + AM_RANGE(0x005f7000, 0x005f70ff) AM_MIRROR(0x02000000) AM_DEVICE16( "rom_board", naomi_board, submap, 0x0000ffff0000ffffU ) + AM_RANGE(0x005f7400, 0x005f74ff) AM_MIRROR(0x02000000) AM_DEVICE32( "rom_board", naomi_g1_device, amap, 0xffffffffffffffffU ) AM_RANGE(0x005f7800, 0x005f78ff) AM_MIRROR(0x02000000) AM_READWRITE(dc_g2_ctrl_r, dc_g2_ctrl_w ) - AM_RANGE(0x005f7c00, 0x005f7cff) AM_MIRROR(0x02000000) AM_DEVICE32("powervr2", powervr2_device, pd_dma_map, U64(0xffffffffffffffff)) - AM_RANGE(0x005f8000, 0x005f9fff) AM_MIRROR(0x02000000) AM_DEVICE32("powervr2", powervr2_device, ta_map, U64(0xffffffffffffffff)) + AM_RANGE(0x005f7c00, 0x005f7cff) AM_MIRROR(0x02000000) AM_DEVICE32("powervr2", powervr2_device, pd_dma_map, 0xffffffffffffffffU) + AM_RANGE(0x005f8000, 0x005f9fff) AM_MIRROR(0x02000000) AM_DEVICE32("powervr2", powervr2_device, ta_map, 0xffffffffffffffffU) AM_RANGE(0x00600000, 0x006007ff) AM_MIRROR(0x02000000) AM_READWRITE(dc_modem_r, dc_modem_w ) - AM_RANGE(0x00700000, 0x00707fff) AM_MIRROR(0x02000000) AM_READWRITE32(dc_aica_reg_r, dc_aica_reg_w, U64(0xffffffffffffffff)) - AM_RANGE(0x00710000, 0x0071000f) AM_MIRROR(0x02000000) AM_DEVREADWRITE16("aicartc", aicartc_device, read, write, U64(0x0000ffff0000ffff) ) + AM_RANGE(0x00700000, 0x00707fff) AM_MIRROR(0x02000000) AM_READWRITE32(dc_aica_reg_r, dc_aica_reg_w, 0xffffffffffffffffU) + AM_RANGE(0x00710000, 0x0071000f) AM_MIRROR(0x02000000) AM_DEVREADWRITE16("aicartc", aicartc_device, read, write, 0x0000ffff0000ffffU ) AM_RANGE(0x00800000, 0x00ffffff) AM_MIRROR(0x02000000) AM_READWRITE(naomi_arm_r, naomi_arm_w ) // sound RAM (8 MB) @@ -214,7 +214,7 @@ static ADDRESS_MAP_START( segasp_map, AS_PROGRAM, 64, segasp_state ) /* Area 4 */ AM_RANGE(0x10000000, 0x107fffff) AM_MIRROR(0x02000000) AM_DEVWRITE("powervr2", powervr2_device, ta_fifo_poly_w) - AM_RANGE(0x10800000, 0x10ffffff) AM_DEVWRITE8("powervr2", powervr2_device, ta_fifo_yuv_w, U64(0xffffffffffffffff)) + AM_RANGE(0x10800000, 0x10ffffff) AM_DEVWRITE8("powervr2", powervr2_device, ta_fifo_yuv_w, 0xffffffffffffffffU) AM_RANGE(0x11000000, 0x11ffffff) AM_DEVWRITE("powervr2", powervr2_device, ta_texture_directpath0_w) // access to texture / framebuffer memory (either 32-bit or 64-bit area depending on SB_LMMODE0 register - cannot be written directly, only through dma / store queue) /* 0x12000000 -0x13ffffff Mirror area of 0x10000000 -0x11ffffff */ AM_RANGE(0x13000000, 0x13ffffff) AM_DEVWRITE("powervr2", powervr2_device, ta_texture_directpath1_w) // access to texture / framebuffer memory (either 32-bit or 64-bit area depending on SB_LMMODE1 register - cannot be written directly, only through dma / store queue) diff --git a/src/mame/drivers/socrates.cpp b/src/mame/drivers/socrates.cpp index 10f9c3a3045..e3e6b734626 100644 --- a/src/mame/drivers/socrates.cpp +++ b/src/mame/drivers/socrates.cpp @@ -787,7 +787,7 @@ int iqunlim_state::get_color(int index, int y) if (index < 8) return m_colors[index]; else - return m_vram_reg->u8(0xf000 + ((index & 0x0f) << 8) + ((m_scroll_offset + y + 1) & 0xff)); + return m_vram_reg->as_u8(0xf000 + ((index & 0x0f) << 8) + ((m_scroll_offset + y + 1) & 0xff)); } uint32_t iqunlim_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) diff --git a/src/mame/drivers/squale.cpp b/src/mame/drivers/squale.cpp index 9ca3a7215fe..8cec6f28245 100644 --- a/src/mame/drivers/squale.cpp +++ b/src/mame/drivers/squale.cpp @@ -489,7 +489,7 @@ READ8_MEMBER( squale_state::pia_u72_porta_r ) #endif if( m_cart_rom && m_cart_rom->bytes() ) - data = m_cart_rom->u8( cart_addr_counter % m_cart_rom->bytes() ); + data = m_cart_rom->as_u8( cart_addr_counter % m_cart_rom->bytes() ); else data = 0xFF; diff --git a/src/mame/drivers/svi318.cpp b/src/mame/drivers/svi318.cpp index c50e17c618b..6708230dfbc 100644 --- a/src/mame/drivers/svi318.cpp +++ b/src/mame/drivers/svi318.cpp @@ -366,7 +366,7 @@ READ8_MEMBER( svi3x8_state::mreq_r ) uint8_t data = m_expander->mreq_r(space, offset); if (ROMCS) - data = m_basic->u8(offset); + data = m_basic->as_u8(offset); if (m_bk21 == 0 && IS_SVI328 && offset < 0x8000) data = m_ram->read(offset); diff --git a/src/mame/drivers/taitotz.cpp b/src/mame/drivers/taitotz.cpp index 1d6850148bd..2c2c0ff3e9e 100644 --- a/src/mame/drivers/taitotz.cpp +++ b/src/mame/drivers/taitotz.cpp @@ -1875,7 +1875,7 @@ READ64_MEMBER(taitotz_state::ieee1394_r) { if (offset == 4) { - return U64(0xffffffffffffffff); + return 0xffffffffffffffffU; } //logerror("ieee1394_r: %08X, %08X%08X\n", offset, (uint32_t)(mem_mask >> 32), (uint32_t)(mem_mask)); diff --git a/src/mame/drivers/viper.cpp b/src/mame/drivers/viper.cpp index 5300d5d199c..3d49c8e88e1 100644 --- a/src/mame/drivers/viper.cpp +++ b/src/mame/drivers/viper.cpp @@ -528,25 +528,25 @@ static void mpc8240_pci_w(device_t *busdevice, device_t *device, int function, i READ64_MEMBER(viper_state::pci_config_addr_r) { pci_bus_legacy_device *device = machine().device("pcibus"); - return device->read_64be(space, 0, U64(0xffffffff00000000)); + return device->read_64be(space, 0, 0xffffffff00000000U); } WRITE64_MEMBER(viper_state::pci_config_addr_w) { pci_bus_legacy_device *device = machine().device("pcibus"); - device->write_64be(space, 0, data, U64(0xffffffff00000000)); + device->write_64be(space, 0, data, 0xffffffff00000000U); } READ64_MEMBER(viper_state::pci_config_data_r) { pci_bus_legacy_device *device = machine().device("pcibus"); - return device->read_64be(space, 1, U64(0x00000000ffffffff)) << 32; + return device->read_64be(space, 1, 0x00000000ffffffffU) << 32; } WRITE64_MEMBER(viper_state::pci_config_data_w) { pci_bus_legacy_device *device = machine().device("pcibus"); - device->write_64be(space, 1, data >> 32, U64(0x00000000ffffffff)); + device->write_64be(space, 1, data >> 32, 0x00000000ffffffffU); } @@ -1756,9 +1756,9 @@ TIMER_CALLBACK_MEMBER(viper_state::ds2430_timer_callback) READ64_MEMBER(viper_state::unk1_r) { uint64_t r = 0; - //return 0;//U64(0x0000400000000000); + //return 0;//0x0000400000000000U; - r |= U64(0xffff00000000ffff); + r |= 0xffff00000000ffffU; if (ACCESSING_BITS_40_47) { @@ -1771,10 +1771,10 @@ READ64_MEMBER(viper_state::unk1_r) r |= reg << 40; //r |= (uint64_t)(unk1_bit << 5) << 40; - //r |= U64(0x0000400000000000); + //r |= 0x0000400000000000U; - //r |= U64(0x0000040000000000); // screen flip - //r |= U64(0x0000080000000000); // memory card check (1 = enable) + //r |= 0x0000040000000000U; // screen flip + //r |= 0x0000080000000000U; // memory card check (1 = enable) } if (ACCESSING_BITS_32_39) { @@ -1984,7 +1984,7 @@ WRITE64_MEMBER(viper_state::e00008_w) READ64_MEMBER(viper_state::e00000_r) { - uint64_t r = 0;//U64(0xffffffffffffffff); + uint64_t r = 0;//0xffffffffffffffffU; return r; } @@ -2056,7 +2056,7 @@ WRITE64_MEMBER(viper_state::unk_serial_w) static ADDRESS_MAP_START(viper_map, AS_PROGRAM, 64, viper_state ) AM_RANGE(0x00000000, 0x00ffffff) AM_MIRROR(0x1000000) AM_RAM AM_SHARE("workram") - AM_RANGE(0x80000000, 0x800fffff) AM_READWRITE32(epic_r, epic_w,U64(0xffffffffffffffff)) + AM_RANGE(0x80000000, 0x800fffff) AM_READWRITE32(epic_r, epic_w,0xffffffffffffffffU) AM_RANGE(0x82000000, 0x83ffffff) AM_READWRITE(voodoo3_r, voodoo3_w) AM_RANGE(0x84000000, 0x85ffffff) AM_READWRITE(voodoo3_lfb_r, voodoo3_lfb_w) AM_RANGE(0xfe800000, 0xfe8000ff) AM_READWRITE(voodoo3_io_r, voodoo3_io_w) @@ -2068,7 +2068,7 @@ static ADDRESS_MAP_START(viper_map, AS_PROGRAM, 64, viper_state ) AM_RANGE(0xffe00000, 0xffe00007) AM_READ(e00000_r) AM_RANGE(0xffe00008, 0xffe0000f) AM_READWRITE(e00008_r, e00008_w) AM_RANGE(0xffe10000, 0xffe10007) AM_READ(unk1_r) - AM_RANGE(0xffe30000, 0xffe31fff) AM_DEVREADWRITE8("m48t58", timekeeper_device, read, write, U64(0xffffffffffffffff)) + AM_RANGE(0xffe30000, 0xffe31fff) AM_DEVREADWRITE8("m48t58", timekeeper_device, read, write, 0xffffffffffffffffU) AM_RANGE(0xffe40000, 0xffe4000f) AM_NOP AM_RANGE(0xffe50000, 0xffe50007) AM_WRITE(unk2_w) AM_RANGE(0xffe70000, 0xffe7000f) AM_READWRITE(e70000_r, e70000_w) diff --git a/src/mame/machine/awboard.cpp b/src/mame/machine/awboard.cpp index 85be7ef263a..59dd8179828 100644 --- a/src/mame/machine/awboard.cpp +++ b/src/mame/machine/awboard.cpp @@ -301,7 +301,7 @@ READ16_MEMBER(aw_rom_board::pio_r) uint32_t roffset = epr_offset & 0x3ffffff; if (roffset >= (mpr_offset / 2)) roffset += mpr_bank * 0x4000000; - uint16_t retval = (m_region->bytes() > (roffset * 2)) ? m_region->u16(roffset) : 0; // not endian-safe? + uint16_t retval = (m_region->bytes() > (roffset * 2)) ? m_region->as_u16(roffset) : 0; // not endian-safe? return retval; } diff --git a/src/mame/machine/awboard.h b/src/mame/machine/awboard.h index acc075bc209..9f47c20b4b1 100644 --- a/src/mame/machine/awboard.h +++ b/src/mame/machine/awboard.h @@ -57,7 +57,7 @@ private: static const int permutation_table[4][16]; static const sbox_set sboxes_table[4]; static uint16_t decrypt(uint16_t cipherText, uint32_t address, const uint32_t key); - uint16_t decrypt16(uint32_t address) { return decrypt(m_region->u16(address), address, rombd_key); } + uint16_t decrypt16(uint32_t address) { return decrypt(m_region->as_u16(address), address, rombd_key); } void set_key(); void recalc_dma_offset(int mode); diff --git a/src/mame/machine/bebox.cpp b/src/mame/machine/bebox.cpp index 0454baf3dd6..49856bdbb9c 100644 --- a/src/mame/machine/bebox.cpp +++ b/src/mame/machine/bebox.cpp @@ -804,10 +804,10 @@ DRIVER_INIT_MEMBER(bebox_state,bebox) { /* li r0, 0x0700 */ /* mtspr ctr, r0 */ - U64(0x380007007C0903A6), + 0x380007007C0903A6U, /* bcctr 0x14, 0 */ - U64(0x4E80042000000000) + 0x4E80042000000000U }; space_1.install_read_bank(0x9421FFF0, 0x9421FFFF, "bank1"); membank("bank1")->set_base(ops); diff --git a/src/mame/machine/dc.cpp b/src/mame/machine/dc.cpp index 0541938f582..7b5d08dd79d 100644 --- a/src/mame/machine/dc.cpp +++ b/src/mame/machine/dc.cpp @@ -241,13 +241,13 @@ int dc_state::decode_reg32_64(uint32_t offset, uint64_t mem_mask, uint64_t *shif *shift = 0; // non 32-bit accesses have not yet been seen here, we need to know when they are - if ((mem_mask != U64(0xffffffff00000000)) && (mem_mask != U64(0x00000000ffffffff))) + if ((mem_mask != 0xffffffff00000000U) && (mem_mask != 0x00000000ffffffffU)) { osd_printf_verbose("%s:Wrong mask!\n", machine().describe_context()); //machine().debug_break(); } - if (mem_mask == U64(0xffffffff00000000)) + if (mem_mask == 0xffffffff00000000U) { reg++; *shift = 32; @@ -264,8 +264,8 @@ int dc_state::decode_reg3216_64(uint32_t offset, uint64_t mem_mask, uint64_t *sh *shift = 0; // non 16&32-bit accesses have not yet been seen here, we need to know when they are - if ((mem_mask != U64(0x0000ffff00000000)) && (mem_mask != U64(0x000000000000ffff)) && - (mem_mask != U64(0xffffffff00000000)) && (mem_mask != U64(0x00000000ffffffff))) + if ((mem_mask != 0x0000ffff00000000U) && (mem_mask != 0x000000000000ffffU) && + (mem_mask != 0xffffffff00000000U) && (mem_mask != 0x00000000ffffffffU)) { osd_printf_verbose("%s:Wrong mask!\n", machine().describe_context()); //machine().debug_break(); @@ -591,13 +591,13 @@ int dc_state::decode_reg_64(uint32_t offset, uint64_t mem_mask, uint64_t *shift) *shift = 0; // non 32-bit accesses have not yet been seen here, we need to know when they are - if ((mem_mask != U64(0xffffffff00000000)) && (mem_mask != U64(0x00000000ffffffff))) + if ((mem_mask != 0xffffffff00000000U) && (mem_mask != 0x00000000ffffffffU)) { /*assume to return the lower 32-bits ONLY*/ return reg & 0xffffffff; } - if (mem_mask == U64(0xffffffff00000000)) + if (mem_mask == 0xffffffff00000000U) { reg++; *shift = 32; @@ -617,7 +617,7 @@ READ64_MEMBER(dc_state::dc_modem_r ) // our PVR emulation is apparently not good enough for that to work yet though. if (reg == 0x280/4) { - return U64(0xffffffffffffffff); + return 0xffffffffffffffffU; } osd_printf_verbose("MODEM: Unmapped read %08x\n", 0x600000+reg*4); diff --git a/src/mame/machine/intv.cpp b/src/mame/machine/intv.cpp index 72ee38838e0..38498eccce1 100644 --- a/src/mame/machine/intv.cpp +++ b/src/mame/machine/intv.cpp @@ -307,7 +307,7 @@ READ8_MEMBER( intv_state::intvkb_iocart_r ) else if (m_iocart2->exists()) return m_iocart2->read_rom(space, offset, mem_mask); else - return m_region_keyboard->u8(offset + 0xe000); + return m_region_keyboard->as_u8(offset + 0xe000); } diff --git a/src/mame/machine/m24_z8000.cpp b/src/mame/machine/m24_z8000.cpp index a9b0be408ed..9019ab3b109 100644 --- a/src/mame/machine/m24_z8000.cpp +++ b/src/mame/machine/m24_z8000.cpp @@ -98,7 +98,7 @@ READ16_MEMBER(m24_z8000_device::pmem_r) uint8_t hostseg; offset <<= 1; if(!m_z8000_mem) - return memregion(subtag("z8000").c_str())->u16(offset >> 1); + return memregion(subtag("z8000").c_str())->as_u16(offset >> 1); hostseg = pmem_table[(offset >> 16) & 0xf][(offset >> 14) & 3]; if(hostseg == 255) diff --git a/src/mame/machine/model3.cpp b/src/mame/machine/model3.cpp index 70e0125b23b..4c13264c150 100644 --- a/src/mame/machine/model3.cpp +++ b/src/mame/machine/model3.cpp @@ -152,7 +152,7 @@ void model3_state::tap_write(int tck, int tms, int tdi, int trst) case 3: // Capture-DR //printf("capture dr (IR = %08X%08X\n", (uint32_t)(m_ir >> 32),(uint32_t)(m_ir)); - if (m_ir == U64(0x000023fffffffffe)) + if (m_ir == 0x000023fffffffffeU) { for (auto & elem : m_id_data) { @@ -167,7 +167,7 @@ void model3_state::tap_write(int tck, int tms, int tdi, int trst) for (int i = 41; i >= 0; i--) insert_bit(m_id_data, start_bit++, ((uint64_t)(1 << i) & res) ? 1 : 0); } - else if (m_ir == U64(0x00000c631f8c7ffe)) + else if (m_ir == 0x00000c631f8c7ffeU) { tap_set_asic_ids(); } @@ -205,7 +205,7 @@ void model3_state::tap_write(int tck, int tms, int tdi, int trst) * TCK) */ - m_ir &= U64(0x3fffffffffff); + m_ir &= 0x3fffffffffffU; break; default: diff --git a/src/mame/machine/msx.cpp b/src/mame/machine/msx.cpp index 50fbc70c4bd..d88b618aaf8 100644 --- a/src/mame/machine/msx.cpp +++ b/src/mame/machine/msx.cpp @@ -501,7 +501,7 @@ READ8_MEMBER( msx_state::msx_kanji_r ) if (offset && m_region_kanji) { int latch = m_kanji_latch; - result = m_region_kanji->u8(latch++); + result = m_region_kanji->as_u8(latch++); m_kanji_latch &= ~0x1f; m_kanji_latch |= latch & 0x1f; diff --git a/src/mame/machine/n64.cpp b/src/mame/machine/n64.cpp index 8ab56187b43..57fca3a602d 100644 --- a/src/mame/machine/n64.cpp +++ b/src/mame/machine/n64.cpp @@ -239,7 +239,7 @@ void n64_periphs::device_reset() cic_type=2; m_mem_map->write_dword(0x00000318, 0x800000); /* RDRAM Size */ - if (boot_checksum == U64(0x00000000001ff230)) + if (boot_checksum == 0x00000000001ff230U) { pif_ram[0x24] = 0x00; pif_ram[0x25] = 0x08; @@ -247,7 +247,7 @@ void n64_periphs::device_reset() pif_ram[0x27] = 0x3f; cic_type=0xd; } - else if (boot_checksum == U64(0x000000cffb830843) || boot_checksum == U64(0x000000d0027fdf31)) + else if (boot_checksum == 0x000000cffb830843U || boot_checksum == 0x000000d0027fdf31U) { // CIC-NUS-6101 pif_ram[0x24] = 0x00; @@ -256,7 +256,7 @@ void n64_periphs::device_reset() pif_ram[0x27] = 0x3f; cic_type=1; } - else if (boot_checksum == U64(0x000000d6499e376b)) + else if (boot_checksum == 0x000000d6499e376bU) { // CIC-NUS-6103 pif_ram[0x24] = 0x00; @@ -265,7 +265,7 @@ void n64_periphs::device_reset() pif_ram[0x27] = 0x3f; cic_type=3; } - else if (boot_checksum == U64(0x0000011a4a1604b6)) + else if (boot_checksum == 0x0000011a4a1604b6U) { // CIC-NUS-6105 pif_ram[0x24] = 0x00; @@ -275,7 +275,7 @@ void n64_periphs::device_reset() cic_type=5; m_mem_map->write_dword(0x000003f0, 0x800000); } - else if (boot_checksum == U64(0x000000d6d5de4ba0)) + else if (boot_checksum == 0x000000d6d5de4ba0U) { // CIC-NUS-6106 pif_ram[0x24] = 0x00; diff --git a/src/mame/machine/naomim2.cpp b/src/mame/machine/naomim2.cpp index 2074625a17e..e4b140a7231 100644 --- a/src/mame/machine/naomim2.cpp +++ b/src/mame/machine/naomim2.cpp @@ -195,7 +195,7 @@ uint16_t naomi_m2_board::read_callback(uint32_t addr) } else { - const uint8_t *base = &m_region->u8(2*addr); + const uint8_t *base = &m_region->as_u8(2*addr); return base[1] | (base[0] << 8); } } diff --git a/src/mame/video/atarisy1.cpp b/src/mame/video/atarisy1.cpp index a7ebae47282..2f41ce7d5d1 100644 --- a/src/mame/video/atarisy1.cpp +++ b/src/mame/video/atarisy1.cpp @@ -511,8 +511,8 @@ uint32_t atarisy1_state::screen_update_atarisy1(screen_device &screen, bitmap_in void atarisy1_state::decode_gfx(uint16_t *pflookup, uint16_t *molookup) { - uint8_t *prom1 = &memregion("proms")->u8(0x000); - uint8_t *prom2 = &memregion("proms")->u8(0x200); + uint8_t *prom1 = &memregion("proms")->as_u8(0x000); + uint8_t *prom2 = &memregion("proms")->as_u8(0x200); int obj, i; /* reset the globals */ @@ -613,7 +613,7 @@ int atarisy1_state::get_bank(uint8_t prom1, uint8_t prom2, int bpp) assert(gfx_index != MAX_GFX_ELEMENTS); /* decode the graphics */ - srcdata = &tiles->u8(0x80000 * (bank_index - 1)); + srcdata = &tiles->as_u8(0x80000 * (bank_index - 1)); switch (bpp) { case 4: diff --git a/src/mame/video/model3.cpp b/src/mame/video/model3.cpp index 259d2ebe53e..a6e74fa823a 100644 --- a/src/mame/video/model3.cpp +++ b/src/mame/video/model3.cpp @@ -488,7 +488,7 @@ READ64_MEMBER(model3_state::model3_vid_reg_r) switch(offset) { case 0x00/8: return m_vid_reg0; - case 0x08/8: return U64(0xffffffffffffffff); /* ??? */ + case 0x08/8: return 0xffffffffffffffffU; /* ??? */ case 0x20/8: return (uint64_t)m_layer_priority << 48; case 0x40/8: return ((uint64_t)m_layer_modulate1 << 32) | (uint64_t)m_layer_modulate2; default: logerror("read reg %02X\n", offset);break; diff --git a/src/mame/video/powervr2.cpp b/src/mame/video/powervr2.cpp index 1445b3cfbe7..641c2c4b60e 100644 --- a/src/mame/video/powervr2.cpp +++ b/src/mame/video/powervr2.cpp @@ -2022,7 +2022,7 @@ void powervr2_device::process_ta_fifo() WRITE64_MEMBER( powervr2_device::ta_fifo_poly_w ) { - if (mem_mask == U64(0xffffffffffffffff)) // 64 bit + if (mem_mask == 0xffffffffffffffffU) // 64 bit { tafifo_buff[tafifo_pos]=(uint32_t)data; tafifo_buff[tafifo_pos+1]=(uint32_t)(data >> 32); diff --git a/src/osd/osdcomm.h b/src/osd/osdcomm.h index d6ed9a43a88..d7caf6a5463 100644 --- a/src/osd/osdcomm.h +++ b/src/osd/osdcomm.h @@ -59,31 +59,24 @@ FUNDAMENTAL TYPES ***************************************************************************/ +namespace osd { -/* 8-bit values */ -using std::uint8_t; -using std::int8_t; +using u8 = std::uint8_t; +using u16 = std::uint16_t; +using u32 = std::uint32_t; +using u64 = std::uint64_t; -/* 16-bit values */ -using std::uint16_t; -using std::int16_t; +using s8 = std::int8_t; +using s16 = std::int16_t; +using s32 = std::int32_t; +using s64 = std::int64_t; -/* 32-bit values */ -using std::uint32_t; -using std::int32_t; - -/* 64-bit values */ -using std::uint64_t; -using std::int64_t; +} // namespace OSD /*************************************************************************** FUNDAMENTAL MACROS ***************************************************************************/ -/* U64 and S64 are used to wrap long integer constants. */ -#define U64(val) val##ULL -#define S64(val) val##LL - /* Concatenate/extract 32-bit halves of 64-bit values */ constexpr uint64_t concat_64(uint32_t hi, uint32_t lo) { return (uint64_t(hi) << 32) | uint32_t(lo); } constexpr uint32_t extract_64hi(uint64_t val) { return uint32_t(val >> 32); } @@ -107,8 +100,8 @@ constexpr uint16_t flipendian_int16(uint16_t val) { return (val << 8) | (val >> constexpr uint32_t flipendian_int32_partial16(uint32_t val) { return ((val << 8) & 0xFF00FF00U) | ((val >> 8) & 0x00FF00FFU); } constexpr uint32_t flipendian_int32(uint32_t val) { return (flipendian_int32_partial16(val) << 16) | (flipendian_int32_partial16(val) >> 16); } -constexpr uint64_t flipendian_int64_partial16(uint64_t val) { return ((val << 8) & U64(0xFF00FF00FF00FF00)) | ((val >> 8) & U64(0x00FF00FF00FF00FF)); } -constexpr uint64_t flipendian_int64_partial32(uint64_t val) { return ((flipendian_int64_partial16(val) << 16) & U64(0xFFFF0000FFFF0000)) | ((flipendian_int64_partial16(val) >> 16) & U64(0x0000FFFF0000FFFF)); } +constexpr uint64_t flipendian_int64_partial16(uint64_t val) { return ((val << 8) & 0xFF00FF00FF00FF00U) | ((val >> 8) & 0x00FF00FF00FF00FFU); } +constexpr uint64_t flipendian_int64_partial32(uint64_t val) { return ((flipendian_int64_partial16(val) << 16) & 0xFFFF0000FFFF0000U) | ((flipendian_int64_partial16(val) >> 16) & 0x0000FFFF0000FFFFU); } constexpr uint64_t flipendian_int64(uint64_t val) { return (flipendian_int64_partial32(val) << 32) | (flipendian_int64_partial32(val) >> 32); } #ifdef LSB_FIRST diff --git a/src/tools/imgtool/modules/fat.cpp b/src/tools/imgtool/modules/fat.cpp index 7d9cd4694dc..a7fab14e029 100644 --- a/src/tools/imgtool/modules/fat.cpp +++ b/src/tools/imgtool/modules/fat.cpp @@ -465,7 +465,7 @@ static imgtoolerr_t fat_partition_create(imgtool::image &image, uint64_t first_b #endif /* check for limits */ - if (block_count > U64(0xFFFFFFFFFFFF)) + if (block_count > 0xFFFFFFFFFFFFU) return IMGTOOLERR_PARAMTOOLARGE; /* get the geometry */