1 /***************************************************************************
2 
3 Loco-Motion memory map (preliminary)
4 
5 driver by Nicola Salmoria
6 
7 TODO:
8 - PROM 7a controls the video shape. This is used to show the top 4 lines in
9   Jungler but not in Locomotion and Commando. The visible area for the latter
10   two should be adjusted, handling flip screen accordingly.
11 
12 
13 CPU #1
14 0000-4fff ROM (empty space at 5000-5fff for diagnostic ROM)
15 8040-83ff video RAM (top 8 rows of screen)
16 8440-87ff video RAM
17 8840-8bff color RAM (top 8 rows of screen)
18 8c40-8fff color RAM
19 8000-803f sprite RAM #1
20 8800-883f sprite RAM #2
21 9800-9fff RAM
22 
23 read:
24 a000      IN0
25 a080      IN1
26 a100      IN2
27 a180      DSW
28 
29 write:
30 a080      watchdog reset
31 a100      command for the audio CPU
32 a180      interrupt trigger on audio CPU
33 a181      interrupt enable
34 
35 
36 CPU #2:
37 2000-23ff RAM
38 
39 read:
40 4000      8910 #0 read
41 6000      8910 #1 read
42 
43 write:
44 5000      8910 #0 control
45 4000      8910 #0 write
46 7000      8910 #1 control
47 6000      8910 #1 write
48 
49 ***************************************************************************/
50 
51 #include "driver.h"
52 #include "vidhrdw/generic.h"
53 
54 
55 
56 extern unsigned char *rallyx_videoram2,*rallyx_colorram2;
57 extern unsigned char *rallyx_radarx,*rallyx_radary,*rallyx_radarattr;
58 extern size_t rallyx_radarram_size;
59 extern unsigned char *rallyx_scrollx,*rallyx_scrolly;
60 WRITE_HANDLER( rallyx_videoram2_w );
61 WRITE_HANDLER( rallyx_colorram2_w );
62 WRITE_HANDLER( rallyx_flipscreen_w );
63 void locomotn_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
64 int rallyx_vh_start(void);
65 void rallyx_vh_stop(void);
66 void locomotn_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
67 void jungler_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
68 void commsega_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
69 
70 /* defined in sndhrdw/timeplt.c */
71 extern struct MemoryReadAddress timeplt_sound_readmem[];
72 extern struct MemoryWriteAddress timeplt_sound_writemem[];
73 extern struct AY8910interface timeplt_ay8910_interface;
74 WRITE_HANDLER( timeplt_sh_irqtrigger_w );
75 
76 
WRITE_HANDLER(coin_1_w)77 static WRITE_HANDLER( coin_1_w )
78 {
79 	coin_counter_w(0,data & 1);
80 }
WRITE_HANDLER(coin_2_w)81 static WRITE_HANDLER( coin_2_w )
82 {
83 	coin_counter_w(1,data & 1);
84 }
85 
86 
87 
88 static struct MemoryReadAddress readmem[] =
89 {
90 	{ 0x0000, 0x7fff, MRA_ROM },
91 	{ 0x8000, 0x8fff, MRA_RAM },
92 	{ 0x9800, 0x9fff, MRA_RAM },
93 	{ 0xa000, 0xa000, input_port_0_r },	/* IN0 */
94 	{ 0xa080, 0xa080, input_port_1_r },	/* IN1 */
95 	{ 0xa100, 0xa100, input_port_2_r },	/* IN2 */
96 	{ 0xa180, 0xa180, input_port_3_r },	/* DSW */
97 	{ -1 }	/* end of table */
98 };
99 
100 static struct MemoryWriteAddress jungler_writemem[] =
101 {
102 	{ 0x0000, 0x7fff, MWA_ROM },
103 	{ 0x8000, 0x83ff, videoram_w, &videoram, &videoram_size },
104 	{ 0x8400, 0x87ff, rallyx_videoram2_w, &rallyx_videoram2 },
105 	{ 0x8800, 0x8bff, colorram_w, &colorram },
106 	{ 0x8c00, 0x8fff, rallyx_colorram2_w, &rallyx_colorram2 },
107 	{ 0x9800, 0x9fff, MWA_RAM },
108 	{ 0xa034, 0xa03f, MWA_RAM, &rallyx_radarattr },
109 	{ 0xa080, 0xa080, watchdog_reset_w },
110 	{ 0xa100, 0xa100, soundlatch_w },
111 	{ 0xa130, 0xa130, MWA_RAM, &rallyx_scrollx },
112 	{ 0xa140, 0xa140, MWA_RAM, &rallyx_scrolly },
113 	{ 0xa170, 0xa170, MWA_NOP },	/* ????? */
114 	{ 0xa180, 0xa180, timeplt_sh_irqtrigger_w },
115 	{ 0xa181, 0xa181, interrupt_enable_w },
116 //	{ 0xa182, 0xa182, MWA_NOP },	sound mute
117 	{ 0xa183, 0xa183, rallyx_flipscreen_w },
118 	{ 0xa184, 0xa184, coin_1_w },
119 	{ 0xa186, 0xa186, coin_2_w },
120 //	{ 0xa187, 0xa187, MWA_NOP },	stars enable
121 	{ 0x8014, 0x801f, MWA_RAM, &spriteram, &spriteram_size },	/* these are here just to initialize */
122 	{ 0x8814, 0x881f, MWA_RAM, &spriteram_2 },	/* the pointers. */
123 	{ 0x8034, 0x803f, MWA_RAM, &rallyx_radarx, &rallyx_radarram_size },	/* ditto */
124 	{ 0x8834, 0x883f, MWA_RAM, &rallyx_radary },
125 	{ -1 }	/* end of table */
126 };
127 
128 static struct MemoryWriteAddress writemem[] =
129 {
130 	{ 0x0000, 0x7fff, MWA_ROM },
131 	{ 0x8000, 0x83ff, videoram_w, &videoram, &videoram_size },
132 	{ 0x8400, 0x87ff, rallyx_videoram2_w, &rallyx_videoram2 },
133 	{ 0x8800, 0x8bff, colorram_w, &colorram },
134 	{ 0x8c00, 0x8fff, rallyx_colorram2_w, &rallyx_colorram2 },
135 	{ 0x9800, 0x9fff, MWA_RAM },
136 	{ 0xa000, 0xa00f, MWA_RAM, &rallyx_radarattr },
137 	{ 0xa080, 0xa080, watchdog_reset_w },
138 	{ 0xa100, 0xa100, soundlatch_w },
139 	{ 0xa130, 0xa130, MWA_RAM, &rallyx_scrollx },
140 	{ 0xa140, 0xa140, MWA_RAM, &rallyx_scrolly },
141 	{ 0xa170, 0xa170, MWA_NOP },	/* ????? */
142 	{ 0xa180, 0xa180, timeplt_sh_irqtrigger_w },
143 	{ 0xa181, 0xa181, interrupt_enable_w },
144 //	{ 0xa182, 0xa182, MWA_NOP },	sound mute
145 	{ 0xa183, 0xa183, rallyx_flipscreen_w },
146 	{ 0xa184, 0xa184, coin_1_w },
147 	{ 0xa186, 0xa186, coin_2_w },
148 //	{ 0xa187, 0xa187, MWA_NOP },	stars enable
149 	{ 0x8000, 0x801f, MWA_RAM, &spriteram, &spriteram_size },	/* these are here just to initialize */
150 	{ 0x8800, 0x881f, MWA_RAM, &spriteram_2 },	/* the pointers. */
151 	{ 0x8020, 0x803f, MWA_RAM, &rallyx_radarx, &rallyx_radarram_size },	/* ditto */
152 	{ 0x8820, 0x883f, MWA_RAM, &rallyx_radary },
153 	{ -1 }	/* end of table */
154 };
155 
156 
157 
158 INPUT_PORTS_START( locomotn )
159 	PORT_START      /* IN0 */
160 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_4WAY | IPF_COCKTAIL )
161 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
162 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
163 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 )
164 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_4WAY )
165 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY )
166 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
167 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
168 
169 	PORT_START      /* IN1 */
170 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_4WAY )
171 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_4WAY | IPF_COCKTAIL )
172 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
173 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
174 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_COCKTAIL )
175 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_4WAY | IPF_COCKTAIL )
176 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
177 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
178 
179 	PORT_START      /* DSW0 */
180 	PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )
181 	PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
182 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
183 	PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
184 	PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
185 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
186 	PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
187 	PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
188 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
189 	PORT_DIPNAME( 0x08, 0x00, DEF_STR( Cabinet ) )
190 	PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
191 	PORT_DIPSETTING(    0x08, DEF_STR( Cocktail ) )
192 	PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) )
193 	PORT_DIPSETTING(    0x30, "3" )
194 	PORT_DIPSETTING(    0x20, "4" )
195 	PORT_DIPSETTING(    0x10, "5" )
196 	PORT_BITX(0,  0x00, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "255", IP_KEY_NONE, IP_JOY_NONE )
197 	PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
198 	PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
199 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
200 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_4WAY )
201 
202 	PORT_START      /* DSW1 */
203 	PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) )
204 	PORT_DIPSETTING(    0x04, DEF_STR( 4C_1C ) )
205 	PORT_DIPSETTING(    0x0a, DEF_STR( 3C_1C ) )
206 	PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
207 	PORT_DIPSETTING(    0x02, DEF_STR( 3C_2C ) )
208 	PORT_DIPSETTING(    0x08, DEF_STR( 4C_3C ) )
209 	PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) )
210 	PORT_DIPSETTING(    0x0c, DEF_STR( 3C_4C ) )
211 	PORT_DIPSETTING(    0x0e, DEF_STR( 2C_3C ) )
212 	PORT_DIPSETTING(    0x07, DEF_STR( 1C_2C ) )
213 	PORT_DIPSETTING(    0x06, DEF_STR( 2C_5C ) )
214 	PORT_DIPSETTING(    0x0b, DEF_STR( 1C_3C ) )
215 	PORT_DIPSETTING(    0x03, DEF_STR( 1C_4C ) )
216 	PORT_DIPSETTING(    0x0d, DEF_STR( 1C_5C ) )
217 	PORT_DIPSETTING(    0x05, DEF_STR( 1C_6C ) )
218 	PORT_DIPSETTING(    0x09, DEF_STR( 1C_7C ) )
219 	PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
220 	PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) )
221 	PORT_DIPSETTING(    0x40, DEF_STR( 4C_1C ) )
222 	PORT_DIPSETTING(    0xa0, DEF_STR( 3C_1C ) )
223 	PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) )
224 	PORT_DIPSETTING(    0x20, DEF_STR( 3C_2C ) )
225 	PORT_DIPSETTING(    0x80, DEF_STR( 4C_3C ) )
226 	PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
227 	PORT_DIPSETTING(    0xc0, DEF_STR( 3C_4C ) )
228 	PORT_DIPSETTING(    0xe0, DEF_STR( 2C_3C ) )
229 	PORT_DIPSETTING(    0x70, DEF_STR( 1C_2C ) )
230 	PORT_DIPSETTING(    0x60, DEF_STR( 2C_5C ) )
231 	PORT_DIPSETTING(    0xb0, DEF_STR( 1C_3C ) )
232 	PORT_DIPSETTING(    0x30, DEF_STR( 1C_4C ) )
233 	PORT_DIPSETTING(    0xd0, DEF_STR( 1C_5C ) )
234 	PORT_DIPSETTING(    0x50, DEF_STR( 1C_6C ) )
235 	PORT_DIPSETTING(    0x90, DEF_STR( 1C_7C ) )
236 	PORT_DIPSETTING(    0x00, "Disabled" )
237 INPUT_PORTS_END
238 
239 
240 INPUT_PORTS_START( jungler )
241 	PORT_START      /* IN0 */
242 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_4WAY | IPF_COCKTAIL )
243 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
244 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
245 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 )
246 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_4WAY )
247 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY )
248 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
249 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
250 
251 	PORT_START      /* IN1 */
252 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_4WAY )
253 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_4WAY | IPF_COCKTAIL )
254 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
255 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
256 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_COCKTAIL )
257 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_4WAY | IPF_COCKTAIL )
258 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
259 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
260 
261 	PORT_START      /* DSW0 */
262 	PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNKNOWN )
263 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_4WAY )
264 
265 	PORT_START      /* DSW1 */
266 	PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) )
267 	PORT_DIPSETTING(    0x01, DEF_STR( 4C_1C ) )
268 	PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
269 	PORT_DIPSETTING(    0x03, DEF_STR( 2C_1C ) )
270 	PORT_DIPSETTING(    0x00, DEF_STR( 4C_3C ) )
271 	PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
272 	PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) )
273 	PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
274 	PORT_DIPSETTING(    0x04, DEF_STR( 1C_4C ) )
275 	PORT_DIPNAME( 0x38, 0x38, DEF_STR( Coin_B ) )
276 	PORT_DIPSETTING(    0x08, DEF_STR( 4C_1C ) )
277 	PORT_DIPSETTING(    0x10, DEF_STR( 3C_1C ) )
278 	PORT_DIPSETTING(    0x18, DEF_STR( 2C_1C ) )
279 	PORT_DIPSETTING(    0x00, DEF_STR( 4C_3C ) )
280 	PORT_DIPSETTING(    0x38, DEF_STR( 1C_1C ) )
281 	PORT_DIPSETTING(    0x30, DEF_STR( 1C_2C ) )
282 	PORT_DIPSETTING(    0x28, DEF_STR( 1C_3C ) )
283 	PORT_DIPSETTING(    0x20, DEF_STR( 1C_4C ) )
284 	PORT_DIPNAME( 0x40, 0x00, DEF_STR( Cabinet ) )
285 	PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
286 	PORT_DIPSETTING(    0x40, DEF_STR( Cocktail ) )
287 	PORT_BITX(    0x80, 0x80, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Infinite Lives", IP_KEY_NONE, IP_JOY_NONE )
288 	PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
289 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
290 INPUT_PORTS_END
291 
292 
293 INPUT_PORTS_START( commsega )
294 	PORT_START      /* IN0 */
295 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_4WAY | IPF_COCKTAIL )
296 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
297 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
298 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 )
299 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_4WAY )
300 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY )
301 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
302 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
303 
304 	PORT_START      /* IN1 */
305 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_4WAY )
306 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_4WAY | IPF_COCKTAIL )
307 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
308 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
309 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_COCKTAIL )
310 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_4WAY | IPF_COCKTAIL )
311 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
312 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
313 
314 	PORT_START      /* DSW0 */
315 	PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_B ) )
316 	PORT_DIPSETTING(    0x04, DEF_STR( 4C_1C ) )
317 	PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
318 	PORT_DIPSETTING(    0x06, DEF_STR( 2C_1C ) )
319 	PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
320 	PORT_DIPSETTING(    0x01, DEF_STR( 2C_3C ) )
321 	PORT_DIPSETTING(    0x03, DEF_STR( 1C_2C ) )
322 	PORT_DIPSETTING(    0x02, DEF_STR( 1C_3C ) )
323 	PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
324 	PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
325 	PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
326 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
327 	PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
328 	PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
329 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
330 	PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
331 	PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
332 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
333 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 )
334 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_4WAY )
335 
336 	PORT_START      /* DSW1 */
337 	PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
338 	PORT_DIPSETTING(    0x03, "3" )
339 	PORT_DIPSETTING(    0x02, "4" )
340 	PORT_DIPSETTING(    0x01, "5" )
341 	PORT_DIPSETTING(    0x00, "6" )
342 	PORT_DIPNAME( 0x1c, 0x1c, DEF_STR( Coin_A ) )
343 	PORT_DIPSETTING(    0x10, DEF_STR( 4C_1C ) )
344 	PORT_DIPSETTING(    0x14, DEF_STR( 3C_1C ) )
345 	PORT_DIPSETTING(    0x18, DEF_STR( 2C_1C ) )
346 	PORT_DIPSETTING(    0x1c, DEF_STR( 1C_1C ) )
347 	PORT_DIPSETTING(    0x04, DEF_STR( 2C_3C ) )
348 	PORT_DIPSETTING(    0x0c, DEF_STR( 1C_2C ) )
349 	PORT_DIPSETTING(    0x08, DEF_STR( 1C_3C ) )
350 	PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
351 	PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
352 	PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
353 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
354 	PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
355 	PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
356 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
357 	PORT_DIPNAME( 0x80, 0x00, DEF_STR( Cabinet ) )
358 	PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
359 	PORT_DIPSETTING(    0x80, DEF_STR( Cocktail ) )
360 INPUT_PORTS_END
361 
362 
363 
364 static struct GfxLayout charlayout =
365 {
366 	8,8,	/* 8*8 characters */
367 	512,	/* 512 characters (256 in Jungler) */
368 	2,	/* 2 bits per pixel */
369 	{ 4, 0 },
370 	{ 8*8+0,8*8+1,8*8+2,8*8+3, 0, 1, 2, 3 },
371 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
372 	16*8	/* every char takes 16 consecutive bytes */
373 };
374 
375 static struct GfxLayout spritelayout =
376 {
377 	16,16,	/* 16*16 sprites */
378 	128,	/* 128 sprites (64 in Jungler) */
379 	2,	/* 2 bits per pixel */
380 	{ 4, 0 },
381 	{ 8*8, 8*8+1, 8*8+2, 8*8+3, 0, 1, 2, 3,
382 			24*8+0, 24*8+1, 24*8+2, 24*8+3, 16*8+0, 16*8+1, 16*8+2, 16*8+3 },
383 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
384 			32*8, 33*8, 34*8, 35*8, 36*8, 37*8, 38*8, 39*8 },
385 	64*8	/* every sprite takes 64 consecutive bytes */
386 };
387 
388 static struct GfxLayout dotlayout =
389 {
390 	4,4,	/* 4*4 characters */
391 	8,	/* 8 characters */
392 	2,	/* 2 bits per pixel */
393 	{ 6, 7 },
394 	{ 3*8, 2*8, 1*8, 0*8 },
395 	{ 3*32, 2*32, 1*32, 0*32 },
396 	16*8	/* every char takes 16 consecutive bytes */
397 };
398 
399 static struct GfxDecodeInfo gfxdecodeinfo[] =
400 {
401 	{ REGION_GFX1, 0, &charlayout,      0, 64 },
402 	{ REGION_GFX1, 0, &spritelayout,    0, 64 },
403 	{ REGION_GFX2, 0, &dotlayout,    64*4,  1 },
404 	{ -1 } /* end of array */
405 };
406 
407 
408 
409 #define MACHINE_DRIVER(GAMENAME)   \
410 																	\
411 static struct MachineDriver machine_driver_##GAMENAME =             \
412 {                                                                   \
413 	/* basic machine hardware */                                    \
414 	{                                                               \
415 		{                                                           \
416 			CPU_Z80,                                                \
417 			18432000/6,	/* 3.072 MHz */                             \
418 			readmem,GAMENAME##_writemem,0,0,                        \
419 			nmi_interrupt,1                                         \
420 		},                                                          \
421 		{                                                           \
422 			CPU_Z80 | CPU_AUDIO_CPU,                                \
423 			14318180/8,	/* 1.789772727 MHz */						\
424 			timeplt_sound_readmem,timeplt_sound_writemem,0,0,       \
425 			ignore_interrupt,1	/* interrupts are triggered by the main CPU */ \
426 		}                                                           \
427 	},                                                              \
428 	60, DEFAULT_60HZ_VBLANK_DURATION,	/* frames per second, vblank duration */ \
429 	1,	/* 1 CPU slice per frame - interleaving is forced when a sound command is written */ \
430 	0,                                                              \
431                                                                     \
432 	/* video hardware */                                            \
433 	36*8, 28*8, { 0*8, 36*8-1, 0*8, 28*8-1 },                       \
434 	gfxdecodeinfo,                                                  \
435 	32,64*4+4,                                                      \
436 	locomotn_vh_convert_color_prom,                                 \
437                                                                     \
438 	VIDEO_TYPE_RASTER,                                              \
439 	0,                                                              \
440 	rallyx_vh_start,                                                \
441 	rallyx_vh_stop,                                                 \
442 	GAMENAME##_vh_screenrefresh,                                    \
443                                                                     \
444 	/* sound hardware */                                            \
445 	0,0,0,0,                                                        \
446 	{                                                               \
447 		{                                                           \
448 			SOUND_AY8910,                                           \
449 			&timeplt_ay8910_interface                               \
450 		}                                                           \
451 	}                                                               \
452 };
453 
454 #define locomotn_writemem writemem
455 #define commsega_writemem writemem
456 MACHINE_DRIVER(locomotn)
457 MACHINE_DRIVER(jungler)
458 MACHINE_DRIVER(commsega)
459 
460 
461 /***************************************************************************
462 
463   Game driver(s)
464 
465 ***************************************************************************/
466 
467 ROM_START( locomotn )
468 	ROM_REGION( 0x10000, REGION_CPU1 )	/* 64k for code */
469 	ROM_LOAD( "1a.cpu",       0x0000, 0x1000, 0xb43e689a )
470 	ROM_LOAD( "2a.cpu",       0x1000, 0x1000, 0x529c823d )
471 	ROM_LOAD( "3.cpu",        0x2000, 0x1000, 0xc9dbfbd1 )
472 	ROM_LOAD( "4.cpu",        0x3000, 0x1000, 0xcaf6431c )
473 	ROM_LOAD( "5.cpu",        0x4000, 0x1000, 0x64cf8dd6 )
474 
475 	ROM_REGION( 0x10000, REGION_CPU2 )	/* 64k for the audio CPU */
476 	ROM_LOAD( "1b_s1.bin",    0x0000, 0x1000, 0xa1105714 )
477 
478 	ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
479 	ROM_LOAD( "5l_c1.bin",    0x0000, 0x1000, 0x5732eda9 )
480 	ROM_LOAD( "c2.cpu",       0x1000, 0x1000, 0xc3035300 )
481 
482 	ROM_REGION( 0x0100, REGION_GFX2 | REGIONFLAG_DISPOSE )
483 	ROM_LOAD( "10g.bpr",      0x0000, 0x0100, 0x2ef89356 ) /* dots */
484 
485 	ROM_REGION( 0x0160, REGION_PROMS )
486 	ROM_LOAD( "8b.bpr",       0x0000, 0x0020, 0x75b05da0 ) /* palette */
487 	ROM_LOAD( "9d.bpr",       0x0020, 0x0100, 0xaa6cf063 ) /* loookup table */
488 	ROM_LOAD( "7a.bpr",       0x0120, 0x0020, 0x48c8f094 ) /* video layout (not used) */
489 	ROM_LOAD( "10a.bpr",      0x0140, 0x0020, 0xb8861096 ) /* video timing (not used) */
490 ROM_END
491 
492 ROM_START( gutangtn )
493 	ROM_REGION( 0x10000, REGION_CPU1 )	/* 64k for code */
494 	ROM_LOAD( "3d_1.bin",     0x0000, 0x1000, 0xe9757395 )
495 	ROM_LOAD( "3e_2.bin",     0x1000, 0x1000, 0x11d21d2e )
496 	ROM_LOAD( "3f_3.bin",     0x2000, 0x1000, 0x4d80f895 )
497 	ROM_LOAD( "3h_4.bin",     0x3000, 0x1000, 0xaa258ddf )
498 	ROM_LOAD( "3j_5.bin",     0x4000, 0x1000, 0x52aec87e )
499 
500 	ROM_REGION( 0x10000, REGION_CPU2 )	/* 64k for the audio CPU */
501 	ROM_LOAD( "1b_s1.bin",    0x0000, 0x1000, 0xa1105714 )
502 
503 	ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
504 	ROM_LOAD( "5l_c1.bin",    0x0000, 0x1000, 0x5732eda9 )
505 	ROM_LOAD( "5m_c2.bin",    0x1000, 0x1000, 0x51c542fd )
506 
507 	ROM_REGION( 0x0100, REGION_GFX2 | REGIONFLAG_DISPOSE )
508 	ROM_LOAD( "10g.bpr",      0x0000, 0x0100, 0x2ef89356 ) /* dots */
509 
510 	ROM_REGION( 0x0160, REGION_PROMS )
511 	ROM_LOAD( "8b.bpr",       0x0000, 0x0020, 0x75b05da0 ) /* palette */
512 	ROM_LOAD( "9d.bpr",       0x0020, 0x0100, 0xaa6cf063 ) /* loookup table */
513 	ROM_LOAD( "7a.bpr",       0x0120, 0x0020, 0x48c8f094 ) /* video layout (not used) */
514 	ROM_LOAD( "10a.bpr",      0x0140, 0x0020, 0xb8861096 ) /* video timing (not used) */
515 ROM_END
516 
517 ROM_START( cottong )
518 	ROM_REGION( 0x10000, REGION_CPU1 ) /* 64k for code */
519 	ROM_LOAD( "c1",           0x0000, 0x1000, 0x2c256fe6 )
520 	ROM_LOAD( "c2",           0x1000, 0x1000, 0x1de5e6a0 )
521 	ROM_LOAD( "c3",           0x2000, 0x1000, 0x01f909fe )
522 	ROM_LOAD( "c4",           0x3000, 0x1000, 0xa89eb3e3 )
523 
524 	ROM_REGION( 0x10000, REGION_CPU2 ) /* 64k for the audio CPU */
525 	ROM_LOAD( "c7",           0x0000, 0x1000, 0x3d83f6d3 )
526 	ROM_LOAD( "c8",           0x1000, 0x1000, 0x323e1937 )
527 
528 	ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
529 	ROM_LOAD( "c5",           0x0000, 0x1000, 0x992d079c )
530 	ROM_LOAD( "c6",           0x1000, 0x1000, 0x0149ef46 )
531 
532 	ROM_REGION( 0x0100, REGION_GFX2 | REGIONFLAG_DISPOSE )
533 	ROM_LOAD( "5.bpr",        0x0000, 0x0100, 0x21fb583f ) /* dots */
534 
535 	ROM_REGION( 0x0160, REGION_PROMS )
536 	ROM_LOAD( "2.bpr",        0x0000, 0x0020, 0x26f42e6f ) /* palette */
537 	ROM_LOAD( "3.bpr",        0x0020, 0x0100, 0x4aecc0c8 ) /* loookup table */
538 	ROM_LOAD( "7a.bpr",       0x0120, 0x0020, 0x48c8f094 ) /* video layout (not used) */
539 	ROM_LOAD( "10a.bpr",      0x0140, 0x0020, 0xb8861096 ) /* video timing (not used) */
540 ROM_END
541 
542 ROM_START( jungler )
543 	ROM_REGION( 0x10000, REGION_CPU1 )	/* 64k for code */
544 	ROM_LOAD( "jungr1",       0x0000, 0x1000, 0x5bd6ad15 )
545 	ROM_LOAD( "jungr2",       0x1000, 0x1000, 0xdc99f1e3 )
546 	ROM_LOAD( "jungr3",       0x2000, 0x1000, 0x3dcc03da )
547 	ROM_LOAD( "jungr4",       0x3000, 0x1000, 0xf92e9940 )
548 
549 	ROM_REGION( 0x10000, REGION_CPU2 )	/* 64k for the audio CPU */
550 	ROM_LOAD( "1b",           0x0000, 0x1000, 0xf86999c3 )
551 
552 	ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
553 	ROM_LOAD( "5k",           0x0000, 0x0800, 0x924262bf )
554 	ROM_LOAD( "5m",           0x0800, 0x0800, 0x131a08ac )
555 	/* 1000-1fff empty for my convenience */
556 
557 	ROM_REGION( 0x0100, REGION_GFX2 | REGIONFLAG_DISPOSE )
558 	ROM_LOAD( "82s129.10g",   0x0000, 0x0100, 0xc59c51b7 ) /* dots */
559 
560 	ROM_REGION( 0x0160, REGION_PROMS )
561 	ROM_LOAD( "18s030.8b",    0x0000, 0x0020, 0x55a7e6d1 ) /* palette */
562 	ROM_LOAD( "tbp24s10.9d",  0x0020, 0x0100, 0xd223f7b8 ) /* loookup table */
563 	ROM_LOAD( "18s030.7a",    0x0120, 0x0020, 0x8f574815 ) /* video layout (not used) */
564 	ROM_LOAD( "6331-1.10a",   0x0140, 0x0020, 0xb8861096 ) /* video timing (not used) */
565 ROM_END
566 
567 ROM_START( junglers )
568 	ROM_REGION( 0x10000, REGION_CPU1 )	/* 64k for code */
569 	ROM_LOAD( "5c",           0x0000, 0x1000, 0xedd71b28 )
570 	ROM_LOAD( "5a",           0x1000, 0x1000, 0x61ea4d46 )
571 	ROM_LOAD( "4d",           0x2000, 0x1000, 0x557c7925 )
572 	ROM_LOAD( "4c",           0x3000, 0x1000, 0x51aac9a5 )
573 
574 	ROM_REGION( 0x10000, REGION_CPU2 )	/* 64k for the audio CPU */
575 	ROM_LOAD( "1b",           0x0000, 0x1000, 0xf86999c3 )
576 
577 	ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
578 	ROM_LOAD( "5k",           0x0000, 0x0800, 0x924262bf )
579 	ROM_LOAD( "5m",           0x0800, 0x0800, 0x131a08ac )
580 	/* 1000-1fff empty for my convenience */
581 
582 	ROM_REGION( 0x0100, REGION_GFX2 | REGIONFLAG_DISPOSE )
583 	ROM_LOAD( "82s129.10g",   0x0000, 0x0100, 0xc59c51b7 ) /* dots */
584 
585 	ROM_REGION( 0x0160, REGION_PROMS )
586 	ROM_LOAD( "18s030.8b",    0x0000, 0x0020, 0x55a7e6d1 ) /* palette */
587 	ROM_LOAD( "tbp24s10.9d",  0x0020, 0x0100, 0xd223f7b8 ) /* loookup table */
588 	ROM_LOAD( "18s030.7a",    0x0120, 0x0020, 0x8f574815 ) /* video layout (not used) */
589 	ROM_LOAD( "6331-1.10a",   0x0140, 0x0020, 0xb8861096 ) /* video timing (not used) */
590 ROM_END
591 
592 ROM_START( commsega )
593 	ROM_REGION( 0x10000, REGION_CPU1 ) /* 64k for code */
594 	ROM_LOAD( "csega1",       0x0000, 0x1000, 0x92de3405 )
595 	ROM_LOAD( "csega2",       0x1000, 0x1000, 0xf14e2f9a )
596 	ROM_LOAD( "csega3",       0x2000, 0x1000, 0x941dbf48 )
597 	ROM_LOAD( "csega4",       0x3000, 0x1000, 0xe0ac69b4 )
598 	ROM_LOAD( "csega5",       0x4000, 0x1000, 0xbc56ebd0 )
599 
600 	ROM_REGION( 0x10000, REGION_CPU2 ) /* 64k for the audio CPU */
601 	ROM_LOAD( "csega8",       0x0000, 0x1000, 0x588b4210 )
602 
603 	ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
604 	ROM_LOAD( "csega7",       0x0000, 0x1000, 0xe8e374f9 )
605 	ROM_LOAD( "csega6",       0x1000, 0x1000, 0xcf07fd5e )
606 
607 	ROM_REGION( 0x0100, REGION_GFX2 | REGIONFLAG_DISPOSE )
608 	ROM_LOAD( "gg3.bpr",      0x0000, 0x0100, 0xae7fd962 ) /* dots */
609 
610 	ROM_REGION( 0x0160, REGION_PROMS )
611 	ROM_LOAD( "gg1.bpr",      0x0000, 0x0020, 0xf69e585a ) /* palette */
612 	ROM_LOAD( "gg2.bpr",      0x0020, 0x0100, 0x0b756e30 ) /* loookup table */
613 	ROM_LOAD( "gg0.bpr",      0x0120, 0x0020, 0x48c8f094 ) /* video layout (not used) */
614 	ROM_LOAD( "tt3.bpr",      0x0140, 0x0020, 0xb8861096 ) /* video timing (not used) */
615 ROM_END
616 
617 
618 
619 GAME( 1982, locomotn, 0,        locomotn, locomotn, 0, ROT90, "Konami (Centuri license)", "Loco-Motion" )
620 GAME( 1982, gutangtn, locomotn, locomotn, locomotn, 0, ROT90, "Konami (Sega license)", "Guttang Gottong" )
621 GAME( 1982, cottong,  locomotn, locomotn, locomotn, 0, ROT90, "bootleg", "Cotocoto Cottong" )
622 GAME( 1981, jungler,  0,        jungler,  jungler,  0, ROT90, "Konami", "Jungler" )
623 GAME( 1981, junglers, jungler,  jungler,  jungler,  0, ROT90, "[Konami] (Stern license)", "Jungler (Stern)" )
624 GAME( 1983, commsega, 0,        commsega, commsega, 0, ROT90, "Sega", "Commando (Sega)" )
625