Skip to content

Commit

Permalink
Tidied up some recent changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
cuavas committed May 15, 2024
1 parent d7d37c0 commit ed77088
Show file tree
Hide file tree
Showing 12 changed files with 248 additions and 222 deletions.
2 changes: 1 addition & 1 deletion src/mame/midway/midzeus.h
Expand Up @@ -119,7 +119,7 @@ class midzeus_state : public driver_device
optional_memory_bank m_mainbank;

private:
static constexpr XTAL MIDZEUS_VIDEO_CLOCK = XTAL(66'666'700);
static inline constexpr XTAL MIDZEUS_VIDEO_CLOCK = 66.6667_MHz_XTAL;

void exit_handler();
void zeus_pointer_w(uint32_t which, uint32_t data, bool logit);
Expand Down
22 changes: 9 additions & 13 deletions src/mame/midway/midzeus_v.cpp
Expand Up @@ -346,40 +346,40 @@ uint32_t midzeus_state::screen_update(screen_device &screen, bitmap_ind16 &bitma

uint32_t midzeus_state::zeus_r(offs_t offset)
{
bool logit = ((!machine().side_effects_disabled()) && (offset < 0xb0 || offset > 0xb7));
bool logit = !machine().side_effects_disabled() && ((offset < 0xb0) || (offset > 0xb7));
uint32_t result = m_zeusbase[offset & ~1];

switch (offset & ~1)
{
case 0xf0:
result = m_screen->hpos();
logit = 0;
logit = false;
break;

case 0xf2:
result = m_screen->vpos();
logit = 0;
logit = false;
break;

case 0xf4:
result = 6;
if (m_screen->vblank())
result |= 0x800;
logit = 0;
logit = false;
break;

case 0xf6: // status -- they wait for this & 9 == 0
// value & $9600 must == $9600 to pass Zeus system test
result = 0x9600;
if (m_zeusbase[0xb6] == 0x80040000)
result |= 1;
logit = 0;
logit = false;
break;
}

// 32-bit mode
if (m_zeusbase[0x80] & 0x00020000)
{
// 32-bit mode
if (offset & 1)
result >>= 16;
if (logit)
Expand All @@ -392,10 +392,9 @@ uint32_t midzeus_state::zeus_r(offs_t offset)
LOGZEUS("%06X:zeus32_r(%02X) = %08X\n", m_maincpu->pc(), offset, result);
}
}

// 16-bit mode
else
{
// 16-bit mode
if (offset & 1)
result >>= 16;
else
Expand All @@ -421,13 +420,10 @@ void midzeus_state::zeus_w(offs_t offset, uint32_t data)
if (logit)
LOGZEUS("%06X:zeus_w", m_maincpu->pc());

// 32-bit mode
if (m_zeusbase[0x80] & 0x00020000)
zeus_register32_w(offset, data, logit);

// 16-bit mode
zeus_register32_w(offset, data, logit); // 32-bit mode
else
zeus_register16_w(offset, data, logit);
zeus_register16_w(offset, data, logit); // 16-bit mode
}


Expand Down
33 changes: 15 additions & 18 deletions src/mame/misc/micro3d_a.cpp
Expand Up @@ -75,8 +75,8 @@ void micro3d_sound_device::lp_filter::init(double fsval)

static void prewarp(double &a0, double &a1, double &a2, double fc, double fs)
{
double pi = 4.0 * atan(1.0);
double wp = 2.0 * fs * tan(pi * fc / fs);
double const pi = 4.0 * atan(1.0);
double const wp = 2.0 * fs * tan(pi * fc / fs);

a2 = a2 / (wp * wp);
a1 = a1 / wp;
Expand All @@ -86,8 +86,8 @@ static void bilinear(double a0, double a1, double a2,
double b0, double b1, double b2,
double &k, double fs, float *coef)
{
double ad = 4. * a2 * fs * fs + 2. * a1 * fs + a0;
double bd = 4. * b2 * fs * fs + 2. * b1* fs + b0;
double const ad = 4. * a2 * fs * fs + 2. * a1 * fs + a0;
double const bd = 4. * b2 * fs * fs + 2. * b1* fs + b0;

k *= ad / bd;

Expand Down Expand Up @@ -137,8 +137,8 @@ void micro3d_sound_device::noise_sh_w(u8 data)
else
m_gain = expf(-(float)(m_dac[VCA]) / 25.0f) * 10.0f;

double q = 0.75/255 * (255 - m_dac[VCQ]) + 0.1;
double fc = 4500.0/255 * (255 - m_dac[VCF]) + 100;
double const q = 0.75/255 * (255 - m_dac[VCQ]) + 0.1;
double const fc = 4500.0/255 * (255 - m_dac[VCF]) + 100;

m_filter.recompute(m_gain, q, fc);
}
Expand Down Expand Up @@ -195,15 +195,12 @@ void micro3d_sound_device::device_start()
save_item(NAME(m_filter.history));
save_item(NAME(m_filter.coef));
save_item(NAME(m_filter.fs));
for (int i = 0; i < 2; i++)
{
save_item(NAME(m_filter.proto_coef[i].a0), i);
save_item(NAME(m_filter.proto_coef[i].a1), i);
save_item(NAME(m_filter.proto_coef[i].a2), i);
save_item(NAME(m_filter.proto_coef[i].b0), i);
save_item(NAME(m_filter.proto_coef[i].b1), i);
save_item(NAME(m_filter.proto_coef[i].b2), i);
}
save_item(STRUCT_MEMBER(m_filter.proto_coef, a0));
save_item(STRUCT_MEMBER(m_filter.proto_coef, a1));
save_item(STRUCT_MEMBER(m_filter.proto_coef, a2));
save_item(STRUCT_MEMBER(m_filter.proto_coef, b0));
save_item(STRUCT_MEMBER(m_filter.proto_coef, b1));
save_item(STRUCT_MEMBER(m_filter.proto_coef, b2));
save_item(STRUCT_MEMBER(m_noise_filters, capval));
save_item(STRUCT_MEMBER(m_noise_filters, exponent));
}
Expand Down Expand Up @@ -239,8 +236,8 @@ void micro3d_sound_device::sound_stream_update(sound_stream &stream, std::vector
if (m_gain == 0)
return;

float pan_l = (float)(255 - m_dac[PAN]) / 255.0f;
float pan_r = (float)(m_dac[PAN]) / 255.0f;
float const pan_l = float(255 - m_dac[PAN]) / 255.0f;
float const pan_r = float(m_dac[PAN]) / 255.0f;

for (int sampindex = 0; sampindex < fl.samples(); sampindex++)
{
Expand All @@ -254,7 +251,7 @@ void micro3d_sound_device::sound_stream_update(sound_stream &stream, std::vector
m_noise_subcount = 2000000 / MM5837_CLOCK;
}
m_noise_subcount -= step;
float input = (float)m_noise_value - 0.5f;
float input = float(m_noise_value) - 0.5f;
float white = input;

// Pink noise filtering
Expand Down
3 changes: 2 additions & 1 deletion src/mame/misc/micro3d_a.h
Expand Up @@ -27,7 +27,8 @@ class micro3d_sound_device : public device_t, public device_sound_interface
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;

private:
enum dac_registers {
enum dac_registers
{
VCF,
VCQ,
VCA,
Expand Down
5 changes: 3 additions & 2 deletions src/mame/misc/micro3d_v.cpp
Expand Up @@ -297,8 +297,9 @@ void micro3d_state::draw_line(uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2

if (x2 < x1)
{
std::swap<uint32_t>(x1, x2);
std::swap<uint32_t>(y1, y2);
using std::swap;
swap(x1, x2);
swap(y1, y2);
}

dx = x2 - x1;
Expand Down
2 changes: 1 addition & 1 deletion src/mame/pinball/inder.cpp
Expand Up @@ -1709,4 +1709,4 @@ GAME(1991, larana, 0, inder, larana, inder_state, init_0, ROT0, "Inder",
GAME(1992, ind250cc, 0, inder, ind250cc, inder_state, init_1, ROT0, "Inder", "250 CC", MACHINE_MECHANICAL | MACHINE_SUPPORTS_SAVE )

// Unknown sound hardware, unknown machine (using 'larana' inputs until proper ones are figured out).
GAME(1991, indunkgam, 0, inder, larana, inder_state, init_0, ROT0, "Inder", "Unknown gambling game on Inder pinball hardware", MACHINE_IS_SKELETON_MECHANICAL | MACHINE_SUPPORTS_SAVE )
GAME(1991, indunkgam, 0, inder, larana, inder_state, init_0, ROT0, "Inder", "unknown gambling game on Inder pinball hardware", MACHINE_IS_SKELETON_MECHANICAL | MACHINE_SUPPORTS_SAVE )
18 changes: 9 additions & 9 deletions src/mame/promat/3x3puzzl.cpp
Expand Up @@ -82,17 +82,17 @@ class _3x3puzzle_state : public driver_device
required_device<gfxdecode_device> m_gfxdecode;
required_device<screen_device> m_screen;

// screen updates
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);

// video-related
tilemap_t *m_tilemap[3] = {nullptr, nullptr, nullptr};

template<unsigned Which> TILE_GET_INFO_MEMBER(get_tile_info);

int m_oki_bank = 0;
uint16_t m_gfx_control = 0;

// screen updates
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);

template <unsigned Which> TILE_GET_INFO_MEMBER(get_tile_info);

void gfx_ctrl_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
void tilemap1_scrollx_w(uint16_t data);
void tilemap1_scrolly_w(uint16_t data);
Expand All @@ -101,7 +101,7 @@ class _3x3puzzle_state : public driver_device
};


template<unsigned Which>
template <unsigned Which>
TILE_GET_INFO_MEMBER(_3x3puzzle_state::get_tile_info)
{
tileinfo.set(Which,
Expand Down Expand Up @@ -294,10 +294,10 @@ static INPUT_PORTS_START( casanova )

PORT_MODIFY("DSW01") // Do NOT trust "DIP INFO" for correct settings! At least Coinage is WRONG!
PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:1,2")
PORT_DIPSETTING( 0x0002, DEF_STR( 1C_2C ) ) // Dip info shows 2 Coins / Credit
PORT_DIPSETTING( 0x0002, DEF_STR( 1C_2C ) ) // DIP switch info shows 2 Coins / Credit
PORT_DIPSETTING( 0x0003, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x0001, DEF_STR( 2C_1C ) ) // Dip info shows 3 Coins / Credit
PORT_DIPSETTING( 0x0000, DEF_STR( 3C_1C ) ) // Dip info shows 5 Coins / Credit
PORT_DIPSETTING( 0x0001, DEF_STR( 2C_1C ) ) // DIP switch info shows 3 Coins / Credit
PORT_DIPSETTING( 0x0000, DEF_STR( 3C_1C ) ) // DIP switch info shows 5 Coins / Credit
PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:3,4")
PORT_DIPSETTING( 0x0008, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x000c, DEF_STR( Normal ) )
Expand Down

0 comments on commit ed77088

Please sign in to comment.