-
Notifications
You must be signed in to change notification settings - Fork 2k
/
mw8080bw.cpp
3111 lines (2488 loc) · 126 KB
/
mw8080bw.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// license:BSD-3-Clause
// copyright-holders:Nicola Salmoria, Tormod Tjaberg, Mirko Buffoni,Lee Taylor, Valerio Verrando, Zsolt Vasvari
// thanks-to:Michael Strutts, Marco Cassili
/***************************************************************************
Midway 8080-based black and white hardware
driver by Michael Strutts, Nicola Salmoria, Tormod Tjaberg, Mirko Buffoni,
Lee Taylor, Valerio Verrando, Marco Cassili, Zsolt Vasvari and others
Games supported:
* Sea Wolf
* Gun Fight
* Tornado Baseball
* (Datsun) 280-ZZZAP
* Amazing Maze
* Boot Hill
* Checkmate
* Desert Gun
* Road Runner
* Double Play
* Laguna Racer
* Guided Missile
* M-4
* Clowns
* Space Walk
* Extra Inning
* Shuffleboard
* Dog Patch
* Space Encounters
* Phantom II
* Bowling Alley
* Space Invaders
* Blue Shark
* Space Invaders II (Midway, cocktail version)
* Space Invaders Deluxe (cocktail version)
Other games on this basic hardware:
* Gun Fight (cocktail version)
* 4 Player Bowling Alley (cocktail version)
Notes:
* Most of these games do not actually use the MB14241 shifter IC,
but instead implement equivalent functionality using a bunch of
standard 74XX IC's.
* The Amazing Maze Game" on title screen, but manual, flyer,
cabinet side art all call it just "Amazing Maze"
* Desert Gun was originally named Road Runner. The name was changed
when Midway merged with Bally who had a game by the same title
* Guided Missile: It is a misconception that that this is the same
game as Taito's "Missile X". The latter does not run on a CPU,
akin to Midway's Gun Fight vs Taito's Western Gun.
* Space Invaders: Taito imported this licensed version because of
short supply in Japan. The game is called "Space Invaders M"
The M stands for Midway.
* "Gun Fight" (Midway) is ported version of "Western Gun" (Taito)
* in Japan, Taito released "Tornado Baseball" as "Ball Park",
"Extra Inning" as "Ball Park II".
* "Road Runner" (Midway): To access the test mode, adjust the
"Extended Time At" dipswitch to select "Test Mode". While in
the test mode, hold Fire until the gun alignment screen appears.
Known issues/to-do's:
* Space Encounters: verify strobe light frequency
* Phantom II: cloud generator is implemented according to the schematics,
but it doesn't look right. Cloud color mixing to be verified as well
* Dog Patch: verify all assumptions
* Blue Shark - all sounds are suspicious. Why is there no diver kill sound?
Why does the shark sound so bad and appear rarely?
Schematics need to be verified against real board.
****************************************************************************
Memory map
****************************************************************************
========================================================================
MAIN CPU memory address space
========================================================================
Address (15-bits) Dir Data Description
----------------- --- -------- -----------------------
x0xxxxxxxxxxxxx R xxxxxxxx Program ROM (various amounts populated)
-1xxxxxxxxxxxxx R/W xxxxxxxx Video RAM (256x256x1 bit display)
Portion in VBLANK region used as work RAM
Legend: (x) bit significant
(-) bit ignored
(0/1) bit must be given value
The I/O address space is used differently from game to game.
****************************************************************************
Horizontal sync chain:
The horizontal synch chain is clocked by the pixel clock, which
is the master clock divided by four via the counter @ C7 and
the D flip-flop at B5.
A 4-bit binary counter @ D5 counts 1H,2H,4H and 8H. This counter
cascades into another 4-bit binary counter @ E5, which counts
16H,32H,64H and 128H. The carry-out of this counter enables the
vertical sync chain. It also clocks a D flip-flop @ A5(1). The
output of the flip-flop is HBLANK and it is also used to reset
the two counters. When HBLANK is high, they are reset to 192,
otherwise to 0, thus giving 320 total pixels.
Clock = 19.968000/4MHz
HBLANK ends at H = 0
HBLANK begins at H = 256 (0x100)
HSYNC begins at H = 272 (0x110)
HSYNC ends at H = 288 (0x120)
HTOTAL = 320 (0x140)
Vertical sync chain:
The vertical synch chain is also clocked by the clock, but it is
only enabled counting in HBLANK, when the horizontal synch chain
overflows.
A 4-bit binary counter @ E6 counts 1V,2V,4V and 8V. This counter
cascades into another 4-bit binary counter @ E7, which counts
16V,32V,64V and 128V. The carry-out of this counter clocks a
D flip-flop @ A5(2). The output of the flip-flop is VBLANK and
it is also used to reset the two counters. When VBLANK is high,
they are reset to 218, otherwise to 32, thus giving
(256-218)+(256-32)=262 total pixels.
Clock = 19.968000/4MHz
VBLANK ends at V = 0
VBLANK begins at V = 224 (0x0e0)
VSYNC begins at V = 236 (0x0ec)
VSYNC ends at V = 240 (0x0f0)
VTOTAL = 262 (0x106)
Interrupts:
The CPU's INT line is asserted via a D flip-flop at E3.
The flip-flop is clocked by the expression (!(64V | !128V) | VBLANK).
According to this, the LO to HI transition happens when the vertical
sync chain is 0x80 and 0xda and VBLANK is 0 and 1, respectively.
These correspond to lines 96 and 224 as displayed.
The interrupt vector is provided by the expression:
0xc7 | (64V << 4) | (!64V << 3), giving 0xcf and 0xd7 for the vectors.
The flip-flop, thus the INT line, is later cleared by the CPU via
one of its memory access control signals.
****************************************************************************/
#include "emu.h"
#include "includes/mw8080bw.h"
#include "cpu/i8085/i8085.h"
#include "machine/rescap.h"
#include <algorithm>
#include "280zzzap.lh"
#include "clowns.lh"
#include "gunfight.lh"
#include "invaders.lh"
#include "invad2ct.lh"
#include "lagunar.lh"
#include "maze.lh"
#include "phantom2.lh"
#include "seawolf.lh"
#include "spacwalk.lh"
#include "spcenctr.lh"
INPUT_CHANGED_MEMBER(mw8080bw_state::direct_coin_count)
{
machine().bookkeeping().coin_counter_w(0, newval);
}
/*************************************
*
* Special shifter circuit
*
*************************************/
u8 mw8080bw_state::mw8080bw_shift_result_rev_r()
{
uint8_t ret = m_mb14241->shift_result_r();
return bitswap<8>(ret,0,1,2,3,4,5,6,7);
}
/*************************************
*
* Main CPU memory handlers
*
*************************************/
void mw8080bw_state::main_map(address_map &map)
{
map.global_mask(0x7fff);
map(0x0000, 0x1fff).rom().nopw();
map(0x2000, 0x3fff).mirror(0x4000).ram().share("main_ram");
map(0x4000, 0x5fff).rom().nopw();
}
/*************************************
*
* Root driver structure
*
*************************************/
void mw8080bw_state::mw8080bw_root(machine_config &config)
{
/* basic machine hardware */
I8080(config, m_maincpu, MW8080BW_CPU_CLOCK);
m_maincpu->set_addrmap(AS_PROGRAM, &mw8080bw_state::main_map);
m_maincpu->set_irq_acknowledge_callback(FUNC(mw8080bw_state::interrupt_vector));
MCFG_MACHINE_RESET_OVERRIDE(mw8080bw_state,mw8080bw)
/* video hardware */
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_raw(MW8080BW_PIXEL_CLOCK, MW8080BW_HTOTAL, MW8080BW_HBEND, MW8080BW_HPIXCOUNT, MW8080BW_VTOTAL, MW8080BW_VBEND, MW8080BW_VBSTART);
m_screen->set_screen_update(FUNC(mw8080bw_state::screen_update_mw8080bw));
}
/*************************************
*
* Sea Wolf (PCB #596)
*
*************************************/
void seawolf_state::machine_start()
{
mw8080bw_state::machine_start();
m_exp_lamps.resolve();
m_torp_lamps.resolve();
m_ready_lamp.resolve();
m_reload_lamp.resolve();
}
void seawolf_state::explosion_lamp_w(u8 data)
{
/* D0-D3 are column drivers and D4-D7 are row drivers.
The following table shows values that light up individual lamps.
D7 D6 D5 D4 D3 D2 D1 D0 Function
--------------------------------------------------------------------------------------
0 0 0 1 1 0 0 0 Explosion Lamp 0
0 0 0 1 0 1 0 0 Explosion Lamp 1
0 0 0 1 0 0 1 0 Explosion Lamp 2
0 0 0 1 0 0 0 1 Explosion Lamp 3
0 0 1 0 1 0 0 0 Explosion Lamp 4
0 0 1 0 0 1 0 0 Explosion Lamp 5
0 0 1 0 0 0 1 0 Explosion Lamp 6
0 0 1 0 0 0 0 1 Explosion Lamp 7
0 1 0 0 1 0 0 0 Explosion Lamp 8
0 1 0 0 0 1 0 0 Explosion Lamp 9
0 1 0 0 0 0 1 0 Explosion Lamp A
0 1 0 0 0 0 0 1 Explosion Lamp B
1 0 0 0 1 0 0 0 Explosion Lamp C
1 0 0 0 0 1 0 0 Explosion Lamp D
1 0 0 0 0 0 1 0 Explosion Lamp E
1 0 0 0 0 0 0 1 Explosion Lamp F
*/
static constexpr u8 BITS_FOR_LAMPS[] =
{
0x18, 0x14, 0x12, 0x11,
0x28, 0x24, 0x22, 0x21,
0x48, 0x44, 0x42, 0x41,
0x88, 0x84, 0x82, 0x81
};
for (int i = 0; i < 16; i++)
{
u8 const bits_for_lamp(BITS_FOR_LAMPS[i]);
m_exp_lamps[i] = ((data & bits_for_lamp) == bits_for_lamp) ? 1 : 0;
}
}
void seawolf_state::periscope_lamp_w(u8 data)
{
/* the schematics and the connecting diagrams show the torpedo light
order differently, but this order is confirmed by the software */
m_torp_lamps[3] = BIT(data, 0);
m_torp_lamps[2] = BIT(data, 1);
m_torp_lamps[1] = BIT(data, 2);
m_torp_lamps[0] = BIT(data, 3);
m_ready_lamp = BIT(data, 4);
m_reload_lamp = BIT(data, 5);
}
CUSTOM_INPUT_MEMBER(seawolf_state::erase_input_r)
{
return m_erase_sw->read() & m_erase_dip->read();
}
void seawolf_state::io_map(address_map &map)
{
map.global_mask(0x7);
map(0x00, 0x00).mirror(0x04).r(FUNC(seawolf_state::mw8080bw_shift_result_rev_r));
map(0x01, 0x01).mirror(0x04).portr("IN0");
map(0x02, 0x02).mirror(0x04).portr("IN1");
map(0x03, 0x03).mirror(0x04).r(m_mb14241, FUNC(mb14241_device::shift_result_r));
map(0x01, 0x01).w(FUNC(seawolf_state::explosion_lamp_w));
map(0x02, 0x02).w(FUNC(seawolf_state::periscope_lamp_w));
map(0x03, 0x03).w(m_mb14241, FUNC(mb14241_device::shift_data_w));
map(0x04, 0x04).w(m_mb14241, FUNC(mb14241_device::shift_count_w));
map(0x05, 0x05).w("soundboard", FUNC(seawolf_audio_device::write));
}
// the 30 position encoder is verified
static const ioport_value seawolf_controller_table[30] =
{
0x1e, 0x1c, 0x1d, 0x19, 0x18, 0x1a, 0x1b, 0x13,
0x12, 0x10, 0x11, 0x15, 0x14, 0x16, 0x17, 0x07,
0x06, 0x04, 0x05, 0x01, 0x00, 0x02, 0x03, 0x0b,
0x0a, 0x08, 0x09, 0x0d, 0x0c, 0x0e
};
static INPUT_PORTS_START( seawolf )
PORT_START("IN0")
// the grey code is inverted by buffers
// The wiring diagram shows the encoder has 32 positions.
// But there is a hand written table on the game logic sheet showing only 30 positions.
// The actual commutator pcb (encoder) has 30 positions and works like the table says.
PORT_BIT( 0x1f, 0x0f, IPT_POSITIONAL ) PORT_POSITIONS(30) PORT_REMAP_TABLE(seawolf_controller_table) PORT_INVERT PORT_SENSITIVITY(20) PORT_KEYDELTA(8) PORT_CENTERDELTA(0) PORT_NAME("Periscope axis") PORT_CROSSHAIR(X, ((float)MW8080BW_HPIXCOUNT - 28) / MW8080BW_HPIXCOUNT, 16.0 / MW8080BW_HPIXCOUNT, 32.0 / MW8080BW_VBSTART)
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1)
PORT_DIPNAME( 0xc0, 0x40, DEF_STR( Game_Time ) ) PORT_CONDITION("IN1", 0xe0, NOTEQUALS, 0xe0) PORT_DIPLOCATION("G4:1,2")
PORT_DIPSETTING( 0x00, "60 seconds + 20 extended" ) PORT_CONDITION("IN1", 0xe0, NOTEQUALS, 0x00)
PORT_DIPSETTING( 0x40, "70 seconds + 20 extended" ) PORT_CONDITION("IN1", 0xe0, NOTEQUALS, 0x00)
PORT_DIPSETTING( 0x80, "80 seconds + 20 extended" ) PORT_CONDITION("IN1", 0xe0, NOTEQUALS, 0x00)
PORT_DIPSETTING( 0xc0, "90 seconds + 20 extended" ) PORT_CONDITION("IN1", 0xe0, NOTEQUALS, 0x00)
PORT_DIPSETTING( 0x00, "60 seconds" ) PORT_CONDITION("IN1", 0xe0, EQUALS, 0x00)
PORT_DIPSETTING( 0x40, "70 seconds" ) PORT_CONDITION("IN1", 0xe0, EQUALS, 0x00)
PORT_DIPSETTING( 0x80, "80 seconds" ) PORT_CONDITION("IN1", 0xe0, EQUALS, 0x00)
PORT_DIPSETTING( 0xc0, "90 seconds" ) PORT_CONDITION("IN1", 0xe0, EQUALS, 0x00)
PORT_START("IN1")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START1 )
PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Coinage ) ) PORT_CONDITION("IN1", 0xe0, NOTEQUALS, 0xe0) PORT_DIPLOCATION("G4:3,4")
PORT_DIPSETTING( 0x04, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x0c, DEF_STR( 2C_3C ) )
PORT_DIPSETTING( 0x08, DEF_STR( 1C_2C ) )
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(seawolf_state, erase_input_r)
PORT_DIPNAME( 0xe0, 0x60, "Extended Time At" ) PORT_DIPLOCATION("G4:6,7,8")
PORT_DIPSETTING( 0x00, DEF_STR( None ) )
PORT_DIPSETTING( 0x20, "2000" )
PORT_DIPSETTING( 0x40, "3000" )
PORT_DIPSETTING( 0x60, "4000" )
PORT_DIPSETTING( 0x80, "5000" )
PORT_DIPSETTING( 0xa0, "6000" )
PORT_DIPSETTING( 0xc0, "7000" )
PORT_DIPSETTING( 0xe0, "Test Mode" )
// 2 fake ports for the 'Reset High Score' input, which has a DIP to enable it
PORT_START(SEAWOLF_ERASE_SW_PORT_TAG)
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_MEMORY_RESET ) PORT_NAME("Reset High Score")
PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_START(SEAWOLF_ERASE_DIP_PORT_TAG)
PORT_DIPNAME( 0x01, 0x01, "Enable Reset High Score Button" ) PORT_DIPLOCATION("G4:5")
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
PORT_DIPSETTING( 0x01, DEF_STR( On ) )
PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNUSED )
INPUT_PORTS_END
void seawolf_state::seawolf(machine_config &config)
{
mw8080bw_root(config);
// basic machine hardware
m_maincpu->set_addrmap(AS_IO, &seawolf_state::io_map);
// there is no watchdog
// add shifter
MB14241(config, m_mb14241);
// audio hardware
SEAWOLF_AUDIO(config, "soundboard");
}
/*************************************
*
* Gun Fight (PCB #597)
*
*************************************/
void gunfight_state::io_w(offs_t offset, u8 data)
{
if (offset & 0x01)
m_soundboard->write(data);
if (offset & 0x02)
m_mb14241->shift_count_w(data);
if (offset & 0x04)
m_mb14241->shift_data_w(data);
}
void gunfight_state::io_map(address_map &map)
{
map.global_mask(0x7);
map(0x00, 0x00).mirror(0x04).portr("IN0");
map(0x01, 0x01).mirror(0x04).portr("IN1");
map(0x02, 0x02).mirror(0x04).portr("IN2");
map(0x03, 0x03).mirror(0x04).r(m_mb14241, FUNC(mb14241_device::shift_result_r));
map(0x00, 0x07).w(FUNC(gunfight_state::io_w)); // no decoder, just 3 AND gates
}
static const ioport_value gunfight_controller_table[7] =
{
0x06, 0x02, 0x00, 0x04, 0x05, 0x01, 0x03
};
static INPUT_PORTS_START( gunfight )
PORT_START("IN0")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x70, 0x30, IPT_POSITIONAL_V ) PORT_POSITIONS(7) PORT_REMAP_TABLE(gunfight_controller_table) PORT_INVERT PORT_SENSITIVITY(5) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_CODE_DEC(KEYCODE_N) PORT_CODE_INC(KEYCODE_H) PORT_PLAYER(1)
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1)
PORT_START("IN1")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x70, 0x30, IPT_POSITIONAL_V ) PORT_POSITIONS(7) PORT_REMAP_TABLE(gunfight_controller_table) PORT_INVERT PORT_SENSITIVITY(5) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_CODE_DEC(KEYCODE_M) PORT_CODE_INC(KEYCODE_J) PORT_PLAYER(2)
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_START("IN2")
PORT_DIPNAME( 0x0f, 0x00, DEF_STR( Coinage ) ) PORT_DIPLOCATION("C1:1,2,3,4")
PORT_DIPSETTING( 0x03, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x02, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x07, DEF_STR( 4C_2C ) )
PORT_DIPSETTING( 0x01, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x06, DEF_STR( 3C_2C ) )
PORT_DIPSETTING( 0x0b, DEF_STR( 4C_3C ) )
PORT_DIPSETTING( 0x0f, DEF_STR( 4C_4C ) )
PORT_DIPSETTING( 0x0a, DEF_STR( 3C_3C ) )
PORT_DIPSETTING( 0x05, DEF_STR( 2C_2C ) )
PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x0e, DEF_STR( 3C_4C ) )
PORT_DIPSETTING( 0x09, DEF_STR( 2C_3C ) )
PORT_DIPSETTING( 0x0d, DEF_STR( 2C_4C ) )
PORT_DIPSETTING( 0x04, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x08, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x0c, DEF_STR( 1C_4C ) )
PORT_DIPNAME( 0x30, 0x10, DEF_STR( Game_Time ) ) PORT_DIPLOCATION("C1:5,6")
PORT_DIPSETTING( 0x00, "60 seconds" )
PORT_DIPSETTING( 0x10, "70 seconds" )
PORT_DIPSETTING( 0x20, "80 seconds" )
PORT_DIPSETTING( 0x30, "90 seconds" )
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN1 )
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_START1 )
INPUT_PORTS_END
void gunfight_state::gunfight(machine_config &config)
{
mw8080bw_root(config);
// basic machine hardware
m_maincpu->set_addrmap(AS_IO, &gunfight_state::io_map);
// there is no watchdog
// add shifter
MB14241(config, m_mb14241);
// audio hardware
GUNFIGHT_AUDIO(config, m_soundboard);
}
/*************************************
*
* Tornado Baseball (PCB #605)
*
* Notes:
* -----
*
* In baseball, the Visitor team always hits first and the Home team pitches (throws the ball).
* This rule gives an advantage to the Home team because they get to score last in any baseball game.
* It is also the team that pitches that controls the player on the field, which, in this game,
* is limited to moving the 3 outfielders left and right.
*
* There are 3 types of cabinets using the same software:
*
* Old Upright: One of everything
*
* New Upright: One fielding/pitching controls, but two (Left/Right) hitting buttons
*
* Cocktail: Two of everything, but the pitching/fielding controls are swapped
*
* Interestingly, the "Whistle" sound effect is controlled by a different
* bit on the Old Upright cabinet than the other two types.
*
*************************************/
#define TORNBASE_L_HIT_PORT_TAG ("LHIT")
#define TORNBASE_R_HIT_PORT_TAG ("RHIT")
#define TORNBASE_L_PITCH_PORT_TAG ("LPITCH")
#define TORNBASE_R_PITCH_PORT_TAG ("RPITCH")
#define TORNBASE_SCORE_SW_PORT_TAG ("SCORESW")
#define TORNBASE_SCORE_DIP_PORT_TAG ("ERASEDIP")
#define TORNBASE_CAB_TYPE_PORT_TAG ("CAB")
uint8_t mw8080bw_state::tornbase_get_cabinet_type()
{
return ioport(TORNBASE_CAB_TYPE_PORT_TAG)->read();
}
CUSTOM_INPUT_MEMBER(mw8080bw_state::tornbase_hit_left_input_r)
{
return ioport(TORNBASE_L_HIT_PORT_TAG)->read();
}
CUSTOM_INPUT_MEMBER(mw8080bw_state::tornbase_hit_right_input_r)
{
uint32_t ret;
switch (tornbase_get_cabinet_type())
{
case TORNBASE_CAB_TYPE_UPRIGHT_OLD:
ret = ioport(TORNBASE_L_HIT_PORT_TAG)->read();
break;
case TORNBASE_CAB_TYPE_UPRIGHT_NEW:
case TORNBASE_CAB_TYPE_COCKTAIL:
default:
ret = ioport(TORNBASE_R_HIT_PORT_TAG)->read();
break;
}
return ret;
}
CUSTOM_INPUT_MEMBER(mw8080bw_state::tornbase_pitch_left_input_r)
{
uint32_t ret;
switch (tornbase_get_cabinet_type())
{
case TORNBASE_CAB_TYPE_UPRIGHT_OLD:
case TORNBASE_CAB_TYPE_UPRIGHT_NEW:
ret = ioport(TORNBASE_L_PITCH_PORT_TAG)->read();
break;
case TORNBASE_CAB_TYPE_COCKTAIL:
default:
ret = ioport(TORNBASE_R_PITCH_PORT_TAG)->read();
break;
}
return ret;
}
CUSTOM_INPUT_MEMBER(mw8080bw_state::tornbase_pitch_right_input_r)
{
return ioport(TORNBASE_L_PITCH_PORT_TAG)->read();
}
CUSTOM_INPUT_MEMBER(mw8080bw_state::tornbase_score_input_r)
{
return ioport(TORNBASE_SCORE_SW_PORT_TAG)->read() &
ioport(TORNBASE_SCORE_DIP_PORT_TAG)->read();
}
WRITE8_MEMBER(mw8080bw_state::tornbase_io_w)
{
if (offset & 0x01)
tornbase_audio_w(space, 0, data);
if (offset & 0x02)
m_mb14241->shift_count_w(data);
if (offset & 0x04)
m_mb14241->shift_data_w(data);
}
void mw8080bw_state::tornbase_io_map(address_map &map)
{
map.global_mask(0x7);
map(0x00, 0x00).mirror(0x04).portr("IN0");
map(0x01, 0x01).mirror(0x04).portr("IN1");
map(0x02, 0x02).mirror(0x04).portr("IN2");
map(0x03, 0x03).mirror(0x04).r(m_mb14241, FUNC(mb14241_device::shift_result_r));
/* no decoder, just 3 AND gates */
map(0x00, 0x07).w(FUNC(mw8080bw_state::tornbase_io_w));
}
static INPUT_PORTS_START( tornbase )
PORT_START("IN0")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(mw8080bw_state, tornbase_hit_left_input_r)
PORT_BIT( 0x7e, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(mw8080bw_state, tornbase_pitch_left_input_r)
PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unused ) ) PORT_CONDITION("IN2", 0x80, EQUALS, 0x00) PORT_DIPLOCATION("B1:7")
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
PORT_DIPSETTING( 0x80, DEF_STR( On ) )
PORT_START("IN1")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(mw8080bw_state, tornbase_hit_right_input_r)
PORT_BIT( 0x7e, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(mw8080bw_state, tornbase_pitch_right_input_r)
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED) /* not connected */
PORT_START("IN2")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* schematics shows it as "START", but not used by the software */
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(mw8080bw_state, tornbase_score_input_r)
PORT_DIPNAME( 0x78, 0x40, DEF_STR( Coinage ) ) PORT_CONDITION("IN2", 0x80, EQUALS, 0x00) PORT_DIPLOCATION("B1:2,3,4,5")
PORT_DIPSETTING( 0x18, "4 Coins/1 Inning" )
PORT_DIPSETTING( 0x10, "3 Coins/1 Inning" )
PORT_DIPSETTING( 0x38, "4 Coins/2 Innings" )
PORT_DIPSETTING( 0x08, "2 Coins/1 Inning" )
PORT_DIPSETTING( 0x30, "3 Coins/2 Innings" )
PORT_DIPSETTING( 0x28, "2 Coins/2 Innings" )
PORT_DIPSETTING( 0x00, "1 Coin/1 Inning" )
PORT_DIPSETTING( 0x58, "4 Coins/4 Innings" )
PORT_DIPSETTING( 0x50, "3 Coins/4 Innings" )
PORT_DIPSETTING( 0x48, "2 Coins/4 Innings" )
PORT_DIPSETTING( 0x20, "1 Coin/2 Innings" )
PORT_DIPSETTING( 0x40, "1 Coin/4 Innings" )
PORT_DIPSETTING( 0x78, "4 Coins/9 Innings" )
PORT_DIPSETTING( 0x70, "3 Coins/9 Innings" )
PORT_DIPSETTING( 0x68, "2 Coins/9 Innings" )
PORT_DIPSETTING( 0x60, "1 Coin/9 Innings" )
PORT_SERVICE_DIPLOC( 0x80, IP_ACTIVE_HIGH, "B1:6" )
/* fake ports to handle the various input configurations based on cabinet type */
PORT_START(TORNBASE_L_HIT_PORT_TAG)
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P1 Hit") PORT_PLAYER(1)
PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_START(TORNBASE_R_HIT_PORT_TAG)
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P2 Hit") PORT_PLAYER(2)
PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_START(TORNBASE_L_PITCH_PORT_TAG)
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P1 Move Outfield Left") PORT_PLAYER(1)
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P1 Move Outfield Right") PORT_PLAYER(1)
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_NAME("P1 Pitch Left") PORT_PLAYER(1)
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_NAME("P1 Pitch Right") PORT_PLAYER(1)
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_NAME("P1 Pitch Slow") PORT_PLAYER(1)
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_NAME("P1 Pitch Fast") PORT_PLAYER(1)
PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_START(TORNBASE_R_PITCH_PORT_TAG)
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("P2 Move Outfield Left") PORT_PLAYER(2)
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P2 Move Outfield Right") PORT_PLAYER(2)
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_NAME("P2 Pitch Left") PORT_PLAYER(2)
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_NAME("P2 Pitch Right") PORT_PLAYER(2)
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_NAME("P2 Pitch Slow") PORT_PLAYER(2)
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_NAME("P2 Pitch Fast") PORT_PLAYER(2)
PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNUSED )
/* 2 fakes port for the 'ERASE' input, which has a DIP to enable it.
This switch is not actually used by the software */
PORT_START(TORNBASE_SCORE_SW_PORT_TAG)
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("SCORE Input (Not Used)") PORT_CODE(KEYCODE_F2)
PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_START(TORNBASE_SCORE_DIP_PORT_TAG)
PORT_DIPNAME( 0x01, 0x01, "Enable SCORE Input" ) PORT_DIPLOCATION("B1:1")
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
PORT_DIPSETTING( 0x01, DEF_STR( On ) )
PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNUSED )
/* fake port for cabinet type */
PORT_START(TORNBASE_CAB_TYPE_PORT_TAG)
PORT_CONFNAME( 0x03, TORNBASE_CAB_TYPE_UPRIGHT_NEW, DEF_STR( Cabinet ) )
PORT_CONFSETTING( TORNBASE_CAB_TYPE_UPRIGHT_OLD, "Upright/w One Hit Button" )
PORT_CONFSETTING( TORNBASE_CAB_TYPE_UPRIGHT_NEW, "Upright/w P1/P2 Hit Buttons" )
PORT_CONFSETTING( TORNBASE_CAB_TYPE_COCKTAIL, DEF_STR( Cocktail ) )
PORT_BIT( 0xfc, IP_ACTIVE_HIGH, IPT_UNUSED )
INPUT_PORTS_END
void mw8080bw_state::tornbase(machine_config &config)
{
mw8080bw_root(config);
/* basic machine hardware */
m_maincpu->set_addrmap(AS_IO, &mw8080bw_state::tornbase_io_map);
/* there is no watchdog */
/* add shifter */
MB14241(config, m_mb14241);
/* audio hardware */
tornbase_audio(config);
}
/*************************************
*
* 280 ZZZAP (PCB #610) / Laguna Racer (PCB #622)
*
*************************************/
void mw8080bw_state::zzzap_io_map(address_map &map)
{
map.global_mask(0x7);
map(0x00, 0x00).mirror(0x04).portr("IN0");
map(0x01, 0x01).mirror(0x04).portr("IN1");
map(0x02, 0x02).mirror(0x04).portr("IN2");
map(0x03, 0x03).mirror(0x04).r(m_mb14241, FUNC(mb14241_device::shift_result_r));
map(0x02, 0x02).w(FUNC(mw8080bw_state::zzzap_audio_1_w));
map(0x03, 0x03).w(m_mb14241, FUNC(mb14241_device::shift_data_w));
map(0x04, 0x04).w(m_mb14241, FUNC(mb14241_device::shift_count_w));
map(0x05, 0x05).w(FUNC(mw8080bw_state::zzzap_audio_2_w));
map(0x07, 0x07).w(m_watchdog, FUNC(watchdog_timer_device::reset_w));
}
static INPUT_PORTS_START( zzzap )
PORT_START("IN0")
PORT_BIT( 0x0f, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(64) PORT_PLAYER(1) /* accelerator */
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_TOGGLE PORT_NAME("P1 Shift") PORT_PLAYER(1)
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) /* not connected */
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 ) /* start button, but never used? */
PORT_START("IN1") /* steering wheel */
PORT_BIT( 0xff, 0x7f, IPT_PADDLE ) PORT_MINMAX(0x01,0xfe) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_REVERSE PORT_PLAYER(1)
PORT_START("IN2")
PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ) ) PORT_CONDITION("IN2", 0x0c, NOTEQUALS, 0x04) PORT_DIPLOCATION("E3:1,2")
PORT_DIPSETTING( 0x02, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x03, DEF_STR( 2C_3C ) )
PORT_DIPSETTING( 0x01, DEF_STR( 1C_2C ) )
PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Game_Time ) ) PORT_DIPLOCATION("E3:3,4")
PORT_DIPSETTING( 0x0c, "60 seconds + 30 extended" ) PORT_CONDITION("IN2", 0x30, NOTEQUALS, 0x20)
PORT_DIPSETTING( 0x00, "80 seconds + 40 extended" ) PORT_CONDITION("IN2", 0x30, NOTEQUALS, 0x20)
PORT_DIPSETTING( 0x08, "99 seconds + 50 extended" ) PORT_CONDITION("IN2", 0x30, NOTEQUALS, 0x20)
PORT_DIPSETTING( 0x0c, "60 seconds" ) PORT_CONDITION("IN2", 0x30, EQUALS, 0x20)
PORT_DIPSETTING( 0x00, "80 seconds" ) PORT_CONDITION("IN2", 0x30, EQUALS, 0x20)
PORT_DIPSETTING( 0x08, "99 seconds" ) PORT_CONDITION("IN2", 0x30, EQUALS, 0x20)
PORT_DIPSETTING( 0x04, "Test Mode" )
PORT_DIPNAME( 0x30, 0x00, "Extended Time At" ) PORT_CONDITION("IN2", 0x0c, NOTEQUALS, 0x04) PORT_DIPLOCATION("E3:5,6")
PORT_DIPSETTING( 0x10, "2.00" )
PORT_DIPSETTING( 0x00, "2.50" )
PORT_DIPSETTING( 0x20, DEF_STR( None ) )
/* PORT_DIPSETTING( 0x30, DEF_STR( None ) ) */
PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Language )) PORT_CONDITION("IN2", 0x0c, NOTEQUALS, 0x04) PORT_DIPLOCATION("E3:7,8")
PORT_DIPSETTING( 0x00, DEF_STR( English ) )
PORT_DIPSETTING( 0x40, DEF_STR( German ) )
PORT_DIPSETTING( 0x80, DEF_STR( French ) )
PORT_DIPSETTING( 0xc0, DEF_STR( Spanish ) )
INPUT_PORTS_END
static INPUT_PORTS_START( lagunar )
PORT_INCLUDE( zzzap )
PORT_MODIFY("IN2")
PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ) ) PORT_DIPLOCATION("E3:1,2")
PORT_DIPSETTING( 0x02, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x03, DEF_STR( 2C_3C ) )
PORT_DIPSETTING( 0x01, DEF_STR( 1C_2C ) )
PORT_DIPNAME( 0x0c, 0x04, DEF_STR( Game_Time ) ) PORT_CONDITION("IN2", 0xc0, NOTEQUALS, 0x04) PORT_DIPLOCATION("E3:3,4")
PORT_DIPSETTING( 0x00, "45 seconds + 22 extended" ) PORT_CONDITION("IN2", 0xc0, NOTEQUALS, 0xc0)
PORT_DIPSETTING( 0x04, "60 seconds + 30 extended" ) PORT_CONDITION("IN2", 0xc0, NOTEQUALS, 0xc0)
PORT_DIPSETTING( 0x08, "75 seconds + 37 extended" ) PORT_CONDITION("IN2", 0xc0, NOTEQUALS, 0xc0)
PORT_DIPSETTING( 0x0c, "90 seconds + 45 extended" ) PORT_CONDITION("IN2", 0xc0, NOTEQUALS, 0xc0)
PORT_DIPSETTING( 0x00, "45 seconds" ) PORT_CONDITION("IN2", 0xc0, EQUALS, 0xc0)
PORT_DIPSETTING( 0x04, "60 seconds" ) PORT_CONDITION("IN2", 0xc0, EQUALS, 0xc0)
PORT_DIPSETTING( 0x08, "75 seconds" ) PORT_CONDITION("IN2", 0xc0, EQUALS, 0xc0)
PORT_DIPSETTING( 0x0c, "90 seconds" ) PORT_CONDITION("IN2", 0xc0, EQUALS, 0xc0)
PORT_DIPNAME( 0x30, 0x20, "Extended Time At" ) PORT_CONDITION("IN2", 0xc0, NOTEQUALS, 0xc0) PORT_DIPLOCATION("E3:5,6")
PORT_DIPSETTING( 0x00, "350" )
PORT_DIPSETTING( 0x10, "400" )
PORT_DIPSETTING( 0x20, "450" )
PORT_DIPSETTING( 0x30, "500" )
PORT_DIPNAME( 0xc0, 0x00, "Test Modes/Extended Time") PORT_DIPLOCATION("E3:7,8")
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
PORT_DIPSETTING( 0x40, "RAM/ROM Test" )
PORT_DIPSETTING( 0x80, "Input Test" )
PORT_DIPSETTING( 0xc0, "No Extended Time" )
INPUT_PORTS_END
void mw8080bw_state::zzzap(machine_config &config)
{
mw8080bw_root(config);
/* basic machine hardware */
m_maincpu->set_addrmap(AS_IO, &mw8080bw_state::zzzap_io_map);
WATCHDOG_TIMER(config, m_watchdog).set_time(PERIOD_OF_555_MONOSTABLE(RES_M(1), CAP_U(1))); /* 1.1s */
/* add shifter */
MB14241(config, m_mb14241);
/* audio hardware */
/* zzzap_audio(config); */
}
/*************************************
*
* Amazing Maze (PCB #611)
*
*************************************/
/* schematic says 12.5 Hz, but R/C values shown give 8.5Hz */
#define MAZE_555_B1_PERIOD PERIOD_OF_555_ASTABLE(RES_K(33) /* R200 */, RES_K(68) /* R201 */, CAP_U(1) /* C201 */)
void mw8080bw_state::maze_update_discrete()
{
maze_write_discrete(m_maze_tone_timing_state);
}
TIMER_CALLBACK_MEMBER(mw8080bw_state::maze_tone_timing_timer_callback)
{
m_maze_tone_timing_state = !m_maze_tone_timing_state;
maze_write_discrete(m_maze_tone_timing_state);
}
MACHINE_START_MEMBER(mw8080bw_state,maze)
{
mw8080bw_state::machine_start();
/* create astable timer for IC B1 */
m_maze_tone_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mw8080bw_state::maze_tone_timing_timer_callback), this));
m_maze_tone_timer->adjust(MAZE_555_B1_PERIOD, 0, MAZE_555_B1_PERIOD);
/* initialize state of Tone Timing FF, IC C1 */
m_maze_tone_timing_state = 0;
/* setup for save states */
save_item(NAME(m_maze_tone_timing_state));
machine().save().register_postload(save_prepost_delegate(FUNC(mw8080bw_state::maze_update_discrete), this));
}
WRITE8_MEMBER(mw8080bw_state::maze_coin_counter_w)
{
/* the data is not used, just pulse the counter */
machine().bookkeeping().coin_counter_w(0, 0);
machine().bookkeeping().coin_counter_w(0, 1);
}
WRITE8_MEMBER(mw8080bw_state::maze_io_w)
{
if (offset & 0x01) maze_coin_counter_w(space, 0, data);
if (offset & 0x02) m_watchdog->watchdog_reset();
}
void mw8080bw_state::maze_io_map(address_map &map)
{
map.global_mask(0x3);
map(0x00, 0x00).portr("IN0");
map(0x01, 0x01).portr("IN1");
/* no decoder, just a couple of AND gates */
map(0x00, 0x03).w(FUNC(mw8080bw_state::maze_io_w));
}
static INPUT_PORTS_START( maze )
PORT_START("IN0")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
PORT_START("IN1")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) /* labeled 'Not Used' */
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN1 )
PORT_DIPNAME( 0x30, 0x00, DEF_STR( Coinage ) ) PORT_CONDITION("IN1", 0x80, EQUALS, 0x00) PORT_DIPLOCATION("SW:1,2")
PORT_DIPSETTING( 0x10, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x30, DEF_STR( 2C_3C ) )
PORT_DIPSETTING( 0x20, DEF_STR( 1C_2C ) )
PORT_DIPNAME( 0x40, 0x40, "2 Player Game Time" ) PORT_CONDITION("IN1", 0x80, EQUALS, 0x00) PORT_DIPLOCATION("SW:3")
PORT_DIPSETTING( 0x40, "4 minutes" )
PORT_DIPSETTING( 0x00, "6 minutes" )
PORT_SERVICE_DIPLOC( 0x80, IP_ACTIVE_HIGH, "SW:4" )
INPUT_PORTS_END
void mw8080bw_state::maze(machine_config &config)
{
mw8080bw_root(config);
/* basic machine hardware */
m_maincpu->set_addrmap(AS_IO, &mw8080bw_state::maze_io_map);
MCFG_MACHINE_START_OVERRIDE(mw8080bw_state,maze)
WATCHDOG_TIMER(config, m_watchdog).set_time(PERIOD_OF_555_MONOSTABLE(RES_K(270), CAP_U(10))); /* 2.97s */
/* audio hardware */
maze_audio(config);
}
/*************************************
*
* Boot Hill (PCB #612)
*
*************************************/
void boothill_state::machine_start()
{
mw8080bw_state::machine_start();
m_rev_shift_res = 0U;
save_item(NAME(m_rev_shift_res));
}
u8 boothill_state::reversible_shift_result_r()
{
return m_rev_shift_res ? mw8080bw_shift_result_rev_r() : m_mb14241->shift_result_r();
}
void boothill_state::reversible_shift_count_w(u8 data)
{
m_mb14241->shift_count_w(data);
m_rev_shift_res = BIT(data, 3);
}
void boothill_state::boothill_io_map(address_map &map)
{
map.global_mask(0x7);
map(0x00, 0x00).mirror(0x04).portr("IN0");
map(0x01, 0x01).mirror(0x04).portr("IN1");
map(0x02, 0x02).mirror(0x04).portr("IN2");
map(0x03, 0x03).mirror(0x04).r(FUNC(boothill_state::reversible_shift_result_r));
map(0x01, 0x01).w(FUNC(boothill_state::reversible_shift_count_w));
map(0x02, 0x02).w(m_mb14241, FUNC(mb14241_device::shift_data_w));
map(0x03, 0x03).w("soundboard", FUNC(boothill_audio_device::write));
map(0x04, 0x04).w(m_watchdog, FUNC(watchdog_timer_device::reset_w));
map(0x05, 0x05).w("soundboard", FUNC(boothill_audio_device::tone_generator_lo_w));
map(0x06, 0x06).w("soundboard", FUNC(boothill_audio_device::tone_generator_hi_w));
}