1 /***************************************************************************
2 
3 Pinball Action memory map (preliminary)
4 
5 driver by Nicola Salmoria
6 
7 
8 0000-9fff ROM
9 d000-d3ff Video RAM
10 d400-d7ff Color RAM
11 d800-dbff Background Video RAM
12 dc00-dfff Background Color RAM
13 e000-e07f Sprites
14 e400-e5ff Palette RAM
15 
16 read:
17 e600      IN0
18 e601      IN1
19 e602      IN2
20 e604      DSW1
21 e605      DSW2
22 e606      watchdog reset????
23 
24 write:
25 e600      interrupt enable
26 e604      flip screen
27 e606      bg scroll? not sure
28 e800      command for the sound CPU
29 
30 
31 Notes:
32 - pbactio2 has a ROM for a third Z80, not emulated, function unknown
33 
34 ***************************************************************************/
35 
36 #include "driver.h"
37 #include "vidhrdw/generic.h"
38 #include "machine/z80fmly.h"
39 
40 
41 extern UINT8 *pbaction_videoram2,*pbaction_colorram2;
42 
43 extern WRITE_HANDLER( pbaction_videoram_w );
44 extern WRITE_HANDLER( pbaction_colorram_w );
45 extern WRITE_HANDLER( pbaction_videoram2_w );
46 extern WRITE_HANDLER( pbaction_colorram2_w );
47 extern WRITE_HANDLER( pbaction_flipscreen_w );
48 extern WRITE_HANDLER( pbaction_scroll_w );
49 
50 extern VIDEO_START( pbaction );
51 extern VIDEO_UPDATE( pbaction );
52 
53 
WRITE_HANDLER(pbaction_sh_command_w)54 static WRITE_HANDLER( pbaction_sh_command_w )
55 {
56 	soundlatch_w(offset,data);
57 	cpu_set_irq_line_and_vector(1,0,HOLD_LINE,0x00);
58 }
59 
60 
61 
MEMORY_READ_START(readmem)62 static MEMORY_READ_START( readmem )
63 	{ 0x0000, 0x9fff, MRA_ROM },
64 	{ 0xc000, 0xdfff, MRA_RAM },
65 	{ 0xe000, 0xe07f, MRA_RAM },
66 	{ 0xe400, 0xe5ff, MRA_RAM },
67 	{ 0xe600, 0xe600, input_port_0_r },	/* IN0 */
68 	{ 0xe601, 0xe601, input_port_1_r },	/* IN1 */
69 	{ 0xe602, 0xe602, input_port_2_r },	/* IN2 */
70 	{ 0xe604, 0xe604, input_port_3_r },	/* DSW1 */
71 	{ 0xe605, 0xe605, input_port_4_r },	/* DSW2 */
72 	{ 0xe606, 0xe606, MRA_NOP },	/* ??? */
73 MEMORY_END
74 
75 static MEMORY_WRITE_START( writemem )
76 	{ 0x0000, 0x9fff, MWA_ROM },
77 	{ 0xc000, 0xcfff, MWA_RAM },
78 	{ 0xd000, 0xd3ff, pbaction_videoram2_w, &pbaction_videoram2 },
79 	{ 0xd400, 0xd7ff, pbaction_colorram2_w, &pbaction_colorram2 },
80 	{ 0xd800, 0xdbff, pbaction_videoram_w, &videoram },
81 	{ 0xdc00, 0xdfff, pbaction_colorram_w, &colorram },
82 	{ 0xe000, 0xe07f, MWA_RAM, &spriteram, &spriteram_size },
83 	{ 0xe400, 0xe5ff, paletteram_xxxxBBBBGGGGRRRR_w, &paletteram },
84 	{ 0xe600, 0xe600, interrupt_enable_w },
85 	{ 0xe604, 0xe604, pbaction_flipscreen_w },
86 	{ 0xe606, 0xe606, pbaction_scroll_w },
87 	{ 0xe800, 0xe800, pbaction_sh_command_w },
88 MEMORY_END
89 
90 static MEMORY_READ_START( sound_readmem )
91 	{ 0x0000, 0x1fff, MRA_ROM },
92 	{ 0x4000, 0x47ff, MRA_RAM },
93 	{ 0x8000, 0x8000, soundlatch_r },
94 MEMORY_END
95 
96 static MEMORY_WRITE_START( sound_writemem )
97 	{ 0x0000, 0x1fff, MWA_ROM },
98 	{ 0x4000, 0x47ff, MWA_RAM },
99 	{ 0xffff, 0xffff, MWA_NOP },	/* watchdog? */
100 MEMORY_END
101 
102 
103 static PORT_WRITE_START( sound_writeport )
104 	{ 0x10, 0x10, AY8910_control_port_0_w },
105 	{ 0x11, 0x11, AY8910_write_port_0_w },
106 	{ 0x20, 0x20, AY8910_control_port_1_w },
107 	{ 0x21, 0x21, AY8910_write_port_1_w },
108 	{ 0x30, 0x30, AY8910_control_port_2_w },
109 	{ 0x31, 0x31, AY8910_write_port_2_w },
110 PORT_END
111 
112 
113 INPUT_PORTS_START( pbaction )
114 	PORT_START	/* IN0 */
115 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3 )
116 	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN )
117 	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 )
118 	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 )
119 	PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON2 )
120 	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
121 	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
122 	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
123 
124 	PORT_START	/* IN1 */
125 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3 | IPF_COCKTAIL )
126 	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN )
127 	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 | IPF_COCKTAIL )
128 	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL )
129 	PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON2 | IPF_COCKTAIL )
130 	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
131 	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
132 	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
133 
134 	PORT_START	/* IN2 */
135 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
136 	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )
137 	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
138 	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START2 )
139 	PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
140 	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
141 	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
142 	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
143 
144 	PORT_START	/* DSW0 */
145 	PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coin_B ) )
146 	PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
147 	PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
148 	PORT_DIPSETTING(    0x02, DEF_STR( 1C_3C ) )
149 	PORT_DIPSETTING(    0x03, DEF_STR( 1C_6C ) )
150 	PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Coin_A ) )
151 	PORT_DIPSETTING(    0x04, DEF_STR( 2C_1C ) )
152 	PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
153 	PORT_DIPSETTING(    0x08, DEF_STR( 1C_2C ) )
154 	PORT_DIPSETTING(    0x0c, DEF_STR( 1C_3C ) )
155 	PORT_DIPNAME( 0x30, 0x00, DEF_STR( Lives ) )
156 	PORT_DIPSETTING(    0x30, "2" )
157 	PORT_DIPSETTING(    0x00, "3" )
158 	PORT_DIPSETTING(    0x10, "4" )
159 	PORT_DIPSETTING(    0x20, "5" )
160 	PORT_DIPNAME( 0x40, 0x40, DEF_STR( Cabinet ) )
161 	PORT_DIPSETTING(    0x40, DEF_STR( Upright ) )
162 	PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
163 	PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
164 	PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
165 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
166 
167 	PORT_START	/* DSW1 */
168 	PORT_DIPNAME( 0x07, 0x00, DEF_STR( Bonus_Life ) )
169 	PORT_DIPSETTING(    0x01, "70K 200K 1000K" )
170 	PORT_DIPSETTING(    0x00, "70K 200K" )
171 	PORT_DIPSETTING(    0x04, "100K 300K 1000K" )
172 	PORT_DIPSETTING(    0x03, "100K 300K" )
173 	PORT_DIPSETTING(    0x02, "100K" )
174 	PORT_DIPSETTING(    0x06, "200K 1000K" )
175 	PORT_DIPSETTING(    0x05, "200K" )
176 	PORT_DIPSETTING(    0x07, "None" )
177 	PORT_DIPNAME( 0x08, 0x00, "Extra" )
178 	PORT_DIPSETTING(    0x00, "Easy" )
179 	PORT_DIPSETTING(    0x08, "Hard" )
180 	PORT_DIPNAME( 0x30, 0x00, "Difficulty (Flippers)" )
181 	PORT_DIPSETTING(    0x00, "Easy" )
182 	PORT_DIPSETTING(    0x10, "Medium" )
183 	PORT_DIPSETTING(    0x20, "Hard" )
184 	PORT_DIPSETTING(    0x30, "Hardest" )
185 	PORT_DIPNAME( 0xc0, 0x00, "Difficulty (Outlanes)" )
186 	PORT_DIPSETTING(    0x00, "Easy" )
187 	PORT_DIPSETTING(    0x40, "Medium" )
188 	PORT_DIPSETTING(    0x80, "Hard" )
189 	PORT_DIPSETTING(    0xc0, "Hardest" )
190 INPUT_PORTS_END
191 
192 
193 
194 static struct GfxLayout charlayout1 =
195 {
196 	8,8,	/* 8*8 characters */
197 	1024,	/* 1024 characters */
198 	3,	/* 3 bits per pixel */
199 	{ 0, 1024*8*8, 2*1024*8*8 },	/* the bitplanes are separated */
200 	{ 0, 1, 2, 3, 4, 5, 6, 7 },	/* pretty straightforward layout */
201 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
202 	8*8	/* every char takes 8 consecutive bytes */
203 };
204 static struct GfxLayout charlayout2 =
205 {
206 	8,8,	/* 8*8 characters */
207 	2048,	/* 2048 characters */
208 	4,	/* 4 bits per pixel */
209 	{ 0, 2048*8*8, 2*2048*8*8, 3*2048*8*8 },	/* the bitplanes are separated */
210 	{ 0, 1, 2, 3, 4, 5, 6, 7 },	/* pretty straightforward layout */
211 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
212 	8*8	/* every char takes 8 consecutive bytes */
213 };
214 static struct GfxLayout spritelayout1 =
215 {
216 	16,16,	/* 16*16 sprites */
217 	128,	/* 128 sprites */
218 	3,	/* 3 bits per pixel */
219 	{ 0, 256*16*16, 2*256*16*16 },	/* the bitplanes are separated */
220 	{ 0, 1, 2, 3, 4, 5, 6, 7,	/* pretty straightforward layout */
221 			8*8+0, 8*8+1, 8*8+2, 8*8+3, 8*8+4, 8*8+5, 8*8+6, 8*8+7 },
222 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
223 			16*8, 17*8, 18*8, 19*8, 20*8, 21*8, 22*8, 23*8 },
224 	32*8	/* every sprite takes 32 consecutive bytes */
225 };
226 static struct GfxLayout spritelayout2 =
227 {
228 	32,32,	/* 32*32 sprites */
229 	32,	/* 32 sprites */
230 	3,	/* 3 bits per pixel */
231 	{ 0*64*32*32, 1*64*32*32, 2*64*32*32 },	/* the bitplanes are separated */
232 	{ 0, 1, 2, 3, 4, 5, 6, 7,	/* pretty straightforward layout */
233 			8*8+0, 8*8+1, 8*8+2, 8*8+3, 8*8+4, 8*8+5, 8*8+6, 8*8+7,
234 			32*8+0, 32*8+1, 32*8+2, 32*8+3, 32*8+4, 32*8+5, 32*8+6, 32*8+7,
235 			40*8+0, 40*8+1, 40*8+2, 40*8+3, 40*8+4, 40*8+5, 40*8+6, 40*8+7 },
236 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
237 			16*8, 17*8, 18*8, 19*8, 20*8, 21*8, 22*8, 23*8,
238 			64*8, 65*8, 66*8, 67*8, 68*8, 69*8, 70*8, 71*8,
239 			80*8, 81*8, 82*8, 83*8, 84*8, 85*8, 86*8, 87*8 },
240 	128*8	/* every sprite takes 128 consecutive bytes */
241 };
242 
243 
244 
245 static struct GfxDecodeInfo gfxdecodeinfo[] =
246 {
247 	{ REGION_GFX1, 0x00000, &charlayout1,    0, 16 },	/*   0-127 characters */
248 	{ REGION_GFX2, 0x00000, &charlayout2,  128,  8 },	/* 128-255 background */
249 	{ REGION_GFX3, 0x00000, &spritelayout1,  0, 16 },	/*   0-127 normal sprites */
250 	{ REGION_GFX3, 0x01000, &spritelayout2,  0, 16 },	/*   0-127 large sprites */
251 	{ -1 } /* end of array */
252 };
253 
254 
255 static struct AY8910interface ay8910_interface =
256 {
257 	3,	/* 3 chips */
258 	1500000,	/* 1.5 MHz?????? */
259 	{ 25, 25, 25 },
260 	{ 0 },
261 	{ 0 },
262 	{ 0 },
263 	{ 0 }
264 };
265 
266 
INTERRUPT_GEN(pbaction_interrupt)267 INTERRUPT_GEN( pbaction_interrupt )
268 {
269 	cpu_set_irq_line_and_vector(1, 0, HOLD_LINE, 0x02);	/* the CPU is in Interrupt Mode 2 */
270 }
271 
272 
273 static MACHINE_DRIVER_START( pbaction )
274 
275 	/* basic machine hardware */
276 	MDRV_CPU_ADD(Z80, 4000000)	/* 4 MHz? */
277 	MDRV_CPU_MEMORY(readmem,writemem)
278 	MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
279 
280 	MDRV_CPU_ADD(Z80, 3072000)
281 	MDRV_CPU_FLAGS(CPU_AUDIO_CPU)	/* 3.072 MHz (?????) */
282 	MDRV_CPU_MEMORY(sound_readmem,sound_writemem)
283 	MDRV_CPU_PORTS(0,sound_writeport)
284 	MDRV_CPU_VBLANK_INT(pbaction_interrupt,2)	/* ??? */
285 									/* IRQs are caused by the main CPU */
286 	MDRV_FRAMES_PER_SECOND(60)
287 	MDRV_VBLANK_DURATION(DEFAULT_60HZ_VBLANK_DURATION)
288 
289 	/* video hardware */
290 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
291 	MDRV_SCREEN_SIZE(32*8, 32*8)
292 	MDRV_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
293 	MDRV_GFXDECODE(gfxdecodeinfo)
294 	MDRV_PALETTE_LENGTH(256)
295 
296 	MDRV_VIDEO_START(pbaction)
297 	MDRV_VIDEO_UPDATE(pbaction)
298 
299 	/* sound hardware */
300 	MDRV_SOUND_ADD(AY8910, ay8910_interface)
301 MACHINE_DRIVER_END
302 
303 
304 
305 /***************************************************************************
306 
307   Game driver(s)
308 
309 ***************************************************************************/
310 
311 ROM_START( pbaction )
312 	ROM_REGION( 0x10000, REGION_CPU1, 0 )	/* 64k for code */
313 	ROM_LOAD( "b-p7.bin",     0x0000, 0x4000, CRC(8d6dcaae) SHA1(c9e605f9d291cb8c7163655ea96c605b7d30365f) )
314 	ROM_LOAD( "b-n7.bin",     0x4000, 0x4000, CRC(d54d5402) SHA1(a4c3205bfe5fba8bb1ff3ad15941a77c35b44a27) )
315 	ROM_LOAD( "b-l7.bin",     0x8000, 0x2000, CRC(e7412d68) SHA1(e75731d9bea80e0dc09798dd46e3b947fdb54aaa) )
316 
317 	ROM_REGION( 0x10000, REGION_CPU2, 0 )	/* 64k for sound board */
318 	ROM_LOAD( "a-e3.bin",     0x0000,  0x2000, CRC(0e53a91f) SHA1(df2827197cd55c3685e5ac8b26c20800623cb932) )
319 
320 	ROM_REGION( 0x06000, REGION_GFX1, ROMREGION_DISPOSE )
321 	ROM_LOAD( "a-s6.bin",     0x00000, 0x2000, CRC(9a74a8e1) SHA1(bd27439b91f41db3fd7eedb44e828d61b793bda0) )
322 	ROM_LOAD( "a-s7.bin",     0x02000, 0x2000, CRC(5ca6ad3c) SHA1(7c8eff087f18cc2ff0572ea45e681a3a1ec94fad) )
323 	ROM_LOAD( "a-s8.bin",     0x04000, 0x2000, CRC(9f00b757) SHA1(74b6d926b8f456c8d0101f0232c5d3662423b396) )
324 
325 	ROM_REGION( 0x10000, REGION_GFX2, ROMREGION_DISPOSE )
326 	ROM_LOAD( "a-j5.bin",     0x00000, 0x4000, CRC(21efe866) SHA1(0c0a05a26d793ba98b0f421d464ff4b1d301ff9e) )
327 	ROM_LOAD( "a-j6.bin",     0x04000, 0x4000, CRC(7f984c80) SHA1(18795ecbcd2da94f1cfcce5559d652388d1b8bc0) )
328 	ROM_LOAD( "a-j7.bin",     0x08000, 0x4000, CRC(df69e51b) SHA1(52ab15c63332f0fa98884fa9adc8d35b93c939c4) )
329 	ROM_LOAD( "a-j8.bin",     0x0c000, 0x4000, CRC(0094cb8b) SHA1(58f48d24903b797e8451bf231f9e8df621685d9f) )
330 
331 	ROM_REGION( 0x06000, REGION_GFX3, ROMREGION_DISPOSE )
332 	ROM_LOAD( "b-c7.bin",     0x00000, 0x2000, CRC(d1795ef5) SHA1(69ad8e419e340d2f548468ed7838102789b978da) )
333 	ROM_LOAD( "b-d7.bin",     0x02000, 0x2000, CRC(f28df203) SHA1(060f70ed6386c808303a488c97691257681bd8f3) )
334 	ROM_LOAD( "b-f7.bin",     0x04000, 0x2000, CRC(af6e9817) SHA1(56f47d25761b3850c49a3a81b5ea35f12bd77b14) )
335 ROM_END
336 
337 
338 ROM_START( pbactio2 )
339 	ROM_REGION( 0x10000, REGION_CPU1, 0 )	/* 64k for code */
340 	ROM_LOAD( "pba16.bin",     0x0000, 0x4000, CRC(4a239ebd) SHA1(74e6da0485ac78093b4f09953fa3accb14bc3e43) )
341 	ROM_LOAD( "pba15.bin",     0x4000, 0x4000, CRC(3afef03a) SHA1(dec714415d2fd00c9021171a48f6c94b40888ae8) )
342 	ROM_LOAD( "pba14.bin",     0x8000, 0x2000, CRC(c0a98c8a) SHA1(442f37af31db13fd98602dd7f9eeae5529da0f44) )
343 
344 	ROM_REGION( 0x10000, REGION_CPU2, 0 )	/* 64k for sound board */
345 	ROM_LOAD( "pba1.bin",     0x0000,  0x2000, CRC(8b69b933) SHA1(eb0762579d52ed9f5b1a002ffe7e517c59650e22) )
346 
347 	ROM_REGION( 0x10000, REGION_CPU3, 0 )	/* 64k for a third Z80 (not emulated) */
348 	ROM_LOAD( "pba17.bin",    0x0000,  0x4000, CRC(2734ae60) SHA1(4edcdfac1611c49c4f890609efbe8352b8161f8e) )
349 
350 	ROM_REGION( 0x06000, REGION_GFX1, ROMREGION_DISPOSE )
351 	ROM_LOAD( "a-s6.bin",     0x00000, 0x2000, CRC(9a74a8e1) SHA1(bd27439b91f41db3fd7eedb44e828d61b793bda0) )
352 	ROM_LOAD( "a-s7.bin",     0x02000, 0x2000, CRC(5ca6ad3c) SHA1(7c8eff087f18cc2ff0572ea45e681a3a1ec94fad) )
353 	ROM_LOAD( "a-s8.bin",     0x04000, 0x2000, CRC(9f00b757) SHA1(74b6d926b8f456c8d0101f0232c5d3662423b396) )
354 
355 	ROM_REGION( 0x10000, REGION_GFX2, ROMREGION_DISPOSE )
356 	ROM_LOAD( "a-j5.bin",     0x00000, 0x4000, CRC(21efe866) SHA1(0c0a05a26d793ba98b0f421d464ff4b1d301ff9e) )
357 	ROM_LOAD( "a-j6.bin",     0x04000, 0x4000, CRC(7f984c80) SHA1(18795ecbcd2da94f1cfcce5559d652388d1b8bc0) )
358 	ROM_LOAD( "a-j7.bin",     0x08000, 0x4000, CRC(df69e51b) SHA1(52ab15c63332f0fa98884fa9adc8d35b93c939c4) )
359 	ROM_LOAD( "a-j8.bin",     0x0c000, 0x4000, CRC(0094cb8b) SHA1(58f48d24903b797e8451bf231f9e8df621685d9f) )
360 
361 	ROM_REGION( 0x06000, REGION_GFX3, ROMREGION_DISPOSE )
362 	ROM_LOAD( "b-c7.bin",     0x00000, 0x2000, CRC(d1795ef5) SHA1(69ad8e419e340d2f548468ed7838102789b978da) )
363 	ROM_LOAD( "b-d7.bin",     0x02000, 0x2000, CRC(f28df203) SHA1(060f70ed6386c808303a488c97691257681bd8f3) )
364 	ROM_LOAD( "b-f7.bin",     0x04000, 0x2000, CRC(af6e9817) SHA1(56f47d25761b3850c49a3a81b5ea35f12bd77b14) )
365 ROM_END
366 
367 
368 
369 GAME( 1985, pbaction, 0,        pbaction, pbaction, 0, ROT90, "Tehkan", "Pinball Action (set 1)" )
370 GAME( 1985, pbactio2, pbaction, pbaction, pbaction, 0, ROT90, "Tehkan", "Pinball Action (set 2)" )
371