/
taitopjc.cpp
1299 lines (1095 loc) · 58.5 KB
/
taitopjc.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:Philip Bennett
/*
Taito Power-JC System
Preliminary driver
Hardware appears sufficiently different to JC system to warrant
a separate driver.
TODO:
- Inconsistent frame rate compared to PCB recordings; game has a tendency to freeze frame hiccup
- Analog inputs update at a slower rate (about every 8-10 frames instead of every frame); this issue
is also present in taitotz.cpp
- Hook up remaining sound / Zoom hardware - see /src/sony/taito_zm.cpp for reference
PCB layout by Brian Troha, thanks to Luke Morse for photos & verification of parts.
Operation Tiger, (c)1998
POWER JC MOTHER-G PCB K11X0870A OPERATION TIGER
+----------------------------------------------------------------------------------------------------+
| |-----------M Connector---------| |-----------X Connector---------| |
| +---------+ |
| QS32X245 x 3 ABT16245 x 3 E63-05 |D481850GF| D4516161 D4516161 |
| +---------+ |
| |
| +----------+ +----------+ |
| D3N03 | | | | IS61LV256 |
| | PowerPC | | Taito | +------+ |
| MAX767 | 603E | | TCG010PJC| |QS5993| IS61LV256 |
| | QFP240 | | QFP240 | +------+ +--------+ |
| +----------+ +----------+ IS61LV256 |CXD1178Q| AD813 |
| +--------+ |
| 16.5000MHz |
| |
| 40.0000MHz TMS418160 +----------+ +-+
| | | D4624456 +----------+ |C|
| +----------+ +----------+ TMS418160 | Taito | | | |o|
| | | | | | TCO780PFA| D4624456 | Heat | |n|
| | TMS320C53| | IDT7024 | E63-06 | QFP240 | | Sink | |n| Connects to
| | PQ80| | QFP84 | QS32X245 +----------+ | for | |e| filter board
| | QFP116| | | E63-07 | AMP | |c|
| +----------+ +----------+ +----------+ D4624456 | | |t|
| | | +----------+ |o|
| TMS418160 | Taito | D4624456 |r|
| IS61C256 E63-01 | TCO780PFA| +----------+ +-+
| TMS418160 | QFP240 | | | |
| +----------+ | Heat | |
| IS61C256 E63-02 ABT16245 M514256 | Sink | |
| +---------+ | for | |
| ABT16245 E63-03 E63-04 |NM1020819| +-------+ | AMP | |
| +---------+ | ZFX-2 | | | |
| IDT7201 IDT7201 E63-08 +-------+ +----------+ |
| |
| IS61C256 +-------+ 25.0000MHz |
| | ZSG-2 | |
| ABT16245 IS61C256 ABT16245 x 2 +-------+ MB87078 6379 NJM2100 |
| |
| |-----------J Connector---------| |-----------K Connector---------| |
+----------------------------------------------------------------------------------------------------+
OSC1 40.0000MHz
OSC2 16.5000MHz
OSC3 25.0000MHz
Main CPU:
PowerPC-603E QFP240 (driven by IDT QS5993 Clock Driver @ 100MHz?)
Video:
TMS320BC53PQ80 QFP116 (rated for 80MHz, driven by 40.0000MHz OSC or 40.0000MHz x 2 by IDT QS5993 Clock Driver?)
Taito TCG010PJC QFP240
Taito TCO780PFG QFP240 Polygon Renderer
Sony CXD1178Q QFP48 8-bit High-Speed D/A converter for video band (RGB 3_channel input/output)
Sound:
Panasonic MN1020819 QFP64 16-Bit Single Chip Microcomputer with 64K x 8 ROM, 3K x 8 RAM (Operational speed of 10MHz-20MHz, driven by 25.0000MHz OSC / 2)
ZOOM ZFX-2 QFP100 DSP (Functionally identical to TMS57002, driven by 25.0000MHz OSC)
ZOOM ZSG-2 QFP100 Sound PCM chip (driven by 25.0000MHz OSC)
uDP6379 2-Channel 16-Bit D/A Audio Converter
MB87078 6-Bit / 4-Channel Electric Volume Controller
NJM2100 Dual Operational AMP
ROMs:
E63-03 & E63-04 are AT27C512 EPROMs and are TMS320BC53PQ80 program ROMs
RAM:
IDT7024 QFP84 4K x 16 Dual-Port SRAM
IDT7201 PLCC32 512 x 9 First-In/First-Out Dual-Port Memory
NEC D4516161AG5 1M x 8 x 2 16M-bit Synchronous DRAM (silkscreened MB81171622)
NEC D481850GF-A12 QFP100 2 x 128K x 16 32-bit Synchronous Graphics RAM (silscreened NEC MB81G83222)
IS61LV256-15J 32K x 8 Low Voltage CMOS SRAM (silkscreened IS61LV256AH)
TMS418160ADZ-60 1Mb x 16-Bit DRAM (Character Sprite RAM)
IS61C256AH-15J 32K x 8 High-Speed CMOS SRAM
NEC uDP482445GW-70 128K x 8 CMOS SRAM
OKI M514256C-70J 256K x 4 Fast Page DRAM (silkscreened MSM514256)
Misc:
IDT QS5993 PLCC32 PLL Clock Driver Turboclock, 6.25MHz-100MHz (silkscreened CY7B991)
D3N03 Power MOSFET 3 Amps, 30 Volts
Maxim MAX767CAP 5V to 3.3V Synchronous Step-Down Power-Supply Controller
QS32X245 High-Speed CMOS QuickSwitch Double Width Bus Switch
ABT16245 16-Bit Bus Transceiver with TriState Outputs
J,K, M & X 3x32 pin connector connect to POWER JC DAUGHTER PCB (Male with KEY blocks)
PALs:
E63-01 CE16C8H PAL
E63-02 CE22C10H PAL
E63-05 CE16C8H PAL
E63-06 CE16C8H PAL
E63-07 CE16C8H PAL
E63-08 CE16C8H PAL
POWER JC DAUGHTER PCB K91E0717B OPERATION TIGER
+----------------------------------------------------------------------------------------------------+
| |-----------J Connector---------| |-----------K Connector---------| |
| |
| IDT74FCT |
| |
| IDT74FCT |
| LC321664AM |
| |
| Taito E63-09 E63 17-1 Taito E63-23 E63 27-1 |
| |
| |
| Taito E63-10 E63 18-1 Taito E63-24 IDT74FCT E63 28-1 |
| |
| |
| Taito E63-11 M66220 Taito E63-25 LC3564SM RESET |
| +-+
| |C|
| * Taito E63-26 RTC64613A C5 |o|
| |n|
| |n| Connects to
| E63 30-1 E63 32-1 25.0000MHz |e| filter board
| +----------+ |c|
| |Toshiba | |t|
| E63 31-1 E63 33-1 |TMP95C063F| |o|
| +----------+ 1.84320MHz |r|
| +-+
| Taito E63-15 Taito E63-21 TLP121-4 |
| |
| |
| Taito E63-16 Taito E63-22 +----------+ TLP121-4 |
| | | |
| | IDT7024 | |
| | QFP84 | TLP121-4 |
| IDT74FCT IDT74FCT IDT74FCT | | |
| +----------+ |
| TLP121-4 |
| |
| |
| |-----------W Connector---------| |-----------X Connector---------| |
+----------------------------------------------------------------------------------------------------+
* Unpopulated socket for 4th polygon data ROM
OSC1 25.0000MHz
OSC2 1.84320MHz
CPU:
Toshiba TMP95C063F 16-Bit CMOS Microcontroller (driven by 25.0000MHz OSC)
ROMs:
8 EPROMs
- E63 30-1 through E63 32-1 are PowerPC program ROMs
- E63 17-1 & E63 18-1 are Panasonic MN1020819 program ROMs to drive Zoom chips / sound
- E63 27-1 & E62 28-1 are Toshiba TMP95C063F program ROMs for I/O
11 mask ROMs
- 4 graphics ROMs (E63-15, E63-16, E63-21 & E63-22)
- 4 Zoom ZSG-2 samples (E63-23 through E63-26)
- 3 polygon data ROMs (E63-09 through E63-11)
RAM:
IDT7024 QFP84 4K x 16 Dual-Port SRAM
Sanyo LC3564BM-70 64K x 8 SRAM
Sanyo LC321664AM-80 64K x 16 Fast Page DRAM
M66220FP 256 x 8-bit Dual Port CMOS Mail Box RAM
MISC:
Reset Push Button
IDT 74 FCT 16245 CTPA 16-Bit Fast CMOS Bidirection Transceiver (silkscreened FTC16245C)
Epson RTC64613A 8-Bit Real Time Clock Module with builtin crystal
C5 is a Super-Cap, supplies back-up power to the RTC
TLP121-4 Four Channel Photo Transistor, optically coupled to a gallium arsenide InfraRed emitting diode
J,K, W & X 3x32 pin connector to connect to POWER JC MOTHER-G PCB (Female with KEY receivers)
Note:
PCB found labeled as K91E0717B came with Operation Tiger Ver 2.14 O
PCB found labeled as K91E0717A came with Operation Tiger Ver 2.10 O
POWER JC FILTER PCB
+----------------------------------------------------------------------------------------------------+
| |
| |
| S...... ......V |
| 6 1 6 1 |
| *RS |
| |
| 111112222233333444445 |
| 2468024680246802468024680 |
| P......... |=========================|G |
| 1 9 11111222223333344444 *MIDI |
| 1357913579135791357913579 |
+----------------------------------------------------------------------------------------------------+
* Unpopulated components
V)ideo Connector, 6 pins | S)ound Connector, 6 pins
----------------------------+--------------------------------
1] Red | 1] Sound R(-)
2] Green | 2] Sound R(+)
3] Blue | 3] Sound L(-)
4] SYNC | 4] Sound L(+)
5] GND | 5] W SND (-) [Subwoofer]
6] GND | 6] W SND (+) [Subwoofer]
P)ower Connector, 9 pins
------------------------
1] +12 Volts
2] +13 Volts
3] +5 Volts
4] +5 Volts
5] +5 Volts
6] Ground
7] Ground
8] Ground
9] Ground
G)ame Connector, dual row 50 pins
----------------------------------------------
1] Meter 2]
3] Lockout 4]
5] 1P Solenoid A 6] 1P Solenoid B
7] 2P Solenoid A 8] 2P Solenoid B
9] 1P Start Lamp 10] 2P Start Lamp
11] 12]
13] 14]
15] 16]
17] 18]
19] 1P X Position 20] 1P Y Position
21] 2P X Position 22] 2P Y Position
23] 24]
25] 26]
27] 28] 1P Trigger
29] 30] 1P Bomb
31] 32] 2P Trigger
33] Service 34] 2P Bomb
35] Test 36]
37] 38] 1P Start
39] 2P Start 40] Coin
41] 42] +12 Volts
43] +12 Volts 44] +5 Volts
45] +5 Volts 46] +5 Volts
47] Ground 48] Ground
49] Ground 50] Ground
*/
/*
PPC -> TLCS Commands:
0x5010: ? RTC?
0x5020: ? RTC?
0x6000: ? Backup RAM init?
0x6010: ? Backup RAM Read. Address in io_shared[0x1d00].
0x6020: ? Backup RAM Write. Address in io_shared[0x1d00].
0x6030: ? ?
0x6040: ? ?
0x4000: ? Sound?
0x4001: ?
0x4002: ?
0x4003: ?
0x4004: ?
0xf055:
0xf0ff:
0xf000:
0xf001:
0xf010:
0xf020:
TLCS -> PPC Commands:
0x7000: DSP ready
0xd000: Vblank
*/
#include "emu.h"
#include "cpu/powerpc/ppc.h"
#include "cpu/tlcs900/tmp95c063.h"
#include "cpu/mn10200/mn10200.h"
#include "cpu/tms32051/tms32051.h"
#include "tc0780fpa.h"
#include "machine/nvram.h"
#include "emupal.h"
#include "screen.h"
#include "tilemap.h"
#define LOG_TLCS_TO_PPC_COMMANDS (1U << 1)
#define LOG_PPC_TO_TLCS_COMMANDS (1U << 2)
#define LOG_DISPLAY_LIST (1U << 3)
#define VERBOSE (0)
#include "logmacro.h"
namespace {
#define FATAL_UNKNOWN_CALLS (0)
class taitopjc_state : public driver_device
{
public:
taitopjc_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_iocpu(*this, "iocpu"),
m_soundcpu(*this, "mn10200"),
m_dsp(*this, "dsp"),
m_tc0780fpa(*this, "tc0780fpa"),
m_palette(*this, "palette"),
m_polyrom(*this, "poly"),
m_gfxdecode(*this, "gfxdecode"),
m_main_ram(*this, "main_ram")
{ }
void taitopjc(machine_config &config);
void init_optiger();
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
private:
required_device<ppc603e_device> m_maincpu;
required_device<tmp95c063_device> m_iocpu;
required_device<cpu_device> m_soundcpu;
required_device<cpu_device> m_dsp;
required_device<tc0780fpa_device> m_tc0780fpa;
required_device<palette_device> m_palette;
required_memory_region m_polyrom;
required_device<gfxdecode_device> m_gfxdecode;
required_shared_ptr<uint64_t> m_main_ram;
uint64_t video_r(offs_t offset, uint64_t mem_mask = ~0);
void video_w(offs_t offset, uint64_t data, uint64_t mem_mask = ~0);
uint64_t ppc_common_r(offs_t offset, uint64_t mem_mask = ~0);
void ppc_common_w(offs_t offset, uint64_t data, uint64_t mem_mask = ~0);
uint64_t dsp_r(offs_t offset, uint64_t mem_mask = ~0);
void dsp_w(offs_t offset, uint64_t data, uint64_t mem_mask = ~0);
uint8_t tlcs_common_r(offs_t offset);
void tlcs_common_w(offs_t offset, uint8_t data);
uint8_t tlcs_sound_r(offs_t offset);
void tlcs_sound_w(offs_t offset, uint8_t data);
void tlcs_unk_w(offs_t offset, uint16_t data);
uint16_t tms_dspshare_r(offs_t offset);
void tms_dspshare_w(offs_t offset, uint16_t data);
uint16_t dsp_rom_r();
void dsp_roml_w(uint16_t data);
void dsp_romh_w(uint16_t data);
uint32_t screen_update_taitopjc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(taitopjc_vbi);
uint32_t videochip_r(offs_t address);
void videochip_w(offs_t address, uint32_t data);
void video_exit();
[[maybe_unused]] void print_display_list();
TILE_GET_INFO_MEMBER(tile_get_info);
TILEMAP_MAPPER_MEMBER(tile_scan_layer0);
TILEMAP_MAPPER_MEMBER(tile_scan_layer1);
uint16_t m_dsp_ram[0x1000]{};
uint16_t m_io_share_ram[0x2000]{};
std::unique_ptr<uint32_t[]> m_screen_ram;
std::unique_ptr<uint32_t[]> m_pal_ram;
tilemap_t *m_tilemap[2]{};
uint32_t m_video_address = 0;
uint32_t m_dsp_rom_address = 0;
int m_scroll_x = 0;
int m_scroll_y = 0;
uint32_t m_tlcs_sound_ptr = 0;
void mn10200_map(address_map &map);
void ppc603e_mem(address_map &map);
void tlcs900h_mem(address_map &map);
void tms_data_map(address_map &map);
void tms_io_map(address_map &map);
void tms_program_map(address_map &map);
};
void taitopjc_state::video_exit()
{
#if 0
FILE *file;
int i;
file = fopen("pjc_screen_ram.bin","wb");
for (i=0; i < 0x40000; i++)
{
fputc((uint8_t)(m_screen_ram[i] >> 24), file);
fputc((uint8_t)(m_screen_ram[i] >> 16), file);
fputc((uint8_t)(m_screen_ram[i] >> 8), file);
fputc((uint8_t)(m_screen_ram[i] >> 0), file);
}
fclose(file);
file = fopen("pjc_pal_ram.bin","wb");
for (i=0; i < 0x8000; i++)
{
fputc((uint8_t)(m_pal_ram[i] >> 24), file);
fputc((uint8_t)(m_pal_ram[i] >> 16), file);
fputc((uint8_t)(m_pal_ram[i] >> 8), file);
fputc((uint8_t)(m_pal_ram[i] >> 0), file);
}
fclose(file);
#endif
}
TILE_GET_INFO_MEMBER(taitopjc_state::tile_get_info)
{
uint32_t val = m_screen_ram[0x3f000 + (tile_index/2)];
if (!(tile_index & 1))
val >>= 16;
int color = (val >> 12) & 0xf;
int tile = (val & 0xfff);
int flags = 0;
tileinfo.set(0, tile, color, flags);
}
TILEMAP_MAPPER_MEMBER(taitopjc_state::tile_scan_layer0)
{
/* logical (col,row) -> memory offset */
return (row * 64) + col;
}
TILEMAP_MAPPER_MEMBER(taitopjc_state::tile_scan_layer1)
{
/* logical (col,row) -> memory offset */
return (row * 64) + col + 4096;
}
void taitopjc_state::video_start()
{
static const gfx_layout char_layout =
{
16, 16,
4032,
8,
{ 0,1,2,3,4,5,6,7 },
{ 3*8, 2*8, 1*8, 0*8, 7*8, 6*8, 5*8, 4*8, 11*8, 10*8, 9*8, 8*8, 15*8, 14*8, 13*8, 12*8 },
{ 0*128, 1*128, 2*128, 3*128, 4*128, 5*128, 6*128, 7*128, 8*128, 9*128, 10*128, 11*128, 12*128, 13*128, 14*128, 15*128 },
8*256
};
m_screen_ram = std::make_unique<uint32_t[]>(0x40000);
m_pal_ram = std::make_unique<uint32_t[]>(0x8000);
m_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(taitopjc_state::tile_get_info)), tilemap_mapper_delegate(*this, FUNC(taitopjc_state::tile_scan_layer0)), 16, 16, 64, 64);
m_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(taitopjc_state::tile_get_info)), tilemap_mapper_delegate(*this, FUNC(taitopjc_state::tile_scan_layer1)), 16, 16, 64, 64);
m_tilemap[0]->set_transparent_pen(0);
m_tilemap[1]->set_transparent_pen(0);
m_gfxdecode->set_gfx(0, std::make_unique<gfx_element>(m_palette, char_layout, (uint8_t*)m_screen_ram.get(), 0, m_palette->entries() / 256, 0));
save_pointer(NAME(m_screen_ram), 0x40000);
save_pointer(NAME(m_pal_ram), 0x8000);
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(&taitopjc_state::video_exit, this));
}
uint32_t taitopjc_state::screen_update_taitopjc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
bitmap.fill(0x000000, cliprect);
m_tc0780fpa->draw(bitmap, cliprect);
m_tilemap[0]->set_scrollx(m_scroll_x);
m_tilemap[0]->set_scrolly(m_scroll_y);
m_tilemap[0]->draw(screen, bitmap, cliprect, 0);
m_tilemap[1]->draw(screen, bitmap, cliprect, 0);
return 0;
}
uint32_t taitopjc_state::videochip_r( offs_t address)
{
uint32_t r = 0;
if (address >= 0x10000000 && address < 0x10040000)
{
r = m_screen_ram[address - 0x10000000];
}
return r;
}
void taitopjc_state::videochip_w(offs_t address, uint32_t data)
{
if (address >= 0x20000000 && address < 0x20008000)
{
m_pal_ram[address - 0x20000000] = data;
int b = (data >> 16) & 0xff;
int g = (data >> 8) & 0xff;
int r = (data >> 0) & 0xff;
m_palette->set_pen_color(address - 0x20000000, rgb_t(r, g, b));
}
else if (address >= 0x10000000 && address < 0x10040000)
{
uint32_t addr = address - 0x10000000;
m_screen_ram[addr] = data;
if (address >= 0x1003f000 && address < 0x1003f800)
{
uint32_t a = address - 0x1003f000;
m_tilemap[0]->mark_tile_dirty((a * 2));
m_tilemap[0]->mark_tile_dirty((a * 2) + 1);
}
else if (address >= 0x1003f800 && address < 0x10040000)
{
uint32_t a = address - 0x1003f000;
m_tilemap[1]->mark_tile_dirty((a * 2));
m_tilemap[1]->mark_tile_dirty((a * 2) + 1);
}
else
{
m_gfxdecode->gfx(0)->mark_dirty(addr / 64);
}
}
else if (address == 0x00000006)
{
m_scroll_y = (data >> 16) & 0xffff;
m_scroll_x = data & 0xffff;
}
else
{
printf("Address %08X = %08X\n", address, data);
}
}
uint64_t taitopjc_state::video_r(offs_t offset, uint64_t mem_mask)
{
uint64_t r = 0;
if (offset == 0)
{
if (ACCESSING_BITS_32_63)
{
r |= (uint64_t)(videochip_r(m_video_address)) << 32;
}
}
return r;
}
void taitopjc_state::video_w(offs_t offset, uint64_t data, uint64_t mem_mask)
{
if (offset == 0)
{
if (ACCESSING_BITS_32_63)
{
//printf("Address %08X = %08X\n", video_address, (uint32_t)(data >> 32));
videochip_w(m_video_address, (uint32_t)(data >> 32));
}
}
if (offset == 1)
{
if (ACCESSING_BITS_32_63)
{
m_video_address = (uint32_t)(data >> 32);
}
}
}
uint64_t taitopjc_state::ppc_common_r(offs_t offset, uint64_t mem_mask)
{
uint64_t r = 0;
uint32_t address;
//logerror("ppc_common_r: %08X, %08X%08X\n", offset, (uint32_t)(mem_mask >> 32), (uint32_t)(mem_mask));
address = offset * 2;
if (ACCESSING_BITS_48_63)
{
r |= (uint64_t)(m_io_share_ram[address]) << 48;
}
if (ACCESSING_BITS_16_31)
{
r |= (uint64_t)(m_io_share_ram[address+1]) << 16;
}
return r;
}
void taitopjc_state::ppc_common_w(offs_t offset, uint64_t data, uint64_t mem_mask)
{
uint32_t address = offset * 2;
// logerror("ppc_common_w: %08X, %X, %X\n", offset, data, mem_mask);
if (ACCESSING_BITS_48_63)
{
m_io_share_ram[address] = (uint16_t)(data >> 48);
}
if (ACCESSING_BITS_16_31)
{
m_io_share_ram[address+1] = (uint16_t)(data >> 16);
}
if (offset == 0x7ff && ACCESSING_BITS_48_63)
{
if (m_io_share_ram[0xfff] != 0x0000)
{
LOGMASKED(LOG_PPC_TO_TLCS_COMMANDS, "PPC -> TLCS cmd %04X\n", m_io_share_ram[0xfff]);
}
m_iocpu->set_input_line(TLCS900_INT6, ASSERT_LINE);
m_maincpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE);
m_maincpu->abort_timeslice();
}
}
uint64_t taitopjc_state::dsp_r(offs_t offset, uint64_t mem_mask)
{
uint64_t r = 0;
if (ACCESSING_BITS_48_63)
{
int addr = offset * 2;
r |= (uint64_t)(m_dsp_ram[addr+0]) << 48;
}
if (ACCESSING_BITS_16_31)
{
int addr = offset * 2;
r |= (uint64_t)(m_dsp_ram[addr+1]) << 16;
}
return r;
}
void taitopjc_state::print_display_list()
{
int ptr = 0;
uint16_t cmd = m_dsp_ram[0xffe];
if (cmd == 0x5245)
{
logerror("DSP command RE\n");
bool end = false;
do
{
uint16_t w = m_dsp_ram[ptr++];
if (w & 0x8000)
{
int count = (w & 0x7fff) + 1;
uint16_t d = m_dsp_ram[ptr++];
for (int i=0; i < count; i++)
{
uint16_t s = m_dsp_ram[ptr++];
logerror(" %04X -> [%04X]\n", s, d);
d++;
}
}
else if (w == 0)
{
end = true;
}
else
{
switch (w)
{
case 0x406d:
logerror(" Call %04X [%04X %04X]\n", w, m_dsp_ram[ptr], m_dsp_ram[ptr+1]);
ptr += 2;
break;
case 0x40cd:
logerror(" Call %04X [%04X %04X]\n", w, m_dsp_ram[ptr], m_dsp_ram[ptr+1]);
ptr += 2;
break;
case 0x40ac:
logerror(" Call %04X [%04X %04X %04X %04X %04X %04X %04X %04X]\n", w, m_dsp_ram[ptr], m_dsp_ram[ptr+1], m_dsp_ram[ptr+2], m_dsp_ram[ptr+3], m_dsp_ram[ptr+4], m_dsp_ram[ptr+5], m_dsp_ram[ptr+6], m_dsp_ram[ptr+7]);
ptr += 8;
break;
case 0x4774:
logerror(" Call %04X [%04X %04X %04X]\n", w, m_dsp_ram[ptr], m_dsp_ram[ptr+1], m_dsp_ram[ptr+2]);
ptr += 3;
break;
case 0x47d9:
logerror(" Call %04X [%04X %04X %04X %04X %04X %04X %04X %04X]\n", w, m_dsp_ram[ptr], m_dsp_ram[ptr+1], m_dsp_ram[ptr+2], m_dsp_ram[ptr+3], m_dsp_ram[ptr+4], m_dsp_ram[ptr+5], m_dsp_ram[ptr+6], m_dsp_ram[ptr+7]);
ptr += 8;
break;
default:
{
logerror("Unknown call %04X\n", w);
for (int i=0; i < 10; i++)
{
logerror("%04X\n", m_dsp_ram[ptr++]);
}
if (FATAL_UNKNOWN_CALLS)
fatalerror("Unknown call %04X\n", w);
break;
}
}
}
} while(!end);
}
else
{
if (cmd != 0)
logerror("DSP command %04X\n", cmd);
return;
}
}
void taitopjc_state::dsp_w(offs_t offset, uint64_t data, uint64_t mem_mask)
{
//logerror("dsp_w: %08X, %08X%08X, %08X%08X at %08X\n", offset, (uint32_t)(data >> 32), (uint32_t)(data), (uint32_t)(mem_mask >> 32), (uint32_t)(mem_mask), m_maincpu->pc());
if (offset == 0x7fe)
{
#if 0
{
int i;
FILE *f = fopen("dspram.bin", "wb");
for (i=0; i < 0x1000; i++)
{
fputc((dsp_ram[i] >> 0) & 0xff, f);
fputc((dsp_ram[i] >> 8) & 0xff, f);
}
fclose(f);
}
#endif
#if (VERBOSE & LOG_DISPLAY_LIST)
print_display_list();
#endif
}
if (ACCESSING_BITS_48_63)
{
int addr = offset * 2;
m_dsp_ram[addr+0] = (data >> 48) & 0xffff;
}
if (ACCESSING_BITS_16_31)
{
int addr = offset * 2;
m_dsp_ram[addr+1] = (data >> 16) & 0xffff;
}
}
// BAT Config:
// IBAT0 U: 0x40000002 L: 0x40000022 (0x40000000...0x4001ffff)
// IBAT1 U: 0x0000007f L: 0x00000002 (0x00000000...0x003fffff)
// IBAT2 U: 0xc0000003 L: 0xc0000022 (0xc0000000...0xc001ffff)
// IBAT3 U: 0xfe0003ff L: 0xfe000022 (0xfe000000...0xffffffff)
// DBAT0 U: 0x40000002 L: 0x40000022 (0x40000000...0x4001ffff)
// DBAT1 U: 0x0000007f L: 0x00000002 (0x00000000...0x003fffff)
// DBAT2 U: 0xc0000003 L: 0xc0000022 (0xc0000000...0xc001ffff)
// DBAT3 U: 0xfe0003ff L: 0xfe000022 (0xfe000000...0xffffffff)
void taitopjc_state::ppc603e_mem(address_map &map)
{
map(0x00000000, 0x003fffff).ram().share(m_main_ram); // Work RAM
map(0x40000000, 0x4000000f).rw(FUNC(taitopjc_state::video_r), FUNC(taitopjc_state::video_w));
map(0x80000000, 0x80003fff).rw(FUNC(taitopjc_state::dsp_r), FUNC(taitopjc_state::dsp_w));
map(0xc0000000, 0xc0003fff).rw(FUNC(taitopjc_state::ppc_common_r), FUNC(taitopjc_state::ppc_common_w));
map(0xfe800000, 0xff7fffff).rom().region("gfx1", 0);
map(0xffe00000, 0xffffffff).rom().region("user1", 0);
}
uint8_t taitopjc_state::tlcs_common_r(offs_t offset)
{
if (offset & 1)
{
return (uint8_t)(m_io_share_ram[offset / 2] >> 8);
}
else
{
return (uint8_t)(m_io_share_ram[offset / 2]);
}
}
void taitopjc_state::tlcs_common_w(offs_t offset, uint8_t data)
{
if (offset & 1)
{
m_io_share_ram[offset / 2] &= 0x00ff;
m_io_share_ram[offset / 2] |= (uint16_t)(data) << 8;
}
else
{
m_io_share_ram[offset / 2] &= 0xff00;
m_io_share_ram[offset / 2] |= data;
}
if (offset == 0x1fff)
{
m_iocpu->set_input_line(TLCS900_INT6, CLEAR_LINE);
}
if (offset == 0x1ffd)
{
if (m_io_share_ram[0xffe] != 0xd000 &&
m_io_share_ram[0xffe] != 0x7000)
{
LOGMASKED(LOG_TLCS_TO_PPC_COMMANDS, "TLCS -> PPC cmd %04X\n", m_io_share_ram[0xffe]);
}
if (m_io_share_ram[0xffe] == 0xd000)
m_iocpu->set_input_line(TLCS900_INT1, CLEAR_LINE);
if (m_io_share_ram[0xffe] == 0x7000)
m_iocpu->set_input_line(TLCS900_INT2, CLEAR_LINE);
if (m_io_share_ram[0xffe] != 0)
m_maincpu->set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE);
m_iocpu->abort_timeslice();
}
}
uint8_t taitopjc_state::tlcs_sound_r(offs_t offset)
{
if (offset == 0x15)
{
return m_tlcs_sound_ptr & 0x7f;
}
else if (offset == 0x17)
{
return 0x55;
}
else if (offset >= 0x80 && offset < 0x100)
{
m_tlcs_sound_ptr++;
}
return 0;
}
void taitopjc_state::tlcs_sound_w(offs_t offset, uint8_t data)
{
// printf("tlcs_sound_w: %08X, %02X\n", offset, data);
}
void taitopjc_state::tlcs_unk_w(offs_t offset, uint16_t data)
{
if (offset == 0xc/2)
{
int reset = (data & 0x4) ? ASSERT_LINE : CLEAR_LINE;
m_maincpu->set_input_line(INPUT_LINE_RESET, reset);
}
}
// TLCS900 interrupt vectors
// 0xfc0100: reset
// 0xfc00ea: INT0 (dummy)
// 0xfc00eb: INT1 vblank?
// 0xfc00f0: INT2 DSP ready?
// 0xfc00f5: INT3 (dummy)
// 0xfc00f6: INT4 (dummy)
// 0xfc00f7: INT5 (dummy)
// 0xfc00f8: INT6 PPC command
// 0xfc00fd: INT7 (dummy)
// 0xfc00fe: int8_t (dummy)
// 0xfc0663: INTT1
// 0xfc0f7d: INTRX0
// 0xfc0f05: INTTX0
// 0xfc0fb5: INTRX1
// 0xfc0f41: INTTX1
void taitopjc_state::tlcs900h_mem(address_map &map)
{
map(0x010000, 0x02ffff).ram(); // Work RAM
map(0x040000, 0x0400ff).rw(FUNC(taitopjc_state::tlcs_sound_r), FUNC(taitopjc_state::tlcs_sound_w));
map(0x044000, 0x045fff).ram().share("nvram");
map(0x060000, 0x061fff).rw(FUNC(taitopjc_state::tlcs_common_r), FUNC(taitopjc_state::tlcs_common_w));
map(0x06c000, 0x06c00f).w(FUNC(taitopjc_state::tlcs_unk_w));
map(0xfc0000, 0xffffff).rom().region("iocpu", 0);
}
void taitopjc_state::mn10200_map(address_map &map)
{
map(0x080000, 0x0fffff).rom().region("mn10200", 0);
}
uint16_t taitopjc_state::tms_dspshare_r(offs_t offset)
{
return m_dsp_ram[offset];
}
void taitopjc_state::tms_dspshare_w(offs_t offset, uint16_t data)
{
if (offset == 0xffc)
{
m_iocpu->set_input_line(TLCS900_INT2, ASSERT_LINE);
}
m_dsp_ram[offset] = data;
}
uint16_t taitopjc_state::dsp_rom_r()
{
assert(m_dsp_rom_address < 0x800000);
uint16_t data = ((uint16_t*)m_polyrom->base())[m_dsp_rom_address];
m_dsp_rom_address++;
return data;
}
void taitopjc_state::dsp_roml_w(uint16_t data)
{
m_dsp_rom_address &= 0xffff0000;
m_dsp_rom_address |= data;
}
void taitopjc_state::dsp_romh_w(uint16_t data)
{
m_dsp_rom_address &= 0xffff;
m_dsp_rom_address |= (uint32_t)(data) << 16;
}
void taitopjc_state::tms_program_map(address_map &map)
{
map(0x0000, 0x3fff).rom().region("dspdata", 0);
map(0x4c00, 0xefff).rom().region("dspdata", 0x9800);
}
void taitopjc_state::tms_data_map(address_map &map)
{
map(0x4000, 0x6fff).rom().region("dspdata", 0x8000);
map(0x7000, 0xefff).ram();
map(0xf000, 0xffff).rw(FUNC(taitopjc_state::tms_dspshare_r), FUNC(taitopjc_state::tms_dspshare_w));
}
void taitopjc_state::tms_io_map(address_map &map)
{
map(0x0053, 0x0053).w(FUNC(taitopjc_state::dsp_roml_w));
map(0x0057, 0x0057).w(FUNC(taitopjc_state::dsp_romh_w));
map(0x0058, 0x0058).w(m_tc0780fpa, FUNC(tc0780fpa_device::poly_fifo_w));
map(0x005a, 0x005a).w(m_tc0780fpa, FUNC(tc0780fpa_device::tex_w));
map(0x005b, 0x005b).rw(m_tc0780fpa, FUNC(tc0780fpa_device::tex_addr_r), FUNC(tc0780fpa_device::tex_addr_w));
map(0x005e, 0x005e).noprw(); // ?? 0x0001 written every frame
map(0x005f, 0x005f).r(FUNC(taitopjc_state::dsp_rom_r));
}
static INPUT_PORTS_START( taitopjc )
PORT_START("INPUTS1")
PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_COIN1 ) // Coin A
PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x00000080, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("INPUTS2")
PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Service") PORT_CODE(KEYCODE_7) // Service switch
PORT_SERVICE_NO_TOGGLE( 0x00000002, IP_ACTIVE_LOW) // Test Button
PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_START1 ) // Select 1
PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_START2 ) // Select 2
PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x00000080, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("INPUTS3")
PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) // P1 trigger
PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) // P1 bomb
PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) // P2 trigger
PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) // P2 bomb
PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x00000080, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("ANALOG1") // Player 1 X
PORT_BIT(0x3ff, 0x200, IPT_AD_STICK_X) PORT_CROSSHAIR(X, -1.0, 0.0, 0) PORT_MINMAX(0x000, 0x3ff) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(1) PORT_REVERSE
PORT_START("ANALOG2") // Player 1 Y
PORT_BIT(0x3ff, 0x200, IPT_AD_STICK_Y) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_MINMAX(0x000, 0x3ff) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(1)