1 /***************************************************************************
2 
3 Shaolin's Road
4 
5 driver by Allard Van Der Bas
6 
7 ***************************************************************************/
8 
9 #include "driver.h"
10 #include "vidhrdw/generic.h"
11 
12 
13 UINT8 shaolins_nmi_enable;
14 
15 extern WRITE_HANDLER( shaolins_videoram_w );
16 extern WRITE_HANDLER( shaolins_colorram_w );
17 extern WRITE_HANDLER( shaolins_palettebank_w );
18 extern WRITE_HANDLER( shaolins_scroll_w );
19 extern WRITE_HANDLER( shaolins_nmi_w );
20 
21 extern PALETTE_INIT( shaolins );
22 extern VIDEO_START( shaolins );
23 extern VIDEO_UPDATE( shaolins );
24 
25 
INTERRUPT_GEN(shaolins_interrupt)26 INTERRUPT_GEN( shaolins_interrupt )
27 {
28 	if (cpu_getiloops() == 0) cpu_set_irq_line(0, 0, HOLD_LINE);
29 	else if (cpu_getiloops() % 2)
30 	{
31 		if (shaolins_nmi_enable & 0x02) cpu_set_irq_line(0, IRQ_LINE_NMI, PULSE_LINE);
32 	}
33 }
34 
35 
36 
MEMORY_READ_START(readmem)37 static MEMORY_READ_START( readmem )
38 	{ 0x0500, 0x0500, input_port_3_r },	/* Dipswitch settings */
39 	{ 0x0600, 0x0600, input_port_4_r },	/* Dipswitch settings */
40 	{ 0x0700, 0x0700, input_port_0_r },	/* coins + service */
41 	{ 0x0701, 0x0701, input_port_1_r },	/* player 1 controls */
42 	{ 0x0702, 0x0702, input_port_2_r },	/* player 2 controls */
43 	{ 0x0703, 0x0703, input_port_5_r },	/* selftest */
44 	{ 0x2800, 0x2bff, MRA_RAM },	/* RAM BANK 2 */
45 	{ 0x3000, 0x33ff, MRA_RAM },	/* RAM BANK 1 */
46 	{ 0x3800, 0x3fff, MRA_RAM },	/* video RAM */
47 	{ 0x4000, 0x5fff, MRA_ROM },    /* Machine checks for extra rom */
48 	{ 0x6000, 0xffff, MRA_ROM },
49 MEMORY_END
50 
51 static MEMORY_WRITE_START( writemem )
52 	{ 0x0000, 0x0000, shaolins_nmi_w },	/* bit 0 = flip screen, bit 1 = nmi enable, bit 2 = ? */
53 										/* bit 3, bit 4 = coin counters */
54 	{ 0x0100, 0x0100, watchdog_reset_w },
55 	{ 0x0300, 0x0300, SN76496_0_w }, 	/* trigger chip to read from latch. The program always */
56 	{ 0x0400, 0x0400, SN76496_1_w }, 	/* writes the same number as the latch, so we don't */
57 										/* bother emulating them. */
58 	{ 0x0800, 0x0800, MWA_NOP },	/* latch for 76496 #0 */
59 	{ 0x1000, 0x1000, MWA_NOP },	/* latch for 76496 #1 */
60 	{ 0x1800, 0x1800, shaolins_palettebank_w },
61 	{ 0x2000, 0x2000, shaolins_scroll_w },
62 	{ 0x2800, 0x2bff, MWA_RAM },	/* RAM BANK 2 */
63 	{ 0x3000, 0x30ff, MWA_RAM },	/* RAM BANK 1 */
64 	{ 0x3100, 0x33ff, MWA_RAM, &spriteram, &spriteram_size },
65 	{ 0x3800, 0x3bff, shaolins_colorram_w, &colorram },
66 	{ 0x3c00, 0x3fff, shaolins_videoram_w, &videoram },
67 	{ 0x6000, 0xffff, MWA_ROM },
68 MEMORY_END
69 
70 
71 
72 INPUT_PORTS_START( shaolins )
73 	PORT_START	/* IN0 */
74 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
75 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
76 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
77 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
78 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
79 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
80 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
81 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
82 
83 	PORT_START	/* IN1 */
84 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_4WAY )
85 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY )
86 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_4WAY )
87 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_4WAY )
88 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
89 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
90 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
91 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
92 
93 	PORT_START	/* IN2 */
94 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_4WAY | IPF_COCKTAIL )
95 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_COCKTAIL )
96 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_4WAY | IPF_COCKTAIL )
97 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_4WAY | IPF_COCKTAIL )
98 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
99 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
100 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
101 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
102 
103 	PORT_START	/* DSW0 */
104 	PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) )
105 	PORT_DIPSETTING(    0x03, "2" )
106 	PORT_DIPSETTING(    0x02, "3" )
107 	PORT_DIPSETTING(    0x01, "5" )
108 	PORT_DIPSETTING(    0x00, "7" )
109 	PORT_DIPNAME( 0x04, 0x00, DEF_STR( Cabinet ) )
110 	PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
111 	PORT_DIPSETTING(    0x04, DEF_STR( Cocktail ) )
112 	PORT_DIPNAME( 0x18, 0x18, DEF_STR( Bonus_Life ) )
113 	PORT_DIPSETTING(    0x18, "30000 and every 70000" )
114 	PORT_DIPSETTING(    0x10, "40000 and every 80000" )
115 	PORT_DIPSETTING(    0x08, "40000" )
116 	PORT_DIPSETTING(    0x00, "50000" )
117 	PORT_DIPNAME( 0x60, 0x40, DEF_STR( Difficulty ) )
118 	PORT_DIPSETTING(    0x60, "Easy" )
119 	PORT_DIPSETTING(    0x40, "Medium" )
120 	PORT_DIPSETTING(    0x20, "Hard" )
121 	PORT_DIPSETTING(    0x00, "Hardest" )
122 	PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
123 	PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
124 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
125 
126 	PORT_START	/* DSW1 */
127 	PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
128 	PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
129 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
130 	PORT_DIPNAME( 0x02, 0x02, "Upright Controls" )
131 	PORT_DIPSETTING(	0x02, "Single" )
132 	PORT_DIPSETTING(	0x00, "Dual" )
133 	PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
134 	PORT_BIT ( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
135 	PORT_DIPNAME( 0x10, 0x10, "Unknown DSW2 5" )
136 	PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
137 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
138 	PORT_DIPNAME( 0x20, 0x20, "Unknown DSW2 6" )
139 	PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
140 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
141 	PORT_DIPNAME( 0x40, 0x40, "Unknown DSW2 7" )
142 	PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
143 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
144 	PORT_DIPNAME( 0x80, 0x80, "Unknown DSW2 8" )
145 	PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
146 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
147 
148 	PORT_START	/* DSW2 */
149 	PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) )
150 	PORT_DIPSETTING(    0x02, DEF_STR( 4C_1C ) )
151 	PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
152 	PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
153 	PORT_DIPSETTING(    0x04, DEF_STR( 3C_2C ) )
154 	PORT_DIPSETTING(    0x01, DEF_STR( 4C_3C ) )
155 	PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) )
156 	PORT_DIPSETTING(    0x03, DEF_STR( 3C_4C ) )
157 	PORT_DIPSETTING(    0x07, DEF_STR( 2C_3C ) )
158 	PORT_DIPSETTING(    0x0e, DEF_STR( 1C_2C ) )
159 	PORT_DIPSETTING(    0x06, DEF_STR( 2C_5C ) )
160 	PORT_DIPSETTING(    0x0d, DEF_STR( 1C_3C ) )
161 	PORT_DIPSETTING(    0x0c, DEF_STR( 1C_4C ) )
162 	PORT_DIPSETTING(    0x0b, DEF_STR( 1C_5C ) )
163 	PORT_DIPSETTING(    0x0a, DEF_STR( 1C_6C ) )
164 	PORT_DIPSETTING(    0x09, DEF_STR( 1C_7C ) )
165 	PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
166 	PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) )
167 	PORT_DIPSETTING(    0x20, DEF_STR( 4C_1C ) )
168 	PORT_DIPSETTING(    0x50, DEF_STR( 3C_1C ) )
169 	PORT_DIPSETTING(    0x80, DEF_STR( 2C_1C ) )
170 	PORT_DIPSETTING(    0x40, DEF_STR( 3C_2C ) )
171 	PORT_DIPSETTING(    0x10, DEF_STR( 4C_3C ) )
172 	PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
173 	PORT_DIPSETTING(    0x30, DEF_STR( 3C_4C ) )
174 	PORT_DIPSETTING(    0x70, DEF_STR( 2C_3C ) )
175 	PORT_DIPSETTING(    0xe0, DEF_STR( 1C_2C ) )
176 	PORT_DIPSETTING(    0x60, DEF_STR( 2C_5C ) )
177 	PORT_DIPSETTING(    0xd0, DEF_STR( 1C_3C ) )
178 	PORT_DIPSETTING(    0xc0, DEF_STR( 1C_4C ) )
179 	PORT_DIPSETTING(    0xb0, DEF_STR( 1C_5C ) )
180 	PORT_DIPSETTING(    0xa0, DEF_STR( 1C_6C ) )
181 	PORT_DIPSETTING(    0x90, DEF_STR( 1C_7C ) )
182 INPUT_PORTS_END
183 
184 
185 
186 static struct GfxLayout shaolins_charlayout =
187 {
188 	8,8,	/* 8*8 chars */
189 	512,	/* 512 characters */
190 	4,	/* 4 bits per pixel */
191 	{ 512*16*8+4, 512*16*8+0, 4, 0 },
192 	{ 0, 1, 2, 3, 8*8+0, 8*8+1, 8*8+2, 8*8+3 },
193 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
194 	16*8	/* every char takes 16 consecutive bytes */
195 };
196 
197 static struct GfxLayout shaolins_spritelayout =
198 {
199 	16,16,	/* 16*16 sprites */
200 	256,	/* 256 sprites */
201 	4,	/* 4 bits per pixel */
202 	{ 256*64*8+4, 256*64*8+0, 4, 0 },
203 	{ 0, 1, 2, 3, 8*8+0, 8*8+1, 8*8+2, 8*8+3,
204 			16*8+0, 16*8+1, 16*8+2, 16*8+3, 24*8+0, 24*8+1, 24*8+2, 24*8+3 },
205 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
206 			32*8, 33*8, 34*8, 35*8, 36*8, 37*8, 38*8, 39*8 },
207 	64*8	/* every sprite takes 64 consecutive bytes */
208 };
209 
210 static struct GfxDecodeInfo shaolins_gfxdecodeinfo[] =
211 {
212 	{ REGION_GFX1, 0, &shaolins_charlayout,         0, 16*8 },
213 	{ REGION_GFX2, 0, &shaolins_spritelayout, 16*8*16, 16*8 },
214 	{ -1 } /* end of array */
215 };
216 
217 
218 
219 static struct SN76496interface sn76496_interface =
220 {
221 	2,	/* 2 chips */
222 	{ 1536000, 3072000 },	/* 3.072 MHz???? */
223 	{ 100, 100 }
224 };
225 
226 
227 
228 static MACHINE_DRIVER_START( shaolins )
229 
230 	/* basic machine hardware */
231 	MDRV_CPU_ADD(M6809, 1250000)        /* 1.25 MHz */
232 	MDRV_CPU_MEMORY(readmem,writemem)
233 	MDRV_CPU_VBLANK_INT(shaolins_interrupt,16)	/* 1 IRQ + 8 NMI */
234 
235 	MDRV_FRAMES_PER_SECOND(60)
236 	MDRV_VBLANK_DURATION(DEFAULT_60HZ_VBLANK_DURATION)
237 
238 	/* video hardware */
239 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
240 	MDRV_SCREEN_SIZE(32*8, 32*8)
241 	MDRV_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
242 	MDRV_GFXDECODE(shaolins_gfxdecodeinfo)
243 	MDRV_PALETTE_LENGTH(256)
244 	MDRV_COLORTABLE_LENGTH(16*8*16+16*8*16)
245 
246 	MDRV_PALETTE_INIT(shaolins)
247 	MDRV_VIDEO_START(shaolins)
248 	MDRV_VIDEO_UPDATE(shaolins)
249 
250 	/* sound hardware */
251 	MDRV_SOUND_ADD(SN76496, sn76496_interface)
252 MACHINE_DRIVER_END
253 
254 
255 /***************************************************************************
256 
257   Game driver(s)
258 
259 ***************************************************************************/
260 
261 ROM_START( kicker )
262 	ROM_REGION( 0x10000, REGION_CPU1, 0 )     /* 64k for code */
263 	ROM_LOAD( "kikrd8.bin",   0x6000, 0x2000, CRC(2598dfdd) SHA1(70a9d81b73bbd4ff6b627a3e4102d5328a946d20) )
264 	ROM_LOAD( "kikrd9.bin",   0x8000, 0x4000, CRC(0cf0351a) SHA1(a9da783b29a63a46912a29715e8d11dc4cd22265) )
265 	ROM_LOAD( "kikrd11.bin",  0xC000, 0x4000, CRC(654037f8) SHA1(52d098386fe87ae97d4dfefab0bd3a902f66d70b) )
266 
267 	ROM_REGION( 0x4000, REGION_GFX1, ROMREGION_DISPOSE )
268 	ROM_LOAD( "kikra10.bin",  0x0000, 0x2000, CRC(4d156afc) SHA1(29eb66e2ebcf2f1c1d5ece5413d1ebf54663f9cf) )
269 	ROM_LOAD( "kikra11.bin",  0x2000, 0x2000, CRC(ff6ca5df) SHA1(dfcd445c8b233a0a4168eb249472e53784eda25d) )
270 
271 	ROM_REGION( 0x8000, REGION_GFX2, ROMREGION_DISPOSE )
272 	ROM_LOAD( "kikrh14.bin",  0x0000, 0x4000, CRC(b94e645b) SHA1(65ae48134a0fe1e910a787714f7ae721734ded5b) )
273 	ROM_LOAD( "kikrh13.bin",  0x4000, 0x4000, CRC(61bbf797) SHA1(97d276099172975499f646f381a6fc587c022435) )
274 
275 	ROM_REGION( 0x0500, REGION_PROMS, 0 )
276 	ROM_LOAD( "kicker.a12",   0x0000, 0x0100, CRC(b09db4b4) SHA1(d21176cdc7def760da109083eb52e5b6a515021f) ) /* palette red component */
277 	ROM_LOAD( "kicker.a13",   0x0100, 0x0100, CRC(270a2bf3) SHA1(c0aec04bd3bceccddf5f5a814a560a893b29ef6b) ) /* palette green component */
278 	ROM_LOAD( "kicker.a14",   0x0200, 0x0100, CRC(83e95ea8) SHA1(e0bfa20600488f5c66233e13ea6ad857f62acb7c) ) /* palette blue component */
279 	ROM_LOAD( "kicker.b8",    0x0300, 0x0100, CRC(aa900724) SHA1(c5343273d0a7101b8ba6876c4f22e43d77610c75) ) /* character lookup table */
280 	ROM_LOAD( "kicker.f16",   0x0400, 0x0100, CRC(80009cf5) SHA1(a367f3f55d75a9d5bf4d43f9d77272eb910a1344) ) /* sprite lookup table */
281 ROM_END
282 
283 ROM_START( shaolins )
284 	ROM_REGION( 0x10000, REGION_CPU1, 0 )     /* 64k for code */
285 	ROM_LOAD( "kikrd8.bin",   0x6000, 0x2000, CRC(2598dfdd) SHA1(70a9d81b73bbd4ff6b627a3e4102d5328a946d20) )
286 	ROM_LOAD( "kikrd9.bin",   0x8000, 0x4000, CRC(0cf0351a) SHA1(a9da783b29a63a46912a29715e8d11dc4cd22265) )
287 	ROM_LOAD( "kikrd11.bin",  0xC000, 0x4000, CRC(654037f8) SHA1(52d098386fe87ae97d4dfefab0bd3a902f66d70b) )
288 
289 	ROM_REGION( 0x4000, REGION_GFX1, ROMREGION_DISPOSE )
290 	ROM_LOAD( "shaolins.6",   0x0000, 0x2000, CRC(ff18a7ed) SHA1(f28bfeff84bb6a08a8bee999a0b7a19e09a8dfc3) )
291 	ROM_LOAD( "shaolins.7",   0x2000, 0x2000, CRC(5f53ae61) SHA1(ad29e2255855c503295c6b63eb4cd6700a1e3f0e) )
292 
293 	ROM_REGION( 0x8000, REGION_GFX2, ROMREGION_DISPOSE )
294 	ROM_LOAD( "kikrh14.bin",  0x0000, 0x4000, CRC(b94e645b) SHA1(65ae48134a0fe1e910a787714f7ae721734ded5b) )
295 	ROM_LOAD( "kikrh13.bin",  0x4000, 0x4000, CRC(61bbf797) SHA1(97d276099172975499f646f381a6fc587c022435) )
296 
297 	ROM_REGION( 0x0500, REGION_PROMS, 0 )
298 	ROM_LOAD( "kicker.a12",   0x0000, 0x0100, CRC(b09db4b4) SHA1(d21176cdc7def760da109083eb52e5b6a515021f) ) /* palette red component */
299 	ROM_LOAD( "kicker.a13",   0x0100, 0x0100, CRC(270a2bf3) SHA1(c0aec04bd3bceccddf5f5a814a560a893b29ef6b) ) /* palette green component */
300 	ROM_LOAD( "kicker.a14",   0x0200, 0x0100, CRC(83e95ea8) SHA1(e0bfa20600488f5c66233e13ea6ad857f62acb7c) ) /* palette blue component */
301 	ROM_LOAD( "kicker.b8",    0x0300, 0x0100, CRC(aa900724) SHA1(c5343273d0a7101b8ba6876c4f22e43d77610c75) ) /* character lookup table */
302 	ROM_LOAD( "kicker.f16",   0x0400, 0x0100, CRC(80009cf5) SHA1(a367f3f55d75a9d5bf4d43f9d77272eb910a1344) ) /* sprite lookup table */
303 ROM_END
304 
305 
306 
307 GAME( 1985, kicker,   0,      shaolins, shaolins, 0, ROT90, "Konami", "Kicker" )
308 GAME( 1985, shaolins, kicker, shaolins, shaolins, 0, ROT90, "Konami", "Shao-Lin's Road" )
309