1 /***************************************************************************
2   Lazer Command memory map (preliminary)
3 
4   driver by Juergen Buchmueller
5 
6   0000-0bff ROM
7 
8   1c00-1c1f RAM 	CPU scratch pad is first 32 bytes of video RAM(not displayed)
9 
10   1c20-1eff RAM 	video buffer
11 			xxxx	D0 - D5 character select
12 					D6		horz line below character (row #9)
13 					D7		vert line right of character (bit #0)
14 
15   1f00-1f03 		R/W hardware
16 
17 			1f00 W	   audio channels
18 					D4 gun fire
19 					D5 explosion
20 					D6 tank engine
21 					D7 running man
22 			1f00 R	   player 1 joystick
23 					D0 up
24 					D1 down
25 					D2 right
26 					D3 left
27 
28 			1f01 W	D0 - D7 marker y position
29 			1f01 R	   player 2 joystick
30 					D0 up
31 					D1 down
32 					D2 right
33 					D3 left
34 
35 			1f02 W	D0 - D7 marker x position
36 			1f02 R	   player 1 + 2 buttons
37 					D0 button 1 player 2
38 					D1 button 1 player 1
39 					D2 button 2 player 2
40 					D3 button 2 player 1
41 
42 			1f03 W		attract mode
43 					D0 toggle on attract mode
44 					   (attract mode switched off by coin detected)
45 					D4 clear coin detected toggle
46 			1f03 R		coinage, coin detected and start buttons
47 					D0 coin 1/2 (DIP switch 4)
48 					D1 start 'expert'
49 					D2 start 'novice'
50 					D3 coin detected
51 
52   1f04-1f07 		Read only hardware
53 
54 			1f04 R	   vertical scan counter
55 					D0 60 Hz
56 					D1 120 Hz
57 					D2 240 Hz
58 					D3 480 Hz
59 
60 			1f05 R	   vertical scan counter
61 					D0 7.860 KHz
62 					D1 3.960 KHz
63 					D2 1.980 KHz
64 					D3 960 Hz
65 
66 			1f06 R	D0 - D7 readback of marker x position
67 
68 			1f07 R	D0 - D7 readback of marker y position
69 
70   I/O ports:
71 
72   'data'         R          game time
73 					D0 - D1 60,90,120,180 seconds (DIP switch 1 - 2)
74 
75 ***************************************************************************/
76 
77 /***************************************************************************
78   Meadows Lanes memory map (preliminary)
79 
80   0000-0bff ROM
81 
82   0c00-0c1f RAM 	CPU scratch pad is first 32 bytes of video RAM(not displayed)
83 
84   0c20-0eff RAM 	video buffer
85 			xxxx	D0 - D5 character select
86 					D6		horz line below character (row #9)
87 					D7		vert line right of character (bit #0)
88 
89   1000-17ff ROM
90 
91   1f00-1f03 		R/W hardware
92 
93 			1f00 W	   audio control bits
94 					D0 - D3 not used
95 					D4 bowl and hit
96 					D5 hit
97 					D6 - D7 not used
98 			1f00 R	   bowl ball
99 					D0 fast
100 					D1 slow
101 					   joystick
102 					D2 right
103 					D3 left
104 
105 			1f01 W	D0 - D7 marker y position
106 			1f01 R	   hook control
107 					D0 left
108 					D1 right
109 					D2 - D3 not used
110 
111 			1f02 W	D0 - D7 marker x position
112 			1f02 R	D0 - D3 not used
113 
114 			1f03 W		attract mode
115 					D0 toggle on attract mode
116 					   (attract mode switched off by coin detected)
117 					D4 clear coin detected toggle
118 					D5 can be jumpered to control inverse video
119 					D6 - D7 not used
120 			1f03 R		coinage, coin detected and start buttons
121 					D0 coin 1/2 (DIP switch 4)
122 					D1 start
123 					D2 not used
124 					D3 coin detected
125 
126   1f04-1f07 		Read only hardware
127 
128 			1f04 R	   vertical scan counter
129 					D0 60 Hz
130 					D1 120 Hz
131 					D2 240 Hz
132 					D3 480 Hz
133 
134 			1f05 R	   vertical scan counter
135 					D0 7.860 KHz
136 					D1 3.960 KHz
137 					D2 1.980 KHz
138 					D3 960 Hz
139 
140 			1f06 R	D0 - D7 readback of marker x position
141 
142 			1f07 R	D0 - D7 readback of marker y position
143 
144   I/O ports:
145 
146   'data'         R          game time
147 					D0 time on	   (DIP switch 1)
148 					D1 3,5 seconds (DIP switch 2)
149 
150 ***************************************************************************/
151 
152 /***************************************************************************
153   Bigfoot Bonkers memory map (preliminary)
154 
155   driver by Juergen Buchmueller
156 
157   0000-07ff ROM
158 
159   1c00-1c1f RAM 	CPU scratch pad is first 32 bytes of video RAM(not displayed)
160 
161   1c20-1eff RAM 	video buffer
162 			xxxx	D0 - D5 character select
163 					D6		horz line below character (row #9)
164 					D7		vert line right of character (bit #0)
165 
166   1f00-1f03 		R/W hardware
167 
168 			1f00 W	   audio channels
169 					D4 unused
170 					D5 tone 1
171 					D6 tone 2
172 					D7 unused
173 			1f00 R	   player 1 joystick
174 					D0 up
175 					D1 down
176 					D2 right
177 					D3 left
178 
179 			1f01 W	D0 - D7 unused
180 			1f01 R	   player 2 joystick
181 					D0 up
182 					D1 down
183 					D2 right
184 					D3 left
185 
186 			1f02 W	D0 - D7 unused
187 			1f02 R	   player 1 + 2 buttons
188 					D0 unused
189 					D1 unused
190 					D2 unused
191 					D3 unused
192 
193 			1f03 W		attract mode
194 					D0 toggle on attract mode
195 					   (attract mode switched off by coin detected)
196 					D4 clear coin detected toggle
197 			1f03 R		coinage, coin detected and start buttons
198 					D0 coin 1/2 (DIP switch 4)
199 					D1 start
200 					D2 start
201 					D3 coin detected
202 
203   1f04-1f07 		Read only hardware
204 
205 			1f04 R	   vertical scan counter
206 					D0 60 Hz
207 					D1 120 Hz
208 					D2 240 Hz
209 					D3 480 Hz
210 
211 			1f05 R	   vertical scan counter
212 					D0 7.860 KHz
213 					D1 3.960 KHz
214 					D2 1.980 KHz
215 					D3 960 Hz
216 
217 			1f06 R	D0 - D7 unused
218 
219 			1f07 R	D0 - D7 unused
220 
221 ***************************************************************************/
222 
223 #include "driver.h"
224 #include "artwork.h"
225 #include "vidhrdw/generic.h"
226 #include "vidhrdw/lazercmd.h"
227 #include "cpu/s2650/s2650.h"
228 
229 
230 int marker_x, marker_y;
231 
232 
233 /*************************************************************
234 
235    externals
236 
237  *************************************************************/
238 VIDEO_START( lazercmd );
239 VIDEO_UPDATE( lazercmd );
240 void lazercmd_marker_dirty(int marker);
241 
242 /*************************************************************
243  *
244  * Statics
245  *
246  *************************************************************/
247 static int timer_count = 0;
248 
249 /*************************************************************
250  * Interrupt for the cpu
251  * Fake something toggling the sense input line of the S2650
252  * The rate should be at about 1 Hz
253  *************************************************************/
INTERRUPT_GEN(lazercmd_timer)254 static INTERRUPT_GEN( lazercmd_timer )
255 {
256 	static int sense_state = 0;
257 
258 	if( ++timer_count >= 64*128 ) {
259 		timer_count = 0;
260 		sense_state ^= 1;
261 		cpu_set_irq_line( 0, 1, (sense_state) ? ASSERT_LINE : CLEAR_LINE );
262 	}
263 }
264 
INTERRUPT_GEN(bbonk_timer)265 static INTERRUPT_GEN( bbonk_timer )
266 {
267 	if( ++timer_count >= 64*128 )
268 		timer_count = 0;
269 }
270 
271 /*************************************************************
272  *
273  * IO port read/write
274  *
275  *************************************************************/
276 
277 /* triggered by WRTC,r opcode */
WRITE_HANDLER(lazercmd_ctrl_port_w)278 static WRITE_HANDLER( lazercmd_ctrl_port_w )
279 {
280 }
281 
282 /* triggered by REDC,r opcode */
READ_HANDLER(lazercmd_ctrl_port_r)283 static READ_HANDLER( lazercmd_ctrl_port_r )
284 {
285 	int data = 0;
286 	return data;
287 }
288 
289 /* triggered by WRTD,r opcode */
WRITE_HANDLER(lazercmd_data_port_w)290 static WRITE_HANDLER( lazercmd_data_port_w )
291 {
292 }
293 
294 /* triggered by REDD,r opcode */
READ_HANDLER(lazercmd_data_port_r)295 static READ_HANDLER( lazercmd_data_port_r )
296 {
297 	int data;
298 	data = input_port_2_r(0) & 0x0f;
299 	return data;
300 }
301 
WRITE_HANDLER(lazercmd_hardware_w)302 static WRITE_HANDLER( lazercmd_hardware_w )
303 {
304 	static int DAC_data = 0;
305 
306 	switch (offset)
307 	{
308 		case 0: /* audio channels */
309 			DAC_data=(data&0x80)^((data&0x40)<<1)^((data&0x20)<<2)^((data&0x10)<<3);
310 			if (DAC_data)
311 			{
312 				DAC_data_w(0, 0xff);
313 			}
314 			else
315 			{
316 				DAC_data_w(0, 0);
317 			}
318 			break;
319 		case 1: /* marker Y position */
320 			lazercmd_marker_dirty(0); /* mark old position dirty */
321 			marker_y = data;
322 			break;
323 		case 2: /* marker X position */
324 			lazercmd_marker_dirty(0); /* mark old position dirty */
325 			marker_x = data;
326 			break;
327 		case 3: /* D4 clears coin detected and D0 toggles on attract mode */
328 			break;
329 	}
330 }
331 
WRITE_HANDLER(medlanes_hardware_w)332 static WRITE_HANDLER( medlanes_hardware_w )
333 {
334 	static int DAC_data = 0;
335 
336 	switch (offset)
337 	{
338 		case 0: /* audio control */
339 			/* bits 4 and 5 are used to control a sound board */
340 			/* these could be used to control sound samples */
341 			/* at the moment they are routed through the dac */
342 			DAC_data=((data&0x20)<<2)^((data&0x10)<<3);
343 			if (DAC_data)
344 			{
345 				DAC_data_w(0, 0xff);
346 			}
347 			else
348 			{
349 				DAC_data_w(0, 0);
350 			}
351 			break;
352 		case 1: /* marker Y position */
353 			lazercmd_marker_dirty(0); /* mark old position dirty */
354 			marker_y = data;
355 			break;
356 		case 2: /* marker X position */
357 			lazercmd_marker_dirty(0); /* mark old position dirty */
358 			marker_x = data;
359 			break;
360 		case 3: /* D4 clears coin detected and D0 toggles on attract mode */
361 			break;
362 	}
363 }
364 
WRITE_HANDLER(bbonk_hardware_w)365 static WRITE_HANDLER( bbonk_hardware_w )
366 {
367 	static int DAC_data = 0;
368 
369 	switch (offset)
370 	{
371 		case 0: /* audio control */
372 			/* bits 4 and 5 are used to control a sound board */
373 			/* these could be used to control sound samples */
374 			/* at the moment they are routed through the dac */
375 			DAC_data=((data&0x20)<<2)^((data&0x10)<<3);
376 			if (DAC_data)
377 			{
378 				DAC_data_w(0, 0xff);
379 			}
380 			else
381 			{
382 				DAC_data_w(0, 0);
383 			}
384 			break;
385 		case 3: /* D4 clears coin detected and D0 toggles on attract mode */
386 			break;
387 	}
388 }
389 
READ_HANDLER(lazercmd_hardware_r)390 static READ_HANDLER( lazercmd_hardware_r )
391 {
392 	int data = 0;
393 
394 	switch (offset)
395 	{
396 		case 0: 			   /* player 1 joysticks */
397 			data = input_port_0_r(0);
398 			break;
399 		case 1: 			   /* player 2 joysticks */
400 			data = input_port_1_r(0);
401 			break;
402 		case 2: 			   /* player 1 + 2 buttons */
403 			data = input_port_4_r(0);
404 			break;
405 		case 3: 			   /* coin slot + start buttons */
406 			data = input_port_3_r(0);
407 			break;
408 		case 4: 			   /* vertical scan counter */
409 			data = ((timer_count&0x10)>>1)|((timer_count&0x20)>>3)|((timer_count&0x40)>>5)|((timer_count&0x80)>>7);
410 			break;
411 		case 5: 			   /* vertical scan counter */
412 			data = timer_count & 0x0f;
413 			break;
414 		case 6: 			   /* 1f02 readback */
415 			data = marker_x;
416 			break;
417 		case 7: 			   /* 1f01 readback */
418 			data = marker_y;
419 			break;
420 	}
421 	return data;
422 }
423 
424 
425 /*************************************************************
426  *
427  * Video overlay
428  *
429  *************************************************************/
430 
431 #define JADE	MAKE_ARGB(0x04,0x2e,0xff,0x2e)
432 #define MUSTARD MAKE_ARGB(0x04,0xff,0xb9,0x2e)
433 
434 OVERLAY_START( lazercmd_overlay )
435 	OVERLAY_RECT(  0*HORZ_CHR,  0*VERT_CHR, 16*HORZ_CHR,  1*VERT_CHR, MUSTARD )
436 	OVERLAY_RECT( 16*HORZ_CHR,  0*VERT_CHR, 32*HORZ_CHR,  1*VERT_CHR, JADE )
437 	OVERLAY_RECT(  0*HORZ_CHR,  1*VERT_CHR, 16*HORZ_CHR, 22*VERT_CHR, JADE )
438 	OVERLAY_RECT( 16*HORZ_CHR,  1*VERT_CHR, 32*HORZ_CHR, 22*VERT_CHR, MUSTARD )
439 	OVERLAY_RECT(  0*HORZ_CHR, 22*VERT_CHR, 16*HORZ_CHR, 23*VERT_CHR, MUSTARD )
440 	OVERLAY_RECT( 16*HORZ_CHR, 22*VERT_CHR, 32*HORZ_CHR, 23*VERT_CHR, JADE )
441 OVERLAY_END
442 
443 
444 
MEMORY_WRITE_START(lazercmd_writemem)445 static MEMORY_WRITE_START( lazercmd_writemem )
446 	{ 0x0000, 0x0bff, MWA_ROM },
447 	{ 0x1c00, 0x1c1f, MWA_RAM },
448 	{ 0x1c20, 0x1eff, videoram_w, &videoram, &videoram_size },
449 	{ 0x1f00, 0x1f03, lazercmd_hardware_w },
450 MEMORY_END
451 
452 static MEMORY_READ_START( lazercmd_readmem )
453 	{ 0x0000, 0x0bff, MRA_ROM },
454 	{ 0x1c00, 0x1c1f, MRA_RAM },
455 	{ 0x1c20, 0x1eff, MRA_RAM },
456 	{ 0x1f00, 0x1f07, lazercmd_hardware_r },
457 MEMORY_END
458 
459 static MEMORY_WRITE_START( medlanes_writemem )
460 	{ 0x0000, 0x0bff, MWA_ROM },
461 	{ 0x1000, 0x1800, MWA_ROM },
462 	{ 0x1c00, 0x1c1f, MWA_RAM },
463 	{ 0x1c20, 0x1eff, videoram_w, &videoram, &videoram_size },
464 	{ 0x1f00, 0x1f03, medlanes_hardware_w },
465 MEMORY_END
466 
467 static MEMORY_READ_START( medlanes_readmem )
468 	{ 0x0000, 0x0bff, MRA_ROM },
469 	{ 0x1000, 0x1800, MRA_ROM },
470 	{ 0x1c00, 0x1c1f, MRA_RAM },
471 	{ 0x1c20, 0x1eff, MRA_RAM },
472 	{ 0x1f00, 0x1f07, lazercmd_hardware_r },
473 MEMORY_END
474 
475 static MEMORY_WRITE_START( bbonk_writemem )
476 	{ 0x0000, 0x0bff, MWA_ROM },
477 	{ 0x1c00, 0x1c1f, MWA_RAM },
478 	{ 0x1c20, 0x1eff, videoram_w, &videoram, &videoram_size },
479 	{ 0x1f00, 0x1f03, bbonk_hardware_w },
480 MEMORY_END
481 
482 static MEMORY_READ_START( bbonk_readmem )
483 	{ 0x0000, 0x0bff, MRA_ROM },
484 	{ 0x1c00, 0x1c1f, MRA_RAM },
485 	{ 0x1c20, 0x1eff, MRA_RAM },
486 	{ 0x1f00, 0x1f07, lazercmd_hardware_r },
487 MEMORY_END
488 
489 static PORT_WRITE_START( lazercmd_writeport )
490 	{ S2650_CTRL_PORT, S2650_CTRL_PORT, lazercmd_ctrl_port_w },
491 	{ S2650_DATA_PORT, S2650_DATA_PORT, lazercmd_data_port_w },
492 PORT_END
493 
494 static PORT_READ_START( lazercmd_readport )
495 	{ S2650_CTRL_PORT, S2650_CTRL_PORT, lazercmd_ctrl_port_r },
496 	{ S2650_DATA_PORT, S2650_DATA_PORT, lazercmd_data_port_r },
497 PORT_END
498 
499 
500 INPUT_PORTS_START( lazercmd )
501 	PORT_START					   /* IN0 player 1 controls */
502 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_PLAYER1 )
503 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_PLAYER1 )
504 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1 )
505 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER1 )
506 	PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
507 
508 	PORT_START					   /* IN1 player 2 controls */
509 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_PLAYER2 )
510 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_PLAYER2 )
511 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2 )
512 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER2 )
513 	PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
514 
515 	PORT_START					   /* IN2 dip switch */
516 	PORT_DIPNAME( 0x03, 0x03, "Game Time" )
517 	PORT_DIPSETTING(	0x00, "60 seconds" )
518 	PORT_DIPSETTING(	0x01, "90 seconds" )
519 	PORT_DIPSETTING(	0x02, "120 seconds" )
520 	PORT_DIPSETTING(	0x03, "180 seconds" )
521 	PORT_BIT( 0x18, IP_ACTIVE_LOW, IPT_UNUSED )
522 	PORT_DIPNAME( 0x20, 0x20, "Video Invert" )
523 	PORT_DIPSETTING(	0x00, DEF_STR( Off ) )
524 	PORT_DIPSETTING(	0x20, DEF_STR( On ) )
525 	PORT_DIPNAME( 0x40, 0x40, "Marker Size" )
526 	PORT_DIPSETTING(	0x00, "Small" )
527 	PORT_DIPSETTING(	0x40, "Large" )
528 	PORT_DIPNAME( 0x80, 0x80, "Color Overlay" )
529 	PORT_DIPSETTING(	0x00, DEF_STR( Off ) )
530 	PORT_DIPSETTING(	0x80, DEF_STR( On ) )
531 
532 	PORT_START					   /* IN3 coinage & start */
533 	PORT_DIPNAME( 0x01, 0x01, DEF_STR( Coinage ) )
534 	PORT_DIPSETTING(	0x00, DEF_STR( 2C_1C ) )
535 	PORT_DIPSETTING(	0x01, DEF_STR( 1C_1C ) )
536 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 )
537 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 )
538 	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN1 )
539 	PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNUSED )
540 
541 	PORT_START					   /* IN4 player 1 + 2 buttons */
542 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
543 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
544 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
545 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
546 	PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
547 INPUT_PORTS_END
548 
549 INPUT_PORTS_START( medlanes )
550 	PORT_START					   /* IN0 player 1 controls */
551 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
552 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
553 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 )
554 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 )
555 	PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
556 
557 	PORT_START					   /* IN1 player 1 controls */
558 	PORT_BITX(0x01, IP_ACTIVE_LOW, 0,"Hook Left", KEYCODE_Z, 0 )
559 	PORT_BITX(0x02, IP_ACTIVE_LOW, 0,"Hook Right", KEYCODE_X, 0 )
560 	PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED)
561 
562 	PORT_START					   /* IN2 dip switch */
563 	PORT_DIPNAME( 0x01, 0x01, "Game Timer" )
564 	PORT_DIPSETTING(	0x00, DEF_STR( Off ) )
565 	PORT_DIPSETTING(	0x01, DEF_STR( On ) )
566 	PORT_DIPNAME( 0x02, 0x02, "Time" )
567 	PORT_DIPSETTING(	0x00, "3 seconds" )
568 	PORT_DIPSETTING(	0x02, "5 seconds" )
569 	PORT_BIT( 0x1C, IP_ACTIVE_LOW, IPT_UNUSED)
570 	PORT_DIPNAME( 0x20, 0x00, "Video Invert" )
571 	PORT_DIPSETTING(	0x00, DEF_STR( Off ) )
572 	PORT_DIPSETTING(	0x20, DEF_STR( On ) )
573 	PORT_DIPNAME( 0x40, 0x00, "Marker Size" )
574 	PORT_DIPSETTING(	0x00, "Small" )
575 	PORT_DIPSETTING(	0x40, "Large" )
576 	PORT_DIPNAME( 0x80, 0x00, "Color Overlay" )
577 	PORT_DIPSETTING(	0x00, DEF_STR( Off ) )
578 	PORT_DIPSETTING(	0x80, DEF_STR( On ) )
579 
580 	PORT_START					   /* IN3 coinage & start */
581 	PORT_DIPNAME( 0x01, 0x01, DEF_STR( Coinage ) )
582 	PORT_DIPSETTING(	0x00, DEF_STR( 2C_1C ) )
583 	PORT_DIPSETTING(	0x01, DEF_STR( 1C_1C ) )
584 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 )
585 	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN1 )
586 	PORT_BIT( 0xf4, IP_ACTIVE_HIGH, IPT_UNUSED )
587 
588 	PORT_START					   /* IN4 not used */
589 	PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
590 INPUT_PORTS_END
591 
592 INPUT_PORTS_START( bbonk )
593 	PORT_START					   /* IN0 player 1 controls */
594 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_PLAYER1 )
595 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_PLAYER1 )
596 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1 )
597 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER1 )
598 	PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
599 
600 	PORT_START					   /* IN1 player 2 controls */
601 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_PLAYER2 )
602 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_PLAYER2 )
603 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2 )
604 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_PLAYER2 )
605 	PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
606 
607 	PORT_START					   /* IN2 dip switch */
608 	PORT_DIPNAME( 0x03, 0x02, "Games to win" )
609 	PORT_DIPSETTING(	0x02, "2" )
610 	PORT_DIPSETTING(	0x03, "3" )
611 	PORT_DIPSETTING(	0x00, "4" )
612 	PORT_DIPSETTING(	0x01, "5" )
613 	PORT_BIT( 0x1C, IP_ACTIVE_LOW, IPT_UNUSED)
614 	PORT_DIPNAME( 0x20, 0x00, "Video Invert" )
615 	PORT_DIPSETTING(	0x00, DEF_STR( Off ) )
616 	PORT_DIPSETTING(	0x20, DEF_STR( On ) )
617 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED)
618 	PORT_DIPNAME( 0x80, 0x00, "Color Overlay" )
619 	PORT_DIPSETTING(	0x00, DEF_STR( Off ) )
620 	PORT_DIPSETTING(	0x80, DEF_STR( On ) )
621 
622 	PORT_START					   /* IN3 coinage & start */
623 	PORT_DIPNAME( 0x01, 0x01, DEF_STR( Coinage ) )
624 	PORT_DIPSETTING(	0x00, DEF_STR( 2C_1C ) )
625 	PORT_DIPSETTING(	0x01, DEF_STR( 1C_1C ) )
626 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 )
627 	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN1 )
628 	PORT_BIT( 0xf4, IP_ACTIVE_HIGH, IPT_UNUSED )
629 
630 	PORT_START					   /* IN4 not used */
631 	PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
632 INPUT_PORTS_END
633 
634 
635 static struct GfxLayout charlayout =
636 {
637 	8, 10,					/* 8*10 characters */
638 	4*64,					/* 4 * 64 characters */
639 	1,						/* 1 bit per pixel */
640 	{ 0 },					/* no bitplanes */
641 	{ 0, 1, 2, 3, 4, 5, 6, 7 },
642 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8 },
643 	10*8					/* every char takes 10 bytes */
644 };
645 
646 static struct GfxDecodeInfo gfxdecodeinfo[] =
647 {
648 	{ REGION_GFX1, 0, &charlayout, 0, 2 },
649 	{ -1 }					 /* end of array */
650 };
651 
652 static unsigned short colortable_source[] =
653 {
654 	 1, 0,
655 	 0, 1
656 };
PALETTE_INIT(lazercmd)657 static PALETTE_INIT( lazercmd )
658 {
659 	palette_set_color(0,0x00,0x00,0x00); 	/* black */
660 	palette_set_color(1,0xb0,0xb0,0xb0); 	/* white */
661 	palette_set_color(2,0xff,0xff,0xff);	/* bright white */
662 	memcpy(colortable,colortable_source,sizeof(colortable_source));
663 }
664 
665 static struct DACinterface lazercmd_DAC_interface =
666 {
667 	1,
668 	{ 100 }
669 };
670 
671 static MACHINE_DRIVER_START( lazercmd )
672 
673 	/* basic machine hardware */
674 	MDRV_CPU_ADD(S2650,8064000/12/3)				/* 672 kHz? */
675 /*			Main Clock is 8MHz divided by 12
676 			but memory and IO access is only possible
677 			within the line and frame blanking period
678 			thus requiring an extra loading of approx 3-5 */
MDRV_CPU_MEMORY(lazercmd_readmem,lazercmd_writemem)679 	MDRV_CPU_MEMORY(lazercmd_readmem,lazercmd_writemem)
680 	MDRV_CPU_PORTS(lazercmd_readport,lazercmd_writeport)
681 	MDRV_CPU_VBLANK_INT(lazercmd_timer, 128) 	/* 7680 Hz */
682 
683 	MDRV_FRAMES_PER_SECOND(60)
684 	MDRV_VBLANK_DURATION(DEFAULT_REAL_60HZ_VBLANK_DURATION)
685 
686 	/* video hardware */
687 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
688 	MDRV_SCREEN_SIZE(HORZ_RES * HORZ_CHR, VERT_RES * VERT_CHR)
689 	MDRV_VISIBLE_AREA(0 * HORZ_CHR, HORZ_RES * HORZ_CHR - 1,
690 						0 * VERT_CHR, (VERT_RES - 1) * VERT_CHR - 1)
691 	MDRV_GFXDECODE(gfxdecodeinfo)
692 	MDRV_PALETTE_LENGTH(3)
693 	MDRV_COLORTABLE_LENGTH(2*2)
694 
695 	MDRV_PALETTE_INIT(lazercmd)
696 	MDRV_VIDEO_START(lazercmd)
697 	MDRV_VIDEO_UPDATE(lazercmd)
698 
699 	/* sound hardware */
700 	MDRV_SOUND_ADD(DAC, lazercmd_DAC_interface)
701 MACHINE_DRIVER_END
702 
703 
704 static MACHINE_DRIVER_START( medlanes )
705 
706 	/* basic machine hardware */
707 	MDRV_CPU_ADD(S2650,8064000/12/3)				/* 672 kHz? */
708 /*			Main Clock is 8MHz divided by 12
709 			but memory and IO access is only possible
710 			within the line and frame blanking period
711 			thus requiring an extra loading of approx 3-5 */
712 	MDRV_CPU_MEMORY(medlanes_readmem,medlanes_writemem)
713 	MDRV_CPU_PORTS(lazercmd_readport,lazercmd_writeport)
714 	MDRV_CPU_VBLANK_INT(lazercmd_timer, 128) 	/* 7680 Hz */
715 
716 	MDRV_FRAMES_PER_SECOND(60)
717 	MDRV_VBLANK_DURATION(DEFAULT_REAL_60HZ_VBLANK_DURATION)
718 
719 	/* video hardware */
720 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
721 	MDRV_SCREEN_SIZE(HORZ_RES * HORZ_CHR, VERT_RES * VERT_CHR)
722 	MDRV_VISIBLE_AREA(0 * HORZ_CHR, HORZ_RES * HORZ_CHR - 1,
723 						 0 * VERT_CHR, VERT_RES * VERT_CHR - 1)
724 	MDRV_GFXDECODE(gfxdecodeinfo)
725 	MDRV_PALETTE_LENGTH(3)
726 	MDRV_COLORTABLE_LENGTH(2*2)
727 
728 	MDRV_VIDEO_START(lazercmd)
729 	MDRV_VIDEO_UPDATE(lazercmd)
730 
731 	/* sound hardware */
732 	MDRV_SOUND_ADD(DAC, lazercmd_DAC_interface)
733 MACHINE_DRIVER_END
734 
735 
736 static MACHINE_DRIVER_START( bbonk )
737 
738 	/* basic machine hardware */
739 	MDRV_CPU_ADD(S2650,8064000/12/3)				/* 672 kHz? */
740 /*			Main Clock is 8MHz divided by 12
741 			but memory and IO access is only possible
742 			within the line and frame blanking period
743 			thus requiring an extra loading of approx 3-5 */
744 	MDRV_CPU_MEMORY(bbonk_readmem,bbonk_writemem)
745 	MDRV_CPU_PORTS(lazercmd_readport,lazercmd_writeport)
746 	MDRV_CPU_VBLANK_INT(bbonk_timer, 128) 	/* 7680 Hz */
747 
748 	MDRV_FRAMES_PER_SECOND(60)
749 	MDRV_VBLANK_DURATION(DEFAULT_REAL_60HZ_VBLANK_DURATION)
750 
751 	/* video hardware */
752 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
753 	MDRV_SCREEN_SIZE(HORZ_RES * HORZ_CHR, VERT_RES * VERT_CHR)
754 	MDRV_VISIBLE_AREA(0 * HORZ_CHR, HORZ_RES * HORZ_CHR - 1,
755 						0 * VERT_CHR, (VERT_RES - 1) * VERT_CHR - 1)
756 	MDRV_GFXDECODE(gfxdecodeinfo)
757 	MDRV_PALETTE_LENGTH(3)
758 	MDRV_COLORTABLE_LENGTH(2*2)
759 
760 	MDRV_PALETTE_INIT(lazercmd)
761 	MDRV_VIDEO_START(lazercmd)
762 	MDRV_VIDEO_UPDATE(lazercmd)
763 
764 	/* sound hardware */
765 	MDRV_SOUND_ADD(DAC, lazercmd_DAC_interface)
766 MACHINE_DRIVER_END
767 
768 /***************************************************************************
769 
770   Game driver(s)
771 
772 ***************************************************************************/
773 
774 ROM_START( lazercmd )
775 	ROM_REGION( 0x8000, REGION_CPU1, 0 )			   /* 32K cpu, 4K for ROM/RAM */
776 	ROM_LOAD( "lc.e5",        0x0000, 0x0400, CRC(56dc7a40) SHA1(1324d5d6a44d7314723a0b5745d89f8e27f49d25) )
777 	ROM_LOAD( "lc.e6",        0x0400, 0x0400, CRC(b1ef0aa2) SHA1(3edeaa4d4f4e18536066898284d430a1ac00512e) )
778 	ROM_LOAD( "lc.e7",        0x0800, 0x0400, CRC(8e6ffc97) SHA1(d5243ce88585db91573b6586d3d47d13b5b473c8) )
779 	ROM_LOAD( "lc.f5",        0x1000, 0x0400, CRC(fc5b38a4) SHA1(bff670d7b78c6b9324d2bf4b2d8a4f9dbfe82158) )
780 	ROM_LOAD( "lc.f6",        0x1400, 0x0400, CRC(26eaee21) SHA1(9c0a4a22abb0b0466378f067ef52a45f86cc4369) )
781 	ROM_LOAD( "lc.f7",        0x1800, 0x0400, CRC(9ec3534d) SHA1(98f15c5828ad2743bf205f71b8e69abd4db78a58) )
782 
783 	ROM_REGION( 0x0c00, REGION_GFX1, ROMREGION_DISPOSE )
784 	ROM_LOAD( "lc.b8",        0x0a00, 0x0200, CRC(6d708edd) SHA1(85a45a292eb7bca288b06a118658bf754f828a92) )
785 ROM_END
786 
787 ROM_START( medlanes )
788 	ROM_REGION( 0x8000, REGION_CPU1, 0 )			   /* 32K cpu, 4K for ROM/RAM */
789 	ROM_LOAD( "medlanes.2a", 0x0000, 0x0400, CRC(9c77566a) SHA1(60e1820012b47da8b86d54f00b6f60d2d0123745) )
790 	ROM_LOAD( "medlanes.2b", 0x0400, 0x0400, CRC(7841b1a9) SHA1(80621d30995dad42ae44c62494922ca8b75415cf) )
791 	ROM_LOAD( "medlanes.2c", 0x0800, 0x0400, CRC(a359b5b8) SHA1(dbc3c286951c50e3465132fc0d6054f06026425d) )
792 	ROM_LOAD( "medlanes.1a", 0x1000, 0x0400, CRC(0d57c596) SHA1(f3ce4802fc777c57f75fe691c93b7062903bdf06) )
793 	ROM_LOAD( "medlanes.1b", 0x1400, 0x0400, CRC(1d451630) SHA1(bf9de3096e98685355c906ab7e1dc2628dce79d6) )
794 	ROM_LOAD( "medlanes.3a", 0x4000, 0x0400, CRC(22bc56a6) SHA1(7444170c19274d9d889df61796e6f61af2361f3e) )
795 	ROM_LOAD( "medlanes.3b", 0x4400, 0x0400, CRC(6616dbef) SHA1(9506177315883b7d87a9bfada712ddeea12fd446) )
796 	ROM_LOAD( "medlanes.3c", 0x4800, 0x0400, CRC(b3db0f3d) SHA1(57c28a54f7a1f17df3a24b61dd0cf37f9f6bc7d8) )
797 	ROM_LOAD( "medlanes.4a", 0x5000, 0x0400, CRC(30d495e9) SHA1(4f2414bf60ef91093bedf5e9ae16833e9e135aa7) )
798 	ROM_LOAD( "medlanes.4b", 0x5400, 0x0400, CRC(a4abb5db) SHA1(a20da872b0f7d6b16b9551233af4269db9d1b55f) )
799 
800 	ROM_REGION( 0x0c00, REGION_GFX1, ROMREGION_DISPOSE )
801 	ROM_LOAD( "medlanes.8b", 0x0a00, 0x0200, CRC(44e5de8f) SHA1(fc797fa137f0c11a15caf9c0013aac668fd69a3c) )
802 ROM_END
803 
804 
805 ROM_START( bbonk )
806 	ROM_REGION( 0x8000, REGION_CPU1, 0 )			   /* 32K cpu, 4K for ROM/RAM */
807 	ROM_LOAD( "bbonk.e5",     0x0000, 0x0400, CRC(d032baa0) SHA1(09cba16f6a2b7d8a8c501db639bd5eeefb63dc0f) )
808 	ROM_LOAD( "bbonk.e6",     0x0400, 0x0400, CRC(71df0e25) SHA1(c2f78490816add1296923861a89df15be9822fed) )
809 	ROM_LOAD( "bbonk.f5",     0x1000, 0x0400, CRC(748e8c7f) SHA1(99e4e182ee41c246e31f656411a9f09d7b617f92) )
810 	ROM_LOAD( "bbonk.f6",     0x1400, 0x0400, CRC(5ce183ed) SHA1(7c78dfa463a37605e8423104426af2f5906fae24) )
811 
812 	ROM_REGION( 0x0c00, REGION_GFX1, ROMREGION_DISPOSE )
813 	ROM_LOAD( "bbonk.b8",     0x0a00, 0x0200, CRC(5ac34260) SHA1(7c2b1e378d2b9fed27117f9adab1381507f5d554) )
814 ROM_END
815 
816 
817 DRIVER_INIT( lazercmd )
818 {
819 int i, y;
820 
821 	artwork_set_overlay(lazercmd_overlay);
822 
823 /******************************************************************
824  * The ROMs are 1K x 4 bit, so we have to mix
825  * them into 8 bit bytes. The data is also inverted.
826  ******************************************************************/
827 	for (i = 0; i < 0x0c00; i++)
828 	{
829 		memory_region(REGION_CPU1)[i + 0x0000] =
830 			((memory_region(REGION_CPU1)[i + 0x0000] << 4) |
831 			 (memory_region(REGION_CPU1)[i + 0x1000] & 15)) ^ 0xff;
832 	}
833 /******************************************************************
834  * To show the maze bit #6 and #7 of the video ram are used.
835  * Bit #7: add a vertical line to the right of the character
836  * Bit #6: add a horizontal line below the character
837  * The video logic generates 10 lines per character row, but the
838  * character generator only contains 8 rows, so we expand the
839  * font to 8x10.
840  ******************************************************************/
841 	for (i = 0; i < 0x40; i++)
842 	{
843 unsigned char *d = &memory_region(REGION_GFX1)[0 * 64 * 10 + i * VERT_CHR];
844 unsigned char *s = &memory_region(REGION_GFX1)[4 * 64 * 10 + i * VERT_FNT];
845 
846 		for (y = 0; y < VERT_CHR; y++)
847 		{
848 			d[0*64*10] = (y < VERT_FNT) ? *s++ : 0xff;
849 			d[1*64*10] = (y == VERT_CHR - 1) ? 0 : *d;
850 			d[2*64*10] = *d & 0xfe;
851 			d[3*64*10] = (y == VERT_CHR - 1) ? 0 : *d & 0xfe;
852 			d++;
853 		}
854 	}
855 }
856 
DRIVER_INIT(medlanes)857 DRIVER_INIT( medlanes )
858 {
859 int i, y;
860 
861 /******************************************************************
862  * The ROMs are 1K x 4 bit, so we have to mix
863  * them into 8 bit bytes. The data is also inverted.
864  ******************************************************************/
865 	for (i = 0; i < 0x4000; i++)
866 	{
867 		memory_region(REGION_CPU1)[i + 0x0000] =
868 			~((memory_region(REGION_CPU1)[i + 0x0000] << 4) |
869 			  (memory_region(REGION_CPU1)[i + 0x4000] & 15));
870 	}
871 /******************************************************************
872  * To show the maze bit #6 and #7 of the video ram are used.
873  * Bit #7: add a vertical line to the right of the character
874  * Bit #6: add a horizontal line below the character
875  * The video logic generates 10 lines per character row, but the
876  * character generator only contains 8 rows, so we expand the
877  * font to 8x10.
878  ******************************************************************/
879 	for (i = 0; i < 0x40; i++)
880 	{
881 unsigned char *d = &memory_region(REGION_GFX1)[0 * 64 * 10 + i * VERT_CHR];
882 unsigned char *s = &memory_region(REGION_GFX1)[4 * 64 * 10 + i * VERT_FNT];
883 
884 		for (y = 0; y < VERT_CHR; y++)
885 		{
886 			d[0*64*10] = (y < VERT_FNT) ? *s++ : 0xff;
887 			d[1*64*10] = (y == VERT_CHR - 1) ? 0 : *d;
888 			d[2*64*10] = *d & 0xfe;
889 			d[3*64*10] = (y == VERT_CHR - 1) ? 0 : *d & 0xfe;
890 			d++;
891 		}
892 	}
893 }
894 
DRIVER_INIT(bbonk)895 DRIVER_INIT( bbonk )
896 {
897 int i, y;
898 
899 /******************************************************************
900  * The ROMs are 1K x 4 bit, so we have to mix
901  * them into 8 bit bytes. The data is also inverted.
902  ******************************************************************/
903 	for (i = 0; i < 0x0c00; i++)
904 	{
905 		memory_region(REGION_CPU1)[i + 0x0000] =
906 			((memory_region(REGION_CPU1)[i + 0x0000] << 4) |
907 			 (memory_region(REGION_CPU1)[i + 0x1000] & 15)) ^ 0xff;
908 	}
909 /******************************************************************
910  * To show the maze bit #6 and #7 of the video ram are used.
911  * Bit #7: add a vertical line to the right of the character
912  * Bit #6: add a horizontal line below the character
913  * The video logic generates 10 lines per character row, but the
914  * character generator only contains 8 rows, so we expand the
915  * font to 8x10.
916  ******************************************************************/
917 	for (i = 0; i < 0x40; i++)
918 	{
919 unsigned char *d = &memory_region(REGION_GFX1)[0 * 64 * 10 + i * VERT_CHR];
920 unsigned char *s = &memory_region(REGION_GFX1)[4 * 64 * 10 + i * VERT_FNT];
921 
922 		for (y = 0; y < VERT_CHR; y++)
923 		{
924 			d[0*64*10] = (y < VERT_FNT) ? *s++ : 0xff;
925 			d[1*64*10] = (y == VERT_CHR - 1) ? 0 : *d;
926 			d[2*64*10] = *d & 0xfe;
927 			d[3*64*10] = (y == VERT_CHR - 1) ? 0 : *d & 0xfe;
928 			d++;
929 		}
930 	}
931 }
932 
933 
934 
935 GAME( 1976, lazercmd, 0, lazercmd, lazercmd, lazercmd, ROT0, "Meadows Games, Inc.", "Lazer Command" )
936 GAMEX(1977, medlanes, 0, medlanes, medlanes, medlanes, ROT0, "Meadows Games, Inc.", "Meadows Lanes", GAME_IMPERFECT_SOUND )
937 GAME( 1976, bbonk,	  0, bbonk,    bbonk,	 bbonk,    ROT0, "Meadows Games, Inc.", "Bigfoot Bonkers" )
938