/
dec8.cpp
3902 lines (3265 loc) · 193 KB
/
dec8.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:Bryan McPhail,Stephane Humbert
/***************************************************************************
Various Data East 8 bit games:
Last Mission (rev 6) (c) 1986 Data East USA (2*6809 + I8751)
Last Mission (rev 5) (c) 1986 Data East USA (2*6809 + I8751)
Last Mission (Japan) (c) 1986 Data East Corporation (2*6809 + I8751)
Shackled (c) 1986 Data East USA (2*6809 + I8751)
Breywood (c) 1986 Data East Corporation (2*6809 + I8751)
Gondomania (c) 1987 Data East USA (6809 + I8751)
Makyou Senshi (c) 1987 Data East Corporation (6809 + I8751)
Garyo Retsuden (c) 1987 Data East Corporation (6809 + I8751)
The Real Ghostbusters (2p) (c) 1987 Data East USA (6809 + I8751)
The Real Ghostbusters (3p) (c) 1987 Data East USA (6809 + I8751)
Meikyuu Hunter G (c) 1987 Data East Corporation (6809 + I8751)
Captain Silver (World) (c) 1987 Data East Corporation (2*6809 + I8751)
Captain Silver (Japan) (c) 1987 Data East Corporation (2*6809 + I8751)
Psycho-Nics Oscar (World) (c) 1987 Data East Corporation (2*6809)
Psycho-Nics Oscar (US) (c) 1988 Data East USA (2*6809)
Psycho-Nics Oscar (Japan) (c) 1987 Data East Corporation (2*6809)
Super Real Darwin (World) (c) 1987 Data East Corporation (6809 + I8751)
Super Real Darwin (Japan) (c) 1987 Data East Corporation (6809 + I8751)
Cobra Command (World) (c) 1988 Data East Corporation (6809)
Cobra Command (Japan) (c) 1988 Data East Corporation (6809)
All games use a 6502 for sound (some are encrypted), all games except Cobracom
and Oscar use an Intel 8751 for protection & coinage. For the games without
(fake) MCU, the coinage dip switch (sometimes based on the manual) is simulated.
Meikyuu Hunter G was formerly known as Mazehunter.
Emulation by Bryan McPhail, mish@tendril.co.uk
To do:
Super Real Darwin 'Double' sprites appearing from the top of the screen are clipped
Strangely coloured butterfly on Garyo Retsuden water levels!
Thanks to Jose Miguel Morales Farreras for Super Real Darwin information!
***************************************************************************/
#include "emu.h"
#include "dec8.h"
#include "cpu/m6502/m6502.h"
#include "cpu/m6809/hd6309.h"
#include "cpu/m6809/m6809.h"
#include "deco222.h"
#include "sound/msm5205.h"
#include "sound/ymopn.h"
#include "sound/ymopl.h"
#include "speaker.h"
/******************************************************************************/
void dec8_state_base::buffer_spriteram16_w(u8 data)
{
u8* spriteram = m_spriteram->live();
// copy to a 16-bit region for the sprite chip
for (int i=0;i<0x800/2;i++)
{
m_buffered_spriteram16[i] = spriteram[(i*2)+1] | (spriteram[(i*2)+0] <<8);
}
}
/* Only used by ghostb, gondo, garyoret, other games can control buffering */
void lastmisn_state::screen_vblank(int state)
{
// rising edge
if (state)
{
buffer_spriteram16_w(0);
}
}
u8 dec8_mcu_state_base::i8751_h_r()
{
return m_i8751_return >> 8; /* MSB */
}
u8 dec8_mcu_state_base::i8751_l_r()
{
return m_i8751_return & 0xff; /* LSB */
}
void dec8_mcu_state_base::i8751_reset_w(u8 data)
{
// ? reset the actual MCU?
//m_i8751_return = 0;
}
/******************************************************************************/
template<unsigned Which>
u8 gondo_state::player_io_r(offs_t offset)
{
int val = 1 << m_analog_io[Which]->read();
switch (offset)
{
case 0: /* Rotary low byte */
return ~(val & 0xff);
case 1: /* Joystick = bottom 4 bits, rotary = top 4 */
return ((~val >> 4) & 0xf0) | (m_in_io[Which]->read() & 0xf);
}
return 0xff;
}
/******************************************************************************/
/***************************************************
*
* Hook-up for games that have a proper MCU dump.
*
***************************************************/
TIMER_CALLBACK_MEMBER(dec8_mcu_state_base::mcu_irq_clear)
{
// The schematics show a clocked LS194 shift register (3A) is used to automatically
// clear the IRQ request. The MCU does not clear it itself.
m_mcu->set_input_line(MCS51_INT1_LINE, CLEAR_LINE);
}
TIMER_CALLBACK_MEMBER(dec8_state_base::audiocpu_nmi_clear)
{
// Gondomania schematics show a LS194 for the sound IRQ, sharing the 6502 clock
// S1=H, S0=L, LSI=H, and QA is the only output connected (to NMI)
m_audiocpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
}
void dec8_mcu_state_base::i8751_w(offs_t offset, u8 data)
{
switch (offset)
{
case 0: /* High byte - SECIRQ is trigged on activating this latch */
m_i8751_value = (m_i8751_value & 0xff) | (data << 8);
m_mcu->set_input_line(MCS51_INT1_LINE, ASSERT_LINE);
m_i8751_timer->adjust(m_mcu->clocks_to_attotime(64)); // 64 clocks not confirmed
break;
case 1: /* Low byte */
m_i8751_value = (m_i8751_value & 0xff00) | data;
break;
}
}
/******************************************************************************/
void oscar_state::bank_w(u8 data)
{
m_mainbank->set_entry(data & 0x0f);
}
/* Used by Ghostbusters, Meikyuu Hunter G & Gondomania */
void lastmisn_state::ghostb_bank_w(u8 data)
{
/* Bit 0: SECCLR - acknowledge interrupt from I8751
Bit 1: NMI enable/disable
Bit 2: Not connected according to schematics
Bit 3: Screen flip
Bits 4-7: Bank switch
*/
m_mainbank->set_entry(data >> 4);
m_secclr = BIT(data, 0);
if (!m_secclr)
m_maincpu->set_input_line(M6809_IRQ_LINE, CLEAR_LINE);
if (m_nmigate.found())
m_nmigate->in_w<0>(BIT(data, 1));
else
{
// Ghostbusters needs to acknowledge/disable NMIs in a different way
m_nmi_enable = BIT(data, 1);
if (!m_nmi_enable)
m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
}
flip_screen_set(BIT(data, 3));
}
void csilver_state::control_w(u8 data)
{
/*
Bit 0x0f - ROM bank switch.
Bit 0x10 - Always set(?)
Bit 0x20 - Unused.
Bit 0x40 - Unused.
Bit 0x80 - Hold subcpu reset line high if clear, else low? (Not needed anyway)
*/
m_mainbank->set_entry(data & 0x0f);
}
void dec8_state_base::sound_w(u8 data)
{
m_soundlatch->write(data);
m_audiocpu->set_input_line(m6502_device::NMI_LINE, ASSERT_LINE);
m_m6502_timer->adjust(m_audiocpu->cycles_to_attotime(3));
}
void csilver_state::adpcm_int(int state)
{
m_toggle ^= 1;
if (m_toggle)
m_audiocpu->set_input_line(m6502_device::IRQ_LINE, HOLD_LINE);
m_msm->data_w(m_msm5205next >> 4);
m_msm5205next <<= 4;
}
u8 csilver_state::adpcm_reset_r()
{
m_msm->reset_w(0);
return 0;
}
void csilver_state::adpcm_data_w(u8 data)
{
m_msm5205next = data;
}
void csilver_state::sound_bank_w(u8 data)
{
m_soundbank->set_entry((data & 0x08) >> 3);
}
/******************************************************************************/
void dec8_state_base::main_irq_on_w(u8 data)
{
m_maincpu->set_input_line(M6809_IRQ_LINE, ASSERT_LINE);
}
void dec8_state_base::main_irq_off_w(u8 data)
{
m_maincpu->set_input_line(M6809_IRQ_LINE, CLEAR_LINE);
}
void dec8_state_base::main_firq_off_w(u8 data)
{
m_maincpu->set_input_line(M6809_FIRQ_LINE, CLEAR_LINE);
}
void dec8_state_base::sub_irq_on_w(u8 data)
{
m_subcpu->set_input_line(M6809_IRQ_LINE, ASSERT_LINE);
}
void dec8_state_base::sub_irq_off_w(u8 data)
{
m_subcpu->set_input_line(M6809_IRQ_LINE, CLEAR_LINE);
}
void dec8_state_base::sub_firq_off_w(u8 data)
{
m_subcpu->set_input_line(M6809_FIRQ_LINE, CLEAR_LINE);
}
/******************************************************************************/
void dec8_state_base::flip_screen_w(u8 data) { flip_screen_set(data); }
/******************************************************************************/
void lastmisn_state::lastmisn_map(address_map &map)
{
map(0x0000, 0x0fff).ram().share("share1");
map(0x1000, 0x13ff).ram().w(m_palette, FUNC(deco_rmc3_device::write8)).share("palette");
map(0x1400, 0x17ff).ram().w(m_palette, FUNC(deco_rmc3_device::write8_ext)).share("palette_ext");
map(0x1800, 0x1800).portr("IN0").w(FUNC(lastmisn_state::sub_irq_off_w));
map(0x1801, 0x1801).portr("IN1").w(FUNC(lastmisn_state::main_irq_off_w));
map(0x1802, 0x1802).portr("IN2").w(FUNC(lastmisn_state::main_firq_off_w));
map(0x1803, 0x1803).portr("DSW0").w(FUNC(lastmisn_state::main_irq_on_w));
map(0x1804, 0x1804).portr("DSW1").w(FUNC(lastmisn_state::sub_irq_on_w));
map(0x1805, 0x1805).w(FUNC(lastmisn_state::buffer_spriteram16_w)); /* DMA */
map(0x1806, 0x1806).r(FUNC(lastmisn_state::i8751_h_r));
map(0x1807, 0x1807).rw(FUNC(lastmisn_state::i8751_l_r), FUNC(lastmisn_state::flip_screen_w));
map(0x1809, 0x1809).w(FUNC(lastmisn_state::lastmisn_scrollx_w)); /* Scroll LSB */
map(0x180b, 0x180b).w(FUNC(lastmisn_state::lastmisn_scrolly_w)); /* Scroll LSB */
map(0x180c, 0x180c).w(FUNC(lastmisn_state::sound_w));
map(0x180d, 0x180d).w(FUNC(lastmisn_state::lastmisn_control_w)); /* Bank switch + Scroll MSB */
map(0x180e, 0x180f).w(FUNC(lastmisn_state::i8751_w));
map(0x2000, 0x27ff).ram().w(FUNC(lastmisn_state::videoram_w)).share(m_videoram);
map(0x2800, 0x2fff).ram().share("spriteram");
map(0x3000, 0x37ff).ram().share("share2");
map(0x3800, 0x3fff).rw(FUNC(lastmisn_state::bg_ram_r), FUNC(lastmisn_state::bg_ram_w)).share(m_bg_ram);
map(0x4000, 0x7fff).bankr(m_mainbank);
map(0x8000, 0xffff).rom();
}
void lastmisn_state::lastmisn_sub_map(address_map &map)
{
map(0x0000, 0x0fff).ram().share("share1");
map(0x1000, 0x13ff).ram().w(m_palette, FUNC(deco_rmc3_device::write8)).share("palette");
map(0x1400, 0x17ff).ram().w(m_palette, FUNC(deco_rmc3_device::write8_ext)).share("palette_ext");
map(0x1800, 0x1800).portr("IN0").w(FUNC(lastmisn_state::sub_irq_off_w));
map(0x1801, 0x1801).portr("IN1").w(FUNC(lastmisn_state::main_irq_off_w));
map(0x1802, 0x1802).portr("IN2").w(FUNC(lastmisn_state::main_firq_off_w));
map(0x1803, 0x1803).portr("DSW0").w(FUNC(lastmisn_state::main_irq_on_w));
map(0x1804, 0x1804).portr("DSW1").w(FUNC(lastmisn_state::sub_irq_on_w));
map(0x1805, 0x1805).w(FUNC(lastmisn_state::buffer_spriteram16_w)); /* DMA */
map(0x1806, 0x1806).r(FUNC(lastmisn_state::i8751_h_r));
map(0x1807, 0x1807).rw(FUNC(lastmisn_state::i8751_l_r), FUNC(lastmisn_state::flip_screen_w));
map(0x180c, 0x180c).w(FUNC(lastmisn_state::sound_w));
map(0x180e, 0x180f).w(FUNC(lastmisn_state::i8751_w));
map(0x2000, 0x27ff).ram().w(FUNC(lastmisn_state::videoram_w));
map(0x2800, 0x2fff).writeonly().share("spriteram");
map(0x3000, 0x37ff).ram().share("share2");
map(0x3800, 0x3fff).rw(FUNC(lastmisn_state::bg_ram_r), FUNC(lastmisn_state::bg_ram_w));
map(0x4000, 0xffff).rom();
}
void lastmisn_state::shackled_map(address_map &map)
{
map(0x0000, 0x0fff).ram().share("share1");
map(0x1000, 0x13ff).ram().w(m_palette, FUNC(deco_rmc3_device::write8)).share("palette");
map(0x1400, 0x17ff).ram().w(m_palette, FUNC(deco_rmc3_device::write8_ext)).share("palette_ext");
map(0x1800, 0x1800).portr("IN0").w(FUNC(lastmisn_state::sub_irq_off_w));
map(0x1801, 0x1801).portr("IN1").w(FUNC(lastmisn_state::main_irq_off_w));
map(0x1802, 0x1802).portr("IN2").w(FUNC(lastmisn_state::sub_firq_off_w));
map(0x1803, 0x1803).portr("DSW0").w(FUNC(lastmisn_state::main_irq_on_w));
map(0x1804, 0x1804).portr("DSW1").w(FUNC(lastmisn_state::sub_irq_on_w));
map(0x1805, 0x1805).w(FUNC(lastmisn_state::buffer_spriteram16_w)); /* DMA */
map(0x1807, 0x1807).w(FUNC(lastmisn_state::flip_screen_w));
map(0x1809, 0x1809).w(FUNC(lastmisn_state::lastmisn_scrollx_w)); /* Scroll LSB */
map(0x180b, 0x180b).w(FUNC(lastmisn_state::lastmisn_scrolly_w)); /* Scroll LSB */
map(0x180c, 0x180c).w(FUNC(lastmisn_state::sound_w));
map(0x180d, 0x180d).w(FUNC(lastmisn_state::shackled_control_w)); /* Bank switch + Scroll MSB */
map(0x2000, 0x27ff).ram().w(FUNC(lastmisn_state::videoram_w));
map(0x2800, 0x2fff).ram().share("spriteram");
map(0x3000, 0x37ff).ram().share("share2");
map(0x3800, 0x3fff).rw(FUNC(lastmisn_state::bg_ram_r), FUNC(lastmisn_state::bg_ram_w)).share("bg_ram");
map(0x4000, 0x7fff).bankr(m_mainbank);
map(0x8000, 0xffff).rom();
}
void lastmisn_state::shackled_sub_map(address_map &map)
{
map(0x0000, 0x0fff).ram().share("share1");
map(0x1000, 0x13ff).ram().w(m_palette, FUNC(deco_rmc3_device::write8)).share("palette");
map(0x1400, 0x17ff).ram().w(m_palette, FUNC(deco_rmc3_device::write8_ext)).share("palette_ext");
map(0x1800, 0x1800).portr("IN0").w(FUNC(lastmisn_state::sub_irq_off_w));
map(0x1801, 0x1801).portr("IN1").w(FUNC(lastmisn_state::main_irq_off_w));
map(0x1802, 0x1802).portr("IN2").w(FUNC(lastmisn_state::sub_firq_off_w));
map(0x1803, 0x1803).portr("DSW0").w(FUNC(lastmisn_state::main_irq_on_w));
map(0x1804, 0x1804).portr("DSW1").w(FUNC(lastmisn_state::sub_irq_on_w));
map(0x1805, 0x1805).w(FUNC(lastmisn_state::buffer_spriteram16_w)); /* DMA */
map(0x1806, 0x1806).r(FUNC(lastmisn_state::i8751_h_r));
map(0x1807, 0x1807).rw(FUNC(lastmisn_state::i8751_l_r), FUNC(lastmisn_state::flip_screen_w));
map(0x1809, 0x1809).w(FUNC(lastmisn_state::lastmisn_scrollx_w)); /* Scroll LSB */
map(0x180b, 0x180b).w(FUNC(lastmisn_state::lastmisn_scrolly_w)); /* Scroll LSB */
map(0x180c, 0x180c).w(FUNC(lastmisn_state::sound_w));
map(0x180d, 0x180d).w(FUNC(lastmisn_state::shackled_control_w)); /* Bank switch + Scroll MSB */
map(0x180e, 0x180f).w(FUNC(lastmisn_state::i8751_w));
map(0x2000, 0x27ff).ram().w(FUNC(lastmisn_state::videoram_w)).share(m_videoram);
map(0x2800, 0x2fff).ram().share("spriteram");
map(0x3000, 0x37ff).ram().share("share2");
map(0x3800, 0x3fff).rw(FUNC(lastmisn_state::bg_ram_r), FUNC(lastmisn_state::bg_ram_w));
map(0x4000, 0xffff).rom();
}
void gondo_state::gondo_map(address_map &map)
{
map(0x0000, 0x17ff).ram();
map(0x1800, 0x1fff).ram().w(FUNC(gondo_state::videoram_w)).share(m_videoram);
map(0x2000, 0x27ff).rw(FUNC(gondo_state::bg_ram_r), FUNC(gondo_state::bg_ram_w)).share("bg_ram");
map(0x2800, 0x2bff).ram().w(m_palette, FUNC(deco_rmc3_device::write8)).share("palette");
map(0x2c00, 0x2fff).ram().w(m_palette, FUNC(deco_rmc3_device::write8_ext)).share("palette_ext");
map(0x3000, 0x37ff).ram().share("spriteram"); /* Sprites */
map(0x3800, 0x3800).portr("DSW0"); /* Dip 1 */
map(0x3801, 0x3801).portr("DSW1"); /* Dip 2 */
map(0x380a, 0x380b).r(FUNC(gondo_state::player_io_r<0>)); /* Player 1 rotary */
map(0x380c, 0x380d).r(FUNC(gondo_state::player_io_r<1>)); /* Player 2 rotary */
map(0x380e, 0x380e).portr("IN3"); /* VBL */
map(0x380f, 0x380f).portr("IN2"); /* Fire buttons */
map(0x3810, 0x3810).w(FUNC(gondo_state::sound_w));
map(0x3818, 0x382f).w(FUNC(gondo_state::gondo_scroll_w));
map(0x3830, 0x3830).w(FUNC(gondo_state::ghostb_bank_w)); /* Bank + NMI enable */
map(0x3838, 0x3838).r(FUNC(gondo_state::i8751_h_r));
map(0x3839, 0x3839).r(FUNC(gondo_state::i8751_l_r));
map(0x383a, 0x383b).w(FUNC(gondo_state::i8751_w));
map(0x4000, 0x7fff).bankr(m_mainbank);
map(0x8000, 0xffff).rom();
}
void lastmisn_state::garyoret_map(address_map &map)
{
map(0x0000, 0x17ff).ram();
map(0x1800, 0x1fff).ram().w(FUNC(lastmisn_state::videoram_w)).share(m_videoram);
map(0x2000, 0x27ff).rw(FUNC(lastmisn_state::bg_ram_r), FUNC(lastmisn_state::bg_ram_w)).share("bg_ram");
map(0x2800, 0x2bff).ram().w(m_palette, FUNC(deco_rmc3_device::write8)).share("palette");
map(0x2c00, 0x2fff).ram().w(m_palette, FUNC(deco_rmc3_device::write8_ext)).share("palette_ext");
map(0x3000, 0x37ff).ram().share("spriteram"); /* Sprites */
map(0x3800, 0x3800).portr("DSW0"); /* Dip 1 */
map(0x3801, 0x3801).portr("DSW1"); /* Dip 2 */
map(0x3808, 0x3808).nopr(); /* ? */
map(0x380a, 0x380a).portr("IN1"); /* Player 2 + VBL */
map(0x380b, 0x380b).portr("IN0"); /* Player 1 */
map(0x3810, 0x3810).w(FUNC(lastmisn_state::sound_w));
map(0x3818, 0x382f).w(FUNC(lastmisn_state::gondo_scroll_w));
map(0x3830, 0x3830).w(FUNC(lastmisn_state::ghostb_bank_w)); /* Bank + NMI enable */
map(0x3838, 0x3839).w(FUNC(lastmisn_state::i8751_w));
map(0x383a, 0x383a).r(FUNC(lastmisn_state::i8751_h_r));
map(0x383b, 0x383b).r(FUNC(lastmisn_state::i8751_l_r));
map(0x4000, 0x7fff).bankr(m_mainbank);
map(0x8000, 0xffff).rom();
}
void lastmisn_state::meikyuh_map(address_map &map)
{
map(0x0000, 0x0fff).ram();
map(0x1000, 0x17ff).ram();
map(0x1800, 0x1fff).ram().w(FUNC(lastmisn_state::videoram_w)).share(m_videoram);
map(0x2000, 0x27ff).rw(m_tilegen[0], FUNC(deco_bac06_device::pf_data_8bit_r), FUNC(deco_bac06_device::pf_data_8bit_w));
map(0x2800, 0x2bff).ram(); // colscroll? mirror?
map(0x2c00, 0x2fff).rw(m_tilegen[0], FUNC(deco_bac06_device::pf_rowscroll_8bit_r), FUNC(deco_bac06_device::pf_rowscroll_8bit_w));
map(0x3000, 0x37ff).ram().share("spriteram");
map(0x3800, 0x3800).portr("IN0"); /* Player 1 */
map(0x3800, 0x3800).w(FUNC(lastmisn_state::sound_w));
map(0x3801, 0x3801).portr("IN1"); /* Player 2 */
map(0x3802, 0x3802).portr("IN2"); /* Player 3 */
map(0x3803, 0x3803).portr("DSW0"); /* Start buttons + VBL */
map(0x3820, 0x3820).portr("DSW1"); /* Dip */
map(0x3820, 0x3827).w(m_tilegen[0], FUNC(deco_bac06_device::pf_control0_8bit_w));
map(0x3830, 0x383f).rw(m_tilegen[0], FUNC(deco_bac06_device::pf_control1_8bit_r), FUNC(deco_bac06_device::pf_control1_8bit_w));
map(0x3840, 0x3840).r(FUNC(lastmisn_state::i8751_h_r));
map(0x3840, 0x3840).w(FUNC(lastmisn_state::ghostb_bank_w));
map(0x3860, 0x3860).r(FUNC(lastmisn_state::i8751_l_r));
map(0x3860, 0x3861).w(FUNC(lastmisn_state::i8751_w));
map(0x4000, 0x7fff).bankr(m_mainbank);
map(0x8000, 0xffff).rom();
}
void csilver_state::main_map(address_map &map)
{
map(0x0000, 0x0fff).ram().share("share1");
map(0x1000, 0x13ff).ram().w(m_palette, FUNC(deco_rmc3_device::write8)).share("palette");
map(0x1400, 0x17ff).ram().w(m_palette, FUNC(deco_rmc3_device::write8_ext)).share("palette_ext");
map(0x1800, 0x1800).portr("IN1").w(FUNC(csilver_state::sub_irq_off_w));
map(0x1801, 0x1801).portr("IN0").w(FUNC(csilver_state::main_irq_off_w));
map(0x1802, 0x1802).w(FUNC(csilver_state::main_firq_off_w));
map(0x1803, 0x1803).portr("IN2").w(FUNC(csilver_state::main_irq_on_w));
map(0x1804, 0x1804).portr("DSW1").w(FUNC(csilver_state::sub_irq_on_w));
map(0x1805, 0x1805).portr("DSW0").w(FUNC(csilver_state::buffer_spriteram16_w)); /* Dip 1, DMA */
map(0x1807, 0x1807).w(FUNC(csilver_state::flip_screen_w));
map(0x1808, 0x180b).w(FUNC(csilver_state::scroll_w));
map(0x180c, 0x180c).w(FUNC(csilver_state::sound_w));
map(0x180d, 0x180d).w(FUNC(csilver_state::control_w));
map(0x180e, 0x180f).w(FUNC(csilver_state::i8751_w));
map(0x1c00, 0x1c00).r(FUNC(csilver_state::i8751_h_r));
map(0x1e00, 0x1e00).r(FUNC(csilver_state::i8751_l_r));
map(0x2000, 0x27ff).ram().w(FUNC(csilver_state::videoram_w));
map(0x2800, 0x2fff).ram().share("spriteram");
map(0x3000, 0x37ff).ram().share("share2");
map(0x3800, 0x3fff).rw(FUNC(csilver_state::bg_ram_r), FUNC(csilver_state::bg_ram_w)).share("bg_ram");
map(0x4000, 0x7fff).bankr(m_mainbank);
map(0x8000, 0xffff).rom();
}
void csilver_state::sub_map(address_map &map)
{
map(0x0000, 0x0fff).ram().share("share1");
map(0x1000, 0x13ff).ram().w(m_palette, FUNC(deco_rmc3_device::write8)).share("palette");
map(0x1400, 0x17ff).ram().w(m_palette, FUNC(deco_rmc3_device::write8_ext)).share("palette_ext");
map(0x1800, 0x1800).w(FUNC(csilver_state::sub_irq_off_w));
map(0x1801, 0x1801).w(FUNC(csilver_state::main_irq_off_w));
map(0x1802, 0x1802).w(FUNC(csilver_state::main_firq_off_w));
map(0x1803, 0x1803).portr("IN2").w(FUNC(csilver_state::main_irq_on_w));
map(0x1804, 0x1804).portr("DSW1").w(FUNC(csilver_state::sub_irq_on_w));
map(0x1805, 0x1805).portr("DSW0").w(FUNC(csilver_state::buffer_spriteram16_w)); /* DMA */
map(0x180c, 0x180c).w(FUNC(csilver_state::sound_w));
map(0x2000, 0x27ff).ram().w(FUNC(csilver_state::videoram_w)).share(m_videoram);
map(0x2800, 0x2fff).ram().share("spriteram");
map(0x3000, 0x37ff).ram().share("share2");
map(0x3800, 0x3fff).rw(FUNC(csilver_state::bg_ram_r), FUNC(csilver_state::bg_ram_w));
map(0x4000, 0xffff).rom();
}
void oscar_state::oscar_map(address_map &map)
{
map(0x0000, 0x0eff).ram().share("share1");
map(0x0f00, 0x0fff).ram();
map(0x1000, 0x1fff).ram().share("share2");
map(0x2000, 0x27ff).ram().w(FUNC(oscar_state::videoram_w)).share(m_videoram);
map(0x2800, 0x2fff).rw(m_tilegen[0], FUNC(deco_bac06_device::pf_data_8bit_r), FUNC(deco_bac06_device::pf_data_8bit_w));
map(0x3000, 0x37ff).ram().share("spriteram"); /* Sprites */
map(0x3800, 0x3bff).ram().w(m_palette, FUNC(deco_rmc3_device::write8)).share("palette");
map(0x3c00, 0x3c00).portr("IN0");
map(0x3c01, 0x3c01).portr("IN1");
map(0x3c02, 0x3c02).portr("IN2"); /* VBL & coins */
map(0x3c03, 0x3c03).portr("DSW0"); /* Dip 1 */
map(0x3c04, 0x3c04).portr("DSW1");
map(0x3c00, 0x3c07).w(m_tilegen[0], FUNC(deco_bac06_device::pf_control0_8bit_w));
map(0x3c10, 0x3c1f).w(m_tilegen[0], FUNC(deco_bac06_device::pf_control1_8bit_w));
map(0x3c80, 0x3c80).w(FUNC(oscar_state::buffer_spriteram16_w)); /* DMA */
map(0x3d00, 0x3d00).w(FUNC(oscar_state::bank_w)); /* BNKS */
map(0x3d80, 0x3d80).w(m_soundlatch, FUNC(generic_latch_8_device::write)); /* SOUN */
map(0x3e00, 0x3e00).w(FUNC(oscar_state::coin_clear_w)); /* COINCL */
map(0x3e80, 0x3e80).w(FUNC(oscar_state::sub_irq_on_w)); /* IRQ 2 */
map(0x3e81, 0x3e81).w(FUNC(oscar_state::main_irq_off_w)); /* IRC 1 */
map(0x3e82, 0x3e82).w(FUNC(oscar_state::main_irq_on_w)); /* IRQ 1 */
map(0x3e83, 0x3e83).w(FUNC(oscar_state::sub_irq_off_w)); /* IRC 2 */
map(0x4000, 0x7fff).bankr(m_mainbank);
map(0x8000, 0xffff).rom();
}
void oscar_state::oscar_sub_map(address_map &map)
{
map(0x0000, 0x0eff).ram().share("share1");
map(0x0f00, 0x0fff).ram();
map(0x1000, 0x1fff).ram().share("share2");
map(0x3e80, 0x3e80).w(FUNC(oscar_state::sub_irq_on_w)); /* IRQ 2 */
map(0x3e81, 0x3e81).w(FUNC(oscar_state::main_irq_off_w)); /* IRC 1 */
map(0x3e82, 0x3e82).w(FUNC(oscar_state::main_irq_on_w)); /* IRQ 1 */
map(0x3e83, 0x3e83).w(FUNC(oscar_state::sub_irq_off_w)); /* IRC 2 */
map(0x4000, 0xffff).rom();
}
void srdarwin_state::main_map(address_map &map)
{
map(0x0000, 0x05ff).ram();
map(0x0600, 0x07ff).ram().share("spriteram");
map(0x0800, 0x0fff).ram().w(FUNC(srdarwin_state::srdarwin_videoram_w)).share(m_videoram);
map(0x1000, 0x13ff).ram();
map(0x1400, 0x17ff).rw(FUNC(srdarwin_state::bg_ram_r), FUNC(srdarwin_state::bg_ram_w)).share("bg_ram");
map(0x1800, 0x1801).w(FUNC(srdarwin_state::i8751_w));
map(0x1802, 0x1802).w(FUNC(srdarwin_state::i8751_reset_w)); /* Maybe.. */
map(0x1803, 0x1803).nopw(); /* NMI ack */
map(0x1804, 0x1804).w(m_spriteram, FUNC(buffered_spriteram8_device::write)); /* DMA */
map(0x1805, 0x1806).w(FUNC(srdarwin_state::control_w)); /* Scroll & Bank */
map(0x2000, 0x2000).rw(FUNC(srdarwin_state::i8751_h_r), FUNC(srdarwin_state::sound_w)); /* Sound */
map(0x2001, 0x2001).rw(FUNC(srdarwin_state::i8751_l_r), FUNC(srdarwin_state::flip_screen_w)); /* Flipscreen */
map(0x2800, 0x288f).w(m_palette, FUNC(deco_rmc3_device::write8)).share("palette");
map(0x3000, 0x308f).w(m_palette, FUNC(deco_rmc3_device::write8_ext)).share("palette_ext");
map(0x3800, 0x3800).portr("DSW0"); /* Dip 1 */
map(0x3801, 0x3801).portr("IN0"); /* Player 1 */
map(0x3802, 0x3802).portr("IN1"); /* Player 2 (cocktail) + VBL */
map(0x3803, 0x3803).portr("DSW1"); /* Dip 2 */
map(0x4000, 0x7fff).bankr(m_mainbank);
map(0x8000, 0xffff).rom();
}
void oscar_state::cobra_map(address_map &map)
{
map(0x0000, 0x07ff).ram();
map(0x0800, 0x0fff).rw(m_tilegen[0], FUNC(deco_bac06_device::pf_data_8bit_r), FUNC(deco_bac06_device::pf_data_8bit_w));
map(0x1000, 0x17ff).rw(m_tilegen[1], FUNC(deco_bac06_device::pf_data_8bit_r), FUNC(deco_bac06_device::pf_data_8bit_w));
map(0x1800, 0x1fff).ram();
map(0x2000, 0x27ff).ram().w(FUNC(oscar_state::videoram_w)).share(m_videoram);
map(0x2800, 0x2fff).ram().share("spriteram");
map(0x3000, 0x31ff).ram().w(m_palette, FUNC(deco_rmc3_device::write8)).share("palette");
map(0x3200, 0x37ff).nopw(); /* Unused */
map(0x3800, 0x3800).portr("IN0"); /* Player 1 */
map(0x3801, 0x3801).portr("IN1"); /* Player 2 */
map(0x3802, 0x3802).portr("DSW0"); /* Dip 1 */
map(0x3803, 0x3803).portr("DSW1"); /* Dip 2 */
map(0x3800, 0x3807).w(m_tilegen[0], FUNC(deco_bac06_device::pf_control0_8bit_w));
map(0x3810, 0x381f).w(m_tilegen[0], FUNC(deco_bac06_device::pf_control1_8bit_w));
map(0x3a00, 0x3a00).portr("IN2"); /* VBL & coins */
map(0x3a00, 0x3a07).w(m_tilegen[1], FUNC(deco_bac06_device::pf_control0_8bit_w));
map(0x3a10, 0x3a1f).w(m_tilegen[1], FUNC(deco_bac06_device::pf_control1_8bit_w));
map(0x3c00, 0x3c00).w(FUNC(oscar_state::bank_w));
map(0x3c02, 0x3c02).w(FUNC(oscar_state::buffer_spriteram16_w)); /* DMA */
map(0x3e00, 0x3e00).w(FUNC(oscar_state::sound_w));
map(0x4000, 0x7fff).bankr(m_mainbank);
map(0x8000, 0xffff).rom();
}
/******************************************************************************/
/* Used for Cobra Command, Maze Hunter, Super Real Darwin etc */
void dec8_state_base::dec8_s_map(address_map &map)
{
map(0x0000, 0x05ff).ram();
map(0x2000, 0x2001).w("ym1", FUNC(ym2203_device::write));
map(0x4000, 0x4001).w("ym2", FUNC(ym3812_device::write));
map(0x6000, 0x6000).r(m_soundlatch, FUNC(generic_latch_8_device::read));
map(0x8000, 0xffff).rom();
}
/* Used by Gondomania, Psycho-Nics Oscar & Garyo Retsuden */
void dec8_state_base::oscar_s_map(address_map &map)
{
map(0x0000, 0x05ff).ram();
map(0x2000, 0x2001).w("ym1", FUNC(ym2203_device::write));
map(0x4000, 0x4001).w("ym2", FUNC(ym3526_device::write));
map(0x6000, 0x6000).r(m_soundlatch, FUNC(generic_latch_8_device::read));
map(0x8000, 0xffff).rom();
}
// Used by the bootleg which has a standard M6502 with predecrypted opcodes
void oscar_state::oscarbl_s_opcodes_map(address_map &map)
{
map(0x8000, 0xffff).rom().region("audiocpu", 0x10000);
}
/* Used by Last Mission, Shackled & Breywood */
void lastmisn_state::ym3526_s_map(address_map &map)
{
map(0x0000, 0x05ff).ram();
map(0x0800, 0x0801).w("ym1", FUNC(ym2203_device::write));
map(0x1000, 0x1001).w("ym2", FUNC(ym3526_device::write));
map(0x3000, 0x3000).r(m_soundlatch, FUNC(generic_latch_8_device::read));
map(0x8000, 0xffff).rom();
}
/* Captain Silver - same sound system as Pocket Gal */
void csilver_state::sound_map(address_map &map)
{
map(0x0000, 0x07ff).ram();
map(0x0800, 0x0801).w("ym1", FUNC(ym2203_device::write));
map(0x1000, 0x1001).w("ym2", FUNC(ym3526_device::write));
map(0x1800, 0x1800).w(FUNC(csilver_state::adpcm_data_w)); /* ADPCM data for the MSM5205 chip */
map(0x2000, 0x2000).w(FUNC(csilver_state::sound_bank_w));
map(0x3000, 0x3000).r(m_soundlatch, FUNC(generic_latch_8_device::read));
map(0x3400, 0x3400).r(FUNC(csilver_state::adpcm_reset_r)); /* ? not sure */
map(0x4000, 0x7fff).bankr("soundbank");
map(0x8000, 0xffff).rom();
}
/******************************************************************************/
/*
Gondomania schematics show the following:
Port P0 - attached to 2 * LS374 at location 4C & 1C
Port P1 - attached to 2 * LS374 at location 3C & 2C
Port P2.2 -> SECIRQ (IRQ to main CPU)
Port P2.3 -> 'COUNT' (Enable coin counter - also wired directly to coinage) [not emulated]
Port P2.4-7 -> Enable latches 4C, 1C, 3C, 2C
Port P3.4-7 -> Directly attached to coinage connector (3 coins & service)
*/
u8 dec8_mcu_state_base::i8751_port0_r()
{
return m_i8751_port0;
}
void dec8_mcu_state_base::i8751_port0_w(u8 data)
{
m_i8751_port0 = data;
}
u8 dec8_mcu_state_base::i8751_port1_r()
{
return m_i8751_port1;
}
void dec8_mcu_state_base::i8751_port1_w(u8 data)
{
m_i8751_port1 = data;
}
void lastmisn_state::gondo_mcu_to_main_w(u8 data)
{
// P2 - controls latches for main CPU communication
if ((data&0x10)==0)
m_i8751_port0 = m_i8751_value>>8;
if ((data&0x20)==0)
m_i8751_port1 = m_i8751_value&0xff;
if ((data&0x40)==0)
m_i8751_return = (m_i8751_return & 0xff) | (m_i8751_port0 << 8);
if ((data&0x80)==0)
m_i8751_return = (m_i8751_return & 0xff00) | m_i8751_port1;
// P2 - IRQ to main CPU
if (BIT(data, 2) && !BIT(m_i8751_p2, 2) && m_secclr)
m_maincpu->set_input_line(M6809_IRQ_LINE, ASSERT_LINE);
m_i8751_p2 = data;
}
void lastmisn_state::shackled_mcu_to_main_w(u8 data)
{
// P2 - controls latches for main CPU communication
if ((data&0x10)==0)
{
m_i8751_port0 = m_i8751_value>>8;
// mcu sets p0 to 0x00
m_mcu->set_port_forced_input(0, m_i8751_port0);
}
if ((data&0x20)==0)
m_i8751_port1 = m_i8751_value&0xff;
if ((data&0x40)==0)
m_i8751_return = (m_i8751_return & 0xff) | (m_i8751_port0 << 8);
if ((data&0x80)==0)
m_i8751_return = (m_i8751_return & 0xff00) | m_i8751_port1;
// P2 - IRQ to main CPU
if (BIT(data, 2) && !BIT(m_i8751_p2, 2))
m_subcpu->set_input_line(M6809_FIRQ_LINE, ASSERT_LINE);
if (!BIT(data, 0))
m_mcu->set_input_line(MCS51_INT0_LINE, CLEAR_LINE);
if (!BIT(data, 1))
m_mcu->set_input_line(MCS51_INT1_LINE, CLEAR_LINE);
m_i8751_p2 = data;
}
/*
Super Real Darwin is similar but only appears to have a single port
*/
void srdarwin_state::mcu_to_main_w(u8 data)
{
// P2 - controls latches for main CPU communication
if ((data & 0x10) == 0)
{
m_i8751_port0 = m_i8751_value >> 8;
}
if ((data & 0x20) == 0)
{
m_i8751_port0 = m_i8751_value & 0xff;
}
if ((data&0x40)==0)
m_i8751_return = (m_i8751_return & 0xff) | (m_i8751_port0 << 8);
if ((data&0x80)==0)
m_i8751_return = (m_i8751_return & 0xff00) | m_i8751_port0;
// P2 - IRQ to main CPU
if ((data&0x04)==0)
m_maincpu->set_input_line(M6809_IRQ_LINE, ASSERT_LINE);
// guess, toggled after above.
if ((data&0x02)==0)
m_maincpu->set_input_line(MCS51_INT1_LINE, CLEAR_LINE);
}
void csilver_state::mcu_to_main_w(u8 data)
{
if (~data & 0x10)
m_i8751_port0 = m_i8751_value >> 8;
if (~data & 0x20)
m_i8751_port1 = m_i8751_value & 0xff;
if (~data & 0x40)
{
m_i8751_return = (m_i8751_return & 0xff) | (m_i8751_port0 << 8);
m_maincpu->set_input_line(M6809_FIRQ_LINE, ASSERT_LINE); // FIRQ to main cpu
}
if (~data & 0x80)
m_i8751_return = (m_i8751_return & 0xff00) | m_i8751_port1;
m_i8751_p2 = data;
}
/******************************************************************************/
#define PLAYER1_JOYSTICK /* Player 1 controls */ \
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY \
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY \
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY \
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
#define PLAYER2_JOYSTICK /* Player 2 controls */ \
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL \
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL \
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL \
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
/* verified from M6809 code */
static INPUT_PORTS_START( lastmisn )
PORT_START("IN0")
PLAYER1_JOYSTICK
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) /* shoot */
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) /* bomb */
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) /* select */
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("IN1")
PLAYER2_JOYSTICK
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL /* shoot */
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL /* bomb */
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL /* select */
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("IN2")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) // coins read through MCU
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) // coins read through MCU
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen")
PORT_START("I8751")
PORT_BIT( 0x1f, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_WRITE_LINE_DEVICE_MEMBER("coin", input_merger_device, in_w<0>)
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_WRITE_LINE_DEVICE_MEMBER("coin", input_merger_device, in_w<1>)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN3 ) PORT_WRITE_LINE_DEVICE_MEMBER("coin", input_merger_device, in_w<2>)
PORT_START("DSW0")
PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:1,2")
PORT_DIPSETTING( 0x00, DEF_STR( 1C_5C ) )
PORT_DIPSETTING( 0x03, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x02, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x01, DEF_STR( 1C_3C ) )
PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:3,4")
PORT_DIPSETTING( 0x00, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x0c, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x08, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x04, DEF_STR( 3C_1C ) )
PORT_DIPNAME( 0x10, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:5")
PORT_DIPSETTING( 0x10, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x20, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW1:6")
PORT_DIPSETTING( 0x00, DEF_STR( Upright ) )
PORT_DIPSETTING( 0x20, DEF_STR( Cocktail ) )
PORT_DIPNAME( 0x40, 0x40, "Invulnerability (Cheat)") PORT_DIPLOCATION("SW1:7")
PORT_DIPSETTING( 0x40, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x80, 0x80, "Infinite Lives (Cheat)") PORT_DIPLOCATION("SW1:8")
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_START("DSW1")
PORT_DIPNAME( 0x01, 0x01, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:1")
PORT_DIPSETTING( 0x01, "3" )
PORT_DIPSETTING( 0x00, "5" )
PORT_DIPNAME( 0x06, 0x06, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW2:2,3") /* tables at 0x82c1 (4 words) and 0xde38 (3 words) in 'lastmisn', 0x82c1 and 0xde17 in 'lastmisno' */
PORT_DIPSETTING( 0x06, "30k 70k 70k+" )
PORT_DIPSETTING( 0x04, "40k 90k 90k+" )
PORT_DIPSETTING( 0x02, "40k and 80k" )
PORT_DIPSETTING( 0x00, "50k only" )
PORT_DIPNAME( 0x18, 0x18, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:4,5")
PORT_DIPSETTING( 0x18, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x10, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x08, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) )
PORT_DIPUNUSED( 0x20, IP_ACTIVE_LOW ) PORT_DIPLOCATION("SW2:6")
PORT_DIPUNUSED( 0x40, IP_ACTIVE_LOW ) PORT_DIPLOCATION("SW2:7")
PORT_DIPNAME( 0x80, 0x00, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW2:8")
PORT_DIPSETTING( 0x80, DEF_STR( No ) )
PORT_DIPSETTING( 0x00, DEF_STR( Yes ) )
INPUT_PORTS_END
/* verified from M6809 code */
static INPUT_PORTS_START( lastmisnj )
PORT_INCLUDE(lastmisn)
PORT_MODIFY("DSW1")
PORT_DIPNAME( 0x06, 0x06, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW2:2,3") /* tables at 0x82b7 (4 words) and 0xdd29 (3 words) */
PORT_DIPSETTING( 0x06, "30k 50k 50k+" )
PORT_DIPSETTING( 0x04, "30k 70k 70k+" )
PORT_DIPSETTING( 0x02, "50k 100k 100k+" )
PORT_DIPSETTING( 0x00, "50k only" )
PORT_DIPNAME( 0x18, 0x18, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:4,5")
PORT_DIPSETTING( 0x18, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x10, DEF_STR( Hard ) ) /* "difficult" */
PORT_DIPSETTING( 0x08, DEF_STR( Very_Hard ) ) /* "very difficult" */
PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) /* "top difficult" */
PORT_DIPUNUSED( 0x80, IP_ACTIVE_LOW ) PORT_DIPLOCATION("SW2:8")
INPUT_PORTS_END
/* verified from M6809 code */
static INPUT_PORTS_START( shackled )
PORT_START("IN0")
PLAYER1_JOYSTICK
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("IN1")
PLAYER2_JOYSTICK
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("IN2")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) // coins read through MCU
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) // coins read through MCU
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) // tested and discarded by vestigial code at start
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen")
PORT_START("I8751")
PORT_BIT( 0x1f, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_WRITE_LINE_DEVICE_MEMBER("coin", input_merger_device, in_w<0>)
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_WRITE_LINE_DEVICE_MEMBER("coin", input_merger_device, in_w<1>)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN3 ) PORT_WRITE_LINE_DEVICE_MEMBER("coin", input_merger_device, in_w<2>)
PORT_START("DSW0")
PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:1")
PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPUNUSED( 0x02, IP_ACTIVE_LOW ) PORT_DIPLOCATION("SW1:2")
PORT_DIPUNUSED( 0x04, IP_ACTIVE_LOW ) PORT_DIPLOCATION("SW1:3")
PORT_DIPUNUSED( 0x08, IP_ACTIVE_LOW ) PORT_DIPLOCATION("SW1:4")
PORT_DIPNAME( 0x10, 0x10, "Leave Off" ) PORT_DIPLOCATION("SW1:5") /* game doesn't boot when this is On - code at 0x401a - related to MCU - "dias" in Dip Switches page */
PORT_DIPSETTING( 0x10, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPUNUSED( 0x20, IP_ACTIVE_LOW ) PORT_DIPLOCATION("SW1:6")
PORT_DIPUNUSED( 0x40, IP_ACTIVE_LOW ) PORT_DIPLOCATION("SW1:7")
PORT_DIPNAME( 0x80, 0x80, "Freeze" ) PORT_DIPLOCATION("SW1:8")
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_START("DSW1")
/* tables in main CPU : 0x859b (Help), 0x85e9 (6-Help), 0x8fbe (Coin), 0x91b6 (Heart) */
PORT_DIPNAME( 0x07, 0x07, "Coin/Heart/Help/6-Help" ) PORT_DIPLOCATION("SW2:1,2,3") /* name from Dip Switches page */
PORT_DIPSETTING( 0x00, "2/100/50/200" )
PORT_DIPSETTING( 0x01, "4/100/60/300" )
PORT_DIPSETTING( 0x02, "6/200/70/300" )
PORT_DIPSETTING( 0x03, "8/200/80/400" )
PORT_DIPSETTING( 0x07, "10/200/100/500" )
PORT_DIPSETTING( 0x06, "12/300/100/600" )
PORT_DIPSETTING( 0x05, "18/400/200/700" )
PORT_DIPSETTING( 0x04, "20/500/200/800" )
PORT_DIPUNUSED( 0x08, IP_ACTIVE_LOW ) PORT_DIPLOCATION("SW2:4")
PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:5,6")
PORT_DIPSETTING( 0x30, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x20, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x10, DEF_STR( Very_Hard ) )
PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) )
PORT_DIPUNUSED( 0x40, IP_ACTIVE_LOW ) PORT_DIPLOCATION("SW2:7")
PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:8")
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
INPUT_PORTS_END
/* verified from M6809 code */
static INPUT_PORTS_START( breywood )
PORT_INCLUDE(shackled)
PORT_MODIFY("DSW1")
PORT_DIPNAME( 0x0f, 0x0f, "Power" ) PORT_DIPLOCATION("SW2:1,2,3,4") /* table at 0x41be in sub CPU */
PORT_DIPSETTING( 0x07, "200" )
PORT_DIPSETTING( 0x0b, "300" )
PORT_DIPSETTING( 0x03, "400" )
PORT_DIPSETTING( 0x0d, "500" )
PORT_DIPSETTING( 0x05, "600" )
PORT_DIPSETTING( 0x09, "700" )
PORT_DIPSETTING( 0x01, "800" )
PORT_DIPSETTING( 0x0e, "900" )
PORT_DIPSETTING( 0x0f, "1000" )
PORT_DIPSETTING( 0x06, "2000" )
PORT_DIPSETTING( 0x0a, "3000" )
PORT_DIPSETTING( 0x02, "4000" )
PORT_DIPSETTING( 0x0c, "5000" )
PORT_DIPSETTING( 0x04, "6000" )
PORT_DIPSETTING( 0x08, "7000" )
PORT_DIPSETTING( 0x00, "8000" )
INPUT_PORTS_END
/* verified from HD6309 code */
static INPUT_PORTS_START( gondo )
PORT_START("IN0")
PLAYER1_JOYSTICK
/* Top 4 bits are rotary controller */
PORT_START("IN1")
PLAYER2_JOYSTICK
/* Top 4 bits are rotary controller */
PORT_START("IN2")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("IN3")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen")
PORT_START("I8751") /* hooked up on the i8751 */
/* Low 4 bits not connected on schematics */
PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN3 ) /* produces sound but gives 0 credits - coinage not initialised in the MCU */