/
ssv.cpp
4861 lines (3890 loc) · 219 KB
/
ssv.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:Luca Elia
/***************************************************************************
-= Seta, Sammy, Visco (SSV) System =-
driver by Luca Elia (l.elia@tin.it)
CPU : NEC V60
Sound Chip : Ensoniq ES5506 (OTTOR2)
Custom Chips : ST-0004 (Video DAC)
ST-0005 (Parallel I/O)
ST-0006 (Video controller)
ST-0007 (System controller)
Others : Battery + MB3790 + LH5168D-10L (NVRAM)
DX-102 (I/O)
M62X42B (RTC)
ST010
TA8210 (Audio AMP)
uPD71051/7001C (UART)
-----------------------------------------------------------------------------------
Main Board ROM Board Year + Game By
-----------------------------------------------------------------------------------
STA-0001 STS-0001 93 Super Real Mahjong PIV Seta
STA-0001 STS-0001 93 Dramatic Adventure Quiz Keith & Lucy Visco
STA-0001 STS-0001 93 Pastel Island Visco
STA-0001 SAM-5127 93 Survival Arts Sammy
STA-0001 SAM-5127 93 Dyna Gears Sammy
STA-0001B VISCO-001B 94 Drift Out '94 (1) Visco
STA-0001B GOLF ROM 94 Eagle Shot Golf Sammy
STA-0001B STS0003 94 Twin Eagle II - The Rescue Mission (1) Seta
STA-0001B VISCO 95 Mobil Suit Gundam Final Shooting (2) Banpresto
STA-0001B P1-102A 95 Mahjong Hyper Reaction Sammy
? ? 95 Ultra X Weapons / Ultra Keibitai Banpresto / Tsuburaya Prod.
STA-0001B VISCO-JJ1 96 Lovely Pop Mahjong JangJang Shimasho Visco
STA-0001B VISCO-001B 96 Storm Blade (1) Visco
STA-0001B P1-105A 96? Meosis Magic Sammy
STA-0001B ? 97 Joryuu Syougi Kyoushitsu (3) Visco
STA-0001B VISCO-JJ1 97 Koi Koi Shimasho 2 Visco
STA-0001B P1-112A 97 Mahjong Hyper Reaction 2 Sammy
STA-0001B STS-0001 97 Monster Slider Visco / Datt
STA-0001 dedicated 97 Super Real Mahjong P7 Seta
STA-0001B VISCO-JJ1 98 Gourmet Battle Quiz Ryorioh CooKing Visco
STA-0001B P1-112C 98 Pachinko Sexy Reaction Sammy
STA-0001B B1-001A 99 Pachinko Sexy Reaction 2 Sammy
STA-0001B P1-112C 99 Change Air Blade Sammy
STA-0001B VISCO-JJ1 00 Lovely Pop Mahjong JangJang Shimasho 2 Visco
STA-0001B SSV_SUB 00 Vasara Visco
STA-0001B SSV_SUB 01 Vasara 2 Visco
-----------------------------------------------------------------------------------
(1) Uses ST010 MCU / Math chip
(2) Uses ST-0009 & ST-0020 & Light Gun
(3) Uses NEC V810 CPU as sub cpu for the AI (basically the same as the majinsen games on st0016)
SSV Hardware Overview
Sammy/Seta/Visco, 1993-2001
SSV was a joint venture between "S"ammy, "S"eta and "V"isco to produce a high quality 32-bit
RISC-based hardware platform.
The SSV main board contains all of the CPUs, RAM, custom ICs and sound chips. The lower PCB plugs
into 4x 64-pin connectors and contains the game software and any additional game-specific connectors
for controllers etc. The SSV games can be swapped by simply exchanging the lower (game) PCB onto any
SSV main board. There is an older main board STA-0001 which is not compatible with _some_ of the
newer games. The actual PCB will plug in, but the games will not boot up, instead displaying some
kind of debug screen full of numbers. This is known to occur on Vasara and Vasara 2 but may occur
with other games also. AFAIK, the actual PCBs look identical!
PCB Layouts
-----------
Main Board (common to all SSV-based games)
STA-0001B SYSTEM SSV
|---------------------------------------------------------|
| 2066 VOL |
|TA8210 |--------| 74ALS245 x6 |
| TL072 |--------| | | |
|H |ENSONIQ | | ST0007 | JP1 |
| TL072 |ES5506 | | | |--------|JP2 |
| |OTTOR2 | |--------| | |74ALS74 |
|S |--------| | V60 | |
| D6376 74ALS08 | |74F32 |
| 74LS07 |--------| |
| TC4050 JP3 |
|J TD62064 |
|A 74ALS245 |
|M LM358 74ALS245 |
|M |------| 74ALS245 |
|A |ST0004| 681000 681000 |
| | | |
||------| |------| 43256 43256 43256 43256 43256 |
||ST0005| |--------| JP4 |
|| | 48MHz | | MB3771 |
||------|42.9545MHz 74AC245 | ST0006 | 74ALS273 |
| 74F245 | | 74F04 |
| DSW1(8) DSW2(8) |--------| |
|---------------------------------------------------------|
(Note All IC's Shown)
Notes:
H - 3 pin connector for additional sound output
S - 5 pin connector for additional sound output
D6376 - NEC D6376 2-channel 16-bit D/A converter (SOIC16)
V60 - NEC D70615GD-16 V60 CPU, clock 16.000MHz [48/3] (QFP120)
ES5506 - Ensoniq ES5506 sound IC, clock 16.000MHz [48/3] (PLCC68)
LM358 - National Semiconductor LM358 Low Power Dual Operational Amplifier (DIP8)
2066 - New Japan Radio NJM2066 Dual Operational Amplifier (DIP16)
TL072 - Texas Instruments TL072 Low Noise JFET-Input Operational Amplifier (DIP8)
TA8210 - Toshiba TA8210 20W 2-channel Audio Power Amplifier
43256 - Sharp LH52B256-70LL 32K x8 SRAM (DIP28)
Note all sockets with 43256 can accept DIP32 128K x8 SRAM instead depending on
game requirements
681000 - Samsung KM681000ALP-7L 128K x8 SRAM (DIP32)
JP1 - 3 pin jumper, hardwired on PCB to 2-3
JP2 - 3 pin jumper, hardwired on PCB to 2-3
JP3 - 3 pin jumper, hardwired on PCB to 1-3
JP4 - 3 pin jumper, hardwired on PCB to 1-3
SETA custom IC's -
ST-0004 Video DAC (QFP64)
ST-0005 Parallel I/O (QFP100)
ST-0006 Video controller (QFP208, covered with large heatsink)
ST-0007 System controller (QFP160)
To Do:
- hypreac2 : communication with other units
- janjans2 : Coin inputs don't register in the input test
- jsk : Coin inputs don't register in the input test
- mslider : Coin inputs don't register in the input test
- srmp4 : Coin inputs don't register in the input test
- srmp7 : Needs interrupts by the sound chip (not properly hooked up yet). Kludged to work.
Notes:
- gdfs : Hold 1P Start on startup to enter test mode
- jsk : Push 1P Start and 2P Start to advance to sound test
code @ $e75cdc
W:
0x482000 - 0x482007 - values taken from obj table
0x482040 - 0x482043 - write latch ?
R:
0x482022 - 0x482023 - result = direction, probably : 00 = down, 40 = left, 80 = up, c0 = right
0x482042 - 0x482043 - protection status bits ?
***************************************************************************/
#include "emu.h"
#include "ssv.h"
#include "cpu/v810/v810.h"
#include "cpu/v60/v60.h"
#include "machine/nvram.h"
#include "machine/watchdog.h"
#include "speaker.h"
/***************************************************************************
Interrupts
***************************************************************************/
// Update the IRQ state based on all possible causes
void ssv_state::update_irq_state()
{
m_maincpu->set_input_line(0, (m_requested_int & m_irq_enable)? ASSERT_LINE : CLEAR_LINE);
}
IRQ_CALLBACK_MEMBER(ssv_state::irq_callback)
{
for (int i = 0; i <= 7; i++)
{
if (BIT(m_requested_int, i))
{
const uint16_t vector = m_irq_vectors[i * (16/2)] & 7;
return vector;
}
}
return 0;
}
void ssv_state::irq_ack_w(offs_t offset, uint16_t data)
{
const int level = ((offset * 2) & 0x70) >> 4;
m_requested_int &= ~(1 << level);
update_irq_state();
}
/*
IRQ Enable Register:
drifto94: c at the start
hypreact: ff at the start
hypreac2: ff at the start
janjans1: 0,6c,60
keithlcy: c at the start
meosism: ff at the start
mslider: c at the start
ryorioh: 0,c at the start
srmp4: 8 at the start
srmp7: 8 at the start, 28, 40 (seems related to 21000e writes)
survarts: 0,8 at the start
sxyreact: ff at the start
ultrax: 40,00 at the start then 42,4a
twineag2: 40,00 at the start then 42,4a
*/
void ssv_state::irq_enable_w(offs_t offset, uint16_t data, uint16_t mem_mask)
{
COMBINE_DATA(&m_irq_enable);
}
TIMER_DEVICE_CALLBACK_MEMBER(ssv_state::interrupt)
{
const int scanline = param;
if (scanline == 0)
{
if (m_interrupt_ultrax)
{
m_requested_int |= 1 << 1; // needed by ultrax to coin up, breaks cairblad
update_irq_state();
}
}
else if ((scanline == 120) && m_raster_interrupt_enabled)
{
/* scanline can almost certainly be programmed, where is the register? (unless it's really just a 'half screen' interrupt)
this split position seems to be correct for pastelis 2 player mode, the end credits aren't quite right, but like the 'for japan' warning it seems to be
more based on polling vblank_read than the raster interrupt.
note, janjans1 and keithlcy and ryorioh might be using it too (they enable this IRQ level at least) */
m_requested_int |= 1 << 2;
update_irq_state();
//m_screen->update_partial(m_screen->vpos() - 1);
}
else if(scanline == 240)
{
m_requested_int |= 1 << 3; // vblank
update_irq_state();
}
}
void gdfs_state::adc_int_w(int state)
{
if (state)
{
m_requested_int |= 1 << 6; // reads lightgun (4 times for 4 axis)
update_irq_state();
}
}
/***************************************************************************
Coins Lockout / Counter
***************************************************************************/
/*
drifto94: c3
janjans1: c3
keithlcy: c3
mslider: c3, 83 in test mode
ryorioh: c3
hypreac2: 80
hypreact: 80
meosism: 83
srmp4: 83, c0 in test mode (where only tilemap sprites are used)
srmp7: 80
survarts: 83
sxyreact: 80
*/
void ssv_state::lockout_w(offs_t offset, uint16_t data, uint16_t mem_mask)
{
//logerror("%s - Unknown lockout bit written %02X\n", machine().describe_context(), data & 0xff);
if (ACCESSING_BITS_0_7)
{
machine().bookkeeping().coin_lockout_w(1, BIT(~data, 0));
machine().bookkeeping().coin_lockout_w(0, BIT(~data, 1));
machine().bookkeeping().coin_counter_w(1, BIT( data, 2));
machine().bookkeeping().coin_counter_w(0, BIT( data, 3));
// Bit 6 is unknown
enable_video(BIT(data, 7));
}
}
// Same as above but with inverted lockout lines
void ssv_state::lockout_inv_w(offs_t offset, uint16_t data, uint16_t mem_mask)
{
//logerror("%s - Unknown lockout bit written %02X\n", machine().describe_context(), data & 0xff);
if (ACCESSING_BITS_0_7)
{
machine().bookkeeping().coin_lockout_w(1, BIT(data, 0));
machine().bookkeeping().coin_lockout_w(0, BIT(data, 1));
machine().bookkeeping().coin_counter_w(1, BIT(data, 2));
machine().bookkeeping().coin_counter_w(0, BIT(data, 3));
// Bit 6 is unknown
enable_video(BIT(data, 7));
}
}
void ssv_state::machine_reset()
{
m_requested_int = 0;
}
/***************************************************************************
DSP
***************************************************************************/
void drifto94_state::dsp_prg_map(address_map &map)
{
map(0x0000, 0x3fff).rom().region("dspprg", 0);
}
void drifto94_state::dsp_data_map(address_map &map)
{
map(0x0000, 0x07ff).rom().region("dspdata", 0);
}
uint16_t drifto94_state::dsp_dr_r()
{
return m_dsp->snesdsp_read(true);
}
void drifto94_state::dsp_dr_w(uint16_t data)
{
m_dsp->snesdsp_write(true, data);
}
uint16_t drifto94_state::dsp_r(offs_t offset)
{
const uint16_t temp = m_dsp->dataram_r(offset / 2);
uint16_t res;
if (BIT(offset, 0))
{
res = temp >> 8;
}
else
{
res = temp & 0xff;
}
return res;
}
void drifto94_state::dsp_w(offs_t offset, uint16_t data)
{
uint16_t temp = m_dsp->dataram_r(offset / 2);
if (BIT(offset, 0))
{
temp &= 0xff;
temp |= data << 8;
}
else
{
temp &= 0xff00;
temp |= data;
}
m_dsp->dataram_w(offset / 2, temp);
}
/***************************************************************************
Memory Maps
***************************************************************************/
uint16_t ssv_state::fake_r(offs_t offset) { return m_scroll[offset]; }
void ssv_state::ssv_map(address_map &map, u32 rom)
{
map(0x000000, 0x00ffff).ram().share(m_mainram); // RAM
map(0x100000, 0x13ffff).ram().share(m_spriteram); // Sprites
map(0x140000, 0x15ffff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); // Palette
map(0x160000, 0x17ffff).ram(); //
map(0x1c0000, 0x1c007f).ram().w(FUNC(ssv_state::scroll_w)).share(m_scroll); // Scroll
map(0x1c0000, 0x1c0001).r(FUNC(ssv_state::vblank_r)); // Vblank?
map(0x210002, 0x210003).portr("DSW1");
map(0x210004, 0x210005).portr("DSW2");
map(0x210008, 0x210009).portr("P1");
map(0x21000a, 0x21000b).portr("P2");
map(0x21000c, 0x21000d).portr("SYSTEM");
map(0x21000e, 0x21000f).nopr().w(FUNC(ssv_state::lockout_w)); // Lockout
map(0x210010, 0x210011).nopw();
map(0x230000, 0x230071).writeonly().share(m_irq_vectors); // IRQ Vec
map(0x240000, 0x240071).w(FUNC(ssv_state::irq_ack_w)); // IRQ Ack
map(0x260000, 0x260001).w(FUNC(ssv_state::irq_enable_w)); // IRQ En
map(0x300000, 0x30007f).rw(m_ensoniq, FUNC(es5506_device::read), FUNC(es5506_device::write)).umask16(0x00ff); // Sound
map(rom, 0xffffff).rom().region("maincpu", 0); // ROM
}
/***************************************************************************
Drift Out '94
***************************************************************************/
uint16_t drifto94_state::drifto94_unknown_r()
{
return machine().rand() & 0xffff;
}
void drifto94_state::drifto94_map(address_map &map)
{
ssv_map(map, 0xc00000);
// map(0x210002, 0x210003).nopw(); // ? 1 at the start
map(0x400000, 0x47ffff).nopw(); // ?
map(0x480000, 0x480001).rw(FUNC(drifto94_state::dsp_dr_r), FUNC(drifto94_state::dsp_dr_w));
map(0x482000, 0x482fff).rw(FUNC(drifto94_state::dsp_r), FUNC(drifto94_state::dsp_w));
map(0x483000, 0x485fff).nopw(); // ?
map(0x500000, 0x500001).nopw(); // ??
map(0x510000, 0x510001).r(FUNC(drifto94_state::drifto94_unknown_r)); // ??
map(0x520000, 0x520001).r(FUNC(drifto94_state::drifto94_unknown_r)); // ??
map(0x580000, 0x5807ff).ram().share("nvram"); // NVRAM
}
/***************************************************************************
Mobil Suit Gundam Final Shooting
***************************************************************************/
uint16_t gdfs_state::eeprom_r()
{
return m_adc->data_r() | (m_eeprom->do_read() << 8);
}
void gdfs_state::eeprom_w(offs_t offset, uint16_t data, uint16_t mem_mask)
{
if (data & ~0x7b00)
logerror("%s - Unknown EEPROM bit written %04X\n", machine().describe_context(), data);
if (ACCESSING_BITS_8_15)
{
// data & 0x8000 ? (near palette writes)
// data & 0x0001 ?
// latch the bit
m_eeprom->di_write(BIT(data, 14));
// reset line asserted: reset.
m_eeprom->cs_write(BIT(data, 12) ? ASSERT_LINE : CLEAR_LINE);
// clock line asserted: write latch or select next bit to read
m_eeprom->clk_write(BIT(data, 13) ? ASSERT_LINE : CLEAR_LINE);
m_adc->address_w((data & 0x0700) >> 8);
m_adc->start_w(BIT(data, 11));
}
}
void gdfs_state::gdfs_map(address_map &map)
{
ssv_map(map, 0xc00000);
map(0x400000, 0x41ffff).ram().w(FUNC(gdfs_state::tmapram_w)).share(m_tmapram);
map(0x420000, 0x43ffff).ram();
map(0x440000, 0x44003f).ram().share(m_tmapscroll);
map(0x500000, 0x500001).w(FUNC(gdfs_state::eeprom_w));
map(0x540000, 0x540001).r(FUNC(gdfs_state::eeprom_r));
map(0x600000, 0x600fff).ram();
map(0x800000, 0x87ffff).rw(m_st0020, FUNC(st0020_device::sprram_r), FUNC(st0020_device::sprram_w));
map(0x8c0000, 0x8c00ff).rw(m_st0020, FUNC(st0020_device::regs_r), FUNC(st0020_device::regs_w));
map(0x900000, 0x9fffff).rw(m_st0020, FUNC(st0020_device::gfxram_r), FUNC(st0020_device::gfxram_w));
}
/***************************************************************************
Hyper Reaction
***************************************************************************/
/*
The game prints "backup ram ok" and there is code to test some ram
at 0x580000-0x5bffff. The test is skipped and this ram isn't used
though. I guess it's either a left-over or there are different
version with some battery backed RAM (which would indeed be on the
ROM board, AFAIK)
*/
uint16_t ssv_state::hypreact_input_r()
{
const uint16_t input_sel = *m_input_sel;
uint16_t result = 0xffff;
if (BIT(input_sel, 0)) result &= m_io_key[0]->read();
if (BIT(input_sel, 1)) result &= m_io_key[1]->read();
if (BIT(input_sel, 2)) result &= m_io_key[2]->read();
if (BIT(input_sel, 3)) result &= m_io_key[3]->read();
return result;
}
void ssv_state::hypreact_map(address_map &map)
{
ssv_map(map, 0xf00000);
map(0x210000, 0x210001).r("watchdog", FUNC(watchdog_timer_device::reset16_r));
// map(0x210002, 0x210003).nopw(); // ? 5 at the start
map(0x21000e, 0x21000f).w(FUNC(ssv_state::lockout_inv_w)); // Inverted lockout lines
// map(0x280000, 0x280001).nopr(); // ? read at the start, value not used
map(0xc00000, 0xc00001).r(FUNC(ssv_state::hypreact_input_r)); // Inputs
map(0xc00006, 0xc00007).ram().share(m_input_sel); //
map(0xc00008, 0xc00009).noprw(); //
}
/***************************************************************************
Hyper Reaction 2
***************************************************************************/
void ssv_state::hypreac2_map(address_map &map)
{
ssv_map(map, 0xe00000);
map(0x210000, 0x210001).r("watchdog", FUNC(watchdog_timer_device::reset16_r));
// map(0x210002, 0x210003).nopw(); // ? 5 at the start
map(0x21000e, 0x21000f).w(FUNC(ssv_state::lockout_inv_w)); // Inverted lockout lines
// map(0x280000, 0x280001).nopr(); // ? read at the start, value not used
map(0x500000, 0x500001).r(FUNC(ssv_state::hypreact_input_r)); // Inputs
map(0x500002, 0x500003).r(FUNC(ssv_state::hypreact_input_r)); // (again?)
map(0x520000, 0x520001).writeonly().share(m_input_sel); // Inputs
// 0x540000, 0x540003 communication with other units
}
/***************************************************************************
Jan Jan Shimasho
***************************************************************************/
void ssv_state::janjans1_map(address_map &map)
{
ssv_map(map, 0xc00000);
map(0x210000, 0x210001).nopw(); // koikois2 but not janjans1
// map(0x210002, 0x210003).nopw(); // ? 1 at the start
map(0x210006, 0x210007).nopr();
map(0x800000, 0x800001).writeonly().share(m_input_sel); // Inputs
map(0x800002, 0x800003).r(FUNC(ssv_state::srmp4_input_r)); // Inputs
}
/***************************************************************************
Keith & Lucy
***************************************************************************/
void ssv_state::keithlcy_map(address_map &map)
{
ssv_map(map, 0xe00000);
// map(0x210002, 0x210003).nopw(); // ? 1 at the start
map(0x210010, 0x210011).nopw(); //
map(0x21000e, 0x21000f).nopr(); //
map(0x400000, 0x47ffff).nopw(); // ?
}
/***************************************************************************
Meosis Magic
***************************************************************************/
void ssv_state::meosism_map(address_map &map)
{
ssv_map(map, 0xf00000);
map(0x210000, 0x210001).r("watchdog", FUNC(watchdog_timer_device::reset16_r));
// map(0x210002, 0x210003).nopw(); // ? 5 at the start
// map(0x280000, 0x280001).nopr(); // ? read once, value not used
// map(0x500004, 0x500005).nopw(); // ? 0,58,18
map(0x580000, 0x58ffff).ram().share("nvram"); // NVRAM
}
/***************************************************************************
Monster Slider
***************************************************************************/
// Monster Slider needs the RAM mirrored for the gameplay logic to work correctly
uint16_t ssv_state::mainram_r(offs_t offset)
{
return m_mainram[offset];
}
void ssv_state::mainram_w(offs_t offset, uint16_t data, uint16_t mem_mask)
{
COMBINE_DATA(&m_mainram[offset]);
}
void ssv_state::mslider_map(address_map &map)
{
ssv_map(map, 0xf00000);
map(0x010000, 0x01ffff).rw(FUNC(ssv_state::mainram_r), FUNC(ssv_state::mainram_w)); // RAM Mirror
// map(0x210002, 0x210003).nopw(); // ? 1 at the start
map(0x400000, 0x47ffff).nopw(); // ?
// map(0x500000, 0x500001).nopw(); // ? ff at the start
}
/***************************************************************************
Gourmet Battle Quiz Ryohrioh CooKing
***************************************************************************/
void ssv_state::ryorioh_map(address_map &map)
{
ssv_map(map, 0xc00000);
map(0x210000, 0x210001).w("watchdog", FUNC(watchdog_timer_device::reset16_w));
// map(0x210002, 0x210003).nopw(); // ? 1 at the start
}
/***************************************************************************
Super Real Mahjong PIV
***************************************************************************/
uint16_t ssv_state::srmp4_input_r()
{
const uint16_t input_sel = *m_input_sel;
uint16_t result = 0xffff;
if (BIT(input_sel, 1)) result &= m_io_key[0]->read();
if (BIT(input_sel, 2)) result &= m_io_key[1]->read();
if (BIT(input_sel, 3)) result &= m_io_key[2]->read();
if (BIT(input_sel, 4)) result &= m_io_key[3]->read();
return result;
}
void ssv_state::srmp4_map(address_map &map)
{
ssv_map(map, 0xf00000);
map(0x210000, 0x210001).r("watchdog", FUNC(watchdog_timer_device::reset16_r));
// map(0x210002, 0x210003).nopw(); // ? 1,5 at the start
map(0xc0000a, 0xc0000b).r(FUNC(ssv_state::srmp4_input_r)); // Inputs
map(0xc0000e, 0xc0000f).writeonly().share(m_input_sel); // Inputs
map(0xc00010, 0xc00011).nopw(); //
}
/***************************************************************************
Super Real Mahjong P7
***************************************************************************/
/*
Interrupts aren't supported by the chip emulator yet
(lev 5 in this case, I guess)
*/
uint16_t ssv_state::srmp7_irqv_r()
{
return 0x0080;
}
void ssv_state::srmp7_sound_bank_w(offs_t offset, uint16_t data, uint16_t mem_mask)
{
if (ACCESSING_BITS_0_7)
{
m_srmp7_esbank[0]->set_entry(data & 1);
m_srmp7_esbank[1]->set_entry(data & 1);
}
// popmessage("%04X",data);
}
void ssv_state::srmp7_map(address_map &map)
{
ssv_map(map, 0xc00000);
map(0x010000, 0x050faf).ram(); // More RAM
map(0x210000, 0x210001).r("watchdog", FUNC(watchdog_timer_device::reset16_r));
// map(0x210002, 0x210003).nopw(); // ? 0,4 at the start
map(0x21000e, 0x21000f).w(FUNC(ssv_state::lockout_inv_w)); // Coin Counters / Lockouts
map(0x300076, 0x300077).r(FUNC(ssv_state::srmp7_irqv_r)); // Sound
// 0x540000, 0x540003, related to lev 5 irq?
map(0x580000, 0x580001).w(FUNC(ssv_state::srmp7_sound_bank_w)); // Sound Bank
map(0x600000, 0x600001).r(FUNC(ssv_state::srmp4_input_r)); // Inputs
map(0x680000, 0x680001).writeonly().share(m_input_sel); // Inputs
}
void ssv_state::srmp7_es5506_bank2_map(address_map &map)
{
map(0x000000, 0x1fffff).bankr(m_srmp7_esbank[0]);
}
void ssv_state::srmp7_es5506_bank3_map(address_map &map)
{
map(0x000000, 0x1fffff).bankr(m_srmp7_esbank[1]);
}
/***************************************************************************
Survival Arts
***************************************************************************/
void ssv_state::survarts_map(address_map &map)
{
ssv_map(map, 0xf00000);
map(0x210000, 0x210001).r("watchdog", FUNC(watchdog_timer_device::reset16_r));
// map(0x210002, 0x210003).nopw(); // ? 0,4 at the start
// map(0x290000, 0x290001).nopr(); // ?
// map(0x2a0000, 0x2a0001).nopr(); // ?
map(0x400000, 0x43ffff).ram(); // dyna
map(0x500008, 0x500009).portr("ADD_BUTTONS"); // Extra Buttons
}
/***************************************************************************
Pachinko Sexy Reaction
***************************************************************************/
uint16_t sxyreact_state::ballswitch_r()
{
return m_io_service->read();
}
uint8_t sxyreact_state::dial_r()
{
return m_sxyreact_adc->eoc_so_r() ? 0x80 : 0;
}
void sxyreact_state::dial_w(uint8_t data)
{
m_sxyreact_adc->cs_w(BIT(data, 5));
m_sxyreact_adc->sck_w(BIT(data, 6));
}
void sxyreact_state::motor_w(uint16_t data)
{
// popmessage("%04X",data); // 8 = motor on; 0 = motor off
}
void ssv_state::cairblad_map(address_map &map)
{
ssv_map(map, 0xe00000);
// map(0x020000, 0x03ffff).rw(FUNC(ssv_state::mainram_r), FUNC(ssv_state::mainram_w)); // sxyreac2 reads / writes here, why?
map(0x210000, 0x210001).r("watchdog", FUNC(watchdog_timer_device::reset16_r));
// map(0x210002, 0x210003).nopw(); // ? 1 at the start
map(0x21000e, 0x21000f).w(FUNC(ssv_state::lockout_inv_w)); // Inverted lockout lines
map(0x580000, 0x58ffff).ram().share("nvram"); // NVRAM
}
void sxyreact_state::sxyreact_map(address_map &map)
{
cairblad_map(map);
map(0x500002, 0x500003).r(FUNC(sxyreact_state::ballswitch_r)); // ?
map(0x500004, 0x500004).r(FUNC(sxyreact_state::dial_r)); // Dial Value (serial)
map(0x500004, 0x500005).w(FUNC(sxyreact_state::motor_w));
map(0x520000, 0x520000).w(FUNC(sxyreact_state::dial_w)); // Dial Value (advance 1 bit)
}
/***************************************************************************
Twin Eagle II
***************************************************************************/
// comes as either a standalone board or a standard SSV ROM board (verified)
void drifto94_state::twineag2_map(address_map &map)
{
ssv_map(map, 0xe00000);
map(0x010000, 0x03ffff).ram(); // More RAM
map(0x210000, 0x210001).r("watchdog", FUNC(watchdog_timer_device::reset16_r)); // Watchdog (also value is cmp.b with mem 8)
map(0x480000, 0x480001).rw(FUNC(drifto94_state::dsp_dr_r), FUNC(drifto94_state::dsp_dr_w));
map(0x482000, 0x482fff).rw(FUNC(drifto94_state::dsp_r), FUNC(drifto94_state::dsp_w));
}
/***************************************************************************
Ultra X
***************************************************************************/
// standalone board based on SSV hardware
void ssv_state::ultrax_map(address_map &map)
{
ssv_map(map, 0xe00000);
map(0x010000, 0x03ffff).ram(); // More RAM
map(0x210000, 0x210001).r("watchdog", FUNC(watchdog_timer_device::reset16_r)); // Watchdog (also value is cmp.b with memory address 8)
// map(0x210002, 0x210003).nopw(); // ? 2,6 at the start
}
/***************************************************************************
Joryuu Syougi Kyoushitsu
***************************************************************************/
// from simple_st0016.cpp
uint32_t ssv_state::latch32_r(offs_t offset)
{
if (!machine().side_effects_disabled())
{
if (!offset)
m_latches[2] &= ~2;
}
return m_latches[offset];
}
void ssv_state::latch32_w(offs_t offset, uint32_t data, uint32_t mem_mask)
{
if (!offset)
m_latches[2] |= 1;
COMBINE_DATA(&m_latches[offset]);
machine().scheduler().synchronize();
}
uint16_t ssv_state::latch16_r(offs_t offset)
{
if (!machine().side_effects_disabled())
{
if (!offset)
m_latches[2] &= ~1;
}
return m_latches[offset];
}
void ssv_state::latch16_w(offs_t offset, uint16_t data)
{
if (!offset)
m_latches[2] |= 2;
m_latches[offset] = data;
machine().scheduler().synchronize();
}
void ssv_state::jsk_map(address_map &map)
{
ssv_map(map, 0xf00000);
map(0x050000, 0x05ffff).rw(FUNC(ssv_state::mainram_r), FUNC(ssv_state::mainram_w)); // RAM Mirror?
map(0x210000, 0x210001).w("watchdog", FUNC(watchdog_timer_device::reset16_w));
map(0x400000, 0x47ffff).ram(); // RAM?
map(0x900000, 0x900007).rw(FUNC(ssv_state::latch16_r), FUNC(ssv_state::latch16_w));
}
void ssv_state::jsk_v810_mem(address_map &map)
{
map(0x00000000, 0x0001ffff).ram();
map(0x80000000, 0x8001ffff).ram();
map(0xc0000000, 0xc001ffff).ram();
map(0x40000000, 0x4000000f).rw(FUNC(ssv_state::latch32_r), FUNC(ssv_state::latch32_w));
map(0xfff80000, 0xffffffff).rom().region("sub", 0);
}
/***************************************************************************
Eagle Shot Golf
***************************************************************************/
void eaglshot_state::gfxrom_bank_w(uint8_t data)
{
m_gfxrom_bank->set_entry(data < 6 ? data : 6);
}
void eaglshot_state::trackball_w(uint8_t data)
{
// All these get toggled during trackball reads; the precise arrangement is uncertain
m_upd4701->cs_w(!BIT(data, 6));
m_upd4701->ul_w(BIT(data, 5));
m_upd4701->xy_w(BIT(data, 4));
m_upd4701->resetx_w(BIT(data, 3));
m_upd4701->resety_w(BIT(data, 2));
}
uint16_t eaglshot_state::gfxram_r(offs_t offset, uint16_t mem_mask)
{
return m_gfxram[offset + (m_scroll[0x76/2] & 0xf) * 0x40000/2];
}
void eaglshot_state::gfxram_w(offs_t offset, uint16_t data, uint16_t mem_mask)
{
offset += (m_scroll[0x76/2] & 0xf) * 0x40000/2;
COMBINE_DATA(&m_gfxram[offset]);
m_gfxdecode->gfx(0)->mark_dirty(offset / (16*8/2));
}
void eaglshot_state::eaglshot_map(address_map &map)
{
ssv_map(map, 0xf00000);
map(0x180000, 0x1bffff).rw(FUNC(eaglshot_state::gfxram_r), FUNC(eaglshot_state::gfxram_w));
map(0x210000, 0x210001).nopr(); // .r("watchdog", FUNC(watchdog_timer_device::reset16_r)); // Watchdog
// map(0x210002, 0x210003).nopw(); // ? 0,4 at the start
map(0x21000e, 0x21000f).w(FUNC(eaglshot_state::lockout_inv_w)); // Inverted lockout lines
map(0x800000, 0x800000).w(FUNC(eaglshot_state::gfxrom_bank_w));
map(0x900000, 0x900000).w(FUNC(eaglshot_state::trackball_w));
map(0xa00000, 0xbfffff).bankr(m_gfxrom_bank);
map(0xc00000, 0xc007ff).ram().share("nvram"); // NVRAM
map(0xd00000, 0xd00000).r(m_upd4701, FUNC(upd4701_device::d_r));
}
/***************************************************************************
Input Ports
***************************************************************************/
/***************************************************************************
Basic Coinage Settings
***************************************************************************/
#define SSV_COINAGE_BASIC( shift, default, name, diploc ) \
PORT_DIPNAME( 0x0003 << (shift), (default) << (shift), (name) ) PORT_DIPLOCATION( (diploc) ) \
PORT_DIPSETTING( 0x0001 << (shift), DEF_STR( 2C_1C ) ) \
PORT_DIPSETTING( 0x0003 << (shift), DEF_STR( 1C_1C ) ) \
PORT_DIPSETTING( 0x0000 << (shift), DEF_STR( 2C_3C ) ) \
PORT_DIPSETTING( 0x0002 << (shift), DEF_STR( 1C_2C ) )
#define SSV_COINAGE_STANDARD( shift, default, name, diploc ) \
PORT_DIPNAME( 0x0007 << (shift), (default) << (shift), (name) ) PORT_DIPLOCATION( (diploc) ) \
PORT_DIPSETTING( 0x0005 << (shift), DEF_STR( 3C_1C ) ) \
PORT_DIPSETTING( 0x0006 << (shift), DEF_STR( 2C_1C ) ) \
PORT_DIPSETTING( 0x0007 << (shift), DEF_STR( 1C_1C ) ) \
PORT_DIPSETTING( 0x0004 << (shift), DEF_STR( 1C_2C ) ) \
PORT_DIPSETTING( 0x0003 << (shift), DEF_STR( 1C_3C ) ) \
PORT_DIPSETTING( 0x0002 << (shift), DEF_STR( 1C_4C ) ) \
PORT_DIPSETTING( 0x0001 << (shift), DEF_STR( 1C_5C ) ) \
PORT_DIPSETTING( 0x0000 << (shift), DEF_STR( 1C_6C ) )
#define SSV_COINAGE_EXTENDED( shift, default, name, diploc ) \
PORT_DIPNAME( 0x000f << (shift), (default) << (shift), (name) ) PORT_DIPLOCATION( (diploc) ) \
PORT_DIPSETTING( 0x0007 << (shift), DEF_STR( 4C_1C ) ) \
PORT_DIPSETTING( 0x0008 << (shift), DEF_STR( 3C_1C ) ) \
PORT_DIPSETTING( 0x0009 << (shift), DEF_STR( 2C_1C ) ) \
PORT_DIPSETTING( 0x000f << (shift), DEF_STR( 1C_1C ) ) \
PORT_DIPSETTING( 0x0006 << (shift), DEF_STR( 2C_3C ) ) \
PORT_DIPSETTING( 0x000e << (shift), DEF_STR( 1C_2C ) ) \
PORT_DIPSETTING( 0x000d << (shift), DEF_STR( 1C_3C ) ) \
PORT_DIPSETTING( 0x000c << (shift), DEF_STR( 1C_4C ) ) \
PORT_DIPSETTING( 0x000b << (shift), DEF_STR( 1C_5C ) ) \
PORT_DIPSETTING( 0x000a << (shift), DEF_STR( 1C_6C ) ) \
/* "** ADDED MULTIPLE COIN FEATURE **" */ \
PORT_DIPSETTING( 0x0005 << (shift), "Multiple Coin Feature A" ) \
/* 2c-1c, 4c-2c, 5c-3c & 6c-4c */ \
PORT_DIPSETTING( 0x0004 << (shift), "Multiple Coin Feature B" ) \
/* 2c-1c, 4c-3c */ \
PORT_DIPSETTING( 0x0003 << (shift), "Multiple Coin Feature C" ) \
/* 1c-1c, 2c-2c, 3c-3c, 4c-4c, 5c-6c */ \
PORT_DIPSETTING( 0x0002 << (shift), "Multiple Coin Feature D" ) \
/* 1c-1c, 2c-2c, 3c-3c & 4c-5c */ \
PORT_DIPSETTING( 0x0001 << (shift), "Multiple Coin Feature E" ) \
/* 1c-1c, 2c-3c */ \
/* Meaning of all "ON" varies between games so it's not included here */
/***************************************************************************
Common Joystick Inputs
***************************************************************************/
static INPUT_PORTS_START( ssv_joystick )
PORT_START("DSW1") // IN0 - $210002
PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Modified below
PORT_START("DSW2") // IN1 - $210004
PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Modified below
PORT_START("P1") // IN2 - $210008
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
PORT_START("P2") // IN3 - $21000a
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)