Previous 199869 Revisions Next

r31333 Sunday 20th July, 2014 at 11:34:35 UTC by Robbbert
GamePlan 1: WIP
[src/mame/drivers]gp_1.c
[src/mame/machine]genpin.h

trunk/src/mame/drivers/gp_1.c
r31332r31333
11/*******************************************************************************
22
3    Pinball
3    PINBALL
44    Game Plan MPU-1
5    These are "cocktail" cabinets, although there is only one seating position.
56
67********************************************************************************/
78
8#include "emu.h"
9#include "machine/genpin.h"
910#include "cpu/z80/z80.h"
11#include "cpu/z80/z80daisy.h"
12#include "machine/i8255.h"
13#include "machine/z80ctc.h"
1014
11class gp_1_state : public driver_device
15class gp_1_state : public genpin_class
1216{
1317public:
1418   gp_1_state(const machine_config &mconfig, device_type type, const char *tag)
15      : driver_device(mconfig, type, tag),
16   m_maincpu(*this, "maincpu")
19      : genpin_class(mconfig, type, tag)
20      , m_maincpu(*this, "maincpu")
21      , m_ctc(*this, "ctc")
1722   { }
1823
19protected:
20
21   // devices
24   DECLARE_DRIVER_INIT(gp_1);
25   DECLARE_WRITE8_MEMBER(porta_w);
26   DECLARE_WRITE8_MEMBER(portc_w);
27   DECLARE_READ8_MEMBER(portb_r);
28   TIMER_DEVICE_CALLBACK_MEMBER(zero_timer);
29private:
30   UINT8 m_u14;
31   UINT8 m_digit;
32   UINT8 m_sol;
33   virtual void machine_reset();
2234   required_device<cpu_device> m_maincpu;
23
24   // driver_device overrides
25   virtual void machine_reset();
26public:
27   DECLARE_DRIVER_INIT(gp_1);
35   required_device<z80ctc_device> m_ctc;
2836};
2937
3038
r31332r31333
3442ADDRESS_MAP_END
3543
3644static ADDRESS_MAP_START( gp_1_io, AS_IO, 8, gp_1_state )
37   ADDRESS_MAP_GLOBAL_MASK(0xff)
38   //AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("ppi", ppi8255_device, read, write)
39   //AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("ctc", z80ctc_device, read, write)
45   ADDRESS_MAP_GLOBAL_MASK(0x0f)
46   AM_RANGE(0x04, 0x07) AM_DEVREADWRITE("ppi", i8255_device, read, write)
47   AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("ctc", z80ctc_device, read, write)
4048ADDRESS_MAP_END
4149
4250static INPUT_PORTS_START( gp_1 )
51   PORT_START("TEST")
52   //PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Self Test") PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, gp_1_state, self_test, 0)
53
54   PORT_START("DSW0")
55   PORT_DIPNAME( 0x01, 0x01, "S01") // S1-5: 32 combinations of coins/credits of coin slot 1.
56   PORT_DIPSETTING(    0x01, DEF_STR( Off ))
57   PORT_DIPSETTING(    0x00, DEF_STR( On ))
58   PORT_DIPNAME( 0x02, 0x00, "S02")
59   PORT_DIPSETTING(    0x02, DEF_STR( Off ))
60   PORT_DIPSETTING(    0x00, DEF_STR( On ))
61   PORT_DIPNAME( 0x04, 0x04, "S03")
62   PORT_DIPSETTING(    0x04, DEF_STR( Off ))
63   PORT_DIPSETTING(    0x00, DEF_STR( On ))
64   PORT_DIPNAME( 0x08, 0x08, "S04")
65   PORT_DIPSETTING(    0x08, DEF_STR( Off ))
66   PORT_DIPSETTING(    0x00, DEF_STR( On ))
67   PORT_DIPNAME( 0x10, 0x10, "S05")
68   PORT_DIPSETTING(    0x10, DEF_STR( Off ))
69   PORT_DIPSETTING(    0x00, DEF_STR( On ))
70   PORT_DIPNAME( 0x20, 0x20, "S06")
71   PORT_DIPSETTING(    0x20, DEF_STR( Off ))
72   PORT_DIPSETTING(    0x00, DEF_STR( On ))
73   PORT_DIPNAME( 0x40, 0x40, "S07")
74   PORT_DIPSETTING(    0x40, DEF_STR( Off ))
75   PORT_DIPSETTING(    0x00, DEF_STR( On ))
76   PORT_DIPNAME( 0x80, 0x80, "Free Play")
77   PORT_DIPSETTING(    0x80, DEF_STR( Off ))
78   PORT_DIPSETTING(    0x00, DEF_STR( On ))
79
80   PORT_START("DSW1")
81   PORT_DIPNAME( 0x01, 0x01, "S09") // S09-12 determine coinage for slot 2
82   PORT_DIPSETTING(    0x01, DEF_STR( Off ))
83   PORT_DIPSETTING(    0x00, DEF_STR( On ))
84   PORT_DIPNAME( 0x02, 0x02, "S10")
85   PORT_DIPSETTING(    0x02, DEF_STR( Off ))
86   PORT_DIPSETTING(    0x00, DEF_STR( On ))
87   PORT_DIPNAME( 0x04, 0x04, "S11")
88   PORT_DIPSETTING(    0x04, DEF_STR( Off ))
89   PORT_DIPSETTING(    0x00, DEF_STR( On ))
90   PORT_DIPNAME( 0x08, 0x08, "S12")
91   PORT_DIPSETTING(    0x08, DEF_STR( Off ))
92   PORT_DIPSETTING(    0x00, DEF_STR( On ))
93   PORT_DIPNAME( 0x10, 0x10, "S13")
94   PORT_DIPSETTING(    0x10, DEF_STR( Off ))
95   PORT_DIPSETTING(    0x00, DEF_STR( On ))
96   PORT_DIPNAME( 0x20, 0x20, "S14")
97   PORT_DIPSETTING(    0x20, DEF_STR( Off ))
98   PORT_DIPSETTING(    0x00, DEF_STR( On ))
99   PORT_DIPNAME( 0x40, 0x40, "S15")
100   PORT_DIPSETTING(    0x40, DEF_STR( Off ))
101   PORT_DIPSETTING(    0x00, DEF_STR( On ))
102   PORT_DIPNAME( 0x80, 0x00, "Play Tunes")
103   PORT_DIPSETTING(    0x80, DEF_STR( Off ))
104   PORT_DIPSETTING(    0x00, DEF_STR( On ))
105
106   PORT_START("DSW2")
107   PORT_DIPNAME( 0x01, 0x01, "S17") // S17-21 coins for slot 3
108   PORT_DIPSETTING(    0x01, DEF_STR( Off ))
109   PORT_DIPSETTING(    0x00, DEF_STR( On ))
110   PORT_DIPNAME( 0x02, 0x00, "S18")
111   PORT_DIPSETTING(    0x02, DEF_STR( Off ))
112   PORT_DIPSETTING(    0x00, DEF_STR( On ))
113   PORT_DIPNAME( 0x04, 0x04, "S19")
114   PORT_DIPSETTING(    0x04, DEF_STR( Off ))
115   PORT_DIPSETTING(    0x00, DEF_STR( On ))
116   PORT_DIPNAME( 0x08, 0x08, "S20")
117   PORT_DIPSETTING(    0x08, DEF_STR( Off ))
118   PORT_DIPSETTING(    0x00, DEF_STR( On ))
119   PORT_DIPNAME( 0x10, 0x10, "S21")
120   PORT_DIPSETTING(    0x10, DEF_STR( Off ))
121   PORT_DIPSETTING(    0x00, DEF_STR( On ))
122   PORT_DIPNAME( 0x20, 0x20, "S22")
123   PORT_DIPSETTING(    0x20, DEF_STR( Off ))
124   PORT_DIPSETTING(    0x00, DEF_STR( On ))
125   PORT_DIPNAME( 0x40, 0x40, "S23")
126   PORT_DIPSETTING(    0x40, DEF_STR( Off ))
127   PORT_DIPSETTING(    0x00, DEF_STR( On ))
128   PORT_DIPNAME( 0x80, 0x80, "S24")
129   PORT_DIPSETTING(    0x80, DEF_STR( Off ))
130   PORT_DIPSETTING(    0x00, DEF_STR( On ))
131
132   PORT_START("DSW3")
133   PORT_DIPNAME( 0x07, 0x00, "Max number of credits")
134   PORT_DIPSETTING(    0x07, "5" )
135   PORT_DIPSETTING(    0x06, "10")
136   PORT_DIPSETTING(    0x05, "15")
137   PORT_DIPSETTING(    0x04, "20")
138   PORT_DIPSETTING(    0x03, "25")
139   PORT_DIPSETTING(    0x02, "30")
140   PORT_DIPSETTING(    0x01, "35")
141   PORT_DIPSETTING(    0x00, "40")
142   PORT_DIPNAME( 0x08, 0x00, "Balls")
143   PORT_DIPSETTING(    0x00, "5")
144   PORT_DIPSETTING(    0x08, "3")
145   PORT_DIPNAME( 0x10, 0x00, "Award")
146   PORT_DIPSETTING(    0x00, "Replay")
147   PORT_DIPSETTING(    0x10, "Extra Ball")
148   PORT_DIPNAME( 0x20, 0x00, "Match")
149   PORT_DIPSETTING(    0x00, DEF_STR( On ))
150   PORT_DIPSETTING(    0x20, DEF_STR( Off ))
151   PORT_DIPNAME( 0xC0, 0x40, "Credits for exceeding high score")
152   PORT_DIPSETTING(    0xC0, "0")
153   PORT_DIPSETTING(    0x80, "1")
154   PORT_DIPSETTING(    0x40, "2")
155   PORT_DIPSETTING(    0x00, "3")
156
157   PORT_START("X7")
158   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE2 ) PORT_NAME("Accounting Reset")
159   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 )
160   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_TILT1 ) PORT_NAME("Slam Tilt")
161   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
162   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2 )
163   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN3 )
164   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
165   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_TILT )
166
167   PORT_START("X8")
168   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("L and R Target") PORT_CODE(KEYCODE_A)
169   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Spinner C") PORT_CODE(KEYCODE_S)
170   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Outhole") PORT_CODE(KEYCODE_X)
171   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Spinner B") PORT_CODE(KEYCODE_D)
172   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("R. Slingshot") PORT_CODE(KEYCODE_F)
173   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Special when lit") PORT_CODE(KEYCODE_G)
174   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("L. Slingshot") PORT_CODE(KEYCODE_H)
175   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Extra when lit") PORT_CODE(KEYCODE_J)
176
177   PORT_START("X9")
178   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("R. Spinner") PORT_CODE(KEYCODE_K)
179   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1000 and advance") PORT_CODE(KEYCODE_L)
180   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
181   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Advance and Change") PORT_CODE(KEYCODE_Z)
182   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("L. Bumper") PORT_CODE(KEYCODE_C)
183   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("R. Bumper") PORT_CODE(KEYCODE_V)
184   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("L. Spinner") PORT_CODE(KEYCODE_B)
185   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Spinner A") PORT_CODE(KEYCODE_N)
186
187   PORT_START("XA")
188   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("1000 Rollover") PORT_CODE(KEYCODE_M)
189   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE1 )
190   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
191
192   PORT_START("XB")
193   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
43194INPUT_PORTS_END
44195
196READ8_MEMBER( gp_1_state::portb_r )
197{
198   switch (m_u14)
199   {
200      case 7:
201         return ioport("X7")->read();
202      case 8:
203         return ioport("X8")->read();
204      case 9:
205         return ioport("X9")->read();
206      case 10:
207         return ioport("XA")->read();
208      case 11:
209         return ioport("XB")->read();
210      case 12:
211         return ioport("DSW0")->read();
212      case 13:
213         return ioport("DSW1")->read();
214      case 14:
215         return ioport("DSW2")->read();
216      case 15:
217         return ioport("DSW3")->read();
218   }
219   return 0xff;
220}
221
222WRITE8_MEMBER( gp_1_state::porta_w )
223{
224   m_u14 = data >> 4;
225   if ((data > 0x0f) && (data < 0x30))
226   {
227      m_sol = data;
228      switch (m_sol)
229      {
230         case 0x10:
231            break;
232         case 0x11:
233            m_samples->start(0, 5);
234            break;
235         case 0x12:
236            m_samples->start(0, 6);
237            break;
238         case 0x13:
239            m_samples->start(0, 1);
240            break;
241         case 0x14:
242            m_samples->start(0, 2);
243            break;
244         case 0x15:
245            m_samples->start(0, 3);
246            break;
247         case 0x16:
248            m_samples->start(0, 4);
249            break;
250         case 0x17:
251         case 0x18:
252         case 0x19:
253            m_samples->start(0, 5);
254            break;
255         case 0x1a:
256         case 0x1b:
257            m_samples->start(0, 0);
258            break;
259         case 0x1c:
260         case 0x1d:
261            m_samples->start(0, 5);
262            break;
263         case 0x1e:
264         case 0x1f:
265            break;
266      }
267   }
268}
269
270WRITE8_MEMBER( gp_1_state::portc_w )
271{
272   if (BIT(data, 4))
273      m_digit = data & 7;
274   else
275      m_digit = 0xff;
276}
277
45278void gp_1_state::machine_reset()
46279{
280   m_u14 = 0;
281   m_digit = 0xff;
47282}
48283
49284DRIVER_INIT_MEMBER(gp_1_state,gp_1)
50285{
51286}
52287
288// zero-cross detection
289TIMER_DEVICE_CALLBACK_MEMBER( gp_1_state::zero_timer )
290{
291   m_ctc->trg2(0);
292   m_ctc->trg2(1);
293}   
294
295static const z80_daisy_config daisy_chain[] =
296{
297   { "ctc" },
298   { NULL }
299};
300
53301static MACHINE_CONFIG_START( gp_1, gp_1_state )
54302   /* basic machine hardware */
55303   MCFG_CPU_ADD("maincpu", Z80, 2457600)
56304   MCFG_CPU_PROGRAM_MAP(gp_1_map)
57305   MCFG_CPU_IO_MAP(gp_1_io)
306   MCFG_CPU_CONFIG(daisy_chain)
307
308   /* Sound */
309   MCFG_FRAGMENT_ADD( genpin_audio )
310
311   /* Devices */
312   MCFG_DEVICE_ADD("ppi", I8255A, 0 )
313   MCFG_I8255_OUT_PORTA_CB(WRITE8(gp_1_state, porta_w))
314   MCFG_I8255_IN_PORTB_CB(READ8(gp_1_state, portb_r))
315   MCFG_I8255_OUT_PORTC_CB(WRITE8(gp_1_state, portc_w))
316
317   MCFG_DEVICE_ADD("ctc", Z80CTC, 2457600 )
318   MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) // Todo: absence of ints will cause a watchdog reset
319   MCFG_TIMER_DRIVER_ADD_PERIODIC("gp1", gp_1_state, zero_timer, attotime::from_hz(120)) // mains freq*2
58320MACHINE_CONFIG_END
59321
60322
r31332r31333
74336/-------------------------------------------------------------------*/
75337#define rom_camlight    rom_gp_110
76338/*-------------------------------------------------------------------
339/ Foxy Lady (May 1978) - Model: Cocktail #110
340/-------------------------------------------------------------------*/
341#define rom_foxylady    rom_gp_110
342/*-------------------------------------------------------------------
343/ Real (May 1978) - Model: Cocktail #110
344/-------------------------------------------------------------------*/
345#define rom_real    rom_gp_110
346/*-------------------------------------------------------------------
347/ Rio (May 1978) - Model: Cocktail #110
348/-------------------------------------------------------------------*/
349#define rom_rio    rom_gp_110
350
351/*-------------------------------------------------------------------
77352/ Chuck-A-Luck (October 1978) - Model: Cocktail #110
78353/-------------------------------------------------------------------*/
79354#define rom_chucklck    rom_gp_110
355
80356/*-------------------------------------------------------------------
81357/ Family Fun! (April 1979) - Model: Cocktail #120
82358/-------------------------------------------------------------------*/
r31332r31333
87363ROM_END
88364
89365/*-------------------------------------------------------------------
90/ Foxy Lady (May 1978) - Model: Cocktail #110
91/-------------------------------------------------------------------*/
92#define rom_foxylady    rom_gp_110
93/*-------------------------------------------------------------------
94/ Real (May 1978) - Model: Cocktail #110
95/-------------------------------------------------------------------*/
96#define rom_real    rom_gp_110
97/*-------------------------------------------------------------------
98/ Rio (May 1978) - Model: Cocktail #110
99/-------------------------------------------------------------------*/
100#define rom_rio    rom_gp_110
101/*-------------------------------------------------------------------
102366/ Star Trip (April 1979) - Model: Cocktail #120
103367/-------------------------------------------------------------------*/
104368ROM_START(startrip)
r31332r31333
110374GAME(1978, gp_110,   0,        gp_1,     gp_1,     gp_1_state,  gp_1,   ROT0, "Game Plan", "Model 110",    GAME_IS_BIOS_ROOT)
111375GAME(1978, blvelvet, gp_110,   gp_1,     gp_1,     gp_1_state,  gp_1,   ROT0, "Game Plan", "Black Velvet", GAME_IS_SKELETON_MECHANICAL)
112376GAME(1978, camlight, gp_110,   gp_1,     gp_1,     gp_1_state,  gp_1,   ROT0, "Game Plan", "Camel Lights", GAME_IS_SKELETON_MECHANICAL)
113GAME(1978, chucklck, gp_110,   gp_1,     gp_1,     gp_1_state,  gp_1,   ROT0, "Game Plan", "Chuck-A-Luck", GAME_IS_SKELETON_MECHANICAL)
114GAME(1979, famlyfun, 0,        gp_1,     gp_1,     gp_1_state,  gp_1,   ROT0, "Game Plan", "Family Fun!",  GAME_IS_SKELETON_MECHANICAL)
115377GAME(1978, foxylady, gp_110,   gp_1,     gp_1,     gp_1_state,  gp_1,   ROT0, "Game Plan", "Foxy Lady",    GAME_IS_SKELETON_MECHANICAL)
116378GAME(1978, real,     gp_110,   gp_1,     gp_1,     gp_1_state,  gp_1,   ROT0, "Game Plan", "Real",         GAME_IS_SKELETON_MECHANICAL)
117379GAME(1978, rio,      gp_110,   gp_1,     gp_1,     gp_1_state,  gp_1,   ROT0, "Game Plan", "Rio",          GAME_IS_SKELETON_MECHANICAL)
380GAME(1978, chucklck, gp_110,   gp_1,     gp_1,     gp_1_state,  gp_1,   ROT0, "Game Plan", "Chuck-A-Luck", GAME_IS_SKELETON_MECHANICAL)
381GAME(1979, famlyfun, 0,        gp_1,     gp_1,     gp_1_state,  gp_1,   ROT0, "Game Plan", "Family Fun!",  GAME_IS_SKELETON_MECHANICAL)
118382GAME(1979, startrip, 0,        gp_1,     gp_1,     gp_1_state,  gp_1,   ROT0, "Game Plan", "Star Trip",    GAME_IS_SKELETON_MECHANICAL)
trunk/src/mame/machine/genpin.h
r31332r31333
1414   "chime1",
1515   "chime2",
1616   "chime3",
17   "coinin",
17   "chime4",
1818   "hole",
1919   "knocker",
20   "coinin",
2021   0   /* end of array */
2122};
2223
r31332r31333
3435{
3536public:
3637   genpin_class(const machine_config &mconfig, device_type type, const char *tag)
37      : driver_device(mconfig, type, tag),
38   m_samples(*this, "samples")
38      : driver_device(mconfig, type, tag)
39      , m_samples(*this, "samples")
3940   { }
4041
4142   required_device<samples_device> m_samples;

Previous 199869 Revisions Next


© 1997-2024 The MAME Team