allied.c : WIP

This commit is contained in:
Robbbert 2014-08-12 06:08:13 +00:00
parent a844cb35d7
commit 09fe0d8f39
4 changed files with 373 additions and 16 deletions

1
.gitattributes vendored
View File

@ -6431,6 +6431,7 @@ src/mame/layout/3bagflvt.lay svneol=native#text/xml
src/mame/layout/abaseb.lay svneol=native#text/xml
src/mame/layout/ace.lay svneol=native#text/xml
src/mame/layout/aces1.lay svneol=native#text/xml
src/mame/layout/allied.lay svneol=native#text/plain
src/mame/layout/ampoker2.lay svneol=native#text/xml
src/mame/layout/arcwins.lay svneol=native#text/xml
src/mame/layout/arimk4nz.lay svneol=native#text/xml

View File

@ -1,42 +1,182 @@
/**************************************************************************
PINBALL
Allied Leisure Cocktail Pinball
All tables use the same base roms and some playfields even interchange
between games.
6504 CPU, 3x R6530 RRIOT, 5x R6520 PIA
It is assumed that the R6530 is the same as MOS6530, and the R6520 is
the same as MC6821.
The schematic is too blurry to make out much detail, so used PinMAME
for the PIA connections.
The display units use 74164 serial units, with clock and data lines
sufficient for all the digits of one player. Data = IC2,PB7, while
Clock is IC2,CB2. To prevent display garbage, the new data is stored
while IC4PBx is high, then displayed when the line goes low. IC7portB
selects which player's display to update.
For some reason the 'rol $46' instruction outputs the original data
followed by the new result, so I've had to employ a horrible hack.
***************************************************************************/
#include "emu.h"
#include "machine/genpin.h"
#include "cpu/m6502/m6504.h"
#include "machine/mos6530.h"
#include "machine/6821pia.h"
#include "allied.lh"
class allied_state : public driver_device
class allied_state : public genpin_class
{
public:
allied_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu")
: genpin_class(mconfig, type, tag)
, m_maincpu(*this, "maincpu")
{ }
protected:
// devices
required_device<cpu_device> m_maincpu;
// driver_device overrides
virtual void machine_reset();
public:
DECLARE_DRIVER_INIT(allied);
DECLARE_WRITE8_MEMBER(ic2_b_w);
DECLARE_WRITE_LINE_MEMBER(ic2_cb2_w);
DECLARE_WRITE8_MEMBER(ic3_b_w);
DECLARE_WRITE8_MEMBER(ic4_b_w);
DECLARE_WRITE_LINE_MEMBER(ic4_cb2_w);
DECLARE_WRITE8_MEMBER(ic5_b_w);
DECLARE_WRITE8_MEMBER(ic6_b_w);
DECLARE_WRITE8_MEMBER(ic7_b_w);
DECLARE_WRITE8_MEMBER(ic8_a_w);
DECLARE_WRITE8_MEMBER(ic8_b_w);
private:
UINT32 m_player_score[6];
UINT8 m_display;
UINT8 m_bit_counter;
bool m_disp_data;
virtual void machine_reset();
required_device<m6504_device> m_maincpu;
};
static ADDRESS_MAP_START( allied_map, AS_PROGRAM, 8, allied_state )
AM_RANGE(0x0000, 0x0fff) AM_RAM
AM_RANGE(0x0000, 0x003f) AM_RAM // ic6
AM_RANGE(0x0044, 0x0047) AM_DEVREADWRITE("ic2", pia6821_device, read, write)
AM_RANGE(0x0048, 0x004b) AM_DEVREADWRITE("ic1", pia6821_device, read, write)
AM_RANGE(0x0050, 0x0053) AM_DEVREADWRITE("ic7", pia6821_device, read, write)
AM_RANGE(0x0060, 0x0063) AM_DEVREADWRITE("ic4", pia6821_device, read, write)
AM_RANGE(0x0080, 0x008f) AM_DEVREADWRITE("ic5", mos6530_device, read, write)
AM_RANGE(0x0840, 0x084f) AM_DEVREADWRITE("ic6", mos6530_device, read, write)
AM_RANGE(0x00c0, 0x00c3) AM_DEVREADWRITE("ic8", pia6821_device, read, write)
AM_RANGE(0x0100, 0x013f) AM_RAM // ic5
AM_RANGE(0x1400, 0x1fff) AM_ROM
ADDRESS_MAP_END
static INPUT_PORTS_START( allied )
INPUT_PORTS_END
WRITE8_MEMBER( allied_state::ic2_b_w )
{
//printf("%s:IC2B:%X ",machine().describe_context(),data);
m_disp_data = !BIT(data, 7);
}
WRITE_LINE_MEMBER( allied_state::ic2_cb2_w )
{
if ((m_display) && (!state))
{
m_bit_counter++;
if BIT(m_bit_counter, 0)
m_player_score[m_display-1] = (m_player_score[m_display-1] << 1) | m_disp_data;
if (m_bit_counter == 15)
m_bit_counter = 0;
}
}
WRITE8_MEMBER( allied_state::ic3_b_w )
{
m_maincpu->set_input_line(M6504_IRQ_LINE, BIT(data, 7) ? CLEAR_LINE : ASSERT_LINE );
}
WRITE8_MEMBER( allied_state::ic4_b_w )
{
static const UINT8 patterns[16] = { 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7c, 0x07, 0x7f, 0x67, 0x58, 0x4c, 0x62, 0x69, 0x78, 0 }; // 7446A
UINT8 segment, i;
//printf("%s:IC4B:%X ",machine().describe_context(),data);
for (i = 0; i < 4; i++)
{
if (!BIT(data, i+4))
{
output_set_digit_value(i*10, patterns[0]);
segment = (m_player_score[i] >> 0) & 15;
output_set_digit_value(i*10+1, patterns[segment]);
segment = (m_player_score[i] >> 4) & 15;
output_set_digit_value(i*10+2, patterns[segment]);
segment = (m_player_score[i] >> 8) & 15;
output_set_digit_value(i*10+3, patterns[segment]);
segment = (m_player_score[i] >> 12) & 15;
output_set_digit_value(i*10+4, patterns[segment]);
segment = (m_player_score[i] >> 16) & 15;
output_set_digit_value(i*10+5, patterns[segment]);
}
}
}
WRITE_LINE_MEMBER( allied_state::ic4_cb2_w )
{
}
// cabinet solenoids
WRITE8_MEMBER( allied_state::ic5_b_w )
{
if (!BIT(data, 2)) // chime C
m_samples->start(1, 1);
if (!BIT(data, 3)) // chime B
m_samples->start(2, 2);
if (!BIT(data, 4)) // chime A
m_samples->start(3, 3); // tens have highest tone
if (!BIT(data, 5)) // knocker
m_samples->start(0, 6);
m_maincpu->set_input_line(M6504_IRQ_LINE, BIT(data, 7) ? CLEAR_LINE : ASSERT_LINE );
}
WRITE8_MEMBER( allied_state::ic6_b_w )
{
m_maincpu->set_input_line(M6504_IRQ_LINE, BIT(data, 7) ? CLEAR_LINE : ASSERT_LINE );
}
WRITE8_MEMBER( allied_state::ic7_b_w )
{
//if (m_display) printf(" %X=%X",m_display,m_player_score[m_display-1]>>1);
//printf("%s:IC7B:%X ",machine().describe_context(),data);
m_display = data >> 4;
if (m_display > 5)
m_display = 0;
m_bit_counter = 0;
}
// playfield solenoids
WRITE8_MEMBER( allied_state::ic8_a_w )
{
if ((data & 0x07) < 0x07) // 3 bumpers
m_samples->start(0, 0);
if ((data & 0x60) < 0x60) // slings
m_samples->start(0, 7);
if (!BIT(data, 7)) // outhole
m_samples->start(0, 5);
}
// PB0-4 = ball 1-5 LED; PB5 = shoot again lamp
WRITE8_MEMBER( allied_state::ic8_b_w )
{
//printf("%s:IC8B:%X ",machine().describe_context(),data);
}
void allied_state::machine_reset()
{
}
@ -49,14 +189,86 @@ static MACHINE_CONFIG_START( allied, allied_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", M6504, 3572549/4)
MCFG_CPU_PROGRAM_MAP(allied_map)
/* Video */
MCFG_DEFAULT_LAYOUT(layout_allied)
/* Sound */
MCFG_FRAGMENT_ADD( genpin_audio )
/* Devices */
MCFG_DEVICE_ADD("ic1", PIA6821, 0)
//MCFG_PIA_READPA_HANDLER(READ8(allied_state, ic1_a_r))
//MCFG_PIA_WRITEPA_HANDLER(WRITE8(allied_state, ic1_a_w))
//MCFG_PIA_READPB_HANDLER(READ8(allied_state, ic1_b_r))
//MCFG_PIA_WRITEPB_HANDLER(WRITE8(allied_state, ic1_b_w))
//MCFG_PIA_CA2_HANDLER(WRITELINE(allied_state, ic1_ca2_w))
//MCFG_PIA_CB2_HANDLER(WRITELINE(allied_state, ic1_cb2_w))
MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("maincpu", m6504_device, irq_line))
MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("maincpu", m6504_device, irq_line))
MCFG_DEVICE_ADD("ic2", PIA6821, 0)
//MCFG_PIA_READPA_HANDLER(READ8(allied_state, ic2_a_r))
//MCFG_PIA_WRITEPA_HANDLER(WRITE8(allied_state, ic2_a_w))
//MCFG_PIA_READPB_HANDLER(READ8(allied_state, ic2_b_r))
MCFG_PIA_WRITEPB_HANDLER(WRITE8(allied_state, ic2_b_w))
//MCFG_PIA_CA2_HANDLER(WRITELINE(allied_state, ic2_ca2_w))
MCFG_PIA_CB2_HANDLER(WRITELINE(allied_state, ic2_cb2_w))
MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("maincpu", m6504_device, irq_line))
MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("maincpu", m6504_device, irq_line))
MCFG_DEVICE_ADD("ic4", PIA6821, 0)
//MCFG_PIA_READPA_HANDLER(READ8(allied_state, ic4_a_r))
//MCFG_PIA_WRITEPA_HANDLER(WRITE8(allied_state, ic4_a_w))
//MCFG_PIA_READPB_HANDLER(READ8(allied_state, ic4_b_r))
MCFG_PIA_WRITEPB_HANDLER(WRITE8(allied_state, ic4_b_w))
//MCFG_PIA_CA2_HANDLER(WRITELINE(allied_state, ic4_ca2_w))
MCFG_PIA_CB2_HANDLER(WRITELINE(allied_state, ic4_cb2_w))
MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("maincpu", m6504_device, irq_line))
MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("maincpu", m6504_device, irq_line))
MCFG_DEVICE_ADD("ic7", PIA6821, 0)
//MCFG_PIA_READPA_HANDLER(READ8(allied_state, ic7_a_r))
//MCFG_PIA_WRITEPA_HANDLER(WRITE8(allied_state, ic7_a_w))
//MCFG_PIA_READPB_HANDLER(READ8(allied_state, ic7_b_r))
MCFG_PIA_WRITEPB_HANDLER(WRITE8(allied_state, ic7_b_w))
//MCFG_PIA_CA2_HANDLER(WRITELINE(allied_state, ic7_ca2_w))
//MCFG_PIA_CB2_HANDLER(WRITELINE(allied_state, ic7_cb2_w))
MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("maincpu", m6504_device, irq_line))
MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("maincpu", m6504_device, irq_line))
MCFG_DEVICE_ADD("ic8", PIA6821, 0)
//MCFG_PIA_READPA_HANDLER(READ8(allied_state, ic8_a_r))
MCFG_PIA_WRITEPA_HANDLER(WRITE8(allied_state, ic8_a_w))
//MCFG_PIA_READPB_HANDLER(READ8(allied_state, ic8_b_r))
MCFG_PIA_WRITEPB_HANDLER(WRITE8(allied_state, ic8_b_w))
//MCFG_PIA_CA2_HANDLER(WRITELINE(allied_state, ic8_ca2_w))
//MCFG_PIA_CB2_HANDLER(WRITELINE(allied_state, ic8_cb2_w))
MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("maincpu", m6504_device, irq_line))
MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("maincpu", m6504_device, irq_line))
MCFG_DEVICE_ADD("ic3", MOS6530, 3572549/4) // unknown where the ram and i/o is located
MCFG_MOS6530_OUT_PB_CB(WRITE8(allied_state, ic3_b_w))
MCFG_DEVICE_ADD("ic5", MOS6530, 3572549/4)
//MCFG_MOS6530_IN_PA_CB(READ8(allied_state, ic5_a_r))
//MCFG_MOS6530_OUT_PA_CB(WRITE8(allied_state, ic5_a_w))
//MCFG_MOS6530_IN_PB_CB(READ8(allied_state, ic5_b_r))
MCFG_MOS6530_OUT_PB_CB(WRITE8(allied_state, ic5_b_w))
MCFG_DEVICE_ADD("ic6", MOS6530, 3572549/4)
//MCFG_MOS6530_IN_PA_CB(READ8(allied_state, ic6_a_r))
//MCFG_MOS6530_OUT_PA_CB(WRITE8(allied_state, ic6_a_w))
//MCFG_MOS6530_IN_PB_CB(READ8(allied_state, ic6_b_r))
MCFG_MOS6530_OUT_PB_CB(WRITE8(allied_state, ic6_b_w))
MACHINE_CONFIG_END
ROM_START( allied )
ROM_REGION( 0x2000, "maincpu", 0 )
ROM_LOAD( "alliedu5.bin", 0x1400, 0x0400, CRC(e4fb64fb) SHA1(a3d9de7cbfb42180a860e0bbbeaeba96d8bd1e20))
ROM_LOAD( "alliedu6.bin", 0x1800, 0x0400, CRC(dca980dd) SHA1(3817d75413854d889fc1ce4fd6a51d820d1e0534))
ROM_LOAD( "alliedu3.bin", 0x1c00, 0x0400, CRC(13f42789) SHA1(baa0f73fda08a3c5d6f1423fb329e4febb07ef97))
ROM_LOAD( "r6530-009.u5", 0x1400, 0x0400, CRC(e4fb64fb) SHA1(a3d9de7cbfb42180a860e0bbbeaeba96d8bd1e20))
ROM_LOAD( "r6530-010.u6", 0x1800, 0x0400, CRC(dca980dd) SHA1(3817d75413854d889fc1ce4fd6a51d820d1e0534))
ROM_LOAD( "r6530-011.u3", 0x1c00, 0x0400, CRC(13f42789) SHA1(baa0f73fda08a3c5d6f1423fb329e4febb07ef97))
ROM_END
#define rom_suprpick rom_allied

142
src/mame/layout/allied.lay Normal file
View File

@ -0,0 +1,142 @@
<!-- Allied copied from gp_1.lay -->
<!-- 2014-08-12: Initial version. [Robbbert] -->
<mamelayout version="2">
<element name="digit" defstate="0">
<led7seg>
<color red="1.0" green="0.25" blue="0.0" />
</led7seg>
</element>
<element name="red_led">
<disk><color red="1.0" green="0.0" blue="0.0" /></disk>
</element>
<element name="background">
<rect>
<bounds left="0" top="0" right="1" bottom="1" />
<color red="0.0" green="0.0" blue="0.0" />
</rect>
</element>
<element name="P0"><text string="Ball / Match"><color red="1.0" green="1.0" blue="1.0" /></text></element>
<element name="P1"><text string="Credits"><color red="1.0" green="1.0" blue="1.0" /></text></element>
<element name="P2"><text string="Players"><color red="1.0" green="1.0" blue="1.0" /></text></element>
<element name="P3"><text string="Player 1"><color red="1.0" green="1.0" blue="1.0" /></text></element>
<element name="P4"><text string="Player 2"><color red="1.0" green="1.0" blue="1.0" /></text></element>
<element name="P5"><text string="Player 3"><color red="1.0" green="1.0" blue="1.0" /></text></element>
<element name="P6"><text string="Player 4"><color red="1.0" green="1.0" blue="1.0" /></text></element>
<view name="Default Layout">
<!-- Background -->
<backdrop element="background">
<bounds left="0" top="20" right="274" bottom="394" />
</backdrop>
<!-- LEDs -->
<!-- Player 1 Score -->
<bezel name="digit5" element="digit">
<bounds left="10" top="45" right="44" bottom="84" />
</bezel>
<bezel name="digit4" element="digit">
<bounds left="54" top="45" right="88" bottom="84" />
</bezel>
<bezel name="digit3" element="digit">
<bounds left="98" top="45" right="132" bottom="84" />
</bezel>
<bezel name="digit2" element="digit">
<bounds left="142" top="45" right="176" bottom="84" />
</bezel>
<bezel name="digit1" element="digit">
<bounds left="186" top="45" right="220" bottom="84" />
</bezel>
<bezel name="digit0" element="digit">
<bounds left="230" top="45" right="264" bottom="84" />
</bezel>
<!-- Player 2 Score -->
<bezel name="digit15" element="digit">
<bounds left="10" top="105" right="44" bottom="144" />
</bezel>
<bezel name="digit14" element="digit">
<bounds left="54" top="105" right="88" bottom="144" />
</bezel>
<bezel name="digit13" element="digit">
<bounds left="98" top="105" right="132" bottom="144" />
</bezel>
<bezel name="digit12" element="digit">
<bounds left="142" top="105" right="176" bottom="144" />
</bezel>
<bezel name="digit11" element="digit">
<bounds left="186" top="105" right="220" bottom="144" />
</bezel>
<bezel name="digit10" element="digit">
<bounds left="230" top="105" right="264" bottom="144" />
</bezel>
<!-- Player 3 Score -->
<bezel name="digit25" element="digit">
<bounds left="10" top="165" right="44" bottom="204" />
</bezel>
<bezel name="digit24" element="digit">
<bounds left="54" top="165" right="88" bottom="204" />
</bezel>
<bezel name="digit23" element="digit">
<bounds left="98" top="165" right="132" bottom="204" />
</bezel>
<bezel name="digit22" element="digit">
<bounds left="142" top="165" right="176" bottom="204" />
</bezel>
<bezel name="digit21" element="digit">
<bounds left="186" top="165" right="220" bottom="204" />
</bezel>
<bezel name="digit20" element="digit">
<bounds left="230" top="165" right="264" bottom="204" />
</bezel>
<!-- Player 4 Score -->
<bezel name="digit35" element="digit">
<bounds left="10" top="225" right="44" bottom="264" />
</bezel>
<bezel name="digit34" element="digit">
<bounds left="54" top="225" right="88" bottom="264" />
</bezel>
<bezel name="digit33" element="digit">
<bounds left="98" top="225" right="132" bottom="264" />
</bezel>
<bezel name="digit32" element="digit">
<bounds left="142" top="225" right="176" bottom="264" />
</bezel>
<bezel name="digit31" element="digit">
<bounds left="186" top="225" right="220" bottom="264" />
</bezel>
<bezel name="digit30" element="digit">
<bounds left="230" top="225" right="264" bottom="264" />
</bezel>
<!-- Credits and Balls -->
<bezel name="digit45" element="digit">
<bounds left="39" top="345" right="73" bottom="384" />
</bezel>
<bezel name="digit44" element="digit">
<bounds left="110" top="345" right="144" bottom="384" />
</bezel>
<bezel name="digit43" element="digit">
<bounds left="171" top="345" right="205" bottom="384" />
</bezel>
<bezel name="digit42" element="digit">
<bounds left="210" top="345" right="244" bottom="384" />
</bezel>
<bezel element="P2"><bounds left="100" right="158" top="330" bottom="342" /></bezel>
<bezel element="P1"><bounds left="200" right="258" top="330" bottom="342" /></bezel>
<bezel element="P0"><bounds left="30" right="88" top="330" bottom="342" /></bezel>
<bezel name="text3" element="P3"><bounds left="100" right="180" top="30" bottom="42" /></bezel>
<bezel name="text2" element="P4"><bounds left="100" right="180" top="90" bottom="102" /></bezel>
<bezel name="text1" element="P5"><bounds left="100" right="180" top="150" bottom="162" /></bezel>
<bezel name="text0" element="P6"><bounds left="100" right="180" top="210" bottom="222" /></bezel>
<bezel name="led0" element="red_led">
<bounds left="10" right="25" top="360" bottom="375" /></bezel>
</view>
</mamelayout>

View File

@ -2460,6 +2460,8 @@ $(DRIVERS)/aces1.o: $(LAYOUT)/aces1.lh
$(DRIVERS)/acefruit.o: $(LAYOUT)/sidewndr.lh
$(DRIVERS)/allied.o: $(LAYOUT)/allied.lh
$(DRIVERS)/amaticmg.o: $(LAYOUT)/suprstar.lh
$(DRIVERS)/ampoker2.o: $(LAYOUT)/ampoker2.lh \