1 /***************************************************************************
2 
3 GAME PLAN driver, used for games like MegaTack, Killer Comet, Kaos, Challenger
4 
5 driver by Chris Moore
6 
7 TO-DO: - Fix the input ports of Kaos
8 	   - Graphics are still somewhat scrambled sometimes (just look at
9          the tests with f2/f1)
10 
11 ****************************************************************************/
12 
13 #include "driver.h"
14 #include "vidhrdw/generic.h"
15 
16 VIDEO_START( gameplan );
17 READ_HANDLER( gameplan_video_r );
18 WRITE_HANDLER( gameplan_video_w );
19 READ_HANDLER( gameplan_sound_r );
20 WRITE_HANDLER( gameplan_sound_w );
21 READ_HANDLER( gameplan_via5_r );
22 WRITE_HANDLER( gameplan_via5_w );
23 
24 static int gameplan_current_port;
25 
WRITE_HANDLER(gameplan_port_select_w)26 static WRITE_HANDLER( gameplan_port_select_w )
27 {
28 #ifdef VERY_VERBOSE
29 	logerror("VIA 2: PC %04x: %x -> reg%X\n",activecpu_get_pc(), data, offset);
30 #endif /* VERY_VERBOSE */
31 
32 	switch (offset)
33 	{
34 		case 0x00:
35 			switch(data)
36 			{
37 				case 0x01: gameplan_current_port = 0; break;
38 				case 0x02: gameplan_current_port = 1; break;
39 				case 0x04: gameplan_current_port = 2; break;
40 				case 0x08: gameplan_current_port = 3; break;
41 				case 0x80: gameplan_current_port = 4; break;
42 				case 0x40: gameplan_current_port = 5; break;
43 
44 				default:
45 #ifdef VERBOSE
46 					logerror("  VIA 2: strange port request byte: %02x\n", data);
47 #endif
48 					return;
49 			}
50 
51 #ifdef VERBOSE
52 			logerror("  VIA 2: selected port %d\n", gameplan_current_port);
53 #endif
54 			break;
55 
56 		case 0x02:
57 #ifdef VERBOSE
58 			logerror("  VIA 2: wrote %02x to Data Direction Register B\n", data);
59 #endif
60 			break;
61 
62 		case 0x03:
63 #ifdef VERBOSE
64 			logerror("  VIA 2: wrote %02x to Data Direction Register A\n", data);
65 #endif
66 			break;
67 
68 		case 0x0c:
69 			if (data == 0xec || data == 0xcc)
70 			{
71 #ifdef VERBOSE
72 				logerror("  VIA 2: initialised Peripheral Control Register to 0x%02x for VIA 2\n",data);
73 #endif
74 			}
75 			else
76 				logerror("  VIA 2: unusual Peripheral Control Register value 0x%02x for VIA 2\n",data);
77 			break;
78 
79 		default:
80 			logerror("  VIA 2: unexpected register written to in VIA 2: %02x -> %02x\n",
81 						data, offset);
82 			break;
83 	}
84 }
85 
READ_HANDLER(gameplan_port_r)86 static READ_HANDLER( gameplan_port_r )
87 {
88 	return readinputport(gameplan_current_port);
89 }
90 
MEMORY_READ_START(readmem)91 static MEMORY_READ_START( readmem )
92     { 0x0000, 0x03ff, MRA_RAM },
93     { 0x032d, 0x03d8, MRA_RAM }, /* note: 300-32c and 3d9-3ff is
94 								  * written but never read?
95 								  * (write by code at e1df and e1e9,
96 								  * 32d is read by e258)*/
97     { 0x2000, 0x200f, gameplan_video_r },
98     { 0x2801, 0x2801, gameplan_port_r },
99 	{ 0x3000, 0x300f, gameplan_sound_r },
100     { 0x9000, 0xffff, MRA_ROM },
101 
102 MEMORY_END
103 
104 static MEMORY_WRITE_START( writemem )
105     { 0x0000, 0x03ff, MWA_RAM },
106     { 0x2000, 0x200f, gameplan_video_w },		/* VIA 1 */
107     { 0x2800, 0x280f, gameplan_port_select_w },	/* VIA 2 */
108     { 0x3000, 0x300f, gameplan_sound_w },       /* VIA 3 */
109     { 0x9000, 0xffff, MWA_ROM },
110 
111 MEMORY_END
112 
113 static MEMORY_READ_START( readmem_snd )
114 	{ 0x0000, 0x0026, MRA_RAM },
115 	{ 0x01f6, 0x01ff, MRA_RAM },
116 	{ 0x0800, 0x080f, gameplan_via5_r },
117 
118 #if 0
119     { 0xa001, 0xa001, gameplan_ay_3_8910_1_r }, /* AY-3-8910 */
120 #else
121     { 0xa001, 0xa001, soundlatch_r }, /* AY-3-8910 */
122 #endif
123 
124     { 0xf800, 0xffff, MRA_ROM },
125 MEMORY_END
126 
127 static MEMORY_WRITE_START( writemem_snd )
128 	{ 0x0000, 0x0026, MWA_RAM },
129 	{ 0x01f6, 0x01ff, MWA_RAM },
130 	{ 0x0800, 0x080f, gameplan_via5_w },
131 
132 #if 0
133     { 0xa000, 0xa000, gameplan_ay_3_8910_0_w }, /* AY-3-8910 */
134     { 0xa002, 0xa002, gameplan_ay_3_8910_2_w }, /* AY-3-8910 */
135 #else
136     { 0xa000, 0xa000, AY8910_control_port_0_w }, /* AY-3-8910 */
137     { 0xa002, 0xa002, AY8910_write_port_0_w }, /* AY-3-8910 */
138 #endif
139 
140 	{ 0xf800, 0xffff, MWA_ROM },
141 
142 MEMORY_END
143 
144 INPUT_PORTS_START( kaos )
145 	PORT_START      /* IN0 - from "TEST NO.7 - status locator - coin-door" */
146 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused */
147 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused */
148 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_TILT )
149 	PORT_BITX(0x08, IP_ACTIVE_LOW, 0, "Do Tests", KEYCODE_F1, IP_JOY_NONE )
150 	PORT_BITX(0x10, IP_ACTIVE_LOW, IPT_SERVICE, "Select Test", KEYCODE_F2, IP_JOY_NONE )
151 	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN3 )
152 	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN2 )
153 	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN1 )
154 
155 	PORT_START      /* IN1 - from "TEST NO.7 - status locator - start sws." */
156 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
157 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
158 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
159 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
160 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
161 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
162 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused */
163 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
164 
165 	PORT_START      /* IN2 - from "TEST NO.8 - status locator - player no.1" */
166 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
167 	PORT_BITX(0x02, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1, "P1 Jump", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
168 	PORT_BITX(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1, "P1 Right", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
169 	PORT_BITX(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER1, "P1 Left", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
170 	PORT_BITX(0x10, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1, "P1 Fire Up", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
171 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
172 	PORT_BITX(0x40, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER1, "P1 Fire Right", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
173 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
174 
175 	PORT_START      /* IN3 - from "TEST NO.8 - status locator - player no.2" */
176 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
177 	PORT_BITX(0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2, "P2 Fire Up", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
178 	PORT_BITX(0x04, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2, "P2 Fire Right", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
179 	PORT_BITX(0x08, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2, "P2 Fire Left", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
180 	PORT_BITX(0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER2, "P2 Left", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
181 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
182 	PORT_BITX(0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2, "P2 Right", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
183 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
184 
185 	PORT_START
186 
187 	PORT_DIPNAME(0x0f, 0x0e, DEF_STR( Coinage ) )
188 	PORT_DIPSETTING(   0x00, DEF_STR( 2C_1C ) )
189 	PORT_DIPSETTING(   0x0e, DEF_STR( 1C_1C ) )
190 	PORT_DIPSETTING(   0x0d, DEF_STR( 1C_2C ) )
191 	PORT_DIPSETTING(   0x0c, DEF_STR( 1C_3C ) )
192 	PORT_DIPSETTING(   0x0b, DEF_STR( 1C_4C ) )
193 	PORT_DIPSETTING(   0x0a, DEF_STR( 1C_5C ) )
194 	PORT_DIPSETTING(   0x09, DEF_STR( 1C_6C ) )
195 	PORT_DIPSETTING(   0x08, DEF_STR( 1C_7C ) )
196 	PORT_DIPSETTING(   0x07, DEF_STR( 1C_8C ) )
197 	PORT_DIPSETTING(   0x06, DEF_STR( 1C_9C ) )
198 	PORT_DIPSETTING(   0x05, "1 Coin/10 Credits" )
199 	PORT_DIPSETTING(   0x04, "1 Coin/11 Credits" )
200 	PORT_DIPSETTING(   0x03, "1 Coin/12 Credits" )
201 	PORT_DIPSETTING(   0x02, "1 Coin/13 Credits" )
202 	PORT_DIPSETTING(   0x01, "1 Coin/14 Credits" )
203 	PORT_DIPSETTING(   0x0f, DEF_STR( 2C_3C ) )
204 	PORT_DIPNAME(0x10, 0x00, DEF_STR( Demo_Sounds ) )
205 	PORT_DIPSETTING(   0x10, DEF_STR( Off ) )
206 	PORT_DIPSETTING(   0x00, DEF_STR( On ) )
207 	PORT_DIPNAME(0x60, 0x60, "Max Credits" )
208 	PORT_DIPSETTING(   0x60, "10" )
209 	PORT_DIPSETTING(   0x40, "20" )
210 	PORT_DIPSETTING(   0x20, "30" )
211 	PORT_DIPSETTING(   0x00, "40" )
212 	PORT_DIPNAME(0x80, 0x80, DEF_STR( Free_Play ) )
213 	PORT_DIPSETTING(   0x80, DEF_STR( Off ) )
214 	PORT_DIPSETTING(   0x00, DEF_STR( On ) )
215 
216 	PORT_START
217 	PORT_DIPNAME(0x01, 0x01, DEF_STR( Lives ) )
218 	PORT_DIPSETTING(   0x01, "3" )
219 	PORT_DIPSETTING(   0x00, "4" )
220 	PORT_DIPNAME(0x02, 0x00, "Speed" )
221 	PORT_DIPSETTING(   0x00, "Slow" )
222 	PORT_DIPSETTING(   0x02, "Fast" )
223 	PORT_DIPNAME(0x0c, 0x00, DEF_STR( Bonus_Life ) )
224 	PORT_DIPSETTING(   0x0c, "No Bonus" )
225 	PORT_DIPSETTING(   0x08, "10k" )
226 	PORT_DIPSETTING(   0x04, "10k 30k" )
227 	PORT_DIPSETTING(   0x00, "10k 30k 60k" )
228 	PORT_DIPNAME(0x10, 0x10, "Number of $" )
229 	PORT_DIPSETTING(   0x10, "8" )
230 	PORT_DIPSETTING(   0x00, "12" )
231 	PORT_DIPNAME(0x20, 0x00, "Bonus erg" )
232 	PORT_DIPSETTING(   0x20, "Every other screen" )
233 	PORT_DIPSETTING(   0x00, "Every screen" )
234 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
235 	PORT_DIPNAME(0x80, 0x80, DEF_STR( Cabinet ) )
236 	PORT_DIPSETTING(   0x80, DEF_STR( Upright ) )
237 	PORT_DIPSETTING(   0x00, DEF_STR( Cocktail ) )
238 INPUT_PORTS_END
239 
240 
241 INPUT_PORTS_START( killcom )
242 	PORT_START      /* IN0 - from "TEST NO.7 - status locator - coin-door" */
243 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused */
244 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused */
245 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_TILT )
246 	PORT_BITX(0x08, IP_ACTIVE_LOW, 0, "Do Tests", KEYCODE_F1, IP_JOY_NONE )
247 	PORT_BITX(0x10, IP_ACTIVE_LOW, IPT_SERVICE, "Select Test", KEYCODE_F2, IP_JOY_NONE )
248 	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN3 )
249 	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN2 )
250 	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN1 )
251 
252 	PORT_START      /* IN1 - from "TEST NO.7 - status locator - start sws." */
253 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
254 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
255 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
256 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
257 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
258 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
259 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused */
260 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
261 
262 	PORT_START      /* IN2 - from "TEST NO.8 - status locator - player no.1" */
263 	PORT_BITX(0x01, IP_ACTIVE_LOW, IPT_BUTTON4 | IPF_PLAYER1, "P1 Hyperspace", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
264 	PORT_BITX(0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1, "P1 Fire Up", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
265 	PORT_BITX(0x04, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER1, "P1 Fire Right", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
266 	PORT_BITX(0x08, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1, "P1 Fire Left", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
267 	PORT_BITX(0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER1, "P1 Left", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
268 	PORT_BITX(0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_PLAYER1, "P1 Down", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
269 	PORT_BITX(0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1, "P1 Right", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
270 	PORT_BITX(0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_PLAYER1, "P1 Up", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
271 
272 	PORT_START      /* IN3 - from "TEST NO.8 - status locator - player no.2" */
273 	PORT_BITX(0x01, IP_ACTIVE_LOW, IPT_BUTTON4 | IPF_PLAYER2, "P2 Hyperspace", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
274 	PORT_BITX(0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2, "P2 Fire Up", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
275 	PORT_BITX(0x04, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2, "P2 Fire Right", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
276 	PORT_BITX(0x08, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2, "P2 Fire Left", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
277 	PORT_BITX(0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER2, "P2 Left", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
278 	PORT_BITX(0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_PLAYER2, "P2 Down", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
279 	PORT_BITX(0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2, "P2 Right", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
280 	PORT_BITX(0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_PLAYER2, "P2 Up", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
281 
282 	PORT_START      /* IN4 - from "TEST NO.6 - dip switch A" */
283 
284 	PORT_DIPNAME(0x03, 0x03, "Coinage P1/P2" )
285 	PORT_DIPSETTING(   0x03, "1 Credit/2 Credits" )
286 	PORT_DIPSETTING(   0x02, "2 Credits/3 Credits" )
287 	PORT_DIPSETTING(   0x01, "2 Credits/4 Credits" )
288 	PORT_DIPSETTING(   0x00, DEF_STR( Free_Play ) )
289 
290 	PORT_DIPNAME(0x08, 0x08, DEF_STR( Lives ) )
291 	PORT_DIPSETTING(   0x00, "4" )
292 	PORT_DIPSETTING(   0x08, "5" )
293 
294 	PORT_DIPNAME(0xc0, 0xc0, "Reaction" )
295 	PORT_DIPSETTING(   0xc0, "Slowest" )
296 	PORT_DIPSETTING(   0x80, "Slow" )
297 	PORT_DIPSETTING(   0x40, "Fast" )
298 	PORT_DIPSETTING(   0x00, "Fastest" )
299 
300 	PORT_START      /* IN5 - from "TEST NO.6 - dip switch B" */
301 
302 	PORT_DIPNAME(0x40, 0x40, DEF_STR( Flip_Screen ) )
303 	PORT_DIPSETTING(   0x40, DEF_STR( Off ) )
304 	PORT_DIPSETTING(   0x00, DEF_STR( On ) )
305 
306 	PORT_DIPNAME(0x80, 0x80, DEF_STR( Cabinet ) )
307 	PORT_DIPSETTING(   0x80, DEF_STR( Upright ) )
308 	PORT_DIPSETTING(   0x00, DEF_STR( Cocktail ) )
309 INPUT_PORTS_END
310 
311 
312 INPUT_PORTS_START( megatack )
313 	PORT_START      /* IN0 - from "TEST NO.7 - status locator - coin-door" */
314 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused */
315 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused */
316 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_TILT )
317 	PORT_BITX(0x08, IP_ACTIVE_LOW, 0, "Do Tests", KEYCODE_F1, IP_JOY_NONE )
318 	PORT_BITX(0x10, IP_ACTIVE_LOW, IPT_SERVICE, "Select Test", KEYCODE_F2, IP_JOY_NONE )
319 	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN3 )
320 	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN2 )
321 	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN1 )
322 
323 	PORT_START      /* IN1 - from "TEST NO.7 - status locator - start sws." */
324 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
325 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
326 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
327 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
328 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
329 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
330 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused */
331 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
332 
333 	PORT_START      /* IN2 - from "TEST NO.8 - status locator - player no.1" */
334 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
335 	PORT_BITX(0x02, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1, "P1 Fire", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
336 /* PORT_BITX(0x04, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER1, "P1 Fire Right", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
337    PORT_BITX(0x08, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1, "P1 Fire Left", IP_KEY_DEFAULT, IP_JOY_DEFAULT )*/
338 	PORT_BITX(0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER1, "P1 Left", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
339 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
340 	PORT_BITX(0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1, "P1 Right", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
341 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
342 
343 	PORT_START      /* IN3 - from "TEST NO.8 - status locator - player no.2" */
344 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
345 	PORT_BITX(0x02, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2, "P2 Fire", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
346 /* PORT_BITX(0x04, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2, "P2 Fire Right", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
347    PORT_BITX(0x08, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2, "P2 Fire Left", IP_KEY_DEFAULT, IP_JOY_DEFAULT )*/
348 	PORT_BITX(0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER2, "P2 Left", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
349 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
350 	PORT_BITX(0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2, "P2 Right", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
351 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
352 
353 	PORT_START      /* IN4 - from "TEST NO.6 - dip switch A" */
354 	PORT_DIPNAME(0x03, 0x03, "Coinage P1/P2" )
355 	PORT_DIPSETTING(   0x03, "1 Credit/2 Credits" )
356 	PORT_DIPSETTING(   0x02, "2 Credits/3 Credits" )
357 	PORT_DIPSETTING(   0x01, "2 Credits/4 Credits" )
358 	PORT_DIPSETTING(   0x00, DEF_STR( Free_Play ) )
359 
360 	PORT_DIPNAME(0x08, 0x08, DEF_STR( Lives ) )
361 	PORT_DIPSETTING(   0x08, "3" )
362 	PORT_DIPSETTING(   0x00, "4" )
363 
364 	PORT_START      /* IN5 - from "TEST NO.6 - dip switch B" */
365 
366 	PORT_DIPNAME(0x07, 0x07, DEF_STR( Bonus_Life ) )
367 	PORT_DIPSETTING(   0x07, "20000" )
368 	PORT_DIPSETTING(   0x06, "30000" )
369 	PORT_DIPSETTING(   0x05, "40000" )
370 	PORT_DIPSETTING(   0x04, "50000" )
371 	PORT_DIPSETTING(   0x03, "60000" )
372 	PORT_DIPSETTING(   0x02, "70000" )
373 	PORT_DIPSETTING(   0x01, "80000" )
374 	PORT_DIPSETTING(   0x00, "90000" )
375 
376 	PORT_DIPNAME(0x10, 0x10, "Monitor View" )
377 	PORT_DIPSETTING(   0x10, "Direct" )
378 	PORT_DIPSETTING(   0x00, "Mirror" )
379 
380 	PORT_DIPNAME(0x20, 0x20, "Monitor Orientation" )
381 	PORT_DIPSETTING(   0x20, "Horizontal" )
382 	PORT_DIPSETTING(   0x00, "Vertical" )
383 
384 	PORT_DIPNAME(0x40, 0x40, DEF_STR( Flip_Screen ) )
385 	PORT_DIPSETTING(   0x40, DEF_STR( Off ) )
386 	PORT_DIPSETTING(   0x00, DEF_STR( On ) )
387 
388 	PORT_DIPNAME(0x80, 0x80, DEF_STR( Cabinet ) )
389 	PORT_DIPSETTING(   0x80, DEF_STR( Upright ) )
390 	PORT_DIPSETTING(   0x00, DEF_STR( Cocktail ) )
391 INPUT_PORTS_END
392 
393 
394 INPUT_PORTS_START( challeng )
395 	PORT_START      /* IN0 - from "TEST NO.7 - status locator - coin-door" */
396 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused */
397 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused */
398 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_TILT )
399 	PORT_BITX(0x08, IP_ACTIVE_LOW, 0, "Do Tests", KEYCODE_F1, IP_JOY_NONE )
400 	PORT_BITX(0x10, IP_ACTIVE_LOW, IPT_SERVICE, "Select Test", KEYCODE_F2, IP_JOY_NONE )
401 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN3 )
402 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
403 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
404 
405 	PORT_START      /* IN1 - from "TEST NO.7 - status locator - start sws." */
406 
407 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
408 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
409 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
410 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
411 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
412 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
413 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused */
414 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
415 
416 PORT_START      /* IN2 - from "TEST NO.8 - status locator - player no.1" */
417 
418 	PORT_BITX(0x01, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER1, "P1 Warp", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
419 	PORT_BITX(0x02, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1, "P1 Fire", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
420 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
421 	PORT_BITX(0x08, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1, "P1 Bomb", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
422 	PORT_BITX(0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER1, "P1 Left", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
423 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
424 	PORT_BITX(0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1, "P1 Right", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
425 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
426 
427 	PORT_START      /* IN3 - from "TEST NO.8 - status locator - player no.2" */
428 
429 	PORT_BITX(0x01, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2, "P2 Warp", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
430 	PORT_BITX(0x02, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2, "P2 Fire", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
431 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
432 	PORT_BITX(0x08, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2, "P2 Bomb", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
433 	PORT_BITX(0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER2, "P2 Left", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
434 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
435 	PORT_BITX(0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2, "P2 Right", IP_KEY_DEFAULT, IP_JOY_DEFAULT )
436 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* unused */
437 
438 	PORT_START      /* IN4 - from "TEST NO.6 - dip switch A" */
439 
440 	PORT_DIPNAME(0x03, 0x03, "Coinage P1/P2" )
441 	PORT_DIPSETTING(   0x03, "1 Credit/2 Credits" )
442 	PORT_DIPSETTING(   0x02, "2 Credits/3 Credits" )
443 	PORT_DIPSETTING(   0x01, "2 Credits/4 Credits" )
444 	PORT_DIPSETTING(   0x00, DEF_STR( Free_Play ) )
445 
446 	PORT_DIPNAME(0xc0, 0xc0, DEF_STR( Lives ) )
447 	PORT_DIPSETTING(   0xc0, "3" )
448 	PORT_DIPSETTING(   0x80, "4" )
449 	PORT_DIPSETTING(   0x40, "5" )
450 	PORT_DIPSETTING(   0x00, "6" )
451 
452 	PORT_START      /* IN5 - from "TEST NO.6 - dip switch B" */
453 	PORT_DIPNAME(0x07, 0x07, DEF_STR( Bonus_Life ) )
454 	PORT_DIPSETTING(   0x01, "20000" )
455 	PORT_DIPSETTING(   0x00, "30000" )
456 	PORT_DIPSETTING(   0x07, "40000" )
457 	PORT_DIPSETTING(   0x06, "50000" )
458 	PORT_DIPSETTING(   0x05, "60000" )
459 	PORT_DIPSETTING(   0x04, "70000" )
460 	PORT_DIPSETTING(   0x03, "80000" )
461 	PORT_DIPSETTING(   0x02, "90000" )
462 	PORT_DIPNAME(0x10, 0x10, "Monitor View" )
463 	PORT_DIPSETTING(   0x10, "Direct" )
464 	PORT_DIPSETTING(   0x00, "Mirror" )
465 	PORT_DIPNAME(0x20, 0x20, "Monitor Orientation" )
466 	PORT_DIPSETTING(   0x20, "Horizontal" )
467 	PORT_DIPSETTING(   0x00, "Vertical" )
468 	PORT_DIPNAME(0x40, 0x40, DEF_STR( Flip_Screen ) )
469 	PORT_DIPSETTING(   0x40, DEF_STR( Off ) )
470 	PORT_DIPSETTING(   0x00, DEF_STR( On ) )
471 	PORT_DIPNAME(0x80, 0x80, DEF_STR( Cabinet ) )
472 	PORT_DIPSETTING(   0x80, DEF_STR( Upright ) )
473 	PORT_DIPSETTING(   0x00, DEF_STR( Cocktail ) )
474 INPUT_PORTS_END
475 
476 
477 
478 static PALETTE_INIT( gameplan )
479 {
480 	palette_set_color(0,0xff,0xff,0xff); /* 0 WHITE   */
481 	palette_set_color(1,0x20,0xff,0xff); /* 1 CYAN    */
482 	palette_set_color(2,0xff,0x20,0xff); /* 2 MAGENTA */
483 	palette_set_color(3,0x20,0x20,0xFF); /* 3 BLUE    */
484 	palette_set_color(4,0xff,0xff,0x20); /* 4 YELLOW  */
485 	palette_set_color(5,0x20,0xff,0x20); /* 5 GREEN   */
486 	palette_set_color(6,0xff,0x20,0x20); /* 6 RED     */
487 	palette_set_color(7,0x00,0x00,0x00); /* 7 BLACK   */
488 }
489 
490 
491 static struct AY8910interface ay8910_interface =
492 {
493 	1,	/* 1 chips */
494 	1500000,	/* 1.5 MHz ? */
495 	{ 50 },
496 	{ 0 },
497 	{ 0 },
498 	{ 0 },
499 	{ 0 }
500 };
501 
502 
503 static MACHINE_DRIVER_START( gameplan )
504 
505 	/* basic machine hardware */
506 	MDRV_CPU_ADD(M6502,3579000 / 4)		/* 3.579 / 4 MHz */
507 	MDRV_CPU_MEMORY(readmem,writemem)
508 	MDRV_CPU_VBLANK_INT(irq0_line_hold,1) /* 1 interrupt per frame */
509 
510 	MDRV_CPU_ADD(M6502,3579000 / 4)
511 	MDRV_CPU_FLAGS(CPU_AUDIO_CPU)		/* 3.579 / 4 MHz */
512 	MDRV_CPU_MEMORY(readmem_snd,writemem_snd)
513 	MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
514 
515 	MDRV_FRAMES_PER_SECOND(57)
516 	MDRV_VBLANK_DURATION(DEFAULT_60HZ_VBLANK_DURATION)
517 
518     /* video hardware */
519 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
520 	MDRV_SCREEN_SIZE(32*8, 32*8)
521 	MDRV_VISIBLE_AREA(0, 32*8-1, 0, 32*8-1)
522 	MDRV_PALETTE_LENGTH(8)
523 
524 	MDRV_PALETTE_INIT(gameplan)
525 	MDRV_VIDEO_START(gameplan)
526 	MDRV_VIDEO_UPDATE(generic_bitmapped)
527 
528 	MDRV_SOUND_ADD(AY8910, ay8910_interface)
529 MACHINE_DRIVER_END
530 
531 /***************************************************************************
532 
533   Game driver(s)
534 
535 ***************************************************************************/
536 
537 /*
538 the manuals for Megattack and the schematics for Kaos are up
539 on spies now. I took a quick look at the rom mapping for kaos
540 and it looks like the roms are split this way:
541 
542 9000 G2 bot 2k
543 9800 J2 bot 2k
544 A000 J1 bot 2k
545 A800 G1 bot 2k
546 B000 F1 bot 2k
547 B800 E1 bot 2k
548 
549 D000 G2 top 2k
550 D800 J2 top 2k
551 E000 J1 top 2k
552 E800 G1 top 2k
553 F000 F1 top 2k
554 F800 E1 top 2k
555 
556 there are three 6522 VIAs, at 2000, 2800, and 3000
557 */
558 
559 ROM_START( kaos )
560     ROM_REGION( 0x10000, REGION_CPU1, 0 )
561     ROM_LOAD( "kaosab.g2",    0x9000, 0x0800, CRC(b23d858f) SHA1(e31fa657ace34130211a0b9fc0d115fd89bb20dd) )
562     ROM_CONTINUE(		   	  0xd000, 0x0800			 )
563     ROM_LOAD( "kaosab.j2",    0x9800, 0x0800, CRC(4861e5dc) SHA1(96ca0b8625af3897bd4a50a45ea964715f9e4973) )
564     ROM_CONTINUE(		   	  0xd800, 0x0800			 )
565     ROM_LOAD( "kaosab.j1",    0xa000, 0x0800, CRC(e055db3f) SHA1(099176629723c1a9bdc59f440339b2e8c38c3261) )
566     ROM_CONTINUE(		   	  0xe000, 0x0800			 )
567     ROM_LOAD( "kaosab.g1",    0xa800, 0x0800, CRC(35d7c467) SHA1(6d5bfd29ff7b96fed4b24c899ddd380e47e52bc5) )
568     ROM_CONTINUE(		   	  0xe800, 0x0800			 )
569     ROM_LOAD( "kaosab.f1",    0xb000, 0x0800, CRC(995b9260) SHA1(580896aa8b6f0618dc532a12d0795b0d03f7cadd) )
570     ROM_CONTINUE(		   	  0xf000, 0x0800			 )
571     ROM_LOAD( "kaosab.e1",    0xb800, 0x0800, CRC(3da5202a) SHA1(6b5aaf44377415763aa0895c64765a4b82086f25) )
572     ROM_CONTINUE(		   	  0xf800, 0x0800			 )
573 
574     ROM_REGION( 0x10000, REGION_CPU2, 0 )
575 	ROM_LOAD( "kaossnd.e1",   0xf800, 0x800, CRC(ab23d52a) SHA1(505f3e4a56e78a3913010f5484891f01c9831480) )
576 ROM_END
577 
578 
579 ROM_START( killcom )
580     ROM_REGION( 0x10000, REGION_CPU1, 0 )
581     ROM_LOAD( "killcom.e2",   0xc000, 0x800, CRC(a01cbb9a) SHA1(a8769243adbdddedfda5f3c8f054e9281a0eca46) )
582     ROM_LOAD( "killcom.f2",   0xc800, 0x800, CRC(bb3b4a93) SHA1(a0ea61ac30a4d191db619b7bfb697914e1500036) )
583     ROM_LOAD( "killcom.g2",   0xd000, 0x800, CRC(86ec68b2) SHA1(a09238190d61684d943ce0acda25eb901d2580ac) )
584     ROM_LOAD( "killcom.j2",   0xd800, 0x800, CRC(28d8c6a1) SHA1(d9003410a651221e608c0dd20d4c9c60c3b0febc) )
585     ROM_LOAD( "killcom.j1",   0xe000, 0x800, CRC(33ef5ac5) SHA1(42f839ad295d3df457ced7886a0003eff7e6c4ae) )
586     ROM_LOAD( "killcom.g1",   0xe800, 0x800, CRC(49cb13e2) SHA1(635e4665042ddd9b8c0b9f275d4bcc6830dc6a98) )
587     ROM_LOAD( "killcom.f1",   0xf000, 0x800, CRC(ef652762) SHA1(414714e5a3f83916bd3ae54afe2cb2271ee9008b) )
588     ROM_LOAD( "killcom.e1",   0xf800, 0x800, CRC(bc19dcb7) SHA1(eb983d2df010c12cb3ffb584fceafa54a4e956b3) )
589 
590     ROM_REGION( 0x10000, REGION_CPU2, 0 )
591 	ROM_LOAD( "killsnd.e1",   0xf800, 0x800, CRC(77d4890d) SHA1(a3ed7e11dec5d404f022c521256ff50aa6940d3c) )
592 ROM_END
593 
594 ROM_START( megatack )
595     ROM_REGION( 0x10000, REGION_CPU1, 0 )
596     ROM_LOAD( "megattac.e2",  0xc000, 0x800, CRC(33fa5104) SHA1(15693eb540563e03502b53ed8a83366e395ca529) )
597     ROM_LOAD( "megattac.f2",  0xc800, 0x800, CRC(af5e96b1) SHA1(5f6ab47c12d051f6af446b08f3cd459fbd2c13bf) )
598     ROM_LOAD( "megattac.g2",  0xd000, 0x800, CRC(670103ea) SHA1(e11f01e8843ed918c6ea5dda75319dc95105d345) )
599     ROM_LOAD( "megattac.j2",  0xd800, 0x800, CRC(4573b798) SHA1(388db11ab114b3575fe26ed65bbf49174021939a) )
600     ROM_LOAD( "megattac.j1",  0xe000, 0x800, CRC(3b1d01a1) SHA1(30bbf51885b1e510b8d21cdd82244a455c5dada0) )
601     ROM_LOAD( "megattac.g1",  0xe800, 0x800, CRC(eed75ef4) SHA1(7c02337344f2716d2f2771229f7dee7b651eeb95) )
602     ROM_LOAD( "megattac.f1",  0xf000, 0x800, CRC(c93a8ed4) SHA1(c87e2f13f2cc00055f4941c272a3126b165a6252) )
603     ROM_LOAD( "megattac.e1",  0xf800, 0x800, CRC(d9996b9f) SHA1(e71d65b695000fdfd5fd1ce9ae39c0cb0b61669e) )
604 
605     ROM_REGION( 0x10000, REGION_CPU2, 0 )
606 	ROM_LOAD( "megatsnd.e1",  0xf800, 0x800, CRC(0c186bdb) SHA1(233af9481a3979971f2d5aa75ec8df4333aa5e0d) )
607 ROM_END
608 
609 ROM_START( challeng )
610     ROM_REGION( 0x10000, REGION_CPU1, 0 )
611     ROM_LOAD( "chall.6",      0xa000, 0x1000, CRC(b30fe7f5) SHA1(ce93a57d626f90d31ddedbc35135f70758949dfa) )
612     ROM_LOAD( "chall.5",      0xb000, 0x1000, CRC(34c6a88e) SHA1(250577e2c8eb1d3a78cac679310ec38924ac1fe0) )
613     ROM_LOAD( "chall.4",      0xc000, 0x1000, CRC(0ddc18ef) SHA1(9f1aa27c71d7e7533bddf7de420c06fb0058cf60) )
614     ROM_LOAD( "chall.3",      0xd000, 0x1000, CRC(6ce03312) SHA1(69c047f501f327f568fe4ad1274168f9dda1ca70) )
615     ROM_LOAD( "chall.2",      0xe000, 0x1000, CRC(948912ad) SHA1(e79738ab94501f858f4d5f218787267523611e92) )
616     ROM_LOAD( "chall.1",      0xf000, 0x1000, CRC(7c71a9dc) SHA1(2530ada6390fb46c44bf7bf2636910ee54786493) )
617 
618     ROM_REGION( 0x10000, REGION_CPU2, 0 )
619 	ROM_LOAD( "chall.snd",    0xf800, 0x800, CRC(1b2bffd2) SHA1(36ceb5abbc92a17576c375019f1c5900320398f9) )
620 ROM_END
621 
622 
623 
624 GAME( 1981, kaos,     0, gameplan, kaos,     0, ROT270, "GamePlan", "Kaos" )
625 GAME( 1980, killcom,  0, gameplan, killcom,  0, ROT0,   "GamePlan (Centuri license)", "Killer Comet" )
626 GAME( 1980, megatack, 0, gameplan, megatack, 0, ROT0,   "GamePlan (Centuri license)", "MegaTack" )
627 GAME( 1981, challeng, 0, gameplan, challeng, 0, ROT0,   "GamePlan (Centuri license)", "Challenger" )
628