hwchamp: Use ADC device

This commit is contained in:
AJR 2023-09-02 13:13:48 -04:00
parent fbdee38492
commit 45db59a77c
2 changed files with 38 additions and 41 deletions

View File

@ -1277,7 +1277,6 @@ void segas16b_state::machine_start()
void segas16b_state::machine_reset()
{
m_atomicp_sound_count = 0;
m_hwc_input_value = 0;
m_mj_input_num = 0;
m_mj_last_val = 0;
@ -1490,10 +1489,8 @@ uint16_t segas16b_state::hwchamp_custom_io_r(address_space &space, offs_t offset
switch (offset & 0x30/2)
{
case 0x20/2:
result = (m_hwc_input_value & 0x80) >> 7;
if (!machine().side_effects_disabled())
m_hwc_input_value <<= 1;
return result;
return m_adc->d0_r(space);
case 0x30/2: // c43035
/*
Signals, affects blocking and stance (both fists down, both fists up, up/down or down/up)
@ -1535,25 +1532,7 @@ void segas16b_state::hwchamp_custom_io_w(address_space &space, offs_t offset, ui
switch (offset & 0x30/2)
{
case 0x20/2:
switch (offset & 3)
{
case 0:
m_hwc_input_value = m_hwc_monitor->read();
break;
// TODO: order of these two flipped when returning a status of 0xf0 instead of open bus in r 0x30?
case 1:
m_hwc_input_value = m_hwc_right->read();
break;
case 2:
m_hwc_input_value = m_hwc_left->read();
break;
default:
m_hwc_input_value = 0xff;
break;
}
m_adc->address_w(offset & 3, 0);
break;
case 0x30/2:
@ -4157,6 +4136,26 @@ void segas16b_state::aceattacb_fd1094(machine_config &config)
m_cxdio->in_portb_cb().set_ioport("HANDX2");
}
void segas16b_state::hwchamp(machine_config &config)
{
system16b(config);
MSM6253(config, m_adc, 0);
m_adc->set_input_tag<0>("MONITOR");
// TODO: order of these two flipped when returning a status of 0xf0 instead of open bus in r 0x30?
m_adc->set_input_tag<1>("RIGHT");
m_adc->set_input_tag<2>("LEFT");
}
void segas16b_state::hwchamp_fd1094(machine_config &config)
{
system16b_fd1094(config);
MSM6253(config, m_adc, 0);
m_adc->set_input_tag<0>("MONITOR");
// TODO: order of these two flipped when returning a status of 0xf0 instead of open bus in r 0x30?
m_adc->set_input_tag<1>("RIGHT");
m_adc->set_input_tag<2>("LEFT");
}
void segas16b_state::system16b_i8751(machine_config &config)
{
system16b(config);
@ -9861,7 +9860,6 @@ void segas16b_state::init_generic(segas16b_rom_board rom_board)
// save state
save_item(NAME(m_atomicp_sound_count));
save_item(NAME(m_hwc_input_value));
save_item(NAME(m_mj_input_num));
save_item(NAME(m_mj_last_val));
}
@ -10110,9 +10108,9 @@ GAME( 1989, goldnaxe3, goldnaxe, system16b_fd1094, goldnaxe, segas16b_stat
GAME( 1989, goldnaxe2, goldnaxe, system16b_i8751, goldnaxe, segas16b_state, init_generic_5704, ROT0, "Sega", "Golden Axe (set 2, US) (8751 317-0112)", 0 )
GAME( 1989, goldnaxe1, goldnaxe, system16b_fd1094_5797, goldnaxe, segas16b_state, init_generic_5797, ROT0, "Sega", "Golden Axe (set 1, World) (FD1094 317-0110)", 0 )
GAME( 1987, hwchamp, 0, system16b, hwchamp, segas16b_state, init_hwchamp_5521, ROT0, "Sega", "Heavyweight Champ (set 1)", 0 )
GAME( 1987, hwchampa, hwchamp, system16b, hwchamp, segas16b_state, init_hwchamp_5521, ROT0, "Sega", "Heavyweight Champ (set 2)", 0 )
GAME( 1987, hwchampj, hwchamp, system16b_fd1094, hwchamp, segas16b_state, init_hwchamp_5521, ROT0, "Sega", "Heavyweight Champ (Japan) (FD1094 317-0046)", 0 )
GAME( 1987, hwchamp, 0, hwchamp, hwchamp, segas16b_state, init_hwchamp_5521, ROT0, "Sega", "Heavyweight Champ (set 1)", 0 )
GAME( 1987, hwchampa, hwchamp, hwchamp, hwchamp, segas16b_state, init_hwchamp_5521, ROT0, "Sega", "Heavyweight Champ (set 2)", 0 )
GAME( 1987, hwchampj, hwchamp, hwchamp_fd1094, hwchamp, segas16b_state, init_hwchamp_5521, ROT0, "Sega", "Heavyweight Champ (Japan) (FD1094 317-0046)", 0 )
GAME( 1989, mvp, 0, system16b_fd1094_5797, mvp, segas16b_state, init_generic_5797, ROT0, "Sega", "MVP (set 2, US) (FD1094 317-0143)", 0 )
GAME( 1989, mvpj, mvp, system16b_fd1094, mvp, segas16b_state, init_generic_5704, ROT0, "Sega", "MVP (set 1, Japan) (FD1094 317-0142)", 0 )
@ -10217,7 +10215,7 @@ GAME( 1987, sonicbomd, sonicbom, system16b, sonicbom, segas16b_stat
GAME( 1990, ryukyud, ryukyu, system16b, ryukyu, segas16b_state, init_generic_5704, ROT0, "bootleg", "RyuKyu (Japan) (bootleg of FD1094 317-5023 set)", 0 )
GAME( 1987, hwchampjd, hwchamp, system16b, hwchamp, segas16b_state, init_hwchamp_5521, ROT0, "bootleg", "Heavyweight Champ (Japan) (bootleg of FD1094 317-0046 set)", 0 )
GAME( 1987, hwchampjd, hwchamp, hwchamp, hwchamp, segas16b_state, init_hwchamp_5521, ROT0, "bootleg", "Heavyweight Champ (Japan) (bootleg of FD1094 317-0046 set)", 0 )
GAME( 1987, bulletd, bullet, system16b, bullet, segas16b_state, init_generic_5358_small, ROT0, "bootleg", "Bullet (bootleg of FD1094 317-0041 set)", 0 )

View File

@ -10,21 +10,24 @@
#pragma once
#include "315_5195.h"
#include "segaic16_m.h"
#include "segaic16.h"
#include "sega16sp.h"
#include "cpu/m68000/m68000.h"
#include "cpu/mcs51/mcs51.h"
#include "cpu/z80/z80.h"
#include "315_5195.h"
#include "machine/cxd1095.h"
#include "machine/gen_latch.h"
#include "machine/msm6253.h"
#include "machine/nvram.h"
#include "segaic16_m.h"
#include "machine/upd4701.h"
#include "sound/dac.h"
#include "sound/upd7759.h"
#include "sound/ymopm.h"
#include "sound/ymopl.h"
#include "segaic16.h"
#include "sega16sp.h"
#include "screen.h"
INPUT_PORTS_EXTERN( system16b_generic );
@ -54,6 +57,7 @@ public:
, m_soundlatch(*this, "soundlatch")
, m_cxdio(*this, "cxdio")
, m_upd4701a(*this, "upd4701a%u", 1U)
, m_adc(*this, "adc")
, m_workram(*this, "workram")
, m_i8751_sync_timer(nullptr)
, m_romboard(ROM_BOARD_INVALID)
@ -64,10 +68,6 @@ public:
, m_i8751_initial_config(nullptr)
, m_atomicp_sound_divisor(0)
, m_atomicp_sound_count(0)
, m_hwc_input_value(0)
, m_hwc_monitor(*this, "MONITOR")
, m_hwc_left(*this, "LEFT")
, m_hwc_right(*this, "RIGHT")
, m_hwc_left_limit(*this, "LEFT_LIMIT")
, m_hwc_right_limit(*this, "RIGHT_LIMIT")
, m_mj_input_num(0)
@ -87,6 +87,8 @@ public:
void fpointbla(machine_config &config);
void atomicp(machine_config &config);
void aceattacb_fd1094(machine_config &config);
void hwchamp(machine_config &config);
void hwchamp_fd1094(machine_config &config);
void system16b_i8751(machine_config &config);
void system16c(machine_config &config);
void system16b_mc8123(machine_config &config);
@ -248,6 +250,7 @@ protected:
optional_device<generic_latch_8_device> m_soundlatch; // not for atomicp
optional_device<cxd1095_device> m_cxdio; // for aceattac
optional_device_array<upd4701_device, 2> m_upd4701a; // for aceattac
optional_device<msm6253_device> m_adc; // for hwchamp
// memory pointers
required_shared_ptr<uint16_t> m_workram;
@ -267,10 +270,6 @@ protected:
// game-specific state
uint8_t m_atomicp_sound_count;
uint8_t m_hwc_input_value;
optional_ioport m_hwc_monitor;
optional_ioport m_hwc_left;
optional_ioport m_hwc_right;
optional_ioport m_hwc_left_limit;
optional_ioport m_hwc_right_limit;
uint8_t m_mj_input_num;