mirror of
https://github.com/holub/mame
synced 2025-04-22 16:31:49 +03:00
hh_pic16: lakeside leboom WIP (nw)
This commit is contained in:
parent
4b753f9274
commit
88022b4545
@ -233,7 +233,7 @@ void hh_cop400_state::display_matrix(int maxx, int maxy, u32 setx, u32 sety, boo
|
||||
u16 hh_cop400_state::read_inputs(int columns)
|
||||
{
|
||||
// active low
|
||||
u16 ret = 0xffff;
|
||||
u16 ret = ~0;
|
||||
|
||||
// read selected input rows
|
||||
for (int i = 0; i < columns; i++)
|
||||
|
@ -2034,8 +2034,9 @@ public:
|
||||
DECLARE_WRITE8_MEMBER(plate_w);
|
||||
DECLARE_WRITE16_MEMBER(grid_w);
|
||||
|
||||
int m_speaker_volume;
|
||||
void speaker_decay_reset();
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(speaker_decay_sim);
|
||||
int m_speaker_volume;
|
||||
|
||||
protected:
|
||||
virtual void machine_start() override;
|
||||
@ -2050,8 +2051,15 @@ protected:
|
||||
#define CDKONG_SPEAKER_MAX 0x10000
|
||||
#define CDKONG_SPEAKER_DECAY 50
|
||||
|
||||
void cdkong_state::speaker_decay_reset()
|
||||
{
|
||||
if (m_r[1] & 8)
|
||||
m_speaker_volume = CDKONG_SPEAKER_MAX;
|
||||
}
|
||||
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(cdkong_state::speaker_decay_sim)
|
||||
{
|
||||
speaker_decay_reset();
|
||||
m_speaker->set_output_gain(0, m_speaker_volume / (double)CDKONG_SPEAKER_MAX);
|
||||
m_speaker_volume /= 2;
|
||||
}
|
||||
@ -2066,8 +2074,8 @@ void cdkong_state::prepare_display()
|
||||
WRITE8_MEMBER(cdkong_state::plate_w)
|
||||
{
|
||||
// R13: speaker on
|
||||
if (offset == HMCS40_PORT_R1X && data & 8)
|
||||
m_speaker_volume = CDKONG_SPEAKER_MAX;
|
||||
m_r[offset] = data;
|
||||
speaker_decay_reset();
|
||||
|
||||
// R0x-R6x: vfd matrix plate
|
||||
int shift = offset * 4;
|
||||
@ -2100,7 +2108,6 @@ static INPUT_PORTS_START( cdkong )
|
||||
PORT_BIT( 0x7ff8, IP_ACTIVE_HIGH, IPT_UNUSED )
|
||||
INPUT_PORTS_END
|
||||
|
||||
|
||||
void cdkong_state::machine_start()
|
||||
{
|
||||
hh_hmcs40_state::machine_start();
|
||||
@ -4460,7 +4467,7 @@ CONS( 1984, machiman, 0, 0, machiman, machiman, driver_device, 0, "Banda
|
||||
CONS( 1984, pairmtch, 0, 0, pairmtch, pairmtch, driver_device, 0, "Bandai", "Pair Match", MACHINE_SUPPORTS_SAVE )
|
||||
|
||||
CONS( 1981, alnattck, 0, 0, alnattck, alnattck, driver_device, 0, "Coleco", "Alien Attack", MACHINE_SUPPORTS_SAVE )
|
||||
CONS( 1982, cdkong, 0, 0, cdkong, cdkong, driver_device, 0, "Coleco", "Donkey Kong (Coleco)", MACHINE_SUPPORTS_SAVE )
|
||||
CONS( 1982, cdkong, 0, 0, cdkong, cdkong, driver_device, 0, "Coleco", "Donkey Kong (Coleco)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND )
|
||||
CONS( 1982, cgalaxn, 0, 0, cgalaxn, cgalaxn, driver_device, 0, "Coleco", "Galaxian (Coleco)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND )
|
||||
CONS( 1981, cpacman, 0, 0, cpacman, cpacman, driver_device, 0, "Coleco", "Pac-Man (Coleco, Rev. 29)", MACHINE_SUPPORTS_SAVE )
|
||||
CONS( 1981, cpacmanr1, cpacman, 0, cpacman, cpacman, driver_device, 0, "Coleco", "Pac-Man (Coleco, Rev. 28)", MACHINE_SUPPORTS_SAVE )
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
|
||||
TODO:
|
||||
- x
|
||||
- leboom: speaker volume decay with discrete sound
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
@ -47,11 +47,17 @@ public:
|
||||
|
||||
// devices
|
||||
required_device<cpu_device> m_maincpu;
|
||||
optional_ioport_array<2> m_inp_matrix; // max 2
|
||||
optional_ioport_array<6> m_inp_matrix; // max 6
|
||||
optional_device<speaker_sound_device> m_speaker;
|
||||
|
||||
// misc common
|
||||
u8 m_port[4]; // MCU port A-D write data
|
||||
u8 m_a; // MCU port A write data
|
||||
u8 m_b; // " B
|
||||
u8 m_c; // " C
|
||||
u8 m_d; // " D
|
||||
u16 m_inp_mux; // multiplexed inputs mask
|
||||
|
||||
u16 read_inputs(int columns);
|
||||
|
||||
// display common
|
||||
int m_display_wait; // led/lamp off-delay in microseconds (default 33ms)
|
||||
@ -85,7 +91,11 @@ void hh_pic16_state::machine_start()
|
||||
memset(m_display_decay, 0, sizeof(m_display_decay));
|
||||
memset(m_display_segmask, 0, sizeof(m_display_segmask));
|
||||
|
||||
memset(m_port, 0, sizeof(m_port));
|
||||
m_a = 0;
|
||||
m_b = 0;
|
||||
m_c = 0;
|
||||
m_d = 0;
|
||||
m_inp_mux = ~0;
|
||||
|
||||
// register for savestates
|
||||
save_item(NAME(m_display_maxy));
|
||||
@ -97,7 +107,11 @@ void hh_pic16_state::machine_start()
|
||||
save_item(NAME(m_display_decay));
|
||||
save_item(NAME(m_display_segmask));
|
||||
|
||||
save_item(NAME(m_port));
|
||||
save_item(NAME(m_a));
|
||||
save_item(NAME(m_b));
|
||||
save_item(NAME(m_c));
|
||||
save_item(NAME(m_d));
|
||||
save_item(NAME(m_inp_mux));
|
||||
}
|
||||
|
||||
void hh_pic16_state::machine_reset()
|
||||
@ -210,6 +224,22 @@ void hh_pic16_state::display_matrix(int maxx, int maxy, u32 setx, u32 sety, bool
|
||||
}
|
||||
|
||||
|
||||
// generic input handlers
|
||||
|
||||
u16 hh_pic16_state::read_inputs(int columns)
|
||||
{
|
||||
// active low
|
||||
u16 ret = ~0;
|
||||
|
||||
// read selected input rows
|
||||
for (int i = 0; i < columns; i++)
|
||||
if (~m_inp_mux >> i & 1)
|
||||
ret &= m_inp_matrix[i]->read();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
@ -223,7 +253,12 @@ void hh_pic16_state::display_matrix(int maxx, int maxy, u32 setx, u32 sety, bool
|
||||
* PIC1655A-036
|
||||
* 2 7seg LEDs, 1-bit sound
|
||||
|
||||
This is a reflex game for 2 to 4 players, 1 button per player.
|
||||
Maniac is a reflex game for 2-4 players. There are 4 challenges:
|
||||
1: Musical Maniac: Press the button as soon as the music stops.
|
||||
2: Sounds Abound: Count the number of tones in the song, then press the button
|
||||
after the same amount of beeps.
|
||||
3: Look Twice: Press the button after the game repeats the first pattern.
|
||||
4: Your Time Is Up: Press the button after estimating the duration of the tone.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
@ -234,25 +269,43 @@ public:
|
||||
: hh_pic16_state(mconfig, type, tag)
|
||||
{ }
|
||||
|
||||
DECLARE_WRITE8_MEMBER(output_w);
|
||||
void prepare_display();
|
||||
DECLARE_WRITE8_MEMBER(write_b);
|
||||
DECLARE_WRITE8_MEMBER(write_c);
|
||||
};
|
||||
|
||||
// handlers
|
||||
|
||||
WRITE8_MEMBER(maniac_state::output_w)
|
||||
void maniac_state::prepare_display()
|
||||
{
|
||||
m_port[offset] = data;
|
||||
m_display_state[0] = ~m_b & 0x7f;
|
||||
m_display_state[1] = ~m_c & 0x7f;
|
||||
|
||||
// B7,C7: speaker out
|
||||
m_speaker->level_w((m_port[PIC16C5x_PORTB] >> 7 & 1) | (m_port[PIC16C5x_PORTC] >> 6 & 2));
|
||||
|
||||
// B0-6,C0-6: 7seg data
|
||||
m_display_state[offset-PIC16C5x_PORTB] = ~data & 0x7f;
|
||||
set_display_segmask(3, 0x7f);
|
||||
set_display_size(7, 2);
|
||||
display_update();
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(maniac_state::write_b)
|
||||
{
|
||||
// B0-B6: left 7seg
|
||||
m_b = data;
|
||||
prepare_display();
|
||||
|
||||
// B7,C7: speaker out
|
||||
m_speaker->level_w((m_b >> 7 & 1) | (m_c >> 6 & 2));
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(maniac_state::write_c)
|
||||
{
|
||||
// C0-C6: right 7seg
|
||||
m_c = data;
|
||||
prepare_display();
|
||||
|
||||
// B7,C7: speaker out
|
||||
m_speaker->level_w((m_b >> 7 & 1) | (m_c >> 6 & 2));
|
||||
}
|
||||
|
||||
|
||||
// config
|
||||
|
||||
@ -271,8 +324,8 @@ static MACHINE_CONFIG_START( maniac, maniac_state )
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", PIC1655, 1000000) // approximation - RC osc. R=~13.4K, C=47pF
|
||||
MCFG_PIC16C5x_READ_A_CB(IOPORT("IN.0"))
|
||||
MCFG_PIC16C5x_WRITE_B_CB(WRITE8(maniac_state, output_w))
|
||||
MCFG_PIC16C5x_WRITE_C_CB(WRITE8(maniac_state, output_w))
|
||||
MCFG_PIC16C5x_WRITE_B_CB(WRITE8(maniac_state, write_b))
|
||||
MCFG_PIC16C5x_WRITE_C_CB(WRITE8(maniac_state, write_c))
|
||||
|
||||
MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_pic16_state, display_decay_tick, attotime::from_msec(1))
|
||||
MCFG_DEFAULT_LAYOUT(layout_maniac)
|
||||
@ -288,6 +341,112 @@ MACHINE_CONFIG_END
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
Lakeside Le Boom
|
||||
* PIC1655A-061
|
||||
* 1 led, 1-bit sound with decay
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
class leboom_state : public hh_pic16_state
|
||||
{
|
||||
public:
|
||||
leboom_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: hh_pic16_state(mconfig, type, tag)
|
||||
{ }
|
||||
|
||||
DECLARE_READ8_MEMBER(read_a);
|
||||
DECLARE_WRITE8_MEMBER(write_b);
|
||||
DECLARE_WRITE8_MEMBER(write_c);
|
||||
};
|
||||
|
||||
// handlers
|
||||
|
||||
READ8_MEMBER(leboom_state::read_a)
|
||||
{
|
||||
// A: multiplexed inputs
|
||||
return read_inputs(6) & 0xf;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(leboom_state::write_b)
|
||||
{
|
||||
// B0-B5: input mux
|
||||
m_inp_mux = data & 0x3f;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(leboom_state::write_c)
|
||||
{
|
||||
// C4: single led
|
||||
display_matrix(1, 1, data >> 4 & 1, 1);
|
||||
|
||||
// C6: speaker out
|
||||
// C7: speaker decay (TODO)
|
||||
m_speaker->level_w(data >> 6 & 1);
|
||||
}
|
||||
|
||||
|
||||
// config
|
||||
|
||||
static INPUT_PORTS_START( leboom )
|
||||
PORT_START("IN.0") // B0 port A
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD )
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD )
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD )
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD )
|
||||
|
||||
PORT_START("IN.1") // B1 port A
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD )
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD )
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD )
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD )
|
||||
|
||||
PORT_START("IN.2") // B2 port A
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD )
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD )
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD )
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD )
|
||||
|
||||
PORT_START("IN.3") // B3 port A
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD )
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD )
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD )
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD )
|
||||
|
||||
PORT_START("IN.4") // B4 port A
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD )
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD )
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD )
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD )
|
||||
|
||||
PORT_START("IN.5") // B5 port A
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD )
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD )
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD )
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD )
|
||||
INPUT_PORTS_END
|
||||
|
||||
static MACHINE_CONFIG_START( leboom, leboom_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", PIC1655, 1000000) // approximation
|
||||
MCFG_PIC16C5x_READ_A_CB(READ8(leboom_state, read_a))
|
||||
MCFG_PIC16C5x_WRITE_B_CB(WRITE8(leboom_state, write_b))
|
||||
MCFG_PIC16C5x_WRITE_C_CB(WRITE8(leboom_state, write_c))
|
||||
|
||||
MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_pic16_state, display_decay_tick, attotime::from_msec(1))
|
||||
//MCFG_DEFAULT_LAYOUT(layout_leboom)
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_MONO("mono")
|
||||
MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0)
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
Game driver(s)
|
||||
@ -300,6 +459,14 @@ ROM_START( maniac )
|
||||
ROM_END
|
||||
|
||||
|
||||
ROM_START( leboom )
|
||||
ROM_REGION( 0x0800, "maincpu", 0 )
|
||||
ROM_LOAD( "pic1655a-061", 0x0000, 0x0400, CRC(5880eea1) SHA1(e3795b347fd5df9de084da36e33f6b70fbc0b0ae) )
|
||||
ROM_END
|
||||
|
||||
|
||||
|
||||
/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */
|
||||
CONS( 1979, maniac, 0, 0, maniac, maniac, driver_device, 0, "Ideal", "Maniac", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK )
|
||||
|
||||
CONS( 1980, leboom, 0, 0, leboom, leboom, driver_device, 0, "Lakeside", "Le Boom", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING )
|
||||
|
@ -14315,6 +14315,7 @@ cfrogger // Coleco
|
||||
gjungler // Gakken
|
||||
|
||||
@source:hh_pic16.cpp
|
||||
leboom // Lakeside
|
||||
maniac // Ideal
|
||||
|
||||
@source:hh_sm510.cpp
|
||||
|
Loading…
Reference in New Issue
Block a user