clean up cane/orbite additions (nw)

This commit is contained in:
Vas Crabb 2019-10-31 23:27:33 +11:00
parent f31b19f9c9
commit ef37c69c9b
6 changed files with 65 additions and 69 deletions

View File

@ -2688,6 +2688,7 @@ files {
MAME_DIR .. "src/mame/drivers/8080bw.cpp",
MAME_DIR .. "src/mame/includes/8080bw.h",
MAME_DIR .. "src/mame/audio/8080bw.cpp",
MAME_DIR .. "src/mame/audio/8080bw.h",
MAME_DIR .. "src/mame/video/8080bw.cpp",
MAME_DIR .. "src/mame/drivers/m79amb.cpp",
MAME_DIR .. "src/mame/includes/m79amb.h",

View File

@ -895,9 +895,9 @@ void sn76477_device::open_wav_file()
std::string s = tag();
std::replace(s.begin(), s.end(), ':', '_');
char const* wav_file_name = util::string_format(LOG_WAV_FILE_NAME, s).c_str();
const std::string wav_file_name = util::string_format(LOG_WAV_FILE_NAME, s).c_str();
m_file = wav_open(wav_file_name, m_our_sample_rate, 2);
m_file = wav_open(wav_file_name.c_str(), m_our_sample_rate, 2);
LOG(1, "SN76477: Logging output: %s\n", wav_file_name);
}

View File

@ -10,6 +10,9 @@
#include "sound/discrete.h"
#include "speaker.h"
//#define VERBOSE 1
#include "logmacro.h"
/*******************************************************/
/* */
@ -1451,24 +1454,24 @@ static INPUT_PORTS_START( cane_audio )
PORT_ADJUSTER( 90, "VR2 - TOS music" )
PORT_START("VR3")
PORT_ADJUSTER( 70, "VR3 - Shoot SFX from 555" )
PORT_ADJUSTER( 70, "VR3 - Shoot SFX from 555" )
INPUT_PORTS_END
cane_audio_device::cane_audio_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock) :
device_t(mconfig, CANE_AUDIO, tag, owner, clock),
m_cane_vco_timer(*this, "cane_vco_timer"),
m_vco_timer(*this, "vco_timer"),
m_sn(*this, "snsnd"),
m_discrete(*this, "discrete"),
m_cane_vco_rc_chargetime(INT_MAX)
m_vco_rc_chargetime(INT_MAX)
{
}
void cane_audio_device::device_add_mconfig(machine_config &config)
{
// provare a commentare
m_cane_vco_rc_chargetime = INT_MAX;
m_vco_rc_chargetime = INT_MAX;
TIMER(config, "cane_vco_timer").configure_periodic(FUNC(cane_vco_voltage_timer), attotime::from_hz(1000));
TIMER(config, m_vco_timer).configure_periodic(FUNC(cane_audio_device::vco_voltage_timer), attotime::from_hz(1000));
SPEAKER(config, "mono").front_center();
@ -1478,7 +1481,7 @@ void cane_audio_device::device_add_mconfig(machine_config &config)
m_sn->set_amp_res(100+RES_K(20));
m_sn->set_noise_params(RES_K(39), RES_K(1), CAP_P(1000));
m_sn->set_decay_res(RES_M(1));
m_sn->set_attack_params(CAP_U(1.0), RES_K(47));
m_sn->set_attack_params(CAP_U(1.0), RES_K(47));
m_sn->set_feedback_res(RES_K(4.7));
m_sn->set_vco_params(0, CAP_P(3300), RES_K(100));
m_sn->set_pitch_voltage(5.0);
@ -1503,10 +1506,10 @@ void cane_audio_device::device_start()
{
}
void cane_audio_device::cane_sh_port_1_w(u8 data)
void cane_audio_device::sh_port_1_w(u8 data)
{
/*
bit 0 - SX0 - Sound enable on mixer
/*
bit 0 - SX0 - Sound enable on mixer
bit 1 - SX1 - SN76477 - Mixer select C - pin 27
bit 2 - SX2 - SN76477 - Mixer select A - pin 26
bit 3 - SX3 - SN76477 - Mixer select B - pin 25
@ -1520,8 +1523,8 @@ void cane_audio_device::cane_sh_port_1_w(u8 data)
m_sn->enable_w(1);
m_sn->set_mixer_params(BIT(data, 2), BIT(data, 3), BIT(data, 1));
m_cane_vco_timer->adjust(attotime::zero, m_cane_vco_timer->param(), attotime::from_hz(1000));
m_cane_vco_rc_chargetime = m_cane_vco_timer->start_time().as_double();
m_vco_timer->adjust(attotime::zero, m_vco_timer->param(), attotime::from_hz(1000));
m_vco_rc_chargetime = m_vco_timer->start_time().as_double();
// Little hack...
// To be precise I should enable the 76477 every time the CPU reads or write to a port different from port 3
@ -1530,18 +1533,18 @@ void cane_audio_device::cane_sh_port_1_w(u8 data)
m_sn->enable_w(0);
}
void cane_audio_device::cane_music_w(u8 data)
void cane_audio_device::music_w(u8 data)
{
m_sn->enable_w(1);
m_discrete->write(CANE_MUSIC_DATA, data);
}
void cane_audio_device::cane_76477_en_w(u8 data)
void cane_audio_device::sn76477_en_w(u8 data)
{
m_sn->enable_w(0);
}
void cane_audio_device::cane_76477_dis_w(u8 data)
void cane_audio_device::sn76477_dis_w(u8 data)
{
m_sn->enable_w(1);
}
@ -1631,8 +1634,8 @@ DISCRETE_SOUND_START(cane_discrete)
*
* Values for this section of the sound hardware where derived from comments
* in the source code and the analysis of TOS.ED sources.
*
* For further info look at the relevant comments reported into
*
* For further info look at the relevant comments reported into
* drivers/8080bw.cpp
*
******************************************************************************/
@ -1645,7 +1648,7 @@ DISCRETE_SOUND_START(cane_discrete)
* From 76477 output
*
******************************************************************************/
DISCRETE_MULTIPLY(CANE_EXP_SND, CANE_EXP_STREAM, CANE_VR1)
DISCRETE_MULTIPLY(CANE_EXP_SND, CANE_EXP_STREAM, CANE_VR1)
/******************************************************************************
*
@ -1667,13 +1670,13 @@ DISCRETE_SOUND_START(cane_discrete)
*/
DISCRETE_SOUND_END
TIMER_DEVICE_CALLBACK_MEMBER(cane_audio_device::cane_vco_voltage_timer)
TIMER_DEVICE_CALLBACK_MEMBER(cane_audio_device::vco_voltage_timer)
{
double voltage;
voltage = 5 * (1 - exp(- (m_cane_vco_timer->fire_time().as_double() - m_cane_vco_rc_chargetime) / 47));
voltage = 5 * (1 - exp(- (m_vco_timer->fire_time().as_double() - m_vco_rc_chargetime) / 47));
LOG("t = %d\n", m_vco_timer->fire_time().as_double() - m_vco_rc_chargetime);
LOG("vco_voltage = %d\n", voltage);
logerror("t = %d\n", m_cane_vco_timer->fire_time().as_double() - m_cane_vco_rc_chargetime);
logerror("vco_voltage = %d\n", voltage);
m_sn->vco_voltage_w(voltage);
}

View File

@ -1,4 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Nicola Salmoria, Tormod Tjaberg, Mirko Buffoni,Lee Taylor, Valerio Verrando, Zsolt Vasvari,Aaron Giles,Jonathan Gevaryahu,hap,Robbbert
/***************************************************************************
8080-based black and white sound hardware
@ -19,10 +20,10 @@ class cane_audio_device : public device_t
public:
cane_audio_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock = 0);
void cane_sh_port_1_w(u8 data);
void cane_music_w(u8 data);
void cane_76477_en_w(u8 data);
void cane_76477_dis_w(u8 data);
void sh_port_1_w(u8 data);
void music_w(u8 data);
void sn76477_en_w(u8 data);
void sn76477_dis_w(u8 data);
protected:
virtual void device_add_mconfig(machine_config &config) override;
@ -30,13 +31,13 @@ protected:
virtual void device_start() override;
private:
TIMER_DEVICE_CALLBACK_MEMBER(cane_vco_voltage_timer);
TIMER_DEVICE_CALLBACK_MEMBER(vco_voltage_timer);
required_device<timer_device> m_cane_vco_timer;
required_device<timer_device> m_vco_timer;
required_device<sn76477_device> m_sn;
required_device<discrete_sound_device> m_discrete;
double m_cane_vco_rc_chargetime;
double m_vco_rc_chargetime;
};
DECLARE_DEVICE_TYPE(CANE_AUDIO, cane_audio_device)

View File

@ -3567,26 +3567,21 @@ void _8080bw_state::init_invmulti()
/*******************************************************/
/***********************************************************************************************************************************
This game was never released by Model Racing to the public.
The assembler source files for this game where extracted from the original floppy disks used by the former Model Racing developer
The assembler source files for this game where extracted from the original floppy disks used by the former Model Racing developer
Adolfo Melilli (adolfo@melilli.com).
Those disks where retrieved by Alessandro Bolgia (xadhoom76@gmail.com) and Lorenzo Fongaro (lorenzo.fongaro@virgilio.it) and
Those disks where retrieved by Alessandro Bolgia (xadhoom76@gmail.com) and Lorenzo Fongaro (lorenzo.fongaro@virgilio.it) and
dumped by Piero Andreini (pieroandreini@gmail.com) using KryoFlux hardware and software.
Subsequently Jean Paul Piccato (j2pguard-spam@yahoo.com) mounted the images and compiled the source files, managed to set up a
romset and wrote a mame driver that aims to reproduce in the most faithful way the work of Melilli at Model Racing in late '70s.
The game driver is not based on hardware inspection and is solely derived from assumptions I've made looking at the assembler
code and comments written into the source files of the game. Several of those hypothesis came following the directions of
code and comments written into the source files of the game. Several of those hypothesis came following the directions of
previous yet contemporary Model Racing works (Eg: Claybuster) and where confirmed by Melilli himself.
Being unreleased this games has not an official name, thus the name used in the source files was used instead.
***********************************************************************************************************************************/
void cane_state::machine_start()
{
mw8080bw_state::machine_start();
}
void cane_state::cane_map(address_map &map)
{
map(0x0000, 0x1fff).rom().nopw();
@ -3609,7 +3604,7 @@ void cane_state::cane_io_map(address_map &map)
sx4 routed to 555 one-shot trigger
$04 - Reset watchdog timer
$05 - Audio TOS
in:
$01 - CPO / coin input port
$03 - Hardware shift register - Shift result
@ -3626,7 +3621,7 @@ Source file: CANE1.ED - Referred only once in code, in the "rifle routine" (ROUT
------------
-- OUT 1 --
Source files: CANE2.ED, MIRINO.ED
Defined in CANE2.ED
> PRMTR EQU 1
@ -3641,7 +3636,7 @@ Source files: CANE2.ED, MIRINO.ED
------------
-- OUT 2 --
Source files: CANE1.ED, CANE2.ED, MIRINO.ED
Defined in CANE2.ED
> DATO EQU 2
@ -3679,7 +3674,7 @@ Source file: CANE1.ED, CANE2.ED
Called directly in CANE1.ED
> INT8:
> OUT 4
> OUT 4
> ;PER LAUTORESET
Also defined in CANE2.ED
@ -3695,7 +3690,7 @@ Source file: CANE1.ED, CANE2.ED
Source file: CANE2.ED, TOS.ED
TOS sound
D0-D7 is pushed into a LS273 (Octal D-type Flip-Flop) and it's value is used to preload the starting value of
D0-D7 is pushed into a LS273 (Octal D-type Flip-Flop) and it's value is used to preload the starting value of
two, cascaded, LS161 (Synchronous 4-Bit Counters).
The counters drive a J-K Flip-Flop generating a square wave signal drived in frequency by the preloaded value.
@ -3734,7 +3729,7 @@ The musical note is defined in a library source file TOS.ED and referred later b
LA 114 - 1000/(255-114) = 7.09 KHz
LAD 122 - 1000/(255-122) = 7.52 KHz
SI 129 - 1000/(255-129) = 7.94 KHz
DO2 136 - 1000/(255-136) = 8.4 KHz
DOD2 143 - 1000/(255-143) = 8.93 KHz
RE2 149.5 - 1000/(255-150) = 9.52 KHz
@ -3747,7 +3742,7 @@ The musical note is defined in a library source file TOS.ED and referred later b
LA2 185 - 1000/(255-185) = 14.29 KHz
LAD2 189 - 1000/(255-189) = 15.15 KHz
SI2 192.5 - 1000/(255-193) = 16.13 KHz
Pause code:
PAU EQU 255
@ -3773,16 +3768,16 @@ Source file: CANE1.ED, CANE2.ED
> OUT LOW DATO
> IN LOW PRONTO
**********************************************************************************************************************************/
**********************************************************************************************************************************/
map(0x00, 0x00).w(FUNC(cane_state::cane_unknown_port0_w));
map(0x01, 0x01).portr("IN1").w(m_mb14241, FUNC(mb14241_device::shift_count_w));
map(0x02, 0x02).w(m_mb14241, FUNC(mb14241_device::shift_data_w));
map(0x03, 0x03).r(m_mb14241, FUNC(mb14241_device::shift_result_r)).w("soundboard", FUNC(cane_audio_device::cane_sh_port_1_w));
map(0x03, 0x03).r(m_mb14241, FUNC(mb14241_device::shift_result_r)).w("soundboard", FUNC(cane_audio_device::sh_port_1_w));
map(0x04, 0x04).w(m_watchdog, FUNC(watchdog_timer_device::reset_w));
map(0x05, 0x05).w("soundboard", FUNC(cane_audio_device::cane_music_w));
map(0x05, 0x05).w("soundboard", FUNC(cane_audio_device::music_w));
}
static INPUT_PORTS_START( cane )
@ -3867,7 +3862,7 @@ void cane_state::cane(machine_config &config)
MB14241(config, m_mb14241);
// audio hardware
CANE_AUDIO(config, "soundboard");
CANE_AUDIO(config, "soundboard");
}
void cane_state::cane_unknown_port0_w(u8 data)
@ -3883,18 +3878,18 @@ void cane_state::cane_unknown_port0_w(u8 data)
/***********************************************************************************************************************************
This game was never completed and released by Model Racing to the public.
It's in a nearly incomplete form (eg: doesn't have any sound or score routine in the code) and it's barely playable.
The assembler source files for this game where extracted from the original floppy disks used by the former Model Racing developer
The assembler source files for this game where extracted from the original floppy disks used by the former Model Racing developer
Adolfo Melilli (adolfo@melilli.com).
Those disks where retrieved by Alessandro Bolgia (xadhoom76@gmail.com) and Lorenzo Fongaro (lorenzo.fongaro@virgilio.it) and
Those disks where retrieved by Alessandro Bolgia (xadhoom76@gmail.com) and Lorenzo Fongaro (lorenzo.fongaro@virgilio.it) and
dumped by Piero Andreini (pieroandreini@gmail.com) using KryoFlux hardware and software.
Subsequently Jean Paul Piccato (j2pguard-spam@yahoo.com) mounted the images and compiled the source files, managed to set up a
romset and wrote a mame driver that aims to reproduce in the most faithful way the work of Melilli at Model Racing in late '70s.
The game driver is not based on hardware inspection and is solely derived from assumptions I've made looking at the assembler
code and comments written into the source files of the game. Several of those hypothesis came following the directions of
code and comments written into the source files of the game. Several of those hypothesis came following the directions of
previous yet contemporary Model Racing works (Eg: Claybuster) and where confirmed by Melilli himself.
Being unreleased this games has not an official name, thus the name used in the source files was used instead.
***********************************************************************************************************************************/
@ -3951,9 +3946,10 @@ INPUT_PORTS_END
void orbite_state::machine_start()
{
m_scattered_colorram = std::make_unique<uint8_t []>(0x800);
_8080bw_state::machine_start();
m_scattered_colorram = std::make_unique<uint8_t []>(0x800);
save_pointer(&m_scattered_colorram[0], "m_scattered_colorram", 0x800);
mw8080bw_state::machine_start();
}
void orbite_state::orbite(machine_config &config)

View File

@ -294,8 +294,7 @@ class cane_state : public _8080bw_state
{
public:
cane_state(machine_config const &mconfig, device_type type, char const *tag) :
_8080bw_state(mconfig, type, tag),
m_soundboard(*this, "soundboard")
_8080bw_state(mconfig, type, tag)
{
}
@ -306,12 +305,8 @@ protected:
void cane_unknown_port0_w(u8 data);
private:
virtual void machine_start() override;
void cane_io_map(address_map &map);
void cane_map(address_map &map);
required_device<cane_audio_device> m_soundboard;
};
DISCRETE_SOUND_EXTERN( cane_discrete );
@ -336,12 +331,12 @@ protected:
required_shared_ptr<uint8_t> m_main_ram;
std::unique_ptr<uint8_t[]> m_scattered_colorram;
virtual void machine_start() override;
u8 orbite_scattered_colorram_r(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED u8 mem_mask = 0xff);
void orbite_scattered_colorram_w(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED u8 data, ATTR_UNUSED u8 mem_mask = 0xff);
private:
virtual void machine_start() override;
void orbite_io_map(address_map &map);
void orbite_map(address_map &map);