/
toaplan2.cpp
6550 lines (5406 loc) · 328 KB
/
toaplan2.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:Quench, Yochizo, David Haywood
// thanks-to:Richard Bush
/*****************************************************************************
ToaPlan game hardware from 1991 - 1994
Raizing/8ing game hardware from 1993 onwards
-------------------------------------------------
Driver by: Quench and Yochizo
Original othldrby.c by Nicola Salmoria
Raizing games and Truxton 2 are heavily dependent on the Raine source -
many thanks to Richard Bush and the Raine team. [Yochizo]
Supported games:
Name Board No Maker Game name
----------------------------------------------------------------------------
tekipaki TP-020 Toaplan Teki Paki
tekipakit TP-020 Toaplan Teki Paki (location test)
ghox TP-021 Toaplan Ghox (Spinner with single up/down axis control)
ghoxj TP-021 Toaplan Ghox (8-Way Joystick controls)
dogyuun TP-022 Toaplan Dogyuun
dogyuuna TP-022 Toaplan Dogyuun (older)
dogyuunt TP-022 Toaplan Dogyuun (location test)
kbash TP-023 Toaplan Knuckle Bash
kbash2 bootleg Toaplan Knuckle Bash 2
truxton2 TP-024 Toaplan Truxton 2 / Tatsujin Oh
pipibibs TP-025 Toaplan Pipi & Bibis / Whoopee!! (set 1)
pipibibsa TP-025 Toaplan Pipi & Bibis / Whoopee!! (set 2)
pipibibsp TP-025 Toaplan Pipi & Bibis / Whoopee!! (Prototype)
pipibibsbl bootleg Toaplan Pipi & Bibis / Whoopee!! (based of the prototype)
whoopee *TP-025/TP-020 Toaplan Pipi & Bibis / Whoopee!! (Teki Paki hardware)
fixeight TP-026 Toaplan FixEight
fixeightbl bootleg Toaplan FixEight
grindstm TP-027 Toaplan Grind Stormer (1992)
grindstma TP-027 Toaplan Grind Stormer (1992) (older)
vfive TP-027 Toaplan V-V (V-Five) (1993 - Japan only)
batsugun TP-030 Toaplan Batsugun
batsuguna TP-030 Toaplan Batsugun (older)
batsugunsp TP-030 Toaplan Batsugun (Special Version)
enmadaio TP-031 Toaplan Enma Daio
pwrkick SW931201 Sunwise Power Kick
burgkids SW931201 Sunwise Burger Kids
othldrby S951060-VGP Sunwise Othello Derby
snowbro2 TP-033 Hanafram Snow Bros. 2 - With New Elves
* This version of Whoopee!! is on a board labeled TP-020
(same board number, and same hardware, as Teki Paki)
but the ROMs are labeled TP-025.
sstriker RA-MA7893-01 Raizing Sorcer Striker
sstrikera RA-MA7893-01 Raizing Sorcer Striker (Unite Trading license)
mahoudai RA-MA7893-01 Raizing Mahou Daisakusen (Japan)
kingdmgp RA-MA9402-03 Raizing/8ing Kingdom Grandprix
shippumd RA-MA9402-03 Raizing/8ing Shippu Mahou Daisakusen (Japan)
bgaregga RA9503 Raizing/8ing Battle Garegga (World - Sat Feb 3 1996)
bgareggat RA9503 Raizing/8ing Battle Garegga (location test - Wed Jan 17 1996)
bgareggahk RA9503 Raizing/8ing Battle Garegga (Hong Kong (and Austria?) - Sat Feb 3 1996)
bgareggatw RA9503 Raizing/8ing Battle Garegga (Taiwan (and Germany?) - Thu Feb 1 1996)
bgaregganv RA9503 Raizing/8ing Battle Garegga - New Version (Hong Kong (and Austria?) - Sat Mar 2 1996)
bgareggat2 RA9503 Raizing/8ing Battle Garegga - Type 2 (World - Sat Mar 2 1996)
bgareggacn RA9503 Raizing/8ing Battle Garegga - Type 2 (China (and Denmark?) - Tue Apr 2 1996)
batrider RA9704 Raizing/8ing Armed Police Batrider (Europe - Fri Feb 13 1998)
batrideru RA9704 Raizing/8ing Armed Police Batrider (USA - Fri Feb 13 1998)
batriderc RA9704 Raizing/8ing Armed Police Batrider (China - Fri Feb 13 1998)
batriderj RA9704 Raizing/8ing Armed Police Batrider - B Version (Japan - Fri Feb 13 1998)
batriderk RA9704 Raizing/8ing Armed Police Batrider (Korea - Fri Feb 13 1998)
batriderja RA9704 Raizing/8ing Armed Police Batrider (Japan - Mon Dec 22 1997)
batridert RA9704 Raizing/8ing Armed Police Batrider (Taiwan - Mon Dec 22 1997)
bbakraid ET68-V99 8ing Battle Bakraid - Unlimited Version (USA - Tue Jun 8th, 1999)
bbakraidj ET68-V99 8ing Battle Bakraid - Unlimited Version (Japan - Tue Jun 8th, 1999)
bbakraidja ET68-V99 8ing Battle Bakraid (Japan - Wed Apr 7th, 1999)
SET NOTES:
ghox - The ghoxj set displays an English title screen when the jumpers are set for Japan/Taito,
and fails to display the "Winners Don't Use Drugs" logo when set for USA/Taito (either
Taito America or Taito Japan).
dogyuun - In the location test version, if you are hit while you have a bomb, the bomb explodes
automatically and saves you from dying. In the final released version, the bomb explodes
but you die anyway.
The only difference between the dogyuun and dogyuuna sets is some of the region jumper
settings; see the INPUT_PORTS definitions.
truxton2 - Although the truxton2 PCB has only standard JAMMA mono audio output, and uses a YM3014B
mono DAC, the YM2151 music is actually sequenced in stereo. In toaplan2.h, uncomment
"#define TRUXTON2_STEREO" to hear the game's music the way it was originally composed.
Difficulty is much lower when the region is set to Europe or USA than when set to any
Asian region, independent of the "Difficulty" dipswitches. See the code beginning at
1FE94 (RAM address 1002D6 contains 0 if region is an Asian region, 1 if Europe or USA)
fixeight - The same program is used for all regions, and the region can be changed just by swapping
EEPROMs. However, the V25 code also recognizes a secret input that rewrites the EEPROM to
use any one of the 14 recognized regional licenses, using the state of the player 1 and
player 2 button inputs held in conjunction with it as a 4-bit binary code:
Region Button input
------------------------ ------------------------------------
Korea, Taito license No buttons
Korea P1 button 1
Hong Kong, Taito license P1 button 2
Hong Kong P1 buttons 1 & 2
Taiwan, Taito license P2 button 1
Taiwan P1 button 1 + P2 button 1
SE Asia, Taito license P1 button 2 + P2 button 1
Southeast Asia P1 buttons 1 & 2 + P2 button 1
Europe, Taito license P2 button 2
Europe P1 button 1 + P2 button 2
USA, Taito license P1 button 2 + P2 button 2
USA P1 buttons 1 & 2 + P2 button 2
(Invalid) P2 buttons 1 & 2
(Invalid) P1 button 1 + P2 buttons 1 & 2
Japan P1 button 2 + P2 buttons 1 & 2
Japan, Taito license P1 buttons 1 & 2 + P2 buttons 1 & 2
grindstm - Code at 20A26 in vfive forces region to Japan. All sets have some NOPs at reset vector,
and the NEC V25 CPU test that the other games do is skipped. Furthermore, all sets have
a broken ROM checksum routine that reads address ranges that don't match the actual
location or size of the ROM, and that has a hack at the end so it always passes.
Normally you would expect to see code like this in a bootleg, but the NOPs and other
oddities are identical among three different sets.
batsugun - The Special Version has many changes to make the game easier: it adds an autofire button,
replaces the regular bomb with the more powerful double bomb (which in the original version
required both players in a two player game to press their bomb buttons at once), gives you
a shield that can absorb one hit each time your ship "levels up", etc. It also changes the
colors of the title screen, ship select screen, stages, and enemies.
batsugun compared to batsuguna has code that looks more like the Special Version, but it
doesn't have any of the Special Version features. All the differences between batsugun
and batsuguna look like bug fixes that were carried over into the Special Version.
sstriker - The mahoudai set reads the region jumpers, but the lookup tables in ROM that map jumper
settings to copyright text, coinage settings, etc., contain identical values for every
jumper setting, effectively ignoring the jumpers and forcing the region to Japan.
On the other hand, sstriker has its title screen and all its text in English even when
the region is set to Japan. This seems odd but has been verified correct on two boards.
The only difference between sstriker and sstrikera is the copyright text displayed when
the region is set to Korea.
kingdmgp - The kingdmgp and shippumd sets have identical program ROMs but a different graphics ROM
for the text layer. Setting the region to Japan with the kingdmgp ROM, or to anything other
than Japan with the shippumd ROM, results in a corrupt title screen and unreadable text.
In kingdmgp some of the tiles needed for the credits screen in attract mode have been
stripped out, resulting in boxes where letters should be. It doesn't seem very professional
but appears to be a genuine release. A lot of boards being sold as 'Kingdom Grand Prix' are
in fact conversions using Neill Corlett's hack.
bgaregga - The later versions change the small bullet-shaped enemy bullets to bright yellow balls,
eliminate the flying metal debris from explosions, and require additional joystick input
to access the Extended, Harder, Special, and Stage Edit hidden features.
In addition to these changes, the bgareggat2 set uses only two buttons. Instead of being
able to change the formation of your options with the third button, each of the selectable
ships has a different, fixed option formation. However, the third button can still be used
to select an alternate ship color and to enter the secret character and Stage Edit codes.
batrider - Batrider was marketed as a two button game, and the regular ships all use only the first
two buttons, but in the original version you need the third button in order to control the
options of the hidden Battle Garegga ships.
This problem was fixed in the B Version, which lets you change the Battle Garegga ships'
option formation using Street Fighter style joystick commands (as well as by using the third
button, if the cabinet has one)
bbakraid - Because players managed to counter stop the original Battle Bakraid not long after release,
the Unlimited Version, which can display more score digits, was released as a ROM upgrade.
The upgrade also fixes the bug in the original version that prevented the unlocking of
Team Edit mode from being saved in the EEPROM.
****************************************************************************
* Battle Garegga and Armed Police Batrider have secret characters *
* and game features. *
* Try to input the following commands to use them. *
* ======================================================================== *
* Battle Garegga *
* The button you use to select your ship not only determines its *
* color, but affects its characteristics. *
* A: Default characteristics. *
* B: Slightly higher speed than A type. *
* C: Slightly smaller hitbox than A type. *
* A+B+C: Same speed as B type and same hitbox as C type. *
* *
* After inserting a coin (pushing a credit button), input *
* UP UP DOWN DOWN LEFT RIGHT LEFT RIGHT A B C START *
* then you can use Mahou Daisakusen characters. *
* *
* Note: In versions of the game dated Mar 2 1996 or later, you must *
* hold the joystick RIGHT in addition to the specified button(s) *
* when entering any of the following commands. Even if Stage Edit *
* is enabled via dipswitch, you need to hold RIGHT to use it. *
* *
* EXTENDED: After inserting a coin, hold A and press START. *
* You play through all stages twice before the game ends. *
* HARDER: After inserting a coin, hold B and press START. *
* Difficulty is increased. *
* SPECIAL: After inserting a coin, hold A and B and press START. *
* Combination of EXTENDED and HARDER modes. *
* STAGE EDIT: After inserting a coin, hold C and press START. *
* You can choose what order to play Stage 2, 3 and 4 in, *
* or even skip them. *
* *
* EXTENDED, HARDER, and SPECIAL modes each have their own high score list. *
* ------------------------------------------------------------------------ *
* Armed Police Batrider *
* The button you use to select your ship not only determines its *
* color, but affects its characteristics. *
* A: High main shot power, low option shot power. *
* Average speed. Default autofire rate is 15 Hz. *
* B: Low main shot power, high option shot power. Slightly *
* slower than A type. Default autofire rate is 12 Hz. *
* C: High main shot and option shot power, but lowest speed. *
* Default autofire rate is 20 Hz. *
* START: Low main shot and option shot power, but highest speed. *
* Default autofire rate is 10 Hz. *
* *
* Note: The following features can also be enabled via dipswitches. *
* *
* PLAYER SELECT: After inserting a coin, input *
* UP UP DOWN DOWN LEFT RIGHT LEFT RIGHT B A *
* You can select a single character instead of a team. *
* GUEST PLAYERS: After inserting a coin, input *
* UP UP DOWN DOWN LEFT RIGHT LEFT RIGHT A B *
* You can use Mahou Daisakusen and Battle Garegga characters. *
* SPECIAL COURSE: After inserting a coin, input *
* UP DOWN UP DOWN LEFT RIGHT LEFT RIGHT A B *
* You can select the Special course, which consists of bosses only. *
* STAGE EDIT: When you select your course, press A and B simultaneously. *
* You can choose what order to play Stage 2, 3 and 4 in, *
* or even skip them. *
****************************************************************************
############################################################################
# In Battle Bakraid, the button you use to select your ship not only #
# determines its color, but affects its characteristics. #
# A: Increased main shot power. Default autofire rate is 20 Hz. #
# B: Increased bomb blast duration. Default autofire rate is 12 Hz. #
# C: Increased side shot power. Default autofire rate is 15 Hz. #
# START: Increased speed. Default autofire rate is 10 Hz. #
# #
# STAGE EDIT: When you select your course, press A and B simultaneously. #
# You can choose what order to play Stage 2, 3, 4 and 5 in, #
# or even skip them. Stage Edit can also be enabled via dipswitch. #
# ======================================================================== #
# Battle Bakraid has unlocking codes to gain access to extra players #
# and game features. Once each feature is unlocked, it is saved in EEPROM #
# and remains unlocked until you erase the EEPROM from the service mode. #
# However, in the original (non-Unlimited) version, the unlocking of #
# Team Edit is not saved in EEPROM, apparently due to a bug. #
# Special thanks go to the 'R8ZING Shooter Tribute' page for finding #
# and publishing this info. #
# ======================================================================== #
# PLAYER SELECT: PHASE 2 #
# Result: 3 more fighter planes available. #
# Code: UP UP DOWN DOWN LEFT RIGHT LEFT RIGHT A B Start #
# Conditions: #
# 1. Start from the title screen #
# 2. Insert Coin #
# 3. Watch the 20 sec. counter and enter each part of the code right #
# between the counting. #
# Example: 12,up,11,up,10,down,9,down,8,left,7,right,6.left,5,r.. #
# After entering the [B] button a chime should sound. Phase 2 unlocked! #
# ------------------------------------------------------------------------ #
# PLAYER SELECT: PHASE 3 #
# Result: 2 more fighter planes available. #
# Code: UP UP DOWN DOWN LEFT RIGHT LEFT RIGHT B A Start #
# Conditions: #
# 1. Unlock Player Select Phase 2 first #
# 2. Insert Coin #
# 3. Watch the 20 sec. counter and enter each part of the code right #
# between the counting. #
# Important: The entering of this code has to be finished before the #
# counter passes 10 ! To do so, you will have to start after coin #
# insertion, right before it starts to count: #
# Example: up,19,up,18,down,17,down,16,left,15,right,14.left,.. #
# After entering the [A] button a chime should sound. Phase 3 unlocked! #
# ------------------------------------------------------------------------ #
# TEAM EDIT: ENABLE #
# Result: Unlocks the 'team edit' feature to select a team of different #
# ships like in Batrider. #
# Code: UP DOWN UP DOWN LEFT RIGHT LEFT RIGHT A B Start #
# Conditions: #
# 1. Unlock Player Select Phase 2 and Phase 3 first #
# 2. Insert Coin #
# 3. Watch the 20 sec. counter and enter each part of the code right #
# between the counting. #
# Important: This code hast to be entered so that the counter is at 0 when #
# you press the final button [B]. To do so, start after second 9: #
# Example: 9,up,8,down,7,up,6,down,5,left,4,right,3,left,2,right,1,A,0,B #
# After entering the [B] button a chime should sound. Team edit unlocked! #
# #
# Note: In the Japan version, to use Team Edit after unlocking it, #
# you must hold UP or DOWN while selecting your course. #
# In the USA version, if Team Edit is unlocked, the game asks you #
# if you want to use it after you select your course. #
# ------------------------------------------------------------------------ #
# SPECIAL COURSE: ENABLE #
# Result: Unlocks the Special course, a game mode where you fight the #
# bosses only. #
# Code: UP DOWN UP DOWN LEFT RIGHT LEFT RIGHT B A Start #
# Conditions: #
# 1. Start from the title screen #
# 2. Hold [C] button #
# 3. Insert Coin #
# 4. Watch the 20 sec. counter and enter each part of the code right #
# between the counting. #
# 5. Release [C] button #
# After entering the [A] button a chime should sound. Special course #
# unlocked! #
############################################################################
*************** Hardware Info ***************
CPU:
MC68000P10
TMP68HC000N-16
Sound CPU/MCU:
HD647180X0FS6 (Hitachi Z180 Compatible CPU with internal 16k ROM)
Z84C0006PEC (Z80)
NEC V25
Sound Chips:
YM3812 + YM3014B (DAC)
YM2151 + YM3014B
YM2151 + YM3014B + M6295
YM2151 + YM3012 (DAC) + M6295 + M6295
YMZ280B-F + YAC516-E (DAC)
Graphics Custom 208pin QFP:
GP9001 L7A0498 TOA PLAN
(emulated in video/gp9001.c)
*********************************************************************
Game status:
Teki Paki Working. MCU type is a Hitachi HD647180.
Ghox Working, MCU type is a Hitachi HD647180.
Dogyuun Working. MCU type is a NEC V25. Chip is a PLCC94 stamped 'TS-002-MACH'.*
Knuckle Bash Working. MCU type is a NEC V25. Chip is a PLCC94 stamped 'TS-004-DASH'.*
Truxton 2 Working.
Pipi & Bibis Working.
Pipi & Bibis (Teki Paki h/w) Working, MCU type is a Hitachi HD647180.
Pipi & Bibis bootleg Working. One unknown ROM.
FixEight Working. MCU type is a NEC V25. Chip is a PLCC94 stamped 'TS-001-TURBO'
FixEight bootleg Working. One unknown ROM (same as pipibibs bootleg one). Region hardcoded to Korea (@ $4d8)
Grind Stormer / VFive Working. MCU type is a NEC V25. Chip is a PLCC94 stamped 'TS-007-SPY'.*
Batsugun / Batsugun Sp' Working. MCU type is a NEC V25. Chip is a PLCC94 stamped 'TS-007-SPY'.*
Snow Bros. 2 Working.
Mahou Daisakusen Working.
Shippu Mahou Daisakusen Working.
Battle Garegga Working.
Armed Police Batrider Working.
Battle Bakraid Working.
* Some PCBs use another version stamped 'NITRO' which is the same chip type.
MACH, DASH and SPY seem to be the same chip (same encryption table)
Batsugun has the CPU hooked up in non-encrypted mode.
Notes:
See Input Port definition header below, for instructions
on how to enter pause/slow motion modes.
To Do / Unknowns:
- Whoopee/Teki Paki sometimes tests bit 5 of the region jumper port
just after testing for vblank. Why?
- Priority problem on 2nd player side of selection screen in Fixeight bootleg.
- Fixeight bootleg text in sound check mode does not display properly
with the CPU set to 10MHz (ok at 16MHz). Possible error in video_count_r routine.
- Need to sort out the video status register.
- Find out how exactly how sound CPU communication really works in bgaregga/batrider/bbakraid
current emulation seems to work (plays all sounds), but there are still some unknown reads/writes
- Music timing is bit different on bbakraid.
reference : https://www.youtube.com/watch?v=zjrWs0iHQ5A
Notes on Power Kick coin inputs:
- The 10 yen input is "Key In" according to the bookkeeping screen, but is
an otherwise normal coin input with a counter and a lockout (sharing the
latter with the "medal" coin).
- The 100 yen input never adds any credits except in "Coin Function Check,"
instead dispensing its value into the hopper immediately.
To reset the NVRAM in Othello Derby, hold P1 Button 1 down while booting.
*****************************************************************************/
#include "emu.h"
#include "toaplan2.h"
#include "toaplipt.h"
#include "cpu/nec/v25.h"
#include "cpu/z80/z80.h"
#include "cpu/z180/hd647180x.h"
#include "machine/nvram.h"
#include "sound/ymopm.h"
#include "sound/ymopl.h"
#include "sound/ymz280b.h"
#include "speaker.h"
#define PWRKICK_HOPPER_PULSE 50 // time between hopper pulses in milliseconds (probably wrong)
//#define TRUXTON2_STEREO /* Uncomment to hear truxton2 music in stereo */
constexpr unsigned toaplan2_state::T2PALETTE_LENGTH;
/***************************************************************************
Initialisation handlers
***************************************************************************/
void ghox_state::machine_start()
{
toaplan2_state::machine_start();
save_item(NAME(m_old_paddle_h));
}
void truxton2_state::machine_start()
{
toaplan2_state::machine_start();
save_item(NAME(m_z80_busreq));
}
void toaplan2_state::toaplan2_reset(int state)
{
if (m_audiocpu != nullptr)
m_audiocpu->pulse_input_line(INPUT_LINE_RESET, attotime::zero);
}
void ghox_state::machine_reset()
{
toaplan2_state::machine_reset();
m_old_paddle_h[0] = 0;
m_old_paddle_h[1] = 0;
}
MACHINE_RESET_MEMBER(truxton2_state, bgaregga)
{
toaplan2_state::machine_reset();
for (int chip = 0; chip < 2; chip++)
{
for (int i = 0; i < 8; i++)
{
if (m_raizing_okibank[chip][i] != nullptr)
m_raizing_okibank[chip][i]->set_entry(0);
}
}
}
void toaplan2_state::init_dogyuun()
{
m_sound_reset_bit = 0x20;
}
void truxton2_state::init_fixeight()
{
m_sound_reset_bit = 0x08;
}
void toaplan2_state::init_fixeightbl()
{
u8 *ROM = memregion("oki1")->base();
m_okibank->configure_entries(0, 5, &ROM[0x30000], 0x10000);
}
void toaplan2_state::init_vfive()
{
m_sound_reset_bit = 0x10;
}
void toaplan2_state::init_pipibibsbl()
{
u16 *ROM = (u16 *)(memregion("maincpu")->base());
for (int i = 0; i < (0x040000/2); i += 4)
{
ROM[i+0] = bitswap<16>(ROM[i+0],0x1,0x5,0x6,0x7,0x8,0x2,0x0,0x9,0xe,0xd,0x4,0x3,0xf,0xa,0xb,0xc);
ROM[i+1] = bitswap<16>(ROM[i+1],0x5,0x3,0x1,0xf,0xd,0xb,0x9,0x0,0x2,0x4,0x6,0x8,0xa,0xc,0xe,0x7);
ROM[i+2] = bitswap<16>(ROM[i+2],0xc,0xd,0xe,0xf,0x8,0x9,0xa,0xb,0x3,0x2,0x1,0x0,0x7,0x6,0x5,0x4);
ROM[i+3] = bitswap<16>(ROM[i+3],0x8,0x9,0xa,0xb,0xc,0xd,0xe,0xf,0x3,0x2,0x1,0x0,0x7,0x6,0x5,0x4);
}
}
void truxton2_state::install_raizing_okibank(int chip)
{
assert(m_oki_rom[chip] && m_raizing_okibank[chip][0]);
for (int i = 0; i < 4; i++)
{
m_raizing_okibank[chip][i]->configure_entries(0, 16, &m_oki_rom[chip][(i * 0x100)], 0x10000);
}
m_raizing_okibank[chip][4]->configure_entries(0, 16, &m_oki_rom[chip][0x400], 0x10000);
for (int i = 5; i < 8; i++)
{
m_raizing_okibank[chip][i]->configure_entries(0, 16, &m_oki_rom[chip][0], 0x10000);
}
}
void truxton2_state::init_bgaregga()
{
u8 *Z80 = memregion("audiocpu")->base();
m_audiobank->configure_entries(0, 8, Z80, 0x4000); // Test mode only, Mirror of First 128KB Areas?
m_audiobank->configure_entries(8, 8, Z80, 0x4000);
install_raizing_okibank(0);
}
void truxton2_state::init_batrider()
{
u8 *Z80 = memregion("audiocpu")->base();
m_audiobank->configure_entries(0, 16, Z80, 0x4000);
install_raizing_okibank(0);
install_raizing_okibank(1);
m_sndirq_line = 4;
}
void truxton2_state::init_bbakraid()
{
m_sndirq_line = 2;
}
void toaplan2_state::init_enmadaio()
{
u8 *ROM = memregion("oki1")->base();
m_okibank->configure_entries(0, 0x60, ROM, 0x40000);
m_okibank->set_entry(0);
}
/***************************************************************************
Toaplan games
***************************************************************************/
void toaplan2_state::cpu_space_fixeightbl_map(address_map &map)
{
map(0xfffff0, 0xffffff).m(m_maincpu, FUNC(m68000_base_device::autovectors_map));
map(0xfffff5, 0xfffff5).lr8(NAME([this] () { m_maincpu->set_input_line(M68K_IRQ_2, CLEAR_LINE); return m68000_device::autovector(2); }));
}
void toaplan2_state::cpu_space_pipibibsbl_map(address_map &map)
{
map(0xfffff0, 0xffffff).m(m_maincpu, FUNC(m68000_base_device::autovectors_map));
map(0xfffff9, 0xfffff9).lr8(NAME([this] () { m_maincpu->set_input_line(M68K_IRQ_4, CLEAR_LINE); return m68000_device::autovector(4); }));
}
u16 toaplan2_state::video_count_r()
{
/* +---------+---------+--------+---------------------------+ */
/* | /H-Sync | /V-Sync | /Blank | Scanline Count | */
/* | Bit 15 | Bit 14 | Bit 8 | Bit 7-0 (count from #EF) | */
/* +---------+---------+--------+---------------------------+ */
/*************** Control Signals are active low ***************/
int vpos = m_screen->vpos();
u16 video_status = 0xff00; // Set signals inactive
vpos = (vpos + 15) % 262;
if (!m_vdp[0]->hsync_r())
video_status &= ~0x8000;
if (!m_vdp[0]->vsync_r())
video_status &= ~0x4000;
if (!m_vdp[0]->fblank_r())
video_status &= ~0x0100;
if (vpos < 256)
video_status |= (vpos & 0xff);
else
video_status |= 0xff;
// logerror("VC: vpos=%04x hpos=%04x VBL=%04x\n",vpos,hpos,m_screen->vblank());
return video_status;
}
void toaplan2_state::coin_w(u8 data)
{
/* +----------------+------ Bits 7-5 not used ------+--------------+ */
/* | Coin Lockout 2 | Coin Lockout 1 | Coin Count 2 | Coin Count 1 | */
/* | Bit 3 | Bit 2 | Bit 1 | Bit 0 | */
if (data & 0x0f)
{
machine().bookkeeping().coin_lockout_w(0, BIT(~data, 2));
machine().bookkeeping().coin_lockout_w(1, BIT(~data, 3));
machine().bookkeeping().coin_counter_w(0, BIT( data, 0));
machine().bookkeeping().coin_counter_w(1, BIT( data, 1));
}
else
{
machine().bookkeeping().coin_lockout_global_w(1); // Lock all coin slots
}
if (data & 0xf0)
{
logerror("Writing unknown upper bits (%02x) to coin control\n",data);
}
}
void pwrkick_state::pwrkick_coin_w(u8 data)
{
machine().bookkeeping().coin_counter_w(0, BIT(data, 1)); // medal
machine().bookkeeping().coin_counter_w(1, BIT(data, 3)); // 10 yen
machine().bookkeeping().coin_counter_w(2, BIT(data, 0)); // 100 yen
m_hopper->motor_w(BIT(data, 7));
}
void pwrkick_state::pwrkick_coin_lockout_w(u8 data)
{
machine().bookkeeping().coin_lockout_w(0, BIT(~data, 2));
machine().bookkeeping().coin_lockout_w(1, BIT(~data, 2));
machine().bookkeeping().coin_lockout_w(2, BIT(~data, 1));
}
void toaplan2_state::coin_sound_reset_w(u8 data)
{
logerror("coin_sound_reset_w %02x\n",data);
coin_w(data & ~m_sound_reset_bit);
sound_reset_w(data & m_sound_reset_bit);
}
void truxton2_state::shippumd_coin_w(u8 data)
{
coin_w(data & ~0x10);
m_oki[0]->set_rom_bank(BIT(data, 4));
}
u8 toaplan2_state::shared_ram_r(offs_t offset)
{
return m_shared_ram[offset];
}
void toaplan2_state::shared_ram_w(offs_t offset, u8 data)
{
m_shared_ram[offset] = data;
}
int toaplan2_state::c2map_r()
{
// For Teki Paki hardware
// bit 4 high signifies secondary CPU is ready
// bit 5 is tested low before V-Blank bit ???
return m_soundlatch[0]->pending_r() ? 0x00 : 0x01;
}
template<unsigned Which>
u16 ghox_state::ghox_h_analog_r()
{
const s8 new_value = m_io_pad[Which]->read();
const s8 result = new_value - m_old_paddle_h[Which];
if (!machine().side_effects_disabled())
m_old_paddle_h[Which] = new_value;
return result;
}
void toaplan2_state::sound_reset_w(u8 data)
{
m_audiocpu->set_input_line(INPUT_LINE_RESET, (data & m_sound_reset_bit) ? CLEAR_LINE : ASSERT_LINE);
}
template<int Chip>
void toaplan2_state::oki_bankswitch_w(u8 data)
{
m_oki[Chip]->set_rom_bank(data & 1);
}
void toaplan2_state::fixeightbl_oki_bankswitch_w(u8 data)
{
data &= 7;
if (data <= 4) m_okibank->set_entry(data);
}
/***************************************************************************
Raizing games
***************************************************************************/
void truxton2_state::raizing_z80_bankswitch_w(u8 data)
{
m_audiobank->set_entry(data & 0x0f);
}
// bgaregga and batrider don't actually have a NMK112, but rather a GAL
// programmed to bankswitch the sound ROMs in a similar fashion.
// it may not be a coincidence that the composer and sound designer for
// these two games, Manabu "Santaruru" Namiki, came to Raizing from NMK...
void truxton2_state::raizing_oki_bankswitch_w(offs_t offset, u8 data)
{
m_raizing_okibank[(offset & 4) >> 2][offset & 3]->set_entry(data & 0xf);
m_raizing_okibank[(offset & 4) >> 2][4 + (offset & 3)]->set_entry(data & 0xf);
offset++;
data >>= 4;
m_raizing_okibank[(offset & 4) >> 2][offset & 3]->set_entry(data & 0xf);
m_raizing_okibank[(offset & 4) >> 2][4 + (offset & 3)]->set_entry(data & 0xf);
}
u8 truxton2_state::bgaregga_E01D_r()
{
// the Z80 reads this address during its IRQ routine,
// and reads the soundlatch only if the lowest bit is clear.
return m_soundlatch[0]->pending_r() ? 0 : 1;
}
u16 truxton2_state::batrider_z80_busack_r()
{
// Bit 0x01 returns the status of BUSAK from the Z80.
// These accesses are made when the 68K wants to read the Z80
// ROM code. Failure to return the correct status incurrs a Sound Error.
return m_z80_busreq; // Loop BUSRQ to BUSAK
}
void truxton2_state::batrider_z80_busreq_w(u8 data)
{
m_z80_busreq = (data & 0x01); // see batrider_z80_busack_r above
}
u16 truxton2_state::batrider_z80rom_r(offs_t offset)
{
return m_z80_rom[offset];
}
// these two latches are always written together, via a single move.l instruction
void truxton2_state::batrider_soundlatch_w(u8 data)
{
m_soundlatch[0]->write(data & 0xff);
m_audiocpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
}
void truxton2_state::batrider_soundlatch2_w(u8 data)
{
m_soundlatch[1]->write(data & 0xff);
m_audiocpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
}
void truxton2_state::batrider_unknown_sound_w(u16 data)
{
// the 68K writes here when it wants a sound acknowledge IRQ from the Z80
// for bbakraid this is on every sound command; for batrider, only on certain commands
}
void truxton2_state::batrider_clear_sndirq_w(u16 data)
{
// not sure whether this is correct
// the 68K writes here during the sound IRQ handler, and nowhere else...
m_maincpu->set_input_line(m_sndirq_line, CLEAR_LINE);
}
void truxton2_state::batrider_sndirq_w(u8 data)
{
// if batrider_clear_sndirq_w() is correct, should this be ASSERT_LINE?
m_maincpu->set_input_line(m_sndirq_line, HOLD_LINE);
}
void truxton2_state::batrider_clear_nmi_w(u8 data)
{
m_audiocpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
}
u16 truxton2_state::bbakraid_eeprom_r()
{
// Bit 0x01 returns the status of BUSAK from the Z80.
// BUSRQ is activated via bit 0x10 on the EEPROM write port.
// These accesses are made when the 68K wants to read the Z80
// ROM code. Failure to return the correct status incurrs a Sound Error.
u8 data;
data = ((m_eeprom->do_read() & 0x01) << 4);
data |= ((m_z80_busreq >> 4) & 0x01); // Loop BUSRQ to BUSAK
return data;
}
void truxton2_state::bbakraid_eeprom_w(u8 data)
{
if (data & ~0x1f)
logerror("CPU #0 PC:%06X - Unknown EEPROM data being written %02X\n",m_maincpu->pc(),data);
m_eepromout->write(data, 0xff);
m_z80_busreq = data & 0x10; // see bbakraid_eeprom_r above
}
INTERRUPT_GEN_MEMBER(truxton2_state::bbakraid_snd_interrupt)
{
device.execute().set_input_line(0, HOLD_LINE);
}
void toaplan2_state::tekipaki_68k_mem(address_map &map)
{
map(0x000000, 0x01ffff).rom();
map(0x020000, 0x03ffff).rom(); // extra for Whoopee
map(0x080000, 0x082fff).ram();
map(0x0c0000, 0x0c0fff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0x140000, 0x14000d).rw(m_vdp[0], FUNC(gp9001vdp_device::read), FUNC(gp9001vdp_device::write));
map(0x180000, 0x180001).portr("DSWA");
map(0x180010, 0x180011).portr("DSWB");
map(0x180020, 0x180021).portr("SYS");
map(0x180030, 0x180031).portr("JMPR"); // CPU 2 busy and Region Jumper block
map(0x180041, 0x180041).w(FUNC(toaplan2_state::coin_w));
map(0x180050, 0x180051).portr("IN1");
map(0x180060, 0x180061).portr("IN2");
map(0x180071, 0x180071).w(m_soundlatch[0], FUNC(generic_latch_8_device::write));
}
void ghox_state::ghox_68k_mem(address_map &map)
{
map(0x000000, 0x03ffff).rom();
map(0x040000, 0x040001).r(FUNC(ghox_state::ghox_h_analog_r<1>));
map(0x080000, 0x083fff).ram();
map(0x0c0000, 0x0c0fff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0x100000, 0x100001).r(FUNC(ghox_state::ghox_h_analog_r<0>));
map(0x140000, 0x14000d).rw(m_vdp[0], FUNC(gp9001vdp_device::read), FUNC(gp9001vdp_device::write));
map(0x180000, 0x180fff).rw(FUNC(ghox_state::shared_ram_r), FUNC(ghox_state::shared_ram_w)).umask16(0x00ff);
map(0x181001, 0x181001).w(FUNC(ghox_state::coin_w));
map(0x18100c, 0x18100d).portr("JMPR");
}
void toaplan2_state::dogyuun_68k_mem(address_map &map)
{
map(0x000000, 0x07ffff).rom();
map(0x100000, 0x103fff).ram();
map(0x200010, 0x200011).portr("IN1");
map(0x200014, 0x200015).portr("IN2");
map(0x200018, 0x200019).portr("SYS");
map(0x20001d, 0x20001d).w(FUNC(toaplan2_state::coin_sound_reset_w)); // Coin count/lock + v25 reset line
map(0x210000, 0x21ffff).rw(FUNC(toaplan2_state::shared_ram_r), FUNC(toaplan2_state::shared_ram_w)).umask16(0x00ff);
map(0x300000, 0x30000d).rw(m_vdp[0], FUNC(gp9001vdp_device::read), FUNC(gp9001vdp_device::write));
map(0x400000, 0x400fff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0x500000, 0x50000d).rw(m_vdp[1], FUNC(gp9001vdp_device::read), FUNC(gp9001vdp_device::write));
map(0x700000, 0x700001).r(FUNC(toaplan2_state::video_count_r)); // test bit 8
}
void toaplan2_state::dogyuunto_68k_mem(address_map &map)
{
map(0x000000, 0x07ffff).rom();
map(0x100000, 0x103fff).ram();
map(0x218000, 0x218fff).rw(FUNC(toaplan2_state::shared_ram_r), FUNC(toaplan2_state::shared_ram_w)).umask16(0x00ff); // reads the same area as the finished game on startup, but then uses only this part
map(0x21c01d, 0x21c01d).w(FUNC(toaplan2_state::coin_sound_reset_w)); // Coin count/lock + Z80 reset line
map(0x21c020, 0x21c021).portr("IN1");
map(0x21c024, 0x21c025).portr("IN2");
map(0x21c028, 0x21c029).portr("SYS");
map(0x21c02c, 0x21c02d).portr("DSWA");
map(0x21c030, 0x21c031).portr("DSWB");
map(0x300000, 0x30000d).rw(m_vdp[0], FUNC(gp9001vdp_device::read), FUNC(gp9001vdp_device::write));
map(0x400000, 0x400fff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0x500000, 0x50000d).rw(m_vdp[1], FUNC(gp9001vdp_device::read), FUNC(gp9001vdp_device::write));
map(0x700000, 0x700001).r(FUNC(toaplan2_state::video_count_r)); // test bit 8
}
void toaplan2_state::kbash_68k_mem(address_map &map)
{
map(0x000000, 0x07ffff).rom();
map(0x100000, 0x103fff).ram();
map(0x200000, 0x200fff).rw(FUNC(toaplan2_state::shared_ram_r), FUNC(toaplan2_state::shared_ram_w)).umask16(0x00ff);
map(0x208010, 0x208011).portr("IN1");
map(0x208014, 0x208015).portr("IN2");
map(0x208018, 0x208019).portr("SYS");
map(0x20801d, 0x20801d).w(FUNC(toaplan2_state::coin_w));
map(0x300000, 0x30000d).rw(m_vdp[0], FUNC(gp9001vdp_device::read), FUNC(gp9001vdp_device::write));
map(0x400000, 0x400fff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0x700000, 0x700001).r(FUNC(toaplan2_state::video_count_r)); // test bit 8
}
void toaplan2_state::kbash2_68k_mem(address_map &map)
{
map(0x000000, 0x07ffff).rom();
map(0x100000, 0x103fff).ram();
map(0x104000, 0x10401f).ram(); // Sound related?
map(0x200000, 0x200001).noprw(); // Left over from original code - Sound Number write, Status read
map(0x200002, 0x200003).nopw(); // Left over from original code - Reset Sound
map(0x200004, 0x200005).portr("DSWA");
map(0x200008, 0x200009).portr("DSWB");
map(0x20000c, 0x20000d).portr("JMPR");
map(0x200010, 0x200011).portr("IN1");
map(0x200014, 0x200015).portr("IN2");
map(0x200018, 0x200019).portr("SYS");
map(0x200021, 0x200021).rw(m_oki[1], FUNC(okim6295_device::read), FUNC(okim6295_device::write));
map(0x200025, 0x200025).rw(m_oki[0], FUNC(okim6295_device::read), FUNC(okim6295_device::write));
map(0x200029, 0x200029).w(FUNC(toaplan2_state::oki_bankswitch_w<0>));
map(0x20002c, 0x20002d).r(FUNC(toaplan2_state::video_count_r));
map(0x300000, 0x30000d).rw(m_vdp[0], FUNC(gp9001vdp_device::read), FUNC(gp9001vdp_device::write));
map(0x400000, 0x400fff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
}
void truxton2_state::truxton2_68k_mem(address_map &map)
{
map(0x000000, 0x07ffff).rom();
map(0x100000, 0x10ffff).ram();
map(0x200000, 0x20000d).rw(m_vdp[0], FUNC(gp9001vdp_device::read), FUNC(gp9001vdp_device::write));
map(0x300000, 0x300fff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0x400000, 0x401fff).ram().w(FUNC(truxton2_state::tx_videoram_w)).share(m_tx_videoram);
map(0x402000, 0x402fff).ram().share(m_tx_lineselect);
map(0x403000, 0x4031ff).ram().w(FUNC(truxton2_state::tx_linescroll_w)).share(m_tx_linescroll);
map(0x403200, 0x403fff).ram();
map(0x500000, 0x50ffff).ram().w(FUNC(truxton2_state::tx_gfxram_w)).share(m_tx_gfxram);
map(0x600000, 0x600001).r(FUNC(truxton2_state::video_count_r));
map(0x700000, 0x700001).portr("DSWA");
map(0x700002, 0x700003).portr("DSWB");
map(0x700004, 0x700005).portr("JMPR");
map(0x700006, 0x700007).portr("IN1");
map(0x700008, 0x700009).portr("IN2");
map(0x70000a, 0x70000b).portr("SYS");
map(0x700011, 0x700011).rw(m_oki[0], FUNC(okim6295_device::read), FUNC(okim6295_device::write));
map(0x700014, 0x700017).rw("ymsnd", FUNC(ym2151_device::read), FUNC(ym2151_device::write)).umask16(0x00ff);
map(0x70001f, 0x70001f).w(FUNC(truxton2_state::coin_w));
}
void toaplan2_state::pipibibs_68k_mem(address_map &map)
{
map(0x000000, 0x03ffff).rom();
map(0x080000, 0x082fff).ram();
map(0x0c0000, 0x0c0fff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0x140000, 0x14000d).rw(m_vdp[0], FUNC(gp9001vdp_device::read), FUNC(gp9001vdp_device::write));
map(0x190000, 0x190fff).rw(FUNC(toaplan2_state::shared_ram_r), FUNC(toaplan2_state::shared_ram_w)).umask16(0x00ff);
map(0x19c01d, 0x19c01d).w(FUNC(toaplan2_state::coin_w));
map(0x19c020, 0x19c021).portr("DSWA");
map(0x19c024, 0x19c025).portr("DSWB");
map(0x19c028, 0x19c029).portr("JMPR");
map(0x19c02c, 0x19c02d).portr("SYS");
map(0x19c030, 0x19c031).portr("IN1");
map(0x19c034, 0x19c035).portr("IN2");
}
// odd scroll registers
void toaplan2_state::pipibibi_bootleg_68k_mem(address_map &map)
{
map(0x000000, 0x03ffff).rom();
map(0x080000, 0x082fff).ram();
map(0x083000, 0x0837ff).rw(m_vdp[0], FUNC(gp9001vdp_device::bootleg_spriteram16_r), FUNC(gp9001vdp_device::bootleg_spriteram16_w)); // SpriteRAM
map(0x083800, 0x087fff).ram(); // SpriteRAM (unused)
map(0x0c0000, 0x0c0fff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0x120000, 0x120fff).ram(); // Copy of SpriteRAM ?
// map(0x13f000, 0x13f001).nopw(); // ???
map(0x180000, 0x182fff).rw(m_vdp[0], FUNC(gp9001vdp_device::bootleg_videoram16_r), FUNC(gp9001vdp_device::bootleg_videoram16_w)); // TileRAM
map(0x188000, 0x18800f).w(m_vdp[0], FUNC(gp9001vdp_device::bootleg_scroll_w));
map(0x190003, 0x190003).r(FUNC(toaplan2_state::shared_ram_r)); // Z80 ready ?
map(0x190011, 0x190011).w(FUNC(toaplan2_state::shared_ram_w)); // Z80 task to perform
map(0x19c01d, 0x19c01d).w(FUNC(toaplan2_state::coin_w));
map(0x19c020, 0x19c021).portr("DSWA");
map(0x19c024, 0x19c025).portr("DSWB");
map(0x19c028, 0x19c029).portr("JMPR");
map(0x19c02c, 0x19c02d).portr("SYS");
map(0x19c030, 0x19c031).portr("IN1");
map(0x19c034, 0x19c035).portr("IN2");
}