1 // license:BSD-3-Clause
2 // copyright-holders:Ville Linde
3 /*  Konami Hornet System
4     Driver by Ville Linde
5 
6 
7     Konami 'Hornet' Hardware
8     Konami, 1997-2000
9 
10     Known games on this hardware include....
11 
12     Game                             (C)      Year
13     ----------------------------------------------
14     Gradius 4 : Fukkatsu             Konami   1998
15     NBA Play by Play                 Konami   1998
16     Teraburst                        Konami   1998
17     Silent Scope                     Konami   1999
18     Silent Scope 2                   Konami   2000
19 
20     Hardware overview:
21 
22     GN715 CPU Board:
23     ----------------
24         IBM PowerPC 403GA at 32MHz (main CPU)
25         Motorola MC68EC000 at 16MHz (sound CPU)
26         Konami K056800 (MIRAC), sound system interface
27         Ricoh RF5c400 sound chip
28 
29     GN715 GFX Board:
30     ----------------
31         Analog Devices ADSP-21062 SHARC DSP at 36MHz
32         Konami 0000037122 (2D Tilemap)
33         Konami 0000033906 (PCI bridge)
34         3DFX 500-0003-03 (Voodoo) FBI with 2MB RAM
35         3DFX 500-0004-02 (Voodoo) TMU with 4MB RAM
36 
37     GQ871 GFX Board:
38     ----------------
39         Analog Devices ADSP-21062 SHARC DSP at 36MHz
40         Konami 0000037122 (2D Tilemap)
41         Konami 0000033906 (PCI bridge)
42         3DFX 500-0009-01 (Voodoo 2) FBI with 2MB RAM
43         3DFX 500-0010-01 (Voodoo 2) TMU with 4MB RAM
44 
45 
46     Hardware configurations:
47     ------------------------
48 
49     Game              KONAMI ID  CPU PCB    GFX Board(s)  notes
50     ----------------------------------------------------------------------
51     Gradius 4         GX837      GN715(A)   GN715(B)
52     NBA Play By Play  GX778      GN715(A)   GN715(B)
53     Teraburst         GX715      GN715(A)   GN715(B)      GN680(E) I/O board
54     Silent Scope      GQ830      GN715(A)   2x GN715(B)
55     Silent Scope 2    GQ931      GN715(A)   2x GQ871(B)   GQ931(H) LAN PCB
56 
57 
58     PCB Layouts
59     -----------
60 
61     Top Board
62     GN715 PWB(A)A
63     |--------------------------------------------------------------|
64     | SP485CS CN10       CN11        CN9          JP8 JP9 JP10 JP11|
65     |CN19                                                    PAL1  |
66     |CN21       JP13 PAL2             68EC000          EPROM.7S    |
67     |   NE5532       PAL3                                      CN12|
68     |           JP12  JP16    DRM1M4SJ8                        CN13|
69     |   NE5532                            MASKROM.9P    MASKROM.9T |
70     |     SM5877 JP15         RF5C400                              |
71     |CN18                                 MASKROM.12P   MASKROM.12T|
72     |     SM5877     16.9344MHz                                    |
73     |CN14            SRAM256K             MASKROM.14P   MASKROM.14T|
74     |                                                              |
75     |CN16            SRAM256K             MASKROM.16P   MASKROM.16T|
76     |  ADC12138                                                    |
77     |             056800            JP5                            |
78     |                               JP4                            |
79     |                      MACH111  JP3                |---------| |
80     |   TEST_SW                         EPROM.22P      |         | |
81     |CN1                   DRAM16X16                   |PPC403GA | |
82     |                                   EPROM.25P      |         | |
83     |                                                  |         | |
84     |                      DRAM16X16    EPROM.27P      |---------| |
85     | 4AK16                                                     JP6|
86     |                                                              |
87     |CN3                                                           |
88     | 0038323  PAL4                                       7.3728MHz|
89     | E9825    058232           CN2                                |
90     |                                                     50.000MHz|
91     |    RESET_SW               CN5                    JP1  JP2    |
92     |M48T58Y-70PC1  CN4                 CN6               64.000MHz|
93     |--------------------------------------------------------------|
94     Notes:
95           DRM1M4SJ8 - Fujitsu 81C4256 256Kx4 DRAM (SOJ24)
96            SRAM256K - Cypress CY7C199 32kx8 SRAM (SOJ28)
97           DRAM16X16 - Fujitsu 8118160A-60 16megx16 DRAM (SOJ42)
98       0038323 E9825 - SOIC8 (Secured PIC?). I've seen a similar chip in the security cart of System573
99       M48T58Y-70PC1 - ST Timekeeper RAM
100             RF5C400 - Ricoh RF5C400 PCM 32Ch, 44.1 kHz Stereo, 3D Effect Spatializer, clock input 16.9344MHz
101              056800 - Konami Custom (QFP80)
102              058232 - Konami Custom Ceramic Package (SIL14)
103            ADC12138 - National Semiconductor ADC12138 A/D Converter, 12-bit + Serial I/O With MUX (SOP28)
104             MACH111 - AMD MACH111 CPLD (Stamped 'N676A1', PLCC44)
105             68EC000 - Motorola MC68EC000, running at 16.0MHz (64/4)
106            PPC403GA - IBM PowerPC 403GA CPU, clock input 32.0MHz (QFP160)
107            SM5877AM - Nippon Precision Circuits 3rd Order 2-Channel D/A Converter (SOIC24)
108               4AK16 - Hitachi 4AK16 Silicon N-Channel Power MOS FET Array (SIL10)
109            NE5532AN - Philips, Dual Low-Noise High-Speed Audio OP Amp (DIP8)
110             SP485CS - Sipex SP485CS Low Power Half Duplex RS485 Transceiver (DIP8)
111                PAL1 - AMD PALCE16V8 (stamped 'N676A4', DIP20)
112                PAL2 - AMD PALCE16V8 (stamped 'N676A2', DIP20)
113                PAL3 - AMD PALCE16V8 (stamped 'N676A3', DIP20)
114                PAL4 - AMD PALCE16V8 (stamped 'N676A5', DIP20)
115                 JP1 -       25M O O-O 32M
116                 JP2 -       25M O O-O 32M
117                 JP3 -        RW O O O RO
118                 JP4 - PROG  32M O O-O 16M
119                 JP5 - DATA  32M O-O O 16M
120                 JP6 - BOOT   16 O-O O 32
121                 JP7 - SRC DOUT2 O O-O 0
122                 JP8 -   64M&32M O-O O 16M
123                 JP9 -       64M O O-O 32M&16M
124                JP10 -   64M&32M O-O O 16M
125                JP11 -       64M O O-O 32M&16M
126                JP12 -   through O-O O SP
127                JP13 -   through O-O O SP
128                JP14 - WDT       O O
129                JP15 -      MONO O-O O SURR
130                JP16 -      HIGH O O O MID (N/C LOW)
131         CN1 to  CN3 - Multi-pin Flat Cable Connector
132                 CN4 - Multi-pin Connector for Network PCB
133                 CN5 - Multi-pin Flat Cable Connector
134                 CN6 - 96-Pin To Lower PCB, Joining Connector
135         CN7 to  CN8 - Not used
136         CN9 to CN11 - 6-Pin Power Connectors
137                CN19 - USB Connector
138                CN21 - 5-Pin Analog Controls Connector (Tied to USB Connector via the Filter Board)
139                CN18 - RCA Mono Audio OUT
140         CN14 & CN16 - RCA Stereo Audio OUT
141 
142 
143     ROM Usage
144     ---------
145                  |------------------------------- ROM Locations ---------------------------------------|
146     Game         27P     25P     22P     16P     14P     12P     9P      16T     14T     12T  9T  7S
147     ----------------------------------------------------------------------------------------------------
148     Gradius 4    837C01  -       -       837A09  837A10  -       778A12  837A04  837A05  -    -   837A08
149     NBA P/Play   778A01  -       -       778A09  778A10  778A11  778A12  778A04  778A05  -    -   778A08
150     Teraburst    -       715l02  715l03  715A09  715A10  -       778A12  715A04  715A05  -    -   715A08
151     S/Scope      830B01  -       -       830A09  830A10  -       -       -       -       -    -   830A08
152     S/Scope 2    931D01  -       -       931A09  931A10  931A11  -       931A04  -       -    -   931A08
153 
154 
155     Bottom Board
156     GN715 PWB(B)A
157     |--------------------------------------------------------------|
158     |CN4        CN2    CN8               CN6                    CN5|
159     |JP1                 |---------|              4M_EDO   4M_EDO  |
160     |                    |         |     |----------|              |
161     |  4M_EDO 4M_EDO     | TEXELFX |     |          |              |
162     |                    |         |     | PIXELFX  |       4M_EDO |
163     |  4M_EDO 4M_EDO     |         |     |          |       4M_EDO |
164     |                    |---------|     |          | |--------|   |
165     |  4M_EDO 4M_EDO                     |----------| |KONAMI  |   |
166     |CN3                                50MHz JP7     |33906   |   |
167     |  4M_EDO 4M_EDO                          JP6     |        |   |
168     |                       256KSRAM 256KSRAM         |--------|   |
169     |CN7                                                           |
170     |         AV9170                     1MSRAM 1MSRAM             |
171     | MC44200                                                      |
172     |                       256KSRAM 256KSRAM                      |
173     |                                    1MSRAM 1MSRAM             |
174     |  |-------|                                    MASKROM.24U    |
175     |  |KONAMI |  MACH111  |-------------|              MASKROM.24V|
176     |  |37122  |           |ANALOG       |   1MSRAM 1MSRAM         |
177     |  |       |           |DEVICES      |                         |
178     |  |-------|       JP5 |ADSP-21062   |   36.00MHz              |
179     |1MSRAM                |SHARC        |   1MSRAM 1MSRAM         |
180     |                      |             |                         |
181     |1MSRAM                |             |                         |
182     |           256KSRAM   |-------------|          MASKROM.32U    |
183     |1MSRAM     256KSRAM                                MASKROM.32V|
184     |           256KSRAM     PAL1  PAL2            JP4             |
185     |1MSRAM                                                        |
186     |           JP2                 CN1            JP3             |
187     |--------------------------------------------------------------|
188     Notes:
189           4M_EDO - Silicon Magic SM81C256K16CJ-35 EDO DRAM 66MHz (SOJ40)
190           1MSRAM - Cypress CY7C109-25VC 1Meg SRAM (SOJ32)
191         256KSRAM - Winbond W24257AJ-15 256K SRAM (SOJ28)
192          TEXELFX - 3DFX 500-0004-02 BD0665.1 TMU (QFP208)
193          PIXELFX - 3DFX 500-0003-03 F001701.1 FBI (QFP240)
194       0000037122 - Konami Custom (QFP208)
195        MC44200FT - Motorola MC44200FT 3 Channel Video D/A Converter (QFP44)
196          MACH111 - AMD MACH111 CPLD (Stamped 'N715B1', PLCC44)
197           AV9170 - Integrated Circuit Systems Inc. Clock Multiplier (SOIC8)
198             PAL1 - AMD PALCE16V8 (stamped 'N676B4', DIP20)
199             PAL2 - AMD PALCE16V8 (stamped 'N676B5', DIP20)
200              JP1 -    SCR O O-O TWN
201              JP2 - MASTER O-O O SLAVE
202              JP3 -    16M O O-O 32M
203              JP4 -    32M O-O O 16M
204              JP5 -  ASYNC O O-O SYNC
205              JP6 -    DSP O O-O ADCK
206              JP7 -    MCK O-O O SCK
207              CN1 - 96 Pin To Lower PCB, Joining Connector
208              CN2 - 8-Pin RGB OUT
209              CN3 - 15-Pin DSUB VGA Video MAIN OUT
210              CN4 - 6-Pin Power Connector
211              CN5 - 4-Pin Power Connector
212              CN6 - 2-Pin Connector (Not Used)
213              CN7 - 15-Pin DSUB VGA Video MAIN OUT
214              CN8 - 6-Pin Connector (Not Used)
215 
216     ROM Usage
217     ---------
218                  |------ ROM Locations -------|
219     Game         24U     24V     32U     32V
220     -------------------------------------------
221     Gradius 4    837A13  837A15  837A14  837A16
222     NBA P/Play   778A13  778A15  778A14  778A16
223     Teraburst    715A13  715A15  778A14  715A16
224     S/Scope      830A13  -       830A14  -
225     S/Scope 2    -       -       -       -          (no ROMs, not used)
226 
227 
228     Teraburst uses a different variation of the I/O board used in Operation: Thunder Hurricane (see gticlub.cpp). Analog inputs are controlled by
229     two CCD cameras, one from each gun. This specific variation uses a K056800 which normally acts as a sound interface controller. Perhaps this
230     either sends analog inputs to the main pcb or isn't used at all. No network connection is involved in this setup as this board directly connects
231     to the main pcb via joining connector.
232 
233     GN680 PWB(E)403381B
234     |------------------------------------------|
235     |CN11  CN12    CN8      CN9    CN10  DSW(4)|
236     |                 NRPS11     NRPS11        |
237     |                                          |
238     |                        LM1881   LM1881   |
239     |                                          |
240     |LED(x4)                                   |
241     |                                          |
242     |           68EC000FN16  8464              |
243     |    RESET_SW            8464              |
244     |32MHz                           715A17.20K|
245     |8464                 PAL(002962)          |
246     |      056800         PAL(002961)          |
247     |   PAL(056787A)      PAL(002960)          |
248     |   CN1                                    |
249     |------------------------------------------|
250     Notes:
251       68EC000 @ 16MHz (32/2)
252       CN11/12 - Power connectors
253       CN8/9   - 6-pin analog control connectors (to CCD cameras)
254       CN1     - Lower joining connector to main pcb
255       NRPS11  - Idec NRPS11 PC Board circuit protector
256       LM1881  - Video sync separator (DIP8)
257       056800  - Konami Custom (QFP80)
258 
259 
260     LAN PCB: GQ931 PWB(H)      (C) 1999 Konami
261     ------------------------------------------
262 
263     2 x LAN ports, LANC(1) & LANC(2)
264     1 x 32.0000MHz Oscillator
265 
266          HYC2485S  SMC ARCNET Media Transceiver, RS485 5Mbps-2.5Mbps
267     8E   931A19    Konami 32meg masked ROM, ROM0 (compressed GFX data)
268     6E   931A20    Konami 32meg masked ROM, ROM1 (compressed GFX data)
269     12F  XC9536    Xilinx  CPLD,  44 pin PLCC, Konami no. Q931H1
270     12C  XCS10XL   Xilinx  FPGA, 100 pin PQFP, Konami no. 4C
271     12B  CY7C199   Cypress 32kx8 SRAM
272     8B   AT93C46   Atmel 1K serial EEPROM, 8 pin SOP
273     16G  DS2401    Dallas Silicon Serial Number IC, 6 pin SOP
274 
275     Note: This PCB does more than just networking. The serial eeprom is used as a means to prevent region change.
276     The timekeeper region has to match the serial eeprom. The two mask roms serve as GFX roms as the game "downloads"
277     the data from those two roms.
278 
279 
280 
281     GFX PCB:  GQ871 PWB(B)A    (C) 1999 Konami
282     ------------------------------------------
283 
284     There are no ROMs on the two GFX PCBs, all sockets are empty. They are loacted on the LAN PCB.
285     Prior to the game starting there is a message saying downloading data.
286 
287 
288     Jumpers set on GFX PCB to main monitor:
289     4A   set to TWN (twin GFX PCBs)
290     37D  set to Master
291 
292 
293     Jumpers set on GFX PCB to scope monitor:
294     4A   set to TWN (twin GFX PCBs)
295     37D  set to Slave
296 
297 
298     1 x 64.0000MHz
299     1 x 36.0000MHz  (to 27L, ADSP)
300 
301     21E  AV9170           ICS, Clock synchroniser and multiplier
302 
303     27L  ADSP-21062       Analog Devices SHARC ADSP, 512k flash, Konami no. 022M16C
304     15T  0000033906       Konami Custom, 160 pin PQFP
305     19R  W241024AI-20     Winbond, 1Meg SRAM
306     22R  W241024AI-20     Winbond, 1Meg SRAM
307     25R  W241024AI-20     Winbond, 1Meg SRAM
308     29R  W241024AI-20     Winbond, 1Meg SRAM
309     19P  W241024AI-20     Winbond, 1Meg SRAM
310     22P  W241024AI-20     Winbond, 1Meg SRAM
311     25P  W241024AI-20     Winbond, 1Meg SRAM
312     29P  W241024AI-20     Winbond, 1Meg SRAM
313     18N  W24257AJ-15      Winbond, 256K SRAM
314     14N  W24257AJ-15      Winbond, 256K SRAM
315     18M  W24257AJ-15      Winbond, 256K SRAM
316     14M  W24257AJ-15      Winbond, 256K SRAM
317 
318     28D  000037122        Konami Custom, 208 pin PQFP
319     33E  W24257AJ-15      Winbond, 256K SRAM
320     33D  W24257AJ-15      Winbond, 256K SRAM
321     33C  W24257AJ-15      Winbond, 256K SRAM
322     27A  W241024AI-20     Winbond, 1Meg SRAM
323     30A  W241024AI-20     Winbond, 1Meg SRAM
324     32A  W241024AI-20     Winbond, 1Meg SRAM
325     35A  W241024AI-20     Winbond, 1Meg SRAM
326 
327     7K   500-0010-01      3DFX, Texture processor
328     16F  SM81C256K16CJ-25 Silicon Magic 100MHz EDO RAM, 4Meg
329     13F  SM81C256K16CJ-25 Silicon Magic 100MHz EDO RAM, 4Meg
330     9F   SM81C256K16CJ-25 Silicon Magic 100MHz EDO RAM, 4Meg
331     5F   SM81C256K16CJ-25 Silicon Magic 100MHz EDO RAM, 4Meg
332     16D  SM81C256K16CJ-25 Silicon Magic 100MHz EDO RAM, 4Meg
333     13D  SM81C256K16CJ-25 Silicon Magic 100MHz EDO RAM, 4Meg
334     9D   SM81C256K16CJ-25 Silicon Magic 100MHz EDO RAM, 4Meg
335     5D   SM81C256K16CJ-25 Silicon Magic 100MHz EDO RAM, 4Meg
336 
337     9P   500-0009-01      3DFX, Pixel processor
338     10U  SM81C256K16CJ-25 Silicon Magic 100MHz EDO RAM, 4Meg
339     7U   SM81C256K16CJ-25 Silicon Magic 100MHz EDO RAM, 4Meg
340     3S   SM81C256K16CJ-25 Silicon Magic 100MHz EDO RAM, 4Meg
341     3R   SM81C256K16CJ-25 Silicon Magic 100MHz EDO RAM, 4Meg
342 
343     27G  XC9536           Xilinx, CPLD, Konami no. Q830B1
344     21C  MC44200FT        Motorola, 3 Channel video D/A converter
345 */
346 
347 #include "emu.h"
348 #include "cpu/m68000/m68000.h"
349 #include "cpu/powerpc/ppc.h"
350 #include "cpu/sharc/sharc.h"
351 #include "machine/adc1213x.h"
352 #include "machine/eepromser.h"
353 #include "machine/k033906.h"
354 #include "machine/konppc.h"
355 #include "machine/timekpr.h"
356 #include "machine/ds2401.h"
357 #include "machine/watchdog.h"
358 #include "sound/rf5c400.h"
359 #include "sound/k056800.h"
360 #include "video/voodoo.h"
361 #include "video/k037122.h"
362 #include "emupal.h"
363 #include "rendlay.h"
364 #include "screen.h"
365 #include "speaker.h"
366 
367 
368 class hornet_state : public driver_device
369 {
370 public:
hornet_state(const machine_config & mconfig,device_type type,const char * tag)371 	hornet_state(const machine_config &mconfig, device_type type, const char *tag)
372 		: driver_device(mconfig, type, tag),
373 		m_workram(*this, "workram"),
374 		m_sharc_dataram0(*this, "sharc_dataram0"),
375 		m_sharc_dataram1(*this, "sharc_dataram1"),
376 		m_maincpu(*this, "maincpu"),
377 		m_audiocpu(*this, "audiocpu"),
378 		m_k056800(*this, "k056800"),
379 		m_gn680(*this, "gn680"),
380 		m_dsp(*this, "dsp"),
381 		m_dsp2(*this, "dsp2"),
382 		m_k037122_1(*this, "k037122_1"),
383 		m_k037122_2(*this, "k037122_2"),
384 		m_adc12138(*this, "adc12138"),
385 		m_konppc(*this, "konppc"),
386 		m_lan_eeprom(*this, "lan_eeprom"),
387 		m_voodoo(*this, "voodoo%u", 0U),
388 		m_in0(*this, "IN0"),
389 		m_in1(*this, "IN1"),
390 		m_in2(*this, "IN2"),
391 		m_dsw(*this, "DSW"),
392 		m_eepromout(*this, "EEPROMOUT"),
393 		m_analog1(*this, "ANALOG1"),
394 		m_analog2(*this, "ANALOG2"),
395 		m_pcb_digit(*this, "pcbdigit%u", 0U),
396 		m_user3_ptr(*this, "user3"),
397 		m_user5_ptr(*this, "user5"),
398 		m_lan_ds2401(*this, "lan_serial_id"),
399 		m_watchdog(*this, "watchdog")
400 	{ }
401 
402 	void hornet(machine_config &config);
403 	void terabrst(machine_config &config);
404 	void sscope(machine_config &config);
405 	void sscope2(machine_config &config);
406 
407 	void init_hornet();
408 	void init_gradius4();
409 	void init_nbapbp();
410 	void init_terabrst();
411 	void init_sscope();
412 	void init_sscope2();
413 
414 private:
415 	// TODO: Needs verification on real hardware
416 	static const int m_sound_timer_usec = 2800;
417 
418 	required_shared_ptr<uint32_t> m_workram;
419 	required_shared_ptr<uint32_t> m_sharc_dataram0;
420 	optional_shared_ptr<uint32_t> m_sharc_dataram1;
421 	required_device<ppc4xx_device> m_maincpu;
422 	required_device<cpu_device> m_audiocpu;
423 	required_device<k056800_device> m_k056800;
424 	optional_device<cpu_device> m_gn680;
425 	required_device<adsp21062_device> m_dsp;
426 	optional_device<adsp21062_device> m_dsp2;
427 	optional_device<k037122_device> m_k037122_1;
428 	optional_device<k037122_device> m_k037122_2;
429 	required_device<adc12138_device> m_adc12138;
430 	required_device<konppc_device> m_konppc;
431 	optional_device<eeprom_serial_93cxx_device> m_lan_eeprom;
432 	optional_device_array<voodoo_device, 2> m_voodoo;
433 	required_ioport m_in0, m_in1, m_in2, m_dsw;
434 	optional_ioport m_eepromout, m_analog1, m_analog2;
435 	output_finder<2> m_pcb_digit;
436 	optional_region_ptr<uint8_t> m_user3_ptr;
437 	optional_region_ptr<uint8_t> m_user5_ptr;
438 	optional_device<ds2401_device> m_lan_ds2401;
439 	required_device<watchdog_timer_device> m_watchdog;
440 
441 	emu_timer *m_sound_irq_timer;
442 	std::unique_ptr<uint8_t[]> m_jvs_sdata;
443 	uint32_t m_jvs_sdata_ptr;
444 	uint16_t m_gn680_latch;
445 	uint16_t m_gn680_ret0;
446 	uint16_t m_gn680_ret1;
447 
448 	uint32_t hornet_k037122_sram_r(offs_t offset);
449 	void hornet_k037122_sram_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
450 	uint32_t hornet_k037122_char_r(offs_t offset);
451 	void hornet_k037122_char_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
452 	uint32_t hornet_k037122_reg_r(offs_t offset);
453 	void hornet_k037122_reg_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
454 	uint8_t sysreg_r(offs_t offset);
455 	void sysreg_w(offs_t offset, uint8_t data);
456 	void comm1_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
457 	void comm_rombank_w(uint32_t data);
458 	uint32_t comm0_unk_r(offs_t offset, uint32_t mem_mask = ~0);
459 	uint32_t gun_r();
460 	void gun_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
461 	void gn680_sysctrl(uint16_t data);
462 	uint16_t gn680_latch_r();
463 	void gn680_latch_w(offs_t offset, uint16_t data);
464 	uint32_t dsp_dataram0_r(offs_t offset);
465 	void dsp_dataram0_w(offs_t offset, uint32_t data);
466 	uint32_t dsp_dataram1_r(offs_t offset);
467 	void dsp_dataram1_w(offs_t offset, uint32_t data);
468 	DECLARE_WRITE_LINE_MEMBER(voodoo_vblank_0);
469 	DECLARE_WRITE_LINE_MEMBER(voodoo_vblank_1);
470 	void soundtimer_en_w(uint16_t data);
471 	void soundtimer_count_w(uint16_t data);
472 	double adc12138_input_callback(uint8_t input);
473 	void jamma_jvs_w(uint8_t data);
474 	uint8_t comm_eeprom_r();
475 	void comm_eeprom_w(uint8_t data);
476 
477 	virtual void machine_start() override;
478 	virtual void machine_reset() override;
479 	DECLARE_MACHINE_RESET(hornet_2board);
480 	uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
481 	uint32_t screen_update_rscreen(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
482 	TIMER_CALLBACK_MEMBER(sound_irq);
483 	int jvs_encode_data(uint8_t *in, int length);
484 	int jvs_decode_data(uint8_t *in, uint8_t *out, int length);
485 	void jamma_jvs_cmd_exec();
486 	void hornet_map(address_map &map);
487 	void terabrst_map(address_map &map);
488 	void sscope_map(address_map &map);
489 	void sscope2_map(address_map &map);
490 	void gn680_memmap(address_map &map);
491 	void sharc0_map(address_map &map);
492 	void sharc1_map(address_map &map);
493 	void sound_memmap(address_map &map);
494 };
495 
496 
497 
498 
hornet_k037122_sram_r(offs_t offset)499 uint32_t hornet_state::hornet_k037122_sram_r(offs_t offset)
500 {
501 	k037122_device *k037122 = m_konppc->get_cgboard_id() ? m_k037122_2 : m_k037122_1;
502 	return k037122->sram_r(offset);
503 }
504 
hornet_k037122_sram_w(offs_t offset,uint32_t data,uint32_t mem_mask)505 void hornet_state::hornet_k037122_sram_w(offs_t offset, uint32_t data, uint32_t mem_mask)
506 {
507 	k037122_device *k037122 = m_konppc->get_cgboard_id() ? m_k037122_2 : m_k037122_1;
508 	k037122->sram_w(offset, data, mem_mask);
509 }
510 
511 
hornet_k037122_char_r(offs_t offset)512 uint32_t hornet_state::hornet_k037122_char_r(offs_t offset)
513 {
514 	k037122_device *k037122 = m_konppc->get_cgboard_id() ? m_k037122_2 : m_k037122_1;
515 	return k037122->char_r(offset);
516 }
517 
hornet_k037122_char_w(offs_t offset,uint32_t data,uint32_t mem_mask)518 void hornet_state::hornet_k037122_char_w(offs_t offset, uint32_t data, uint32_t mem_mask)
519 {
520 	k037122_device *k037122 = m_konppc->get_cgboard_id() ? m_k037122_2 : m_k037122_1;
521 	k037122->char_w(offset, data, mem_mask);
522 }
523 
hornet_k037122_reg_r(offs_t offset)524 uint32_t hornet_state::hornet_k037122_reg_r(offs_t offset)
525 {
526 	k037122_device *k037122 = m_konppc->get_cgboard_id() ? m_k037122_2 : m_k037122_1;
527 	return k037122->reg_r(offset);
528 }
529 
hornet_k037122_reg_w(offs_t offset,uint32_t data,uint32_t mem_mask)530 void hornet_state::hornet_k037122_reg_w(offs_t offset, uint32_t data, uint32_t mem_mask)
531 {
532 	k037122_device *k037122 = m_konppc->get_cgboard_id() ? m_k037122_2 : m_k037122_1;
533 	k037122->reg_w(offset, data, mem_mask);
534 }
535 
WRITE_LINE_MEMBER(hornet_state::voodoo_vblank_0)536 WRITE_LINE_MEMBER(hornet_state::voodoo_vblank_0)
537 {
538 	m_maincpu->set_input_line(INPUT_LINE_IRQ0, state);
539 }
540 
WRITE_LINE_MEMBER(hornet_state::voodoo_vblank_1)541 WRITE_LINE_MEMBER(hornet_state::voodoo_vblank_1)
542 {
543 	m_maincpu->set_input_line(INPUT_LINE_IRQ1, state);
544 }
545 
screen_update(screen_device & screen,bitmap_rgb32 & bitmap,const rectangle & cliprect)546 uint32_t hornet_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
547 {
548 	m_voodoo[0]->voodoo_update(bitmap, cliprect);
549 
550 	m_k037122_1->tile_draw(screen, bitmap, cliprect);
551 
552 	return 0;
553 }
554 
screen_update_rscreen(screen_device & screen,bitmap_rgb32 & bitmap,const rectangle & cliprect)555 uint32_t hornet_state::screen_update_rscreen(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
556 {
557 	m_voodoo[1]->voodoo_update(bitmap, cliprect);
558 
559 	m_k037122_2->tile_draw(screen, bitmap, cliprect);
560 
561 	return 0;
562 }
563 
564 /*****************************************************************************/
565 
sysreg_r(offs_t offset)566 uint8_t hornet_state::sysreg_r(offs_t offset)
567 {
568 	uint8_t r = 0;
569 
570 	switch (offset)
571 	{
572 		case 0: /* I/O port 0 */
573 			r = m_in0->read();
574 			break;
575 		case 1: /* I/O port 1 */
576 			r = m_in1->read();
577 			break;
578 		case 2: /* I/O port 2 */
579 			r = m_in2->read();
580 			break;
581 
582 		case 3: /* I/O port 3 */
583 			/*
584 			    0x80 = JVSINIT (JAMMA I/F SENSE)
585 			    0x40 = COMMST
586 			    0x20 = GSENSE
587 			    0x08 = EEPDO (EEPROM DO)
588 			    0x04 = ADEOC (ADC EOC)
589 			    0x02 = ADDOR (ADC DOR)
590 			    0x01 = ADDO (ADC DO)
591 			*/
592 			r = 0xf0;
593 			r |= m_adc12138->do_r() | (m_adc12138->eoc_r() << 2);
594 			break;
595 
596 		case 4: /* I/O port 4 - DIP switches */
597 			r = m_dsw->read();
598 			break;
599 
600 		default:
601 			break;
602 	}
603 	return r;
604 }
605 
sysreg_w(offs_t offset,uint8_t data)606 void hornet_state::sysreg_w(offs_t offset, uint8_t data)
607 {
608 	switch (offset)
609 	{
610 		case 0: /* 7seg LEDs on PCB */
611 		case 1:
612 			m_pcb_digit[offset] = bitswap<8>(~data,7,0,1,2,3,4,5,6) & 0x7f;
613 			break;
614 
615 		case 2: /* Parallel data register */
616 			osd_printf_debug("Parallel data = %02X\n", data);
617 			break;
618 
619 		case 3: /* System Register 0 */
620 			/*
621 			    0x80 = EEPWEN (EEPROM write enable)
622 			    0x40 = EEPCS (EEPROM CS)
623 			    0x20 = EEPSCL (EEPROM SCL?)
624 			    0x10 = EEPDT (EEPROM data)
625 			    0x08 = JVSTXEN / LAMP3 (something about JAMMA interface)
626 			    0x04 = LAMP2
627 			    0x02 = LAMP1
628 			    0x01 = LAMP0
629 			*/
630 			osd_printf_debug("System register 0 = %02X\n", data);
631 			break;
632 
633 		case 4: /* System Register 1 */
634 			/*
635 			    0x80 = SNDRES (sound reset)
636 			    0x40 = COMRES (COM reset)
637 			    0x20 = COINRQ2 (EEPROM SCL?)
638 			    0x10 = COINRQ1 (EEPROM data)
639 			    0x08 = ADCS (ADC CS)
640 			    0x04 = ADCONV (ADC CONV)
641 			    0x02 = ADDI (ADC DI)
642 			    0x01 = ADDSCLK (ADC SCLK)
643 			*/
644 			m_adc12138->cs_w((data >> 3) & 0x1);
645 			m_adc12138->conv_w((data >> 2) & 0x1);
646 			m_adc12138->di_w((data >> 1) & 0x1);
647 			m_adc12138->sclk_w(data & 0x1);
648 
649 			m_audiocpu->set_input_line(INPUT_LINE_RESET, (data & 0x80) ? CLEAR_LINE : ASSERT_LINE);
650 			osd_printf_debug("System register 1 = %02X\n", data);
651 			break;
652 
653 		case 5: /* Sound Control Register */
654 			/*
655 			    0x80 = MODE1
656 			    0x40 = MUTE1
657 			    0x20 = DEEN1
658 			    0x10 = ATCK1
659 			    0x08 = MODE0
660 			    0x04 = MUTE0
661 			    0x02 = DEEN0
662 			    0x01 = ATCK0
663 			*/
664 			osd_printf_debug("Sound control register = %02X\n", data);
665 			break;
666 
667 		case 6: /* WDT Register */
668 			/*
669 			    0x80 = WDTCLK
670 			*/
671 			if (data & 0x80)
672 				m_watchdog->watchdog_reset();
673 			break;
674 
675 		case 7: /* CG Control Register */
676 			/*
677 			    0x80 = EXRES1
678 			    0x40 = EXRES0
679 			    0x20 = EXID1
680 			    0x10 = EXID0
681 			    0x01 = EXRGB
682 			*/
683 			if (data & 0x80)
684 				m_maincpu->set_input_line(INPUT_LINE_IRQ1, CLEAR_LINE);
685 			if (data & 0x40)
686 				m_maincpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE);
687 			m_konppc->set_cgboard_id((data >> 4) & 3);
688 			break;
689 	}
690 }
691 
692 /*****************************************************************************/
693 
comm_eeprom_r()694 uint8_t hornet_state::comm_eeprom_r()
695 {
696 	uint8_t r = 0;
697 	r |= (m_lan_eeprom->do_read() & 1) << 1;
698 	r |= m_lan_ds2401->read() & 1;
699 	return r;
700 }
701 
comm_eeprom_w(uint8_t data)702 void hornet_state::comm_eeprom_w(uint8_t data)
703 {
704 	m_eepromout->write(data, 0xff);
705 	m_lan_ds2401->write((data >> 4) & 1);
706 }
707 
comm1_w(offs_t offset,uint32_t data,uint32_t mem_mask)708 void hornet_state::comm1_w(offs_t offset, uint32_t data, uint32_t mem_mask)
709 {
710 	printf("comm1_w: %08X, %08X, %08X\n", offset, data, mem_mask);
711 }
712 
comm_rombank_w(uint32_t data)713 void hornet_state::comm_rombank_w(uint32_t data)
714 {
715 	int bank = data >> 24;
716 	uint8_t *usr3 = memregion("user3")->base();
717 	if (usr3 != nullptr)
718 		membank("bank1")->set_entry(bank & 0x7f);
719 }
720 
comm0_unk_r(offs_t offset,uint32_t mem_mask)721 uint32_t hornet_state::comm0_unk_r(offs_t offset, uint32_t mem_mask)
722 {
723 //  printf("comm0_unk_r: %08X, %08X\n", offset, mem_mask);
724 	return 0xffffffff;
725 }
726 
727 
gun_r()728 uint32_t hornet_state::gun_r()
729 {
730 	return m_gn680_ret0<<16 | m_gn680_ret1;
731 }
732 
gun_w(offs_t offset,uint32_t data,uint32_t mem_mask)733 void hornet_state::gun_w(offs_t offset, uint32_t data, uint32_t mem_mask)
734 {
735 	if (mem_mask == 0xffff0000)
736 	{
737 		m_gn680_latch = data>>16;
738 		m_gn680->set_input_line(M68K_IRQ_6, HOLD_LINE);
739 	}
740 }
741 
742 /******************************************************************/
743 
TIMER_CALLBACK_MEMBER(hornet_state::sound_irq)744 TIMER_CALLBACK_MEMBER(hornet_state::sound_irq)
745 {
746 	m_audiocpu->set_input_line(M68K_IRQ_1, ASSERT_LINE);
747 }
748 
749 
soundtimer_en_w(uint16_t data)750 void hornet_state::soundtimer_en_w(uint16_t data)
751 {
752 	if (data & 1)
753 	{
754 		// Reset and disable timer
755 		m_sound_irq_timer->adjust(attotime::from_usec(m_sound_timer_usec));
756 		m_sound_irq_timer->enable(false);
757 	}
758 	else
759 	{
760 		// Enable timer
761 		m_sound_irq_timer->enable(true);
762 	}
763 }
764 
soundtimer_count_w(uint16_t data)765 void hornet_state::soundtimer_count_w(uint16_t data)
766 {
767 	// Reset the count
768 	m_sound_irq_timer->adjust(attotime::from_usec(m_sound_timer_usec));
769 	m_audiocpu->set_input_line(M68K_IRQ_1, CLEAR_LINE);
770 }
771 
772 /*****************************************************************************/
773 
hornet_map(address_map & map)774 void hornet_state::hornet_map(address_map &map)
775 {
776 	map(0x00000000, 0x003fffff).ram().share("workram");     /* Work RAM */
777 	map(0x74000000, 0x740000ff).rw(FUNC(hornet_state::hornet_k037122_reg_r), FUNC(hornet_state::hornet_k037122_reg_w));
778 	map(0x74020000, 0x7403ffff).rw(FUNC(hornet_state::hornet_k037122_sram_r), FUNC(hornet_state::hornet_k037122_sram_w));
779 	map(0x74040000, 0x7407ffff).rw(FUNC(hornet_state::hornet_k037122_char_r), FUNC(hornet_state::hornet_k037122_char_w));
780 	map(0x78000000, 0x7800ffff).rw(m_konppc, FUNC(konppc_device::cgboard_dsp_shared_r_ppc), FUNC(konppc_device::cgboard_dsp_shared_w_ppc));
781 	map(0x780c0000, 0x780c0003).rw(m_konppc, FUNC(konppc_device::cgboard_dsp_comm_r_ppc), FUNC(konppc_device::cgboard_dsp_comm_w_ppc));
782 	map(0x7d000000, 0x7d00ffff).r(FUNC(hornet_state::sysreg_r));
783 	map(0x7d010000, 0x7d01ffff).w(FUNC(hornet_state::sysreg_w));
784 	map(0x7d020000, 0x7d021fff).rw("m48t58", FUNC(timekeeper_device::read), FUNC(timekeeper_device::write));  /* M48T58Y RTC/NVRAM */
785 	map(0x7d030000, 0x7d03000f).rw(m_k056800, FUNC(k056800_device::host_r), FUNC(k056800_device::host_w));
786 	map(0x7e000000, 0x7e7fffff).rom().region("user2", 0);       /* Data ROM */
787 	map(0x7f000000, 0x7f3fffff).rom().share("share2");
788 	map(0x7fc00000, 0x7fffffff).rom().region("user1", 0).share("share2");    /* Program ROM */
789 }
790 
terabrst_map(address_map & map)791 void hornet_state::terabrst_map(address_map &map)
792 {
793 	hornet_map(map);
794 	map(0x74080000, 0x7408000f).rw(FUNC(hornet_state::gun_r), FUNC(hornet_state::gun_w));
795 }
796 
sscope_map(address_map & map)797 void hornet_state::sscope_map(address_map &map) //placeholder; may remove if mapping the second ADC12138 isn't necessary
798 {
799 	hornet_map(map);
800 }
801 
sscope2_map(address_map & map)802 void hornet_state::sscope2_map(address_map &map)
803 {
804 	sscope_map(map);
805 	map(0x7d040004, 0x7d040007).rw(FUNC(hornet_state::comm_eeprom_r), FUNC(hornet_state::comm_eeprom_w));
806 	map(0x7d042000, 0x7d043fff).ram();             /* COMM BOARD 0 */
807 	map(0x7d044000, 0x7d044007).r(FUNC(hornet_state::comm0_unk_r));
808 	map(0x7d048000, 0x7d048003).w(FUNC(hornet_state::comm1_w));
809 	map(0x7d04a000, 0x7d04a003).w(FUNC(hornet_state::comm_rombank_w));
810 	map(0x7d050000, 0x7d05ffff).bankr("bank1");        /* COMM BOARD 1 */
811 }
812 
813 /*****************************************************************************/
814 
sound_memmap(address_map & map)815 void hornet_state::sound_memmap(address_map &map)
816 {
817 	map(0x000000, 0x07ffff).rom();
818 	map(0x100000, 0x10ffff).ram();     /* Work RAM */
819 	map(0x200000, 0x200fff).rw("rfsnd", FUNC(rf5c400_device::rf5c400_r), FUNC(rf5c400_device::rf5c400_w));      /* Ricoh RF5C400 */
820 	map(0x300000, 0x30001f).rw(m_k056800, FUNC(k056800_device::sound_r), FUNC(k056800_device::sound_w)).umask16(0x00ff);
821 	map(0x480000, 0x480001).nopw();
822 	map(0x4c0000, 0x4c0001).nopw();
823 	map(0x500000, 0x500001).w(FUNC(hornet_state::soundtimer_en_w)).nopr();
824 	map(0x600000, 0x600001).w(FUNC(hornet_state::soundtimer_count_w)).nopr();
825 }
826 
827 /*****************************************************************************/
828 
gn680_sysctrl(uint16_t data)829 void hornet_state::gn680_sysctrl(uint16_t data)
830 {
831 	// bit 15 = watchdog toggle
832 	// lower 4 bits = LEDs?
833 }
834 
gn680_latch_r()835 uint16_t hornet_state::gn680_latch_r()
836 {
837 	m_gn680->set_input_line(M68K_IRQ_6, CLEAR_LINE);
838 
839 	return m_gn680_latch;
840 }
841 
gn680_latch_w(offs_t offset,uint16_t data)842 void hornet_state::gn680_latch_w(offs_t offset, uint16_t data)
843 {
844 	if (offset)
845 	{
846 		m_gn680_ret1 = data;
847 	}
848 	else
849 	{
850 		m_gn680_ret0 = data;
851 	}
852 }
853 
854 // WORD at 30000e: IRQ 4 tests bits 6 and 7, IRQ5 tests bits 4 and 5
855 // (vsync and hsync status for each of the two screens?)
856 
gn680_memmap(address_map & map)857 void hornet_state::gn680_memmap(address_map &map)
858 {
859 	map(0x000000, 0x01ffff).rom();
860 	map(0x200000, 0x203fff).ram();
861 	map(0x300000, 0x300001).w(FUNC(hornet_state::gn680_sysctrl));
862 	map(0x314000, 0x317fff).ram();
863 	map(0x400000, 0x400003).rw(FUNC(hornet_state::gn680_latch_r), FUNC(hornet_state::gn680_latch_w));
864 	map(0x400008, 0x400009).nopw();    // writes 0001 00fe each time IRQ 6 triggers
865 }
866 
867 /*****************************************************************************/
868 
dsp_dataram0_r(offs_t offset)869 uint32_t hornet_state::dsp_dataram0_r(offs_t offset)
870 {
871 	return m_sharc_dataram0[offset] & 0xffff;
872 }
873 
dsp_dataram0_w(offs_t offset,uint32_t data)874 void hornet_state::dsp_dataram0_w(offs_t offset, uint32_t data)
875 {
876 	m_sharc_dataram0[offset] = data;
877 }
878 
dsp_dataram1_r(offs_t offset)879 uint32_t hornet_state::dsp_dataram1_r(offs_t offset)
880 {
881 	return m_sharc_dataram1[offset] & 0xffff;
882 }
883 
dsp_dataram1_w(offs_t offset,uint32_t data)884 void hornet_state::dsp_dataram1_w(offs_t offset, uint32_t data)
885 {
886 	m_sharc_dataram1[offset] = data;
887 }
888 
sharc0_map(address_map & map)889 void hornet_state::sharc0_map(address_map &map)
890 {
891 	map(0x0400000, 0x041ffff).rw(m_konppc, FUNC(konppc_device::cgboard_0_shared_sharc_r), FUNC(konppc_device::cgboard_0_shared_sharc_w));
892 	map(0x0500000, 0x05fffff).rw(FUNC(hornet_state::dsp_dataram0_r), FUNC(hornet_state::dsp_dataram0_w)).share("sharc_dataram0");
893 	map(0x1400000, 0x14fffff).ram();
894 	map(0x2400000, 0x27fffff).rw("voodoo0", FUNC(voodoo_device::voodoo_r), FUNC(voodoo_device::voodoo_w));
895 	map(0x3400000, 0x34000ff).rw(m_konppc, FUNC(konppc_device::cgboard_0_comm_sharc_r), FUNC(konppc_device::cgboard_0_comm_sharc_w));
896 	map(0x3500000, 0x35000ff).rw(m_konppc, FUNC(konppc_device::K033906_0_r), FUNC(konppc_device::K033906_0_w));
897 	map(0x3600000, 0x37fffff).bankr("bank5");
898 }
899 
sharc1_map(address_map & map)900 void hornet_state::sharc1_map(address_map &map)
901 {
902 	map(0x0400000, 0x041ffff).rw(m_konppc, FUNC(konppc_device::cgboard_1_shared_sharc_r), FUNC(konppc_device::cgboard_1_shared_sharc_w));
903 	map(0x0500000, 0x05fffff).rw(FUNC(hornet_state::dsp_dataram1_r), FUNC(hornet_state::dsp_dataram1_w)).share("sharc_dataram1");
904 	map(0x1400000, 0x14fffff).ram();
905 	map(0x2400000, 0x27fffff).rw("voodoo1", FUNC(voodoo_device::voodoo_r), FUNC(voodoo_device::voodoo_w));
906 	map(0x3400000, 0x34000ff).rw(m_konppc, FUNC(konppc_device::cgboard_1_comm_sharc_r), FUNC(konppc_device::cgboard_1_comm_sharc_w));
907 	map(0x3500000, 0x35000ff).rw(m_konppc, FUNC(konppc_device::K033906_1_r), FUNC(konppc_device::K033906_1_w));
908 	map(0x3600000, 0x37fffff).bankr("bank6");
909 }
910 
911 /*****************************************************************************/
912 
913 static INPUT_PORTS_START( hornet )
914 	PORT_START("IN0")
915 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
916 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
917 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
918 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
919 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
920 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
921 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
922 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
923 
924 	PORT_START("IN1")
925 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
926 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
927 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
928 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
929 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
930 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
931 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
932 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
933 
934 	PORT_START("IN2")
935 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
936 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
937 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE1 )
938 	PORT_SERVICE_NO_TOGGLE( 0x10, IP_ACTIVE_LOW )
939 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE2 ) // greyed out in gradius4 test mode, but does work
940 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
941 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
942 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
943 
944 	PORT_START("DSW")
945 	PORT_DIPNAME( 0x80, 0x00, "Skip Post" ) PORT_DIPLOCATION("SW:1")
DEF_STR(Off)946 	PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
947 	PORT_DIPSETTING( 0x00, DEF_STR( On ) )
948 	PORT_DIPNAME( 0x40, 0x00, "Disable Machine Init" ) PORT_DIPLOCATION("SW:2") // Having this on disables the analog controls in terabrst, sscope and sscope2
949 	PORT_DIPSETTING( 0x40, DEF_STR( Off ) )
950 	PORT_DIPSETTING( 0x00, DEF_STR( On ) ) //they instead make them usable with JAMMA inputs
951 	PORT_DIPNAME( 0x20, 0x20, "DIP3" ) PORT_DIPLOCATION("SW:3")
952 	PORT_DIPSETTING( 0x20, DEF_STR( Off ) )
953 	PORT_DIPSETTING( 0x00, DEF_STR( On ) )
954 	PORT_DIPNAME( 0x10, 0x10, "DIP4" ) PORT_DIPLOCATION("SW:4")
955 	PORT_DIPSETTING( 0x10, DEF_STR( Off ) )
956 	PORT_DIPSETTING( 0x00, DEF_STR( On ) )
957 	PORT_DIPNAME( 0x08, 0x08, "DIP5" ) PORT_DIPLOCATION("SW:5")
958 	PORT_DIPSETTING( 0x08, DEF_STR( Off ) )
959 	PORT_DIPSETTING( 0x00, DEF_STR( On ) )
960 	PORT_DIPNAME( 0x04, 0x04, "DIP6" ) PORT_DIPLOCATION("SW:6")
961 	PORT_DIPSETTING( 0x04, DEF_STR( Off ) )
962 	PORT_DIPSETTING( 0x00, DEF_STR( On ) )
963 	PORT_DIPNAME( 0x02, 0x02, "DIP7" ) PORT_DIPLOCATION("SW:7")
964 	PORT_DIPSETTING( 0x02, DEF_STR( Off ) )
965 	PORT_DIPSETTING( 0x00, DEF_STR( On ) )
966 	PORT_DIPNAME( 0x01, 0x01, "DIP8" ) PORT_DIPLOCATION("SW:8")
967 	PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
968 	PORT_DIPSETTING( 0x00, DEF_STR( On ) )
969 INPUT_PORTS_END
970 
971 static INPUT_PORTS_START( gradius4 )
972 	PORT_INCLUDE( hornet )
973 
974 	PORT_MODIFY("DSW")
975 	PORT_DIPNAME( 0x80, 0x00, "Skip Post" ) PORT_DIPLOCATION("SW:1")
976 	PORT_DIPSETTING( 0x00, DEF_STR( On ) )
977 	PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
978 	PORT_DIPNAME( 0x40, 0x40, "Screen Flip (H)" ) PORT_DIPLOCATION("SW:2")
979 	PORT_DIPSETTING( 0x40, DEF_STR( Off ) )
980 	PORT_DIPSETTING( 0x00, DEF_STR( On ) )
981 	PORT_DIPNAME( 0x20, 0x20, "Screen Flip (V)" ) PORT_DIPLOCATION("SW:3")
982 	PORT_DIPSETTING( 0x20, DEF_STR( Off ) )
983 	PORT_DIPSETTING( 0x00, DEF_STR( On ) )
984 	PORT_DIPNAME( 0x10, 0x10, "DIP4" ) PORT_DIPLOCATION("SW:4")
985 	PORT_DIPSETTING( 0x10, DEF_STR( Off ) )
986 	PORT_DIPSETTING( 0x00, DEF_STR( On ) )
987 	PORT_DIPNAME( 0x08, 0x08, "DIP5" ) PORT_DIPLOCATION("SW:5")
988 	PORT_DIPSETTING( 0x08, DEF_STR( Off ) )
989 	PORT_DIPSETTING( 0x00, DEF_STR( On ) )
990 	PORT_DIPNAME( 0x04, 0x00, "Harness" ) PORT_DIPLOCATION("SW:6")
991 	PORT_DIPSETTING( 0x04, "JVS" )
992 	PORT_DIPSETTING( 0x00, "JAMMA" )
993 	PORT_DIPNAME( 0x02, 0x02, "DIP7" ) PORT_DIPLOCATION("SW:7")
994 	PORT_DIPSETTING( 0x02, DEF_STR( Off ) )
995 	PORT_DIPSETTING( 0x00, DEF_STR( On ) )
996 	PORT_DIPNAME( 0x01, 0x01, "Monitor Type" ) PORT_DIPLOCATION("SW:8")
997 	PORT_DIPSETTING( 0x01, "24KHz" )
998 	PORT_DIPSETTING( 0x00, "15KHz" )
999 INPUT_PORTS_END
1000 
1001 static INPUT_PORTS_START(nbapbp) //Need to add inputs for player 3 and 4.
1002 	PORT_INCLUDE(gradius4)
1003 
1004 	PORT_MODIFY("DSW")
1005 	PORT_DIPNAME(0x02, 0x02, "Cabinet Type") PORT_DIPLOCATION("SW:7")
1006 	PORT_DIPSETTING(0x02, "2 Player")
1007 	PORT_DIPSETTING(0x00, "4 Player")
1008 
1009 /*  PORT_START("IN3")
1010     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START3 )
1011     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(3)
1012     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(3)
1013     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(3)
1014     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(3)
1015     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
1016     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3)
1017     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3)
1018 
1019     PORT_START("IN4")
1020     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START4 )
1021     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(4)
1022     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(4)
1023     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(4)
1024     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(4)
1025     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4)
1026     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(4)
1027     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(4) */
1028 INPUT_PORTS_END
1029 
1030 static INPUT_PORTS_START(terabrst)
1031 	PORT_INCLUDE(hornet)
1032 
1033 	PORT_MODIFY("IN0")
1034 	PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(1) PORT_NAME("P1 Trigger")
1035 	PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_PLAYER(1) PORT_NAME("P1 Bomb")
1036 	PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON3) PORT_PLAYER(1) PORT_NAME("P1 Temp Cursor Speedup")
1037 
1038 	PORT_MODIFY("IN1")
1039 	PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(2) PORT_NAME("P2 Trigger")
1040 	PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_PLAYER(2) PORT_NAME("P2 Bomb")
1041 	PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON3) PORT_PLAYER(2) PORT_NAME("P2 Temp Cursor Speedup")
1042 INPUT_PORTS_END
1043 
1044 static INPUT_PORTS_START( sscope )
1045 	PORT_INCLUDE( hornet )
1046 
1047 	PORT_MODIFY("IN0")
1048 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Gun Trigger")
1049 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
1050 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
1051 
1052 	PORT_MODIFY("IN1")
1053 	PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
1054 
1055 	PORT_START("ANALOG1") // Gun Yaw
1056 	PORT_BIT( 0x7ff, 0x400, IPT_AD_STICK_X ) PORT_MINMAX(0x000, 0x7ff) PORT_SENSITIVITY(35) PORT_KEYDELTA(20)
1057 
1058 	PORT_START("ANALOG2") // Gun Pitch
1059 	PORT_BIT( 0x7ff, 0x3ff, IPT_AD_STICK_Y ) PORT_MINMAX(0x000, 0x7ff) PORT_SENSITIVITY(35) PORT_KEYDELTA(20) PORT_INVERT
1060 INPUT_PORTS_END
1061 
1062 static INPUT_PORTS_START( sscope2 )
1063 	PORT_INCLUDE( sscope )
1064 
1065 	// LAN board EEPROM
1066 	PORT_START( "EEPROMOUT" )
1067 	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("lan_eeprom", eeprom_serial_93cxx_device, di_write)
1068 	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("lan_eeprom", eeprom_serial_93cxx_device, clk_write)
1069 	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("lan_eeprom", eeprom_serial_93cxx_device, cs_write)
1070 INPUT_PORTS_END
1071 
1072 
1073 /* PowerPC interrupts
1074 
1075     IRQ0:   Vblank CG Board 0
1076     IRQ1:   Vblank CG Board 1
1077     IRQ2:   LANC
1078     DMA0
1079     NMI:    SCI
1080 
1081 */
1082 
1083 
1084 void hornet_state::machine_start()
1085 {
1086 	m_pcb_digit.resolve();
1087 
1088 	m_jvs_sdata_ptr = 0;
1089 	m_jvs_sdata = make_unique_clear<uint8_t[]>(1024);
1090 
1091 	/* set conservative DRC options */
1092 	m_maincpu->ppcdrc_set_options(PPCDRC_COMPATIBLE_OPTIONS);
1093 
1094 	/* configure fast RAM regions for DRC */
1095 	m_maincpu->ppcdrc_add_fastram(0x00000000, 0x003fffff, false, m_workram);
1096 
1097 	save_pointer(NAME(m_jvs_sdata), 1024);
1098 	save_item(NAME(m_jvs_sdata_ptr));
1099 
1100 	m_sound_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(hornet_state::sound_irq), this));
1101 }
1102 
machine_reset()1103 void hornet_state::machine_reset()
1104 {
1105 	memory_region* comm_region = memregion("user3");
1106 	if (comm_region != nullptr)
1107 	{
1108 		uint8_t* comm_rom = comm_region->base();
1109 		membank("bank1")->configure_entries(0, comm_region->bytes() / 0x10000, comm_rom, 0x10000);
1110 		membank("bank1")->set_entry(0);
1111 	}
1112 
1113 	m_dsp->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
1114 	if (m_dsp2 != nullptr)
1115 		m_dsp2->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
1116 
1117 	if (m_user5_ptr)
1118 	{
1119 		membank("bank5")->set_base(m_user5_ptr);
1120 		membank("bank6")->set_base(m_user5_ptr);
1121 	}
1122 }
1123 
adc12138_input_callback(uint8_t input)1124 double hornet_state::adc12138_input_callback(uint8_t input)
1125 {
1126 	int value = 0;
1127 	switch (input)
1128 	{
1129 		case 0: value = m_analog1.read_safe(0); break;
1130 		case 1: value = m_analog2.read_safe(0); break;
1131 	}
1132 
1133 	return (double)(value) / 2047.0;
1134 }
1135 
hornet(machine_config & config)1136 void hornet_state::hornet(machine_config &config)
1137 {
1138 	/* basic machine hardware */
1139 	PPC403GA(config, m_maincpu, XTAL(64'000'000) / 2);   /* PowerPC 403GA 32MHz */
1140 	m_maincpu->set_addrmap(AS_PROGRAM, &hornet_state::hornet_map);
1141 
1142 	M68000(config, m_audiocpu, XTAL(64'000'000) / 4);    /* 16MHz */
1143 	m_audiocpu->set_addrmap(AS_PROGRAM, &hornet_state::sound_memmap);
1144 
1145 	ADSP21062(config, m_dsp, XTAL(36'000'000));
1146 	m_dsp->set_boot_mode(adsp21062_device::BOOT_MODE_EPROM);
1147 	m_dsp->set_addrmap(AS_DATA, &hornet_state::sharc0_map);
1148 
1149 	config.set_maximum_quantum(attotime::from_hz(6000));
1150 
1151 	WATCHDOG_TIMER(config, m_watchdog);
1152 
1153 //  PCB description at top doesn't mention any EEPROM on the base board...
1154 //  EEPROM_93C46_16BIT(config, "eeprom");
1155 
1156 	VOODOO_1(config, m_voodoo[0], XTAL(50'000'000));
1157 	m_voodoo[0]->set_fbmem(2);
1158 	m_voodoo[0]->set_tmumem(4,0);
1159 	m_voodoo[0]->set_screen_tag("screen");
1160 	m_voodoo[0]->set_cpu_tag("dsp");
1161 	m_voodoo[0]->vblank_callback().set(FUNC(hornet_state::voodoo_vblank_0));
1162 
1163 	K033906(config, "k033906_1", 0, "voodoo0");
1164 
1165 	/* video hardware */
1166 	screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
1167 	// default 24KHz parameter in both 037122 and voodoo, input clock correct? (58~Hz Vsync, 50MHz/3 or 64MHz/4?)
1168 	screen.set_raw(XTAL(64'000'000) / 4, 644, 41, 41 + 512, 428, 27, 27 + 384);
1169 	screen.set_screen_update(FUNC(hornet_state::screen_update));
1170 
1171 	PALETTE(config, "palette").set_entries(65536);
1172 
1173 	K037122(config, m_k037122_1, 0);
1174 	m_k037122_1->set_screen("screen");
1175 	m_k037122_1->set_palette("palette");
1176 
1177 	K056800(config, m_k056800, XTAL(16'934'400));
1178 	m_k056800->int_callback().set_inputline(m_audiocpu, M68K_IRQ_2);
1179 
1180 	SPEAKER(config, "lspeaker").front_left();
1181 	SPEAKER(config, "rspeaker").front_right();
1182 
1183 	RF5C400(config, "rfsnd", XTAL(16'934'400))  // value from Guru readme, gives 44100 Hz sample rate
1184 		.add_route(0, "lspeaker", 1.0)
1185 		.add_route(1, "rspeaker", 1.0);
1186 
1187 	M48T58(config, "m48t58", 0);
1188 
1189 	ADC12138(config, m_adc12138, 0);
1190 	m_adc12138->set_ipt_convert_callback(FUNC(hornet_state::adc12138_input_callback));
1191 
1192 	KONPPC(config, m_konppc, 0);
1193 	m_konppc->set_num_boards(1);
1194 	m_konppc->set_cbboard_type(konppc_device::CGBOARD_TYPE_HORNET);
1195 }
1196 
terabrst(machine_config & config)1197 void hornet_state::terabrst(machine_config &config) //todo: add K056800 from I/O board
1198 {
1199 	hornet(config);
1200 
1201 	m_maincpu->set_addrmap(AS_PROGRAM, &hornet_state::terabrst_map);
1202 
1203 	M68000(config, m_gn680, XTAL(32'000'000) / 2);   /* 16MHz */
1204 	m_gn680->set_addrmap(AS_PROGRAM, &hornet_state::gn680_memmap);
1205 }
1206 
sscope(machine_config & config)1207 void hornet_state::sscope(machine_config &config)
1208 {
1209 	hornet(config);
1210 
1211 	m_maincpu->set_addrmap(AS_PROGRAM, &hornet_state::sscope_map);
1212 
1213 	ADSP21062(config, m_dsp2, XTAL(36'000'000));
1214 	m_dsp2->set_boot_mode(adsp21062_device::BOOT_MODE_EPROM);
1215 	m_dsp2->set_addrmap(AS_DATA, &hornet_state::sharc1_map);
1216 
1217 	m_k037122_1->set_screen("lscreen");
1218 	m_k037122_1->set_palette("palette");
1219 
1220 	K037122(config, m_k037122_2, 0); // unknown input clock
1221 	m_k037122_2->set_screen("rscreen");
1222 	m_k037122_2->set_palette("palette");
1223 
1224 	m_voodoo[0]->set_screen_tag("lscreen");
1225 
1226 	VOODOO_1(config, m_voodoo[1], XTAL(50'000'000));
1227 	m_voodoo[1]->set_fbmem(2);
1228 	m_voodoo[1]->set_tmumem(4, 0);
1229 	m_voodoo[1]->set_screen_tag("rscreen");
1230 	m_voodoo[1]->set_cpu_tag("dsp2");
1231 	m_voodoo[1]->vblank_callback().set(FUNC(hornet_state::voodoo_vblank_1));
1232 
1233 	K033906(config, "k033906_2", 0, "voodoo1");
1234 
1235 	/* video hardware */
1236 	config.device_remove("screen");
1237 
1238 	screen_device &lscreen(SCREEN(config, "lscreen", SCREEN_TYPE_RASTER));
1239 	// default 24KHz parameter in both 037122 and voodoo, input clock correct? (58~Hz Vsync, 50MHz/3 or 64MHz/4?)
1240 	lscreen.set_raw(XTAL(64'000'000) / 4, 644, 41, 41 + 512, 428, 27, 27 + 384);
1241 	lscreen.set_screen_update(FUNC(hornet_state::screen_update));
1242 
1243 	screen_device &rscreen(SCREEN(config, "rscreen", SCREEN_TYPE_RASTER)); // for scope
1244 	// scope screen is 15khz, verified default parameter in both 037122 and voodoo, input clock correct? (60~Hz Vsync, 50MHz/3 or 64MHz/4?)
1245 	rscreen.set_raw(XTAL(64'000'000) / 4, 1017, 106, 106 + 768, 262, 17, 17 + 236);
1246 	rscreen.set_screen_update(FUNC(hornet_state::screen_update_rscreen));
1247 
1248 /*  ADC12138(config, m_adc12138_2, 0);
1249     m_adc12138->set_ipt_convert_callback(FUNC(hornet_state::sscope_input_callback)); */
1250 
1251 	m_konppc->set_num_boards(2);
1252 }
1253 
sscope2(machine_config & config)1254 void hornet_state::sscope2(machine_config &config)
1255 {
1256 	sscope(config);
1257 
1258 	m_maincpu->set_addrmap(AS_PROGRAM, &hornet_state::sscope2_map);
1259 
1260 	VOODOO_2(config.replace(), m_voodoo[0], STD_VOODOO_2_CLOCK);
1261 	m_voodoo[0]->set_fbmem(2);
1262 	m_voodoo[0]->set_tmumem(4,0);
1263 	m_voodoo[0]->set_screen_tag("lscreen");
1264 	m_voodoo[0]->set_cpu_tag("dsp");
1265 	m_voodoo[0]->vblank_callback().set(FUNC(hornet_state::voodoo_vblank_0));
1266 
1267 	VOODOO_2(config.replace(), m_voodoo[1], STD_VOODOO_2_CLOCK);
1268 	m_voodoo[1]->set_fbmem(2);
1269 	m_voodoo[1]->set_tmumem(4,0);
1270 	m_voodoo[1]->set_screen_tag("rscreen");
1271 	m_voodoo[1]->set_cpu_tag("dsp2");
1272 	m_voodoo[1]->vblank_callback().set(FUNC(hornet_state::voodoo_vblank_1));
1273 
1274 	DS2401(config, "lan_serial_id");
1275 	EEPROM_93C46_16BIT(config, "lan_eeprom");
1276 }
1277 
1278 
1279 /*****************************************************************************/
1280 
jamma_jvs_w(uint8_t data)1281 void hornet_state::jamma_jvs_w(uint8_t data)
1282 {
1283 	if (m_jvs_sdata_ptr == 0 && data != 0xe0)
1284 		return;
1285 	m_jvs_sdata[m_jvs_sdata_ptr] = data;
1286 	m_jvs_sdata_ptr++;
1287 
1288 	if (m_jvs_sdata_ptr >= 3 && m_jvs_sdata_ptr >= 3 + m_jvs_sdata[2])
1289 		jamma_jvs_cmd_exec();
1290 }
1291 
jvs_encode_data(uint8_t * in,int length)1292 int hornet_state::jvs_encode_data(uint8_t *in, int length)
1293 {
1294 	int inptr = 0;
1295 	int sum = 0;
1296 
1297 	while (inptr < length)
1298 	{
1299 		uint8_t b = in[inptr++];
1300 		if (b == 0xe0)
1301 		{
1302 			sum += 0xd0 + 0xdf;
1303 			m_maincpu->ppc4xx_spu_receive_byte(0xd0);
1304 			m_maincpu->ppc4xx_spu_receive_byte(0xdf);
1305 		}
1306 		else if (b == 0xd0)
1307 		{
1308 			sum += 0xd0 + 0xcf;
1309 			m_maincpu->ppc4xx_spu_receive_byte(0xd0);
1310 			m_maincpu->ppc4xx_spu_receive_byte(0xcf);
1311 		}
1312 		else
1313 		{
1314 			sum += b;
1315 			m_maincpu->ppc4xx_spu_receive_byte(b);
1316 		}
1317 	}
1318 	return sum;
1319 }
1320 
jvs_decode_data(uint8_t * in,uint8_t * out,int length)1321 int hornet_state::jvs_decode_data(uint8_t *in, uint8_t *out, int length)
1322 {
1323 	int outptr = 0;
1324 	int inptr = 0;
1325 
1326 	while (inptr < length)
1327 	{
1328 		uint8_t b = in[inptr++];
1329 		if (b == 0xd0)
1330 		{
1331 			uint8_t b2 = in[inptr++];
1332 			out[outptr++] = b2 + 1;
1333 		}
1334 		else
1335 		{
1336 			out[outptr++] = b;
1337 		}
1338 	};
1339 
1340 	return outptr;
1341 }
1342 
jamma_jvs_cmd_exec()1343 void hornet_state::jamma_jvs_cmd_exec()
1344 {
1345 	uint8_t byte_num;
1346 	uint8_t data[1024], rdata[1024];
1347 #if 0
1348 	int length;
1349 #endif
1350 	int rdata_ptr;
1351 	int sum;
1352 
1353 //  sync = m_jvs_sdata[0];
1354 //  node = m_jvs_sdata[1];
1355 	byte_num = m_jvs_sdata[2];
1356 
1357 #if 0
1358 	length =
1359 #endif
1360 		jvs_decode_data(&m_jvs_sdata[3], data, byte_num-1);
1361 #if 0
1362 	printf("jvs input data:\n");
1363 	for (i=0; i < byte_num; i++)
1364 	{
1365 		printf("%02X ", m_jvs_sdata[3+i]);
1366 	}
1367 	printf("\n");
1368 
1369 	printf("jvs data decoded to:\n");
1370 	for (i=0; i < length; i++)
1371 	{
1372 		printf("%02X ", data[i]);
1373 	}
1374 	printf("\n\n");
1375 #endif
1376 
1377 	// clear return data
1378 	memset(rdata, 0, sizeof(rdata));
1379 	rdata_ptr = 0;
1380 
1381 	// status
1382 	rdata[rdata_ptr++] = 0x01;      // normal
1383 
1384 	// handle the command
1385 	switch (data[0])
1386 	{
1387 		case 0xf0:      // Reset
1388 		{
1389 			break;
1390 		}
1391 		case 0xf1:      // Address setting
1392 		{
1393 			rdata[rdata_ptr++] = 0x01;      // report data (normal)
1394 			break;
1395 		}
1396 		case 0xfa:
1397 		{
1398 			break;
1399 		}
1400 		default:
1401 		{
1402 			fatalerror("jamma_jvs_cmd_exec: unknown command %02X\n", data[0]);
1403 		}
1404 	}
1405 
1406 	// write jvs return data
1407 	sum = 0x00 + (rdata_ptr+1);
1408 	m_maincpu->ppc4xx_spu_receive_byte(0xe0);           // sync
1409 	m_maincpu->ppc4xx_spu_receive_byte(0x00);           // node
1410 	m_maincpu->ppc4xx_spu_receive_byte(rdata_ptr + 1);  // num of bytes
1411 	sum += jvs_encode_data(rdata, rdata_ptr);
1412 	m_maincpu->ppc4xx_spu_receive_byte(sum - 1);        // checksum
1413 
1414 	m_jvs_sdata_ptr = 0;
1415 }
1416 
1417 /*****************************************************************************/
1418 
init_hornet()1419 void hornet_state::init_hornet()
1420 {
1421 	m_konppc->set_cgboard_texture_bank(0, "bank5", memregion("user5")->base());
1422 
1423 	m_maincpu->ppc4xx_spu_set_tx_handler(write8smo_delegate(*this, FUNC(hornet_state::jamma_jvs_w)));
1424 }
1425 
init_gradius4()1426 void hornet_state::init_gradius4()
1427 {
1428 	init_hornet();
1429 	m_dsp->enable_recompiler();
1430 }
1431 
init_nbapbp()1432 void hornet_state::init_nbapbp()
1433 {
1434 	init_hornet();
1435 	m_dsp->enable_recompiler();
1436 }
1437 
init_terabrst()1438 void hornet_state::init_terabrst()
1439 {
1440 	init_hornet();
1441 	m_dsp->enable_recompiler();
1442 }
1443 
init_sscope()1444 void hornet_state::init_sscope()
1445 {
1446 	m_konppc->set_cgboard_texture_bank(0, "bank5", memregion("user5")->base());
1447 	m_konppc->set_cgboard_texture_bank(1, "bank6", memregion("user5")->base());
1448 
1449 	m_maincpu->ppc4xx_spu_set_tx_handler(write8smo_delegate(*this, FUNC(hornet_state::jamma_jvs_w)));
1450 }
1451 
init_sscope2()1452 void hornet_state::init_sscope2() //fixme: eventually set sscope2 to load gfx roms from the comm board
1453 {
1454 	m_konppc->set_cgboard_texture_bank(0, "bank5", memregion("user5")->base());
1455 	m_konppc->set_cgboard_texture_bank(1, "bank6", memregion("user5")->base());
1456 
1457 	m_maincpu->ppc4xx_spu_set_tx_handler(write8smo_delegate(*this, FUNC(hornet_state::jamma_jvs_w)));
1458 }
1459 
1460 /*****************************************************************************/
1461 
1462 ROM_START(sscope)
1463 	ROM_REGION32_BE(0x400000, "user1", 0)   /* PowerPC program */
1464 	ROM_LOAD16_WORD_SWAP("830d01.27p", 0x200000, 0x200000, CRC(de9b3dfa) SHA1(660652a5f745cb04687481c3626d8a43cd169193) )
1465 	ROM_RELOAD(0x000000, 0x200000)
1466 
1467 	ROM_REGION32_BE(0x800000, "user2", ROMREGION_ERASE00)   /* Data roms */
1468 
1469 	ROM_REGION(0x80000, "audiocpu", 0)      /* 68K Program */
1470 	ROM_LOAD16_WORD_SWAP("830a08.7s", 0x000000, 0x80000, CRC(2805ea1d) SHA1(2556a51ee98cb8f59bf081e916c69a24532196f1) )
1471 
1472 	ROM_REGION(0x1000000, "user5", 0)       /* CG Board texture roms */
1473 	ROM_LOAD32_WORD( "830a14.u32", 0x000000, 0x400000, CRC(335793e1) SHA1(d582b53c3853abd59bc728f619a30c27cfc9497c) )
1474 	ROM_LOAD32_WORD( "830a13.u24", 0x000002, 0x400000, CRC(d6e7877e) SHA1(b4d0e17ada7dd126ec564a20e7140775b4b3fdb7) )
1475 
1476 	ROM_REGION16_LE(0x1000000, "rfsnd", 0)       /* PCM sample roms */
1477 	ROM_LOAD( "830a09.16p", 0x000000, 0x400000, CRC(e4b9f305) SHA1(ce2c6f63bdc9374dde48d8359102b57e48b4fdeb) )
1478 	ROM_LOAD( "830a10.14p", 0x400000, 0x400000, CRC(8b8aaf7e) SHA1(49b694dc171c149056b87c15410a6bf37ff2987f) )
1479 
1480 	ROM_REGION(0x2000, "m48t58",0)
1481 	ROM_LOAD( "m48t58y.35d",   0x000000, 0x002000, CRC(b077e262) SHA1(5cdcc1b742bf23562f4558216063fea903f045ab) ) // this is set to the JXD, I don't think it's valid.
1482 	ROM_LOAD( "m48t58y-70pc1", 0x000000, 0x002000, CRC(ee815325) SHA1(91b10802791b68a8360c0cd6c376c0c4bbbc6fa0) ) // so just load over it with the US one, we know works.
1483 ROM_END
1484 
1485 ROM_START(sscopec)
1486 	ROM_REGION32_BE(0x400000, "user1", 0)   /* PowerPC program */
1487 	ROM_LOAD16_WORD_SWAP("830c01.27p", 0x200000, 0x200000, CRC(87682449) SHA1(6ccaa5bac86e947e01a6aae568a75f002421fe5b) )
1488 	ROM_RELOAD(0x000000, 0x200000)
1489 
1490 	ROM_REGION32_BE(0x800000, "user2", ROMREGION_ERASE00)   /* Data roms */
1491 
1492 	ROM_REGION(0x80000, "audiocpu", 0)      /* 68K Program */
1493 	ROM_LOAD16_WORD_SWAP("830a08.7s", 0x000000, 0x80000, CRC(2805ea1d) SHA1(2556a51ee98cb8f59bf081e916c69a24532196f1) )
1494 
1495 	ROM_REGION(0x1000000, "user5", 0)       /* CG Board texture roms */
1496 	ROM_LOAD32_WORD( "830a14.u32", 0x000000, 0x400000, CRC(335793e1) SHA1(d582b53c3853abd59bc728f619a30c27cfc9497c) )
1497 	ROM_LOAD32_WORD( "830a13.u24", 0x000002, 0x400000, CRC(d6e7877e) SHA1(b4d0e17ada7dd126ec564a20e7140775b4b3fdb7) )
1498 
1499 	ROM_REGION16_LE(0x1000000, "rfsnd", 0)       /* PCM sample roms */
1500 	ROM_LOAD( "830a09.16p", 0x000000, 0x400000, CRC(e4b9f305) SHA1(ce2c6f63bdc9374dde48d8359102b57e48b4fdeb) )
1501 	ROM_LOAD( "830a10.14p", 0x400000, 0x400000, CRC(8b8aaf7e) SHA1(49b694dc171c149056b87c15410a6bf37ff2987f) )
1502 
1503 	ROM_REGION(0x2000, "m48t58",0)
1504 	ROM_LOAD( "m48t58y-70pc1", 0x000000, 0x002000, CRC(ee815325) SHA1(91b10802791b68a8360c0cd6c376c0c4bbbc6fa0) )
1505 ROM_END
1506 
1507 ROM_START(sscopeb)
1508 	ROM_REGION32_BE(0x400000, "user1", 0)   /* PowerPC program */
1509 	ROM_LOAD16_WORD_SWAP("830b01.27p", 0x200000, 0x200000, CRC(3b6bb075) SHA1(babc134c3a20c7cdcaa735d5f1fd5cab38667a14) )
1510 	ROM_RELOAD(0x000000, 0x200000)
1511 
1512 	ROM_REGION32_BE(0x800000, "user2", ROMREGION_ERASE00)   /* Data roms */
1513 
1514 	ROM_REGION(0x80000, "audiocpu", 0)      /* 68K Program */
1515 	ROM_LOAD16_WORD_SWAP("830a08.7s", 0x000000, 0x80000, CRC(2805ea1d) SHA1(2556a51ee98cb8f59bf081e916c69a24532196f1) )
1516 
1517 	ROM_REGION(0x1000000, "user5", 0)       /* CG Board texture roms */
1518 	ROM_LOAD32_WORD( "830a14.u32", 0x000000, 0x400000, CRC(335793e1) SHA1(d582b53c3853abd59bc728f619a30c27cfc9497c) )
1519 	ROM_LOAD32_WORD( "830a13.u24", 0x000002, 0x400000, CRC(d6e7877e) SHA1(b4d0e17ada7dd126ec564a20e7140775b4b3fdb7) )
1520 
1521 	ROM_REGION16_LE(0x1000000, "rfsnd", 0)       /* PCM sample roms */
1522 	ROM_LOAD( "830a09.16p", 0x000000, 0x400000, CRC(e4b9f305) SHA1(ce2c6f63bdc9374dde48d8359102b57e48b4fdeb) )
1523 	ROM_LOAD( "830a10.14p", 0x400000, 0x400000, CRC(8b8aaf7e) SHA1(49b694dc171c149056b87c15410a6bf37ff2987f) )
1524 
1525 	ROM_REGION(0x2000, "m48t58",0)
1526 	ROM_LOAD( "m48t58y-70pc1", 0x000000, 0x002000, CRC(ee815325) SHA1(91b10802791b68a8360c0cd6c376c0c4bbbc6fa0) )
1527 ROM_END
1528 
1529 ROM_START(sscopea)
1530 	ROM_REGION32_BE(0x400000, "user1", 0)   /* PowerPC program */
1531 	ROM_LOAD16_WORD_SWAP("830a01.27p", 0x200000, 0x200000, CRC(39e353f1) SHA1(569b06969ae7a690f6d6e63cc3b5336061663a37) )
1532 	ROM_RELOAD(0x000000, 0x200000)
1533 
1534 	ROM_REGION32_BE(0x800000, "user2", ROMREGION_ERASE00)   /* Data roms */
1535 
1536 	ROM_REGION(0x80000, "audiocpu", 0)      /* 68K Program */
1537 	ROM_LOAD16_WORD_SWAP("830a08.7s", 0x000000, 0x80000, CRC(2805ea1d) SHA1(2556a51ee98cb8f59bf081e916c69a24532196f1) )
1538 
1539 	ROM_REGION(0x1000000, "user5", 0)       /* CG Board texture roms */
1540 	ROM_LOAD32_WORD( "830a14.u32", 0x000000, 0x400000, CRC(335793e1) SHA1(d582b53c3853abd59bc728f619a30c27cfc9497c) )
1541 	ROM_LOAD32_WORD( "830a13.u24", 0x000002, 0x400000, CRC(d6e7877e) SHA1(b4d0e17ada7dd126ec564a20e7140775b4b3fdb7) )
1542 
1543 	ROM_REGION16_LE(0x1000000, "rfsnd", 0)       /* PCM sample roms */
1544 	ROM_LOAD( "830a09.16p", 0x000000, 0x400000, CRC(e4b9f305) SHA1(ce2c6f63bdc9374dde48d8359102b57e48b4fdeb) )
1545 	ROM_LOAD( "830a10.14p", 0x400000, 0x400000, CRC(8b8aaf7e) SHA1(49b694dc171c149056b87c15410a6bf37ff2987f) )
1546 
1547 	ROM_REGION(0x2000, "m48t58",0)
1548 	ROM_LOAD( "m48t58y-70pc1", 0x000000, 0x002000, CRC(ee815325) SHA1(91b10802791b68a8360c0cd6c376c0c4bbbc6fa0) )
1549 ROM_END
1550 
1551 ROM_START(sscope2)
1552 	ROM_REGION32_BE(0x400000, "user1", 0)   /* PowerPC program */
1553 	ROM_LOAD16_WORD_SWAP("931d01.bin", 0x200000, 0x200000, CRC(4065fde6) SHA1(84f2dedc3e8f61651b22c0a21433a64993e1b9e2) )
1554 	ROM_RELOAD(0x000000, 0x200000)
1555 
1556 	ROM_REGION32_BE(0x800000, "user2", 0)   /* Data roms */
1557 	ROM_LOAD32_WORD_SWAP("931a04.bin", 0x000000, 0x200000, CRC(4f5917e6) SHA1(a63a107f1d6d9756e4ab0965d72ea446f0692814) )
1558 
1559 	ROM_REGION32_BE(0x800000, "user3", 0)   /* Comm board roms */
1560 	ROM_LOAD("931a19.bin", 0x000000, 0x400000, BAD_DUMP CRC(8b25a6f1) SHA1(41f9c2046a6aae1e9f5f3ffa3e0ffb15eba46211) )
1561 	ROM_LOAD("931a20.bin", 0x400000, 0x400000, BAD_DUMP CRC(ecf665f6) SHA1(5a73e87435560a7bb2d0f9be7fba12254b18708d) )
1562 
1563 	ROM_REGION(0x800000, "user5", ROMREGION_ERASE00)    /* CG Board texture roms */
1564 
1565 	ROM_REGION(0x80000, "audiocpu", 0)      /* 68K Program */
1566 	ROM_LOAD16_WORD_SWAP("931a08.bin", 0x000000, 0x80000, CRC(1597d604) SHA1(a1eab4d25907930b59ea558b484c3b6ddcb9303c) )
1567 
1568 	ROM_REGION16_LE(0xc00000, "rfsnd", 0)        /* PCM sample roms */
1569 	ROM_LOAD( "931a09.bin",   0x000000, 0x400000, CRC(694c354c) SHA1(42f54254a5959e1b341f2801f1ad032c4ed6f329) )
1570 	ROM_LOAD( "931a10.bin",   0x400000, 0x400000, CRC(78ceb519) SHA1(e61c0d21b6dc37a9293e72814474f5aee59115ad) )
1571 	ROM_LOAD( "931a11.bin",   0x800000, 0x400000, CRC(9c8362b2) SHA1(a8158c4db386e2bbd61dc9a600720f07a1eba294) )
1572 
1573 	ROM_REGION(0x2000, "m48t58",0)
1574 	ROM_LOAD( "m48t58y-70pc1", 0x000000, 0x002000, CRC(d4e69d7a) SHA1(1e29eecf4886e5e098a388dedd5f3901c2bb65e5) )
1575 
1576 	ROM_REGION(0x8, "lan_serial_id", 0)     /* LAN Board DS2401 */
1577 	ROM_LOAD( "ds2401.8b", 0x000000, 0x000008, BAD_DUMP CRC(bae36d0b) SHA1(4dd5915888d5718356b40bbe897f2470e410176a) ) // hand built
1578 
1579 	ROM_REGION16_BE(0x80, "lan_eeprom", 0)       /* LAN Board AT93C46 */
1580 	ROM_LOAD( "at93c46.16g", 0x000000, 0x000080, BAD_DUMP CRC(cc63c213) SHA1(fb20e56fb73a887dc7b6db49efd1f8a18b959152) ) // hand built
1581 ROM_END
1582 
1583 ROM_START(gradius4)
1584 	ROM_REGION32_BE(0x400000, "user1", 0)   /* PowerPC program */
1585 	ROM_LOAD16_WORD_SWAP( "837c01.27p",   0x200000, 0x200000, CRC(ce003123) SHA1(15e33997be2c1b3f71998627c540db378680a7a1) )
1586 	ROM_RELOAD(0x000000, 0x200000)
1587 
1588 	ROM_REGION32_BE(0x800000, "user2", 0)   /* Data roms */
1589 	ROM_LOAD32_WORD_SWAP( "837a04.16t",   0x000000, 0x200000, CRC(18453b59) SHA1(3c75a54d8c09c0796223b42d30fb3867a911a074) )
1590 	ROM_LOAD32_WORD_SWAP( "837a05.14t",   0x000002, 0x200000, CRC(77178633) SHA1(ececdd501d0692390325c8dad6dbb068808a8b26) )
1591 
1592 	ROM_REGION32_BE(0x1000000, "user5", 0)  /* CG Board texture roms */
1593 	ROM_LOAD32_WORD_SWAP( "837a14.32u",   0x000002, 0x400000, CRC(ff1b5d18) SHA1(7a38362170133dcc6ea01eb62981845917b85c36) )
1594 	ROM_LOAD32_WORD_SWAP( "837a13.24u",   0x000000, 0x400000, CRC(d86e10ff) SHA1(6de1179d7081d9a93ab6df47692d3efc190c38ba) )
1595 	ROM_LOAD32_WORD_SWAP( "837a16.32v",   0x800002, 0x400000, CRC(bb7a7558) SHA1(8c8cc062793c2dcfa72657b6ea0813d7223a0b87) )
1596 	ROM_LOAD32_WORD_SWAP( "837a15.24v",   0x800000, 0x400000, CRC(e0620737) SHA1(c14078cdb44f75c7c956b3627045d8494941d6b4) )
1597 
1598 	ROM_REGION(0x80000, "audiocpu", 0)      /* 68K Program */
1599 	ROM_LOAD16_WORD_SWAP( "837a08.7s",    0x000000, 0x080000, CRC(c3a7ff56) SHA1(9d8d033277d560b58da151338d14b4758a9235ea) )
1600 
1601 	ROM_REGION16_LE(0x800000, "rfsnd", 0)        /* PCM sample roms */
1602 	ROM_LOAD( "837a09.16p",   0x000000, 0x400000, CRC(fb8f3dc2) SHA1(69e314ac06308c5a24309abc3d7b05af6c0302a8) )
1603 	ROM_LOAD( "837a10.14p",   0x400000, 0x400000, CRC(1419cad2) SHA1(a6369a5c29813fa51e8246d0c091736f32994f3d) )
1604 
1605 	ROM_REGION(0x2000, "m48t58",0)
1606 	ROM_LOAD( "m48t58y-70pc1", 0x000000, 0x002000, CRC(935f9d05) SHA1(c3a787dff1b2ac4942858ffa1574405db01292b6) )
1607 ROM_END
1608 
1609 ROM_START(nbapbp)
1610 	ROM_REGION32_BE(0x400000, "user1", 0)   /* PowerPC program */
1611 	ROM_LOAD16_WORD_SWAP( "778a01.27p",   0x200000, 0x200000, CRC(e70019ce) SHA1(8b187b6e670fdc88771da08a56685cd621b139dc) )
1612 	ROM_RELOAD(0x000000, 0x200000)
1613 
1614 	ROM_REGION32_BE(0x800000, "user2", 0)   /* Data roms */
1615 	ROM_LOAD32_WORD_SWAP( "778a04.16t",   0x000000, 0x400000, CRC(62c70132) SHA1(405aed149fc51e0adfa3ace3c644e47d53cf1ee3) )
1616 	ROM_LOAD32_WORD_SWAP( "778a05.14t",   0x000002, 0x400000, CRC(03249803) SHA1(f632a5f1dfa0a8500407214df0ec8d98ce09bc2b) )
1617 
1618 	ROM_REGION32_BE(0x1000000, "user5", 0)  /* CG Board texture roms */
1619 	ROM_LOAD32_WORD_SWAP( "778a14.32u",   0x000002, 0x400000, CRC(db0c278d) SHA1(bb9884b6cdcdb707fff7e56e92e2ede062abcfd3) )
1620 	ROM_LOAD32_WORD_SWAP( "778a13.24u",   0x000000, 0x400000, CRC(47fda9cc) SHA1(4aae01c1f1861b4b12a3f9de6b39eb4d11a9736b) )
1621 	ROM_LOAD32_WORD_SWAP( "778a16.32v",   0x800002, 0x400000, CRC(6c0f46ea) SHA1(c6b9fbe14e13114a91a5925a0b46496260539687) )
1622 	ROM_LOAD32_WORD_SWAP( "778a15.24v",   0x800000, 0x400000, CRC(d176ad0d) SHA1(2be755dfa3f60379d396734809bbaaaad49e0db5) )
1623 
1624 	ROM_REGION(0x80000, "audiocpu", 0)      /* 68K Program */
1625 	ROM_LOAD16_WORD_SWAP( "778a08.7s",    0x000000, 0x080000, CRC(6259b4bf) SHA1(d0c38870495c9a07984b4b85e736d6477dd44832) )
1626 
1627 	ROM_REGION16_LE(0x1000000, "rfsnd", 0)       /* PCM sample roms */
1628 	ROM_LOAD( "778a09.16p",   0x000000, 0x400000, CRC(e8c6fd93) SHA1(dd378b67b3b7dd932e4b39fbf4321e706522247f) )
1629 	ROM_LOAD( "778a10.14p",   0x400000, 0x400000, CRC(c6a0857b) SHA1(976734ba56460fcc090619fbba043a3d888c4f4e) )
1630 	ROM_LOAD( "778a11.12p",   0x800000, 0x400000, CRC(40199382) SHA1(bee268adf9b6634a4f6bb39278ecd02f2bdcb1f4) )
1631 	ROM_LOAD( "778a12.9p",    0xc00000, 0x400000, CRC(27d0c724) SHA1(48e48cbaea6db0de8c3471a2eda6faaa16eed46e) )
1632 
1633 	ROM_REGION(0x2000, "m48t58",0)
1634 	ROM_LOAD( "m48t58y-70pc1", 0x000000, 0x002000, CRC(3cff1b1d) SHA1(bed0fc657a785be0c69bb21ad52365635c83d751) )
1635 ROM_END
1636 
1637 ROM_START(nbapbpa) // only the PowerPC program rom present in the archive
1638 	ROM_REGION32_BE(0x400000, "user1", 0)   /* PowerPC program */
1639 	ROM_LOAD16_WORD_SWAP( "778b01.27p",   0x200000, 0x200000, CRC(8dca96b5) SHA1(7dfa38c4be6c3547ee9c7ad104282510e205ab37) )
1640 	ROM_RELOAD(0x000000, 0x200000)
1641 
1642 	ROM_REGION32_BE(0x800000, "user2", 0)   /* Data roms */
1643 	ROM_LOAD32_WORD_SWAP( "778a04.16t",   0x000000, 0x400000, CRC(62c70132) SHA1(405aed149fc51e0adfa3ace3c644e47d53cf1ee3) )
1644 	ROM_LOAD32_WORD_SWAP( "778a05.14t",   0x000002, 0x400000, CRC(03249803) SHA1(f632a5f1dfa0a8500407214df0ec8d98ce09bc2b) )
1645 
1646 	ROM_REGION32_BE(0x1000000, "user5", 0)  /* CG Board texture roms */
1647 	ROM_LOAD32_WORD_SWAP( "778a14.32u",   0x000002, 0x400000, CRC(db0c278d) SHA1(bb9884b6cdcdb707fff7e56e92e2ede062abcfd3) )
1648 	ROM_LOAD32_WORD_SWAP( "778a13.24u",   0x000000, 0x400000, CRC(47fda9cc) SHA1(4aae01c1f1861b4b12a3f9de6b39eb4d11a9736b) )
1649 	ROM_LOAD32_WORD_SWAP( "778a16.32v",   0x800002, 0x400000, CRC(6c0f46ea) SHA1(c6b9fbe14e13114a91a5925a0b46496260539687) )
1650 	ROM_LOAD32_WORD_SWAP( "778a15.24v",   0x800000, 0x400000, CRC(d176ad0d) SHA1(2be755dfa3f60379d396734809bbaaaad49e0db5) )
1651 
1652 	ROM_REGION(0x80000, "audiocpu", 0)      /* 68K Program */
1653 	ROM_LOAD16_WORD_SWAP( "778a08.7s",    0x000000, 0x080000, CRC(6259b4bf) SHA1(d0c38870495c9a07984b4b85e736d6477dd44832) )
1654 
1655 	ROM_REGION16_LE(0x1000000, "rfsnd", 0)       /* PCM sample roms */
1656 	ROM_LOAD( "778a09.16p",   0x000000, 0x400000, CRC(e8c6fd93) SHA1(dd378b67b3b7dd932e4b39fbf4321e706522247f) )
1657 	ROM_LOAD( "778a10.14p",   0x400000, 0x400000, CRC(c6a0857b) SHA1(976734ba56460fcc090619fbba043a3d888c4f4e) )
1658 	ROM_LOAD( "778a11.12p",   0x800000, 0x400000, CRC(40199382) SHA1(bee268adf9b6634a4f6bb39278ecd02f2bdcb1f4) )
1659 	ROM_LOAD( "778a12.9p",    0xc00000, 0x400000, CRC(27d0c724) SHA1(48e48cbaea6db0de8c3471a2eda6faaa16eed46e) )
1660 
1661 	ROM_REGION(0x2000, "m48t58",0)
1662 	ROM_LOAD( "m48t58y-70pc1", 0x000000, 0x002000, BAD_DUMP CRC(3cff1b1d) SHA1(bed0fc657a785be0c69bb21ad52365635c83d751) )
1663 ROM_END
1664 
1665 ROM_START(terabrst)
1666 	ROM_REGION32_BE(0x400000, "user1", 0)   /* PowerPC program */
1667 		ROM_LOAD32_WORD_SWAP( "715l02.25p",   0x000000, 0x200000, CRC(79586f19) SHA1(8dcfed5d101ebe49d958a7a38d5472323f75dd1d) )
1668 	ROM_LOAD32_WORD_SWAP( "715l03.22p",   0x000002, 0x200000, CRC(c193021e) SHA1(c934b7c4bdab0ceff0f1699fcf2fb7d90e2e8962) )
1669 
1670 	ROM_REGION32_BE(0x800000, "user2", 0)   /* Data roms */
1671 	ROM_LOAD32_WORD_SWAP( "715a04.16t",   0x000000, 0x200000, CRC(00d9567e) SHA1(fe372399ad0ae89d557c93c3145b38e3ed0f714d) )
1672 	ROM_LOAD32_WORD_SWAP( "715a05.14t",   0x000002, 0x200000, CRC(462d53bf) SHA1(0216a84358571de6791365c69a1fa8fe2784148d) )
1673 
1674 	ROM_REGION32_BE(0x1000000, "user5", 0)  /* CG Board texture roms */
1675 	ROM_LOAD32_WORD_SWAP( "715a14.32u",   0x000002, 0x400000, CRC(bbb36be3) SHA1(c828d0af0546db02e87afe68423b9447db7c7e51) )
1676 	ROM_LOAD32_WORD_SWAP( "715a13.24u",   0x000000, 0x400000, CRC(dbff58a1) SHA1(f0c60bb2cbf268cfcbdd65606ebb18f1b4839c0e) )
1677 
1678 	ROM_REGION(0x80000, "audiocpu", 0)      /* 68K Program */
1679 	ROM_LOAD16_WORD_SWAP( "715a08.7s",    0x000000, 0x080000, CRC(3aa2f4a5) SHA1(bb43e5f5ef4ac51f228d4d825be66d3c720d51ea) )
1680 
1681 	ROM_REGION16_LE(0x1000000, "rfsnd", 0)       /* PCM sample roms */
1682 	ROM_LOAD( "715a09.16p",   0x000000, 0x400000, CRC(65845866) SHA1(d2a63d0deef1901e6fa21b55c5f96e1f781dceda) )
1683 	ROM_LOAD( "715a10.14p",   0x400000, 0x400000, CRC(294fe71b) SHA1(ac5fff5627df1cee4f1e1867377f208b34334899) )
1684 
1685 	ROM_REGION(0x20000, "gn680", 0)     /* 68K Program */
1686 	ROM_LOAD16_WORD_SWAP( "715a17.20k",    0x000000, 0x020000, CRC(f0b7ba0c) SHA1(863b260824b0ae2f890ba84d1c9a8f436891b1ff) )
1687 
1688 	ROM_REGION(0x2000, "m48t58",0)
1689 	ROM_LOAD( "715uel_m48t58y.35d", 0x000000, 0x002000, CRC(57322db4) SHA1(59cb8cd6ab446bf8781e3dddf902a4ff2484068e) )
1690 ROM_END
1691 
1692 ROM_START(terabrsta)
1693 	ROM_REGION32_BE(0x400000, "user1", 0)   /* PowerPC program */
1694 	ROM_LOAD32_WORD_SWAP( "715a02.25p",   0x000000, 0x200000, CRC(070c48b3) SHA1(066cefbd34d8f6476083417471114f782bef97fb) )
1695 	ROM_LOAD32_WORD_SWAP( "715a03.22p",   0x000002, 0x200000, CRC(f77d242f) SHA1(7680e4abcccd549b3f6d1d245f64631fab57e80d) )
1696 
1697 	ROM_REGION32_BE(0x800000, "user2", 0)   /* Data roms */
1698 	ROM_LOAD32_WORD_SWAP( "715a04.16t",   0x000000, 0x200000, CRC(00d9567e) SHA1(fe372399ad0ae89d557c93c3145b38e3ed0f714d) )
1699 	ROM_LOAD32_WORD_SWAP( "715a05.14t",   0x000002, 0x200000, CRC(462d53bf) SHA1(0216a84358571de6791365c69a1fa8fe2784148d) )
1700 
1701 	ROM_REGION32_BE(0x1000000, "user5", 0)  /* CG Board texture roms */
1702 	ROM_LOAD32_WORD_SWAP( "715a14.32u",   0x000002, 0x400000, CRC(bbb36be3) SHA1(c828d0af0546db02e87afe68423b9447db7c7e51) )
1703 	ROM_LOAD32_WORD_SWAP( "715a13.24u",   0x000000, 0x400000, CRC(dbff58a1) SHA1(f0c60bb2cbf268cfcbdd65606ebb18f1b4839c0e) )
1704 
1705 	ROM_REGION(0x80000, "audiocpu", 0)      /* 68K Program */
1706 	ROM_LOAD16_WORD_SWAP( "715a08.7s",    0x000000, 0x080000, CRC(3aa2f4a5) SHA1(bb43e5f5ef4ac51f228d4d825be66d3c720d51ea) )
1707 
1708 	ROM_REGION16_LE(0x1000000, "rfsnd", 0)       /* PCM sample roms */
1709 	ROM_LOAD( "715a09.16p",   0x000000, 0x400000, CRC(65845866) SHA1(d2a63d0deef1901e6fa21b55c5f96e1f781dceda) )
1710 	ROM_LOAD( "715a10.14p",   0x400000, 0x400000, CRC(294fe71b) SHA1(ac5fff5627df1cee4f1e1867377f208b34334899) )
1711 
1712 	ROM_REGION(0x20000, "gn680", 0)     /* 68K Program */
1713 	ROM_LOAD16_WORD_SWAP( "715a17.20k",    0x000000, 0x020000, CRC(f0b7ba0c) SHA1(863b260824b0ae2f890ba84d1c9a8f436891b1ff) )
1714 
1715 	ROM_REGION(0x2000, "m48t58",0)
1716 	ROM_LOAD( "m48t58y-70pc1", 0x000000, 0x002000, CRC(62fecb78) SHA1(09509be8a947cf2d38e12a6ea755ec0de4aa9bd4) )
1717 ROM_END
1718 
1719 /*************************************************************************/
1720 
1721 GAME(  1998, gradius4,  0,        hornet,   gradius4, hornet_state, init_gradius4, ROT0, "Konami", "Gradius IV: Fukkatsu (ver JAC)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
1722 GAME(  1998, nbapbp,    0,        hornet,   nbapbp,   hornet_state, init_nbapbp,   ROT0, "Konami", "NBA Play By Play (ver JAA)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
1723 GAME(  1998, nbapbpa,   nbapbp,   hornet,   nbapbp,   hornet_state, init_nbapbp,   ROT0, "Konami", "NBA Play By Play (ver AAB)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
1724 GAME(  1998, terabrst,  0,        terabrst, terabrst, hornet_state, init_terabrst, ROT0, "Konami", "Teraburst (1998/07/17 ver UEL)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
1725 GAME(  1998, terabrsta, terabrst, terabrst, terabrst, hornet_state, init_terabrst, ROT0, "Konami", "Teraburst (1998/02/25 ver AAA)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
1726 
1727 // The region comes from the Timekeeper NVRAM, without a valid default all sets except 'xxD, Ver 1.33' will init their NVRAM to UAx versions, the xxD set seems to incorrectly init it to JXD, which isn't a valid
1728 // version, and thus can't be booted.  If you copy the NVRAM from another already initialized set, it will boot as UAD.
1729 // to get the actual game to boot you must calibrate the guns etc.
1730 GAMEL( 1999, sscope,    0,        sscope,  sscope,    hornet_state, init_sscope,  ROT0, "Konami", "Silent Scope (ver xxD, Ver 1.33)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE, layout_dualhsxs )
1731 GAMEL( 1999, sscopec,   sscope,   sscope,  sscope,    hornet_state, init_sscope,  ROT0, "Konami", "Silent Scope (ver xxC, Ver 1.30)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE, layout_dualhsxs )
1732 GAMEL( 1999, sscopeb,   sscope,   sscope,  sscope,    hornet_state, init_sscope,  ROT0, "Konami", "Silent Scope (ver xxB, Ver 1.20)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE, layout_dualhsxs )
1733 GAMEL( 1999, sscopea,   sscope,   sscope,  sscope,    hornet_state, init_sscope,  ROT0, "Konami", "Silent Scope (ver xxA, Ver 1.00)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE, layout_dualhsxs )
1734 
1735 GAMEL( 2000, sscope2,   0,        sscope2, sscope2,   hornet_state, init_sscope2, ROT0, "Konami", "Silent Scope 2 : Dark Silhouette (ver UAD)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE | MACHINE_NODEVICE_LAN , layout_dualhsxs )
1736 //GAMEL( 2000, sscope2e, sscope2, sscope2, sscope2,   hornet_state, init_sscope2, ROT0, "Konami", "Silent Scope 2 : Fatal Judgement (ver EAD)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE | MACHINE_NODEVICE_LAN , layout_dualhsxs )
1737 //GAMEL( 2000, sscope2j, sscope2  sscope2, sscope2,   hornet_state, init_sscope2, ROT0, "Konami", "Silent Scope 2 : Innocent Sweeper (ver JAD)", MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE | MACHINE_NODEVICE_LAN , layout_dualhsxs )
1738 
1739