Previous 199869 Revisions Next

r26236 Sunday 17th November, 2013 at 20:01:42 UTC by Phil Bennett
Rewrote Konami 056800 (MIRAC): [Phil Bennett]
- Implemented as an 8-bit device
- Fixed address mapping
- Removed bogus timer interrupt
- Fixed interrupt handling

054539.c: Fixed input clock rate and implemented programmable timer based on hardware measurements [Phil Bennett, Stefan Lindberg]

lethal.c, mystwarr,c, tmnt.c: Hooked up 054539 timer interrupt. Fixes music tempo in some games [Phil Bennett]

qdrmfgp.c: Hooked up 054539 timer interrupt for qdrmfgp, fixed IRQ acknowledge handling [Phil Bennett]

plygonet.c: Hooked up 054539 timer interrupt, removed non-existent second 054539 and fixed EEPROM regression [Phil Bennett]

hornet.c, gticlub.c: Implemented sound interrupt timer [Phil Bennett]

konamigx.c improvements: [Phil Bennett]
- Hooked up 056800 device
- Hooked up 054539 timer interrupt
- Removed sound hacks
- All DSP RAM tests now pass, winspike sound now works

konamigq.c improvements: [Phil Bennett]
- Hooked up 056800 device
- Hooked up 054539 timer interrupt
- Added TMS57002 DASP

ultrsprt.c improvements: [Phil Bennett]
- Hooked up 054539 timer interrupt
- Implemented VRAM double buffering
- Improved trackball inputs
- Fixed sound

zr107.c improvements: [Phil Bennett]
- Hooked up 054539 timer interrupt
- Fixed sound in all games

rungun.c improvements: [Phil Bennett]
- Hooked up 054539 timer interrupt. Fixes music tempo
- Implemented sound CPU NMI control
- Fixed 054539 #2 regression


New games added or promoted from NOT_WORKING status:
====================================================

Wave shark/Jet Wave [Phil Bennett]
[src/emu/sound]k054539.c k054539.h k056800.c k056800.h
[src/mame/drivers]gijoe.c gticlub.c hornet.c konamigq.c konamigx.c lethal.c moo.c mystwarr.c nwk-tr.c plygonet.c qdrmfgp.c rungun.c tmnt.c ultrsprt.c zr107.c
[src/mame/includes]konamigx.h mystwarr.h plygonet.h qdrmfgp.h rungun.h

trunk/src/emu/sound/k054539.c
r26235r26236
11/*********************************************************
22
3    Konami 054539 PCM Sound Chip
3    Konami 054539 (TOP) PCM Sound Chip
44
55    A lot of information comes from Amuse.
66    Big thanks to them.
77
8
9
10CHANNEL_DEBUG enables the following keys:
11
12    PAD.   : toggle debug mode
13    PAD0   : toggle chip    (0 / 1)
14    PAD4,6 : select channel (0 - 7)
15    PAD8,2 : adjust gain    (00=0.0 10=1.0, 20=2.0, etc.)
16    PAD5   : reset gain factor to 1.0
17
188*********************************************************/
199
2010#include "emu.h"
r26235r26236
2212
2313const device_type K054539 = &device_creator<k054539_device>;
2414
25#define CHANNEL_DEBUG 0
2615#define VERBOSE 0
2716#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
2817
2918k054539_device::k054539_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
3019   : device_t(mconfig, K054539, "K054539", tag, owner, clock, "k054539", __FILE__),
31      device_sound_interface(mconfig, *this)
20      device_sound_interface(mconfig, *this),
21      m_timer_handler(*this)
3222{
3323}
3424
r26235r26236
6151     00: type (b2-3), reverse (b5)
6252     01: loop (b0)
6353
64   214: keyon (b0-7 = channel 0-7)
65   215: keyoff          ""
66   22c: channel active? ""
67   22d: data read/write port
68   22e: rom/ram select (00..7f == rom banks, 80 = ram)
69   22f: enable pcm (b0), disable register ram updating (b7)
54   214: Key on (b0-7 = channel 0-7)
55   215: Key off          ""
56   225: ?
57   227: Timer frequency
58   228: ?
59   229: ?
60   22a: ?
61   22b: ?
62   22c: Channel active? (b0-7 = channel 0-7)
63   22d: Data read/write port
64   22e: ROM/RAM select (00..7f == ROM banks, 80 = Reverb RAM)
65   22f: Global control:
66      .......x - Enable PCM
67      ......x. - Timer related?
68      ...x.... - Enable ROM/RAM readback from 0x22d
69      ..x..... - Timer output enable?
70      x....... - Disable register RAM updates
7071
71   The chip has a 0x4000 bytes reverb buffer (the ram from 0x22e).
72   The reverb delay is actually an offset in this buffer.
72   The chip has an optional 0x8000 byte reverb buffer.
73   The reverb delay is actually an offset in this buffer.
7374*/
7475
7576void k054539_device::init_flags(int _flags)
r26235r26236
302303
303304void k054539_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
304305{
305   if(regs[0x22f] & 0x20)
306      irq(this);
306   if (regs[0x22f] & 0x20)
307      m_timer_handler(m_timer_state ^= 1);
307308}
308309
309310void k054539_device::init_chip()
r26235r26236
327328         break;
328329      }
329330
330   if(irq) {
331      // One or more of the registers must be the timer period
332      // And anyway, this particular frequency is probably wrong
333      // 480 hz is TRUSTED by gokuparo disco stage - the looping sample doesn't line up otherwise
334      emu_timer *tm = timer_alloc();
335      tm->adjust(attotime::from_hz(480), 0, attotime::from_hz(480));
336   }
331   stream = stream_alloc(0, 2, clock() / 384);
337332
338   // If the clock is anything else than 48000, things are going to go wrong.
339   stream = stream_alloc(0, 2, clock());
340
341333   save_item(NAME(regs));
342334   save_pointer(NAME(ram), 0x4000);
343335   save_item(NAME(cur_ptr));
r26235r26236
422414               keyoff(ch);
423415      break;
424416
417      case 0x227:
418      {
419         attotime period = attotime::from_hz((float)(38 + data) * (clock()/384.0f/14400.0f)) / 2.0f;
420
421         m_timer->adjust(period, 0, period);
422
423         m_timer_state = 0;
424         m_timer_handler(m_timer_state);
425      }
426      break;
427
425428      case 0x22d:
426429         if(regs[0x22e] == 0x80)
427430            cur_zone[cur_ptr] = data;
r26235r26236
437440         cur_limit = data == 0x80 ? 0x4000 : 0x20000;
438441         cur_ptr = 0;
439442      break;
443     
444      case 0x22f:
445         if (!(data & 0x20)) // Disable timer output?
446         {
447            m_timer_state = 0;
448            m_timer_handler(m_timer_state);
449         }
450      break;
440451
441452      default:
442453#if 0
r26235r26236
489500
490501void k054539_device::device_start()
491502{
503   m_timer = timer_alloc(0);
504
505   m_timer_handler.resolve_safe();
506
492507   for (int i = 0; i < 8; i++)
493508      gain[i] = 1.0;
509
494510   flags = RESET_FLAGS;
495511
496512   /*
r26235r26236
520536
521537void k054539_device::device_reset()
522538{
523}
539   m_timer->enable(false);
540}
No newline at end of file
trunk/src/emu/sound/k054539.h
r26235r26236
1212#define MCFG_K054539_ADD(_tag, _clock, _interface) \
1313   MCFG_DEVICE_ADD(_tag, K054539, _clock) \
1414   k054539_device::static_set_interface(*device, _interface);
15
16#define MCFG_K054539_TIMER_HANDLER(_devcb) \
17   devcb = &k054539_device::set_timer_handler(*device, DEVCB2_##_devcb);
18
1519struct k054539_interface
1620{
1721   const char *rgnoverride;
1822   void (*apan)(device_t *, double, double);   /* Callback for analog output mixing levels (0..1 for each channel) */
19   void (*irq)(device_t *);
2023};
2124
2225
r26235r26236
4649   k054539_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
4750
4851   // static configuration helpers
49   static void static_set_interface(device_t &device, const k054539_interface &interface);
52   static void static_set_interface(device_t &device, const k054539_interface &interface);   
53   template<class _Object> static devcb2_base &set_timer_handler(device_t &device, _Object object) { return downcast<k054539_device &>(device).m_timer_handler.set_callback(object); }
54   
5055
5156   DECLARE_WRITE8_MEMBER(write);
5257   DECLARE_READ8_MEMBER(read);
r26235r26236
104109
105110   channel channels[8];
106111   sound_stream *stream;
112   
113   emu_timer         *m_timer;
114   UINT32            m_timer_state;
115   devcb2_write_line   m_timer_handler;
107116
108117   bool regupdate();
109118   void keyon(int channel);
trunk/src/emu/sound/k056800.c
r26235r26236
11/***********************************************************************
22
33    Konami K056800 (MIRAC)
4    Sound interface
4    Sound interface and audio control
55
6
76***********************************************************************/
87
98#include "emu.h"
109#include "sound/k056800.h"
1110
1211
12
1313const device_type K056800 = &device_creator<k056800_device>;
1414
15k056800_device::k056800_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
16            : device_t(mconfig, K056800, "Konami 056800 MIRAC", tag, owner, clock, "k056800", __FILE__)
17{
18}
1915
16
2017//-------------------------------------------------
21//  device_config_complete - perform any
22//  operations now that the configuration is
23//  complete
18//  k056800_device - constructor
2419//-------------------------------------------------
2520
26void k056800_device::device_config_complete()
21k056800_device::k056800_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
22            : device_t(mconfig, K056800, "Konami 056800 MIRAC", tag, owner, clock, "k056800", __FILE__),
23   m_int_handler(*this)
2724{
28   // inherit a copy of the static data
29   const k056800_interface *intf = reinterpret_cast<const k056800_interface *>(static_config());
30   if (intf != NULL)
31      *static_cast<k056800_interface *>(this) = *intf;
32
33   // or initialize to defaults if none provided
34   else
35   {
36      m_irq_cb = NULL;
37   }
3825}
3926
27
4028//-------------------------------------------------
4129//  device_start - device-specific startup
4230//-------------------------------------------------
4331
4432void k056800_device::device_start()
4533{
46   attotime timer_period = attotime::from_hz(clock()) * 14700 * 3;
34   m_int_handler.resolve_safe();
4735
48   m_irq_cb_func = m_irq_cb;
36   save_item(NAME(m_int_pending));
37   save_item(NAME(m_host_to_snd_regs));
38   save_item(NAME(m_snd_to_host_regs));
39}
4940
50   m_sound_cpu_timer = timer_alloc(TIMER_TICK_SOUND_CPU);
51   m_sound_cpu_timer->adjust(timer_period, 0, timer_period);
5241
53   save_item(NAME(m_host_reg));
54   save_item(NAME(m_sound_reg));
55   save_item(NAME(m_sound_cpu_irq1_enable));
56}
57
5842//-------------------------------------------------
5943//  device_reset - device-specific reset
6044//-------------------------------------------------
6145
6246void k056800_device::device_reset()
6347{
64   memset(m_host_reg, 0, sizeof(m_host_reg));
65   memset(m_sound_reg, 0, sizeof(m_sound_reg));
66
67   m_sound_cpu_irq1_enable = 0;
48   m_int_pending = false;
49   memset(m_host_to_snd_regs, 0, sizeof(m_host_to_snd_regs));
50   memset(m_snd_to_host_regs, 0, sizeof(m_snd_to_host_regs));
6851}
6952
7053
r26235r26236
7255    DEVICE HANDLERS
7356*****************************************************************************/
7457
75
76UINT8 k056800_device::host_reg_r( int reg )
58READ8_MEMBER( k056800_device::host_r )
7759{
78   UINT8 value = m_host_reg[reg];
79   if (reg == 2)
80      value &= ~3; // suppress VOLWR busy flags
60   UINT32 r = offset & 7;
61   UINT8 data = 0;
62   
63   switch (r)
64   {
65      case 0:
66      case 1:
67         data = m_snd_to_host_regs[r];
68         break;
8169
82   return value;
83}
70      case 2:
71         // .... ...x - Front volume busy
72         // .... ..x. - Rear volume busy
73         break;
74   }
8475
85void k056800_device::host_reg_w( int reg, UINT8 data )
86{
87   m_sound_reg[reg] = data;
88
89   if (reg == 7)
90      m_irq_cb(machine(), 1);
76   return data;
9177}
9278
93UINT8 k056800_device::sound_reg_r( int reg )
94{
95   return m_sound_reg[reg];
96}
9779
98void k056800_device::sound_reg_w( int reg, UINT8 data )
80WRITE8_MEMBER( k056800_device::host_w )
9981{
100   if (reg == 4)
101      m_sound_cpu_irq1_enable = data & 0x01;
82   UINT32 r = offset & 7;
10283
103   m_host_reg[reg] = data;
104}
105
106void k056800_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
107{
108   switch (id)
84   switch (r)
10985   {
110      case TIMER_TICK_SOUND_CPU:
111         if (m_sound_cpu_irq1_enable)
112            m_irq_cb_func(machine(), 0);
86      case 0:
87      case 1:
88      case 2:
89      case 3:
90         m_host_to_snd_regs[r] = data;
11391         break;
11492
115         default:
116         assert_always(FALSE, "Unknown id in k056800_device::device_timer");
117   }
118}
93      case 4:
94         // xxxx xxxx - Front volume (CAh increments, 35h decrements)
95         break;
11996
120READ32_MEMBER( k056800_device::host_r )
121{
122   UINT32 r = 0;
97      case 5:
98         // xxxx xxxx - Rear volume (as above)
99         break;
123100
124   if (ACCESSING_BITS_24_31)
125      r |= host_reg_r((offset * 4) + 0) << 24;
101      case 6:
102         // .... ...x - Mute front
103         // .... ..x. - Mute rear
104         break;
105         
106      case 7:
107         // Sound interrupt
108         m_int_pending = true;
126109
127   if (ACCESSING_BITS_16_23)
128      r |= host_reg_r((offset * 4) + 1) << 16;
110         if (m_int_enabled)
111            m_int_handler(ASSERT_LINE);
129112
130   if (ACCESSING_BITS_8_15)
131      r |= host_reg_r((offset * 4) + 2) << 8;
113         break;
114   }
115}
132116
133   if (ACCESSING_BITS_0_7)
134      r |= host_reg_r((offset * 4) + 3) << 0;
135117
118READ8_MEMBER( k056800_device::sound_r )
119{
120   UINT32 r = offset & 7;
121   UINT8 data = 0;
122   
123   switch (r)
124   {
125      case 0:
126      case 1:
127      case 2:
128      case 3:
129         data = m_host_to_snd_regs[r];
130         break;
131   }
136132
137   return r;
133   return data;
138134}
139135
140WRITE32_MEMBER( k056800_device::host_w )
136
137WRITE8_MEMBER( k056800_device::sound_w )
141138{
142   if (ACCESSING_BITS_24_31)
143      host_reg_w((offset * 4) + 0, (data >> 24) & 0xff);
139   UINT32 r = offset & 7;
144140
145   if (ACCESSING_BITS_16_23)
146      host_reg_w((offset * 4) + 1, (data >> 16) & 0xff);
141   switch (r)
142   {
143      case 0:
144      case 1:
145         m_snd_to_host_regs[r] = data;
146         break;
147         
148      case 2:
149      case 3:
150         // TODO: Unknown
151         break;
147152
148   if (ACCESSING_BITS_8_15)
149      host_reg_w((offset * 4) + 2, (data >> 8) & 0xff);
153      case 4:
154         // Sound CPU interrupt control
155         m_int_enabled = (data & 1) != 0;
150156
151   if (ACCESSING_BITS_0_7)
152      host_reg_w((offset * 4) + 3, (data >> 0) & 0xff);
153
154}
155
156READ16_MEMBER( k056800_device::sound_r )
157{
158   return sound_reg_r(offset);
159}
160
161WRITE16_MEMBER( k056800_device::sound_w )
162{
163   sound_reg_w(offset, data);
164}
157         if (m_int_enabled)
158         {
159            // Enable interrupt
160            if (m_int_pending)
161               m_int_handler(ASSERT_LINE);
162         }
163         else
164         {
165            // Disable/acknowledge interrupt
166            m_int_pending = false;
167            m_int_handler(CLEAR_LINE);
168         }
169         break;
170         
171      case 5:
172         // TODO: Unknown
173         break;
174   }
175}
No newline at end of file
trunk/src/emu/sound/k056800.h
r26235r26236
99
1010
1111/***************************************************************************
12    TYPE DEFINITIONS
12    DEVICE CONFIGURATION MACROS
1313***************************************************************************/
1414
15typedef void (*k056800_irq_cb)(running_machine &, int);
15#define MCFG_K056800_ADD(_tag, _clock) \
16   MCFG_DEVICE_ADD(_tag, K056800, _clock) \
1617
18#define MCFG_K056800_INT_HANDLER(_devcb) \
19   devcb = &k056800_device::set_int_handler(*device, DEVCB2_##_devcb);
1720
18struct k056800_interface
19{
20   k056800_irq_cb       m_irq_cb;
21};
2221
23class k056800_device : public device_t,
24                  public k056800_interface
22
23/***************************************************************************
24    TYPE DEFINITIONS
25***************************************************************************/
26
27class k056800_device : public device_t
2528{
2629public:
30   // construction/destruction
2731   k056800_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
28   ~k056800_device() {}
2932
30   enum
31   {
32      TIMER_TICK_SOUND_CPU
33   };
33   // static configuration helpers
34   template<class _Object> static devcb2_base &set_int_handler(device_t &device, _Object object) { return downcast<k056800_device &>(device).m_int_handler.set_callback(object); }
3435
35   DECLARE_READ32_MEMBER( host_r );
36   DECLARE_WRITE32_MEMBER( host_w );
37   DECLARE_READ16_MEMBER( sound_r );
38   DECLARE_WRITE16_MEMBER( sound_w );
36   DECLARE_READ8_MEMBER( host_r );
37   DECLARE_WRITE8_MEMBER( host_w );
38   DECLARE_READ8_MEMBER( sound_r );
39   DECLARE_WRITE8_MEMBER( sound_w );
3940
4041protected:
4142   // device-level overrides
42   virtual void device_config_complete();
4343   virtual void device_start();
4444   virtual void device_reset();
4545
46   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
47
4846private:
4947   // internal state
50   UINT8                m_host_reg[8];
51   UINT8                m_sound_reg[8];
52   emu_timer            *m_sound_cpu_timer;
53   UINT8                m_sound_cpu_irq1_enable;
54   k056800_irq_cb       m_irq_cb_func;
48   bool            m_int_pending;
49   bool            m_int_enabled;
50   UINT8            m_host_to_snd_regs[4];
51   UINT8            m_snd_to_host_regs[2];
5552
56   UINT8 host_reg_r( int reg );
57   void host_reg_w( int reg, UINT8 data );
58   UINT8 sound_reg_r( int reg );
59   void sound_reg_w( int reg, UINT8 data );
60
53   devcb2_write_line   m_int_handler;
6154};
6255
6356extern const device_type K056800;
6457
6558
6659
67/***************************************************************************
68    DEVICE CONFIGURATION MACROS
69***************************************************************************/
70
71#define MCFG_K056800_ADD(_tag, _interface, _clock) \
72   MCFG_DEVICE_ADD(_tag, K056800, _clock) \
73   MCFG_DEVICE_CONFIG(_interface)
74
75
7660#endif /* __K056800_H__ */
trunk/src/mame/drivers/mystwarr.c
r26235r26236
523523
524524/**********************************************************************************/
525525
526
527526void mystwarr_state::reset_sound_region()
528527{
529   membank("bank2")->set_base(memregion("soundcpu")->base() + 0x10000 + m_cur_sound_region*0x4000);
528   membank("bank2")->set_base(memregion("soundcpu")->base() + 0x10000 + (m_sound_ctrl & 0xf)*0x4000);
530529}
531530
532WRITE8_MEMBER(mystwarr_state::sound_bankswitch_w)
531WRITE8_MEMBER(mystwarr_state::sound_ctrl_w)
533532{
534   m_cur_sound_region = (data & 0xf);
533   if (!(data & 0x10))
534      m_soundcpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
535
536   m_sound_ctrl = data;
535537   reset_sound_region();
536538}
537539
538540/* sound memory maps
539541
540   there are 2 sound boards: the martial champion single-'539 version
542   there are 2 sound systems: the martial champion single-'539 version
541543   and the dual-'539 version used by run and gun, violent storm, monster maulers,
542544   gaiapolous, metamorphic force, and mystic warriors.  Their memory maps are
543545   quite similar to xexex/gijoe/asterix's sound.
r26235r26236
555557   AM_RANGE(0xf000, 0xf000) AM_WRITE(soundlatch3_byte_w)
556558   AM_RANGE(0xf002, 0xf002) AM_READ(soundlatch_byte_r)
557559   AM_RANGE(0xf003, 0xf003) AM_READ(soundlatch2_byte_r)
558   AM_RANGE(0xf800, 0xf800) AM_WRITE(sound_bankswitch_w)
560   AM_RANGE(0xf800, 0xf800) AM_WRITE(sound_ctrl_w)
559561   AM_RANGE(0xfff0, 0xfff3) AM_WRITENOP    // unknown write
560562ADDRESS_MAP_END
561563
562564
565WRITE_LINE_MEMBER(mystwarr_state::k054539_nmi_gen)
566{
567   if (m_sound_ctrl & 0x10)
568   {
569      // Trigger an /NMI on the rising edge
570      if (!m_sound_nmi_clk && state)
571      {
572         m_soundcpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
573      }
574   }
575
576   m_sound_nmi_clk = state;
577}
578
563579static const k054539_interface k054539_config =
564580{
565581   "shared"
r26235r26236
809825MACHINE_START_MEMBER(mystwarr_state,mystwarr)
810826{
811827   /* set default bankswitch */
812   m_cur_sound_region = 2;
828   m_sound_ctrl = 2;
813829   reset_sound_region();
814830
815831   m_mw_irq_control = 0;
816832
817833   save_item(NAME(m_mw_irq_control));
818   save_item(NAME(m_cur_sound_region));
834   save_item(NAME(m_sound_ctrl));
835   save_item(NAME(m_sound_nmi_clk));
836
819837   machine().save().register_postload(save_prepost_delegate(FUNC(mystwarr_state::reset_sound_region), this));
820838}
821839
r26235r26236
945963
946964   MCFG_CPU_ADD("soundcpu", Z80, 8000000)
947965   MCFG_CPU_PROGRAM_MAP(mystwarr_sound_map)
948   MCFG_CPU_PERIODIC_INT_DRIVER(mystwarr_state, nmi_line_pulse,  480)
949966
950967   MCFG_QUANTUM_TIME(attotime::from_hz(1920))
951968
r26235r26236
976993   /* sound hardware */
977994   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
978995
979   MCFG_K054539_ADD("k054539_1", 48000, k054539_config)
996   MCFG_K054539_ADD("k054539_1", XTAL_18_432MHz, k054539_config)
997   MCFG_K054539_TIMER_HANDLER(WRITELINE(mystwarr_state, k054539_nmi_gen))
980998   MCFG_SOUND_ROUTE(0, "rspeaker", 1.0)    /* stereo channels are inverted */
981999   MCFG_SOUND_ROUTE(1, "lspeaker", 1.0)
9821000
983   MCFG_K054539_ADD("k054539_2", 48000, k054539_config)
1001   MCFG_K054539_ADD("k054539_2", XTAL_18_432MHz, k054539_config)
9841002   MCFG_SOUND_ROUTE(0, "rspeaker", 1.0)    /* stereo channels are inverted */
9851003   MCFG_SOUND_ROUTE(1, "lspeaker", 1.0)
9861004MACHINE_CONFIG_END
trunk/src/mame/drivers/konamigx.c
r26235r26236
9999#include "cpu/z80/z80.h"
100100#include "cpu/tms57002/tms57002.h"
101101#include "machine/eepromser.h"
102#include "sound/k056800.h"
102103#include "sound/k054539.h"
103104#include "includes/konamigx.h"
104105#include "machine/adc083x.h"
r26235r26236
114115static int gx_rdport1_3, gx_syncen;
115116
116117static emu_timer *dmadelay_timer;
118static emu_timer *boothack_timer;
117119
118120/**********************************************************************************/
119121/*
r26235r26236
483485//      logerror("write %x to IRQ register (PC=%x)\n", konamigx_wrport1_1, space.device().safe_pc());
484486
485487      // gx_syncen is to ensure each IRQ is trigger at least once after being enabled
486      if (konamigx_wrport1_1 & 0x80) gx_syncen |= konamigx_wrport1_1 & 0x1f;
488      if (konamigx_wrport1_1 & 0x80)
489         gx_syncen |= konamigx_wrport1_1 & 0x1f;
487490   }
488491}
489492
r26235r26236
506509   {
507510      if (data & 0x400000)
508511      {
509         // enable 68k
510         // clear the halt condition and reset the 68000
512         // Enable sound CPU and DSP
511513         m_soundcpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
512         m_soundcpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE);
514         m_soundcpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE);
515
516         if (m_sound_ctrl & 0x10)
517            m_dasp->set_input_line(INPUT_LINE_RESET, CLEAR_LINE);
513518      }
514519      else
515520      {
516         // disable 68k
521         m_sound_ctrl = 0;
522
523         // Reset sound CPU and DSP
517524         m_soundcpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
525         m_soundcpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
526         m_dasp->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
527         m_k056832->reset();
518528      }
519529
520530      m_k055673->k053246_set_objcha_line((data&0x100000) ? ASSERT_LINE : CLEAR_LINE);
r26235r26236
527537/**********************************************************************************/
528538/* IRQ controllers */
529539
530#define ADD_SKIPPER32(PC, BASE, START, END, DATA, MASK){ \
531   waitskip.pc   = PC;        \
532   waitskip.offs = START/4;   \
533   waitskip.data = DATA;      \
534   waitskip.mask = MASK;      \
535   resume_trigger= 1000;      \
536   space.install_legacy_read_handler \
537   ((BASE+START)&~3, (BASE+END)|3, FUNC(waitskip_r));}
538
539540static int suspension_active, resume_trigger;
540#ifdef UNUSED_FUNCTION
541static struct { UINT32 offs, pc, mask, data; } waitskip;
542541
543READ32_MEMBER(konamigx_state::waitskip_r)
544{
545   UINT32 data = m_workram[waitskip.offs+offset];
546
547   if (space.device().safe_pc() == waitskip.pc && (data & mem_mask) == (waitskip.data & mem_mask))
548   {
549      space.device().execute().spin_until_trigger(resume_trigger);
550      suspension_active = 1;
551   }
552
553   return(data);
554}
555#endif
556
557
558542READ32_MEMBER(konamigx_state::ccu_r)
559543{
560544   // the routine at 204abe in opengolf polls to see if we're in vblank (it wants values between 0x111 and 0x1df)
r26235r26236
590574   }
591575}
592576
577TIMER_CALLBACK_MEMBER(konamigx_state::boothack_callback)
578{
579   // Restore main CPU normal operating frequency
580   m_maincpu->set_clock_scale(1.0f);
581}
593582
594583/*
595584    GX object DMA timings:
r26235r26236
602591TIMER_CALLBACK_MEMBER(konamigx_state::dmaend_callback)
603592{
604593   // foul-proof (CPU0 could be deactivated while we wait)
605   if (resume_trigger && suspension_active) { suspension_active = 0; machine().scheduler().trigger(resume_trigger); }
594   if (resume_trigger && suspension_active)
595   {
596      suspension_active = 0;
597      machine().scheduler().trigger(resume_trigger);
598   }
606599
607600   // DMA busy flag must be cleared before triggering IRQ 3
608601   gx_rdport1_3 &= ~2;
r26235r26236
638631INTERRUPT_GEN_MEMBER(konamigx_state::konamigx_vbinterrupt)
639632{
640633   // lift idle suspension
641   if (resume_trigger && suspension_active) { suspension_active = 0; machine().scheduler().trigger(resume_trigger); }
634   if (resume_trigger && suspension_active)
635   {
636      suspension_active = 0;
637      machine().scheduler().trigger(resume_trigger);
638   }
642639
643640   // IRQ 1 is the main 60hz vblank interrupt
644641   if (gx_syncen & 0x20)
r26235r26236
662659   if (scanline == 240)
663660   {
664661      // lift idle suspension
665      if (resume_trigger && suspension_active) { suspension_active = 0; machine().scheduler().trigger(resume_trigger); }
662      if (resume_trigger && suspension_active)
663      {
664         suspension_active = 0;
665         machine().scheduler().trigger(resume_trigger);
666      }
666667
667668      // IRQ 1 is the main 60hz vblank interrupt
668669      // the gx_syncen & 0x20 test doesn't work on type 3 or 4 ROM boards, likely because the ROM board
r26235r26236
703704
704705
705706/**********************************************************************************/
706/* sound communication handlers */
707
708static UINT8 sndto000[16], sndto020[16];    /* read/write split mapping */
709static int snd020_hack;
710
711READ32_MEMBER(konamigx_state::sound020_r)
712{
713   UINT32 reg, MSW, LSW, rv = 0;
714
715   reg = offset << 1;
716
717   if (ACCESSING_BITS_24_31)
718   {
719      MSW = sndto020[reg];
720      if (reg == 2) MSW &= ~3; // suppress VOLWR busy flags
721      rv |= MSW<<24;
722   }
723
724   if (ACCESSING_BITS_8_15)
725   {
726      LSW = sndto020[reg+1];
727      rv |= LSW<<8;
728   }
729
730//  mame_printf_debug("Read 68k @ %x (PC=%x)\n", reg, space.device().safe_pc());
731
732   // we clearly have some problem because some games require these hacks
733   // perhaps 68000/68020 timing is skewed?
734   switch (snd020_hack)
735   {
736      case 1: // Lethal Enforcer init
737         if (reg == 0) rv |= 0xff00;
738         break;
739      case 2: // Winning Spike
740         if (space.device().safe_pc() == 0x2026fe) rv = 0xc0c0c0c0;
741         break;
742      case 3: // Run'n Gun 2
743         if (space.device().safe_pc() == 0x24f0b6) rv = 0xffffffff;
744         if (space.device().safe_pc() == 0x24f122) rv = 0xc0c0c0c0;
745         break;
746      case 4: // Rushing Heroes
747         if (space.device().safe_pc() == 0x20eda6) rv = 0xc0c0c0c0;
748         break;
749      case 5: // Vs. Net Soccer ver. UAB
750         if (space.device().safe_pc() == 0x24c5d2) rv = 0xffffffff;
751         if (space.device().safe_pc() == 0x24c63e) rv = 0xc0c0c0c0;
752         break;
753      case 6: // Slam Dunk 2
754         if (space.device().safe_pc() == 0x24f1b0) rv = 0xffffffff;
755         if (space.device().safe_pc() == 0x24f21c) rv = 0xc0c0c0c0;
756         break;
757      case 7: // Vs. Net Soccer ver. AAA
758         if (space.device().safe_pc() == 0x24c6b6) rv = 0xffffffff;
759         if (space.device().safe_pc() == 0x24c722) rv = 0xc0c0c0c0;
760         break;
761      case 8: // Vs. Net Soccer ver. EAD
762         if (space.device().safe_pc() == 0x24c416) rv = 0xffffffff;
763         if (space.device().safe_pc() == 0x24c482) rv = 0xc0c0c0c0;
764         break;
765      case 9: // Vs. Net Soccer ver. EAB
766         if (space.device().safe_pc() == 0x24c400) rv = 0xffffffff;
767         if (space.device().safe_pc() == 0x24c46c) rv = 0xc0c0c0c0;
768         break;
769      case 10: // Vs. Net Soccer ver. JAB
770         if (space.device().safe_pc() == 0x24c584) rv = 0xffffffff;
771         if (space.device().safe_pc() == 0x24c5f0) rv = 0xc0c0c0c0;
772         break;
773      case 11: // Racin' Force
774         if (reg == 0)
775         {
776            if (space.device().safe_pc() == 0x0202190)
777               rv |= 0x4000;
778         }
779         break;
780
781      case 12: // Open Golf / Golfing Greats 2
782         if (reg == 0)
783         {
784            if ((space.device().safe_pc() == 0x0245e80) || (space.device().safe_pc() == 0x02459d6) || (space.device().safe_pc() == 0x0245e40) )
785               rv |= 0x4000;
786         }
787         break;
788      case 13: // Soccer Superstars
789         //if(space.device().safe_pc() != 0x236dce && space.device().safe_pc() != 0x236d8a && space.device().safe_pc() != 0x236d8a)
790         //  printf("Read 68k @ %x (PC=%x)\n", reg, space.device().safe_pc());
791         if (space.device().safe_pc() == 0x0236e04)  rv = 0xffffffff;
792         if (space.device().safe_pc() == 0x0236e12)  rv = 0xffffffff;
793         break;
794      case 14: // Soccer Superstars ver. JAC
795         //if(space.device().safe_pc() != 0x2367b4)
796         //  printf("Read 68k @ %x (PC=%x)\n", reg, space.device().safe_pc());
797         if (space.device().safe_pc() == 0x02367ea)  rv = 0xffffffff;
798         if (space.device().safe_pc() == 0x02367f8)  rv = 0xffffffff;
799         break;
800      case 15: // Soccer Superstars ver. JAA
801         //if(space.device().safe_pc() != 0x23670a)
802         //  printf("Read 68k @ %x (PC=%x)\n", reg, space.device().safe_pc());
803         if (space.device().safe_pc() == 0x0236740)  rv = 0xffffffff;
804         if (space.device().safe_pc() == 0x023674e)  rv = 0xffffffff;
805         break;
806      case 16: // Dragoon Might ver. JAA
807         {
808            UINT32 cur_pc;
809
810            cur_pc = space.device().safe_pc();
811
812            switch(cur_pc)
813            {
814               case 0x203534: break; //ffc0, OK
815               case 0x20358a: rv = 0; break; // != ffc0
816               case 0x2035e4: rv = 0xffffffff; break; // != 0
817               case 0x2036e4: rv = 0x0000ff00; break; // 00ff
818               case 0x203766: rv = 0x5500aa00; break; // 00ff
819               case 0x2037e8: rv = 0xaa005500; break; // 00ff
820               case 0x20386a: rv = 0xff000000; break;
821               case 0x203960: rv = 0; break;
822               case 0x2039f2: rv = 0x0100ff00; break;
823               //default:
824               //  if(cur_pc != 0x20358a && cur_pc != 0x2038aa && cur_pc != 0x2038d4)
825               //      printf("Read 68k @ %x (PC=%x)\n", reg, cur_pc);
826            }
827         }
828         break;
829   }
830
831   return(rv);
832}
833
834INLINE void write_snd_020(running_machine &machine, int reg, int val)
835{
836   konamigx_state *state = machine.driver_data<konamigx_state>();
837   sndto000[reg] = val;
838
839   if (reg == 7)
840   {
841      state->m_soundcpu->set_input_line(1, HOLD_LINE);
842   }
843}
844
845WRITE32_MEMBER(konamigx_state::sound020_w)
846{
847   int reg=0, val=0;
848
849   if (ACCESSING_BITS_24_31)
850   {
851      reg = offset<<1;
852      val = data>>24;
853      write_snd_020(machine(), reg, val);
854   }
855
856   if (ACCESSING_BITS_8_15)
857   {
858      reg = (offset<<1)+1;
859      val = (data>>8)&0xff;
860      write_snd_020(machine(), reg, val);
861   }
862}
863
864
865/**********************************************************************************/
866707/* input handlers */
867708
868709/* National Semiconductor ADC0834 4-channel serial ADC emulation */
r26235r26236
1151992   AM_RANGE(0x000000, 0x01ffff) AM_ROM // BIOS ROM
1152993   AM_RANGE(0x200000, 0x3fffff) AM_ROM // main program ROM
1153994   AM_RANGE(0x400000, 0x7fffff) AM_ROM // data ROM
1154   AM_RANGE(0xc00000, 0xc1ffff) AM_RAM AM_SHARE("workram") // work RAM
995   AM_RANGE(0xc00000, 0xc1ffff) AM_RAM AM_SHARE("workram")
1155996   AM_RANGE(0xd00000, 0xd01fff) AM_DEVREAD("k056832", k056832_device, k_5bpp_rom_long_r)
1156997   AM_RANGE(0xd20000, 0xd20fff) AM_DEVREADWRITE("k055673", k055673_device, k053247_long_r, k053247_long_w)
1157998   AM_RANGE(0xd21000, 0xd23fff) AM_RAM
r26235r26236
11621003   AM_RANGE(0xd4c000, 0xd4c01f) AM_READWRITE(ccu_r, ccu_w)
11631004   AM_RANGE(0xd4e000, 0xd4e01f) AM_WRITENOP
11641005   AM_RANGE(0xd50000, 0xd500ff) AM_DEVWRITE("k055555", k055555_device, K055555_long_w)
1165   AM_RANGE(0xd52000, 0xd5200f) AM_WRITE(sound020_w)
1166   AM_RANGE(0xd52010, 0xd5201f) AM_READ(sound020_r)
1006   AM_RANGE(0xd52000, 0xd5201f) AM_DEVREADWRITE8("k056800", k056800_device, host_r, host_w, 0xff00ff00)
11671007   AM_RANGE(0xd56000, 0xd56003) AM_WRITE(eeprom_w)
11681008   AM_RANGE(0xd58000, 0xd58003) AM_WRITE(control_w)
11691009   AM_RANGE(0xd5a000, 0xd5a003) AM_READ_PORT("SYSTEM_DSW")
r26235r26236
12371077/**********************************************************************************/
12381078/* Sound handling */
12391079
1240READ16_MEMBER(konamigx_state::sndcomm68k_r)
1241{
1242   return sndto000[offset];
1243}
1244
1245WRITE16_MEMBER(konamigx_state::sndcomm68k_w)
1246{
1247//  logerror("68K: write %x to %x\n", data, offset);
1248   sndto020[offset] = data;
1249}
1250
12511080INTERRUPT_GEN_MEMBER(konamigx_state::tms_sync)
12521081{
1253   m_dasp->sync_w(1);
1082   // DASP is synced to the LRCLK of one of the K054539s
1083   if (m_sound_ctrl & 0x20)
1084      m_dasp->sync_w(1);
12541085}
12551086
12561087READ16_MEMBER(konamigx_state::tms57002_data_word_r)
r26235r26236
12751106{
12761107   if (ACCESSING_BITS_0_7)
12771108   {
1109      if (!(data & 1))
1110         m_soundcpu->set_input_line(M68K_IRQ_2, CLEAR_LINE);
1111
12781112      m_dasp->pload_w(data & 4);
12791113      m_dasp->cload_w(data & 8);
1280      m_dasp->set_input_line(INPUT_LINE_RESET, !(data & 16) ? ASSERT_LINE : CLEAR_LINE);
1114      m_dasp->set_input_line(INPUT_LINE_RESET, data & 0x10 ? CLEAR_LINE : ASSERT_LINE);
1115
1116      m_sound_ctrl = data;
12811117   }
12821118}
12831119
r26235r26236
12881124   AM_RANGE(0x200000, 0x2004ff) AM_DEVREADWRITE8("k054539_1", k054539_device, read, write, 0xff00)
12891125   AM_RANGE(0x200000, 0x2004ff) AM_DEVREADWRITE8("k054539_2", k054539_device, read, write, 0x00ff)
12901126   AM_RANGE(0x300000, 0x300001) AM_READWRITE(tms57002_data_word_r, tms57002_data_word_w)
1291   AM_RANGE(0x400000, 0x40000f) AM_WRITE(sndcomm68k_w)
1292   AM_RANGE(0x400010, 0x40001f) AM_READ(sndcomm68k_r)
1127   AM_RANGE(0x400000, 0x40001f) AM_DEVREADWRITE8("k056800", k056800_device, sound_r, sound_w, 0x00ff)
12931128   AM_RANGE(0x500000, 0x500001) AM_READWRITE(tms57002_status_word_r, tms57002_control_word_w)
1294   AM_RANGE(0x580000, 0x580001) AM_WRITENOP
1129   AM_RANGE(0x580000, 0x580001) AM_WRITENOP // 'NRES' - D2: K056602 /RESET
12951130ADDRESS_MAP_END
12961131
12971132static ADDRESS_MAP_START( gxtmsmap, AS_DATA, 8, konamigx_state )
1298   AM_RANGE(0x000000, 0x03ffff) AM_RAM
1133   AM_RANGE(0x00000, 0x3ffff) AM_RAM
12991134ADDRESS_MAP_END
13001135
13011136static const k054539_interface k054539_config =
r26235r26236
13041139};
13051140
13061141
1142WRITE_LINE_MEMBER(konamigx_state::k054539_irq_gen)
1143{
1144   if (m_sound_ctrl & 1)
1145   {
1146      // Trigger an interrupt on the rising edge
1147      if (!m_sound_intck && state)
1148         m_soundcpu->set_input_line(M68K_IRQ_2, ASSERT_LINE);
1149   }
1150
1151   m_sound_intck = state;
1152}
1153
13071154/**********************************************************************************/
13081155/* port maps */
13091156
r26235r26236
17631610   /* basic machine hardware */
17641611   MCFG_CPU_ADD("maincpu", M68EC020, 24000000)
17651612   MCFG_CPU_PROGRAM_MAP(gx_type2_map)
1766   MCFG_CPU_VBLANK_INT_DRIVER("screen", konamigx_state, konamigx_vbinterrupt)
1613   MCFG_CPU_VBLANK_INT_DRIVER("screen", konamigx_state, konamigx_vbinterrupt)
17671614
17681615   MCFG_CPU_ADD("soundcpu", M68000, 8000000)
17691616   MCFG_CPU_PROGRAM_MAP(gxsndmap)
1770   MCFG_CPU_PERIODIC_INT_DRIVER(konamigx_state, irq2_line_hold,  480)
17711617
1772   MCFG_CPU_ADD("dasp", TMS57002, 12500000)
1618   MCFG_CPU_ADD("dasp", TMS57002, 24000000/2)
17731619   MCFG_CPU_DATA_MAP(gxtmsmap)
1774   MCFG_CPU_PERIODIC_INT_DRIVER(konamigx_state, tms_sync, 48000)
1620   MCFG_CPU_PERIODIC_INT_DRIVER(konamigx_state, tms_sync, 48000)
17751621
1776   MCFG_QUANTUM_TIME(attotime::from_hz(1920))
1622   MCFG_QUANTUM_TIME(attotime::from_hz(6000))
17771623
17781624   MCFG_MACHINE_START_OVERRIDE(konamigx_state,konamigx)
17791625   MCFG_MACHINE_RESET_OVERRIDE(konamigx_state,konamigx)
r26235r26236
18061652   /* sound hardware */
18071653   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
18081654
1809   MCFG_K054539_ADD("k054539_1", 48000, k054539_config)
1655   MCFG_K056800_ADD("k056800", XTAL_18_432MHz)
1656   MCFG_K056800_INT_HANDLER(INPUTLINE("soundcpu", M68K_IRQ_1))
1657
1658   MCFG_K054539_ADD("k054539_1", XTAL_18_432MHz, k054539_config)
1659   MCFG_K054539_TIMER_HANDLER(WRITELINE(konamigx_state, k054539_irq_gen))
1660
18101661   MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
18111662   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
18121663
1813   MCFG_K054539_ADD("k054539_2", 48000, k054539_config)
1664   MCFG_K054539_ADD("k054539_2", XTAL_18_432MHz, k054539_config)
18141665   MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
18151666   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
18161667MACHINE_CONFIG_END
18171668
18181669static MACHINE_CONFIG_DERIVED( dragoonj, konamigx )
1819   MCFG_CPU_MODIFY("maincpu")
1820   MCFG_CPU_CLOCK(26400000) // needs higher clock to stop sprite flickerings
18211670   MCFG_SCREEN_MODIFY("screen")
18221671   MCFG_SCREEN_VISIBLE_AREA(40, 40+384-1, 16, 16+224-1)
18231672   MCFG_VIDEO_START_OVERRIDE(konamigx_state,dragoonj)
r26235r26236
18651714
18661715static MACHINE_CONFIG_DERIVED( gxtype3, konamigx )
18671716
1868   MCFG_DEVICE_REMOVE("maincpu")
1869
1870   MCFG_CPU_ADD("maincpu", M68EC020, 24000000)
1717   MCFG_DEVICE_MODIFY("maincpu")
18711718   MCFG_CPU_PROGRAM_MAP(gx_type3_map)
18721719   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", konamigx_state, konamigx_hbinterrupt, "screen", 0, 1)
18731720
r26235r26236
18921739
18931740static MACHINE_CONFIG_DERIVED( gxtype4, konamigx )
18941741
1895   MCFG_DEVICE_REMOVE("maincpu")
1896
1897   MCFG_CPU_ADD("maincpu", M68EC020, 24000000)
1742   MCFG_DEVICE_MODIFY("maincpu")
18981743   MCFG_CPU_PROGRAM_MAP(gx_type4_map)
18991744   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", konamigx_state, konamigx_hbinterrupt, "screen", 0, 1)
19001745
r26235r26236
21782023   ROM_LOAD( "424a17.9g", 0x000000, 2*1024*1024, CRC(e9dd9692) SHA1(c289019c8d1dd71b3cec26479c39b649de804707) )
21792024   ROM_LOAD( "424a18.7g", 0x200000, 2*1024*1024, CRC(0f0d9f3a) SHA1(57f6b113b80f06964b7e672ad517c1654c5569c5) )
21802025
2181   // reports RAMs as bad on first boot due to TMS emulation problems, but automatically resets
21822026   ROM_REGION( 0x80, "eeprom", 0 ) // default eeprom to prevent game booting with error
21832027   ROM_LOAD( "tbyahhoo.nv", 0x0000, 0x080, CRC(1e6fa2f8) SHA1(fceb6617a4e02babfc1678bae9f6a131c1d759f5) )
21842028ROM_END
r26235r26236
26022446   ROM_LOAD( "315a17.9g", 0x000000, 2*1024*1024, CRC(ea763d61) SHA1(2a7dcb2a2a23c9fea62fb82ffc18949bf15b9f6f) )
26032447   ROM_LOAD( "315a18.7g", 0x200000, 2*1024*1024, CRC(6e416cee) SHA1(145a766ad2fa2b692692053dd36e0caf51d67a56) )
26042448
2605   // the TMS emulation is causing problems which means you have to reset this one anyway
26062449   ROM_REGION( 0x80, "eeprom", 0 ) // default eeprom to prevent game booting upside down with error
26072450   ROM_LOAD( "puzldama.nv", 0x0000, 0x080, CRC(bda98b84) SHA1(f4b03130bdc2a5bc6f0fc9ca21603109d82703b4) )
26082451ROM_END
r26235r26236
26432486   ROM_REGION( 0x200000, "shared", 0 )
26442487   ROM_LOAD( "417a17.9g", 0x000000, 2*1024*1024, CRC(88d47dfd) SHA1(b5d6dd7ee9ac0c427dc3e714a97945c954260913) )
26452488
2646   // game is currently broken due to TMS emulation anyway..
26472489   ROM_REGION( 0x80, "eeprom", 0 ) // default eeprom to prevent game booting with error
26482490   ROM_LOAD( "dragoonj.nv", 0x0000, 0x080, CRC(cbe16082) SHA1(da48893f3584ae2e034c73d4338b220107a884da) )
26492491ROM_END
r26235r26236
26842526   ROM_REGION( 0x200000, "shared", 0 )
26852527   ROM_LOAD( "417a17.9g", 0x000000, 2*1024*1024, CRC(88d47dfd) SHA1(b5d6dd7ee9ac0c427dc3e714a97945c954260913) )
26862528
2687   // game is currently broken due to TMS emulation anyway..
26882529   ROM_REGION( 0x80, "eeprom", 0 ) // default eeprom to prevent game booting with error
26892530   ROM_LOAD( "dragoona.nv", 0x0000, 0x080, CRC(7980ad2b) SHA1(dccaab02d23edbd81ae13441fbac0dbd7112c258) )
26902531ROM_END
r26235r26236
36263467MACHINE_START_MEMBER(konamigx_state,konamigx)
36273468{
36283469   save_item(NAME(konamigx_wrport1_1));
3629   save_item(NAME(sndto020));
3630   save_item(NAME(sndto000));
36313470}
36323471
36333472MACHINE_RESET_MEMBER(konamigx_state,konamigx)
36343473{
3635   int i;
3636
36373474   konamigx_wrport1_0 = konamigx_wrport1_1 = 0;
36383475   konamigx_wrport2 = 0;
36393476
r26235r26236
36463483   gx_syncen    = 0;
36473484   suspension_active = 0;
36483485
3649   memset(sndto000, 0, 16);
3650   memset(sndto020, 0, 16);
3651
3652   // sound CPU initially disabled?
3486   // Hold sound CPUs in reset
36533487   m_soundcpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
3488   m_soundcpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
36543489   m_dasp->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
36553490
3491
3492   // [HACK] This shouldn't be necessary
36563493   if (!strcmp(machine().system().name, "tkmmpzdm"))
36573494   {
36583495      // boost voice(chip 1 channel 3-7)
3659      for (i=3; i<=7; i++) m_k054539_2->set_gain(i, 2.0);
3496      for (int i=3; i<=7; i++) m_k054539_2->set_gain(i, 2.0);
36603497   }
36613498   else if ((!strcmp(machine().system().name, "dragoonj")) || (!strcmp(machine().system().name, "dragoona")))
36623499   {
36633500      // soften percussions(chip 1 channel 0-3), boost voice(chip 1 channel 4-7)
3664      for (i=0; i<=3; i++)
3501      for (int i=0; i<=3; i++)
36653502      {
36663503         m_k054539_2->set_gain(i, 0.8);
36673504         m_k054539_2->set_gain(i+4, 2.0);
36683505      }
36693506   }
3507
3508   const char *setname = machine().system().name;
3509
3510   if (!strcmp(setname, "opengolf") ||
3511      !strcmp(setname, "opengolf2")||
3512      !strcmp(setname, "ggreats2") ||
3513      !strcmp(setname, "tbyahhoo") ||
3514      !strcmp(setname, "dragoona") ||
3515      !strcmp(setname, "dragoonj"))
3516   {
3517      // [HACK] The 68020 instruction cache is disabled during POST.
3518      // We don't emulate this nor the slow program ROM access times (120ns)
3519      // so some games that rely on wait loops timeout far too quickly
3520      // waiting for the sound system tests to complete.
3521
3522      // To hack around this, we underclock the 68020 for 10 seconds during POST
3523      m_maincpu->set_clock_scale(0.66f);
3524      boothack_timer->adjust(attotime::from_seconds(10));
3525   }
36703526}
36713527
36723528struct GXGameInfoT
36733529{
36743530   const char *romname;
36753531   UINT32 cfgport;
3676   UINT32 sndhack;
36773532   UINT32 special;
36783533   UINT32 readback;
36793534};
r26235r26236
36853540
36863541static const GXGameInfoT gameDefs[] =
36873542{
3688   { "racinfrc", 11, 11, 0, BPP4 },
3689   { "racinfrcu",11, 11, 0, BPP4 },
3690   { "opengolf", 11, 12, 0, BPP4 },
3691   { "opengolf2",11, 12, 0, BPP4 },
3692   { "ggreats2", 11, 12, 0, BPP4 },
3693   { "le2",      13, 1, 1, BPP4 },
3694   { "le2u",     13, 1, 1, BPP4 },
3695   { "le2j",     13, 1, 1, BPP4 },
3696   { "gokuparo",  7, 0, 0, BPP5 },
3697   { "fantjour",  7, 0, 9, BPP5 },
3698   { "fantjoura", 7, 0, 9, BPP5 },
3699   { "puzldama",  7, 0, 0, BPP5 },
3700   { "tbyahhoo",  7, 0, 8, BPP5 },
3701   { "tkmmpzdm",  7, 0, 2, BPP6 },
3702   { "dragoonj",  7, 16, 3, BPP4 },
3703   { "dragoona",  7, 16, 3, BPP4 },
3704   { "sexyparo",  7, 0, 4, BPP5 },
3705   { "sexyparoa", 7, 0, 4, BPP5 },
3706   { "daiskiss",  7, 0, 5, BPP5 },
3707   { "tokkae",    7, 0, 0, BPP5 },
3708   { "salmndr2",  7, 0, 6, BPP66 },
3709   { "salmndr2a", 7, 0, 6, BPP66 },
3710   { "winspike",  8, 2, 7, BPP4 },
3711   { "winspikej", 8, 2, 7, BPP4 },
3712   { "soccerss",  7, 13, 0, BPP4 },
3713   { "soccerssa", 7, 13, 0, BPP4 },
3714   { "soccerssj", 7, 14, 0, BPP4 },
3715   { "soccerssja",7, 15, 0, BPP4 },
3716   { "vsnetscr",  7, 8, 0, BPP4 },
3717   { "vsnetscru", 7, 5, 0, BPP4 },
3718   { "vsnetscrj", 7, 10, 0, BPP4 },
3719   { "vsnetscra", 7, 7, 0, BPP4 },
3720   { "vsnetscreb",7, 9, 0, BPP4 },
3721   { "rungun2",   7, 3, 0, BPP4 },
3722   { "slamdnk2",  7, 6, 0, BPP4 },
3723   { "rushhero",  7, 4, 0, BPP4 },
3724   { "",         -1, -1, -1, -1 },
3543   { "racinfrc", 11, 0, BPP4 },
3544   { "racinfrcu",11, 0, BPP4 },
3545   { "opengolf", 11, 0, BPP4 },
3546   { "opengolf2",11, 0, BPP4 },
3547   { "ggreats2", 11, 0, BPP4 },
3548   { "le2",      13, 1, BPP4 },
3549   { "le2u",     13, 1, BPP4 },
3550   { "le2j",     13, 1, BPP4 },
3551   { "gokuparo",  7, 0, BPP5 },
3552   { "fantjour",  7, 9, BPP5 },
3553   { "fantjoura", 7, 9, BPP5 },
3554   { "puzldama",  7, 0, BPP5 },
3555   { "tbyahhoo",  7, 8, BPP5 },
3556   { "tkmmpzdm",  7, 2, BPP6 },
3557   { "dragoonj",  7, 3, BPP4 },
3558   { "dragoona",  7, 3, BPP4 },
3559   { "sexyparo",  7, 4, BPP5 },
3560   { "sexyparoa", 7, 4, BPP5 },
3561   { "daiskiss",  7, 5, BPP5 },
3562   { "tokkae",    7, 0, BPP5 },
3563   { "salmndr2",  7, 6, BPP66 },
3564   { "salmndr2a", 7, 6, BPP66 },
3565   { "winspike",  8, 7, BPP4 },
3566   { "winspikej", 8, 7, BPP4 },
3567   { "soccerss",  7, 0, BPP4 },
3568   { "soccerssa", 7, 0, BPP4 },
3569   { "soccerssj", 7, 0, BPP4 },
3570   { "soccerssja",7, 0, BPP4 },
3571   { "vsnetscr",  7, 0, BPP4 },
3572   { "vsnetscru", 7, 0, BPP4 },
3573   { "vsnetscrj", 7, 0, BPP4 },
3574   { "vsnetscra", 7, 0, BPP4 },
3575   { "vsnetscreb",7, 0, BPP4 },
3576   { "rungun2",   7, 0, BPP4 },
3577   { "slamdnk2",  7, 0, BPP4 },
3578   { "rushhero",  7, 0, BPP4 },
3579   { "",         -1, -1, -1 },
37253580};
37263581
37273582READ32_MEMBER( konamigx_state::k_6bpp_rom_long_r )
r26235r26236
37393594   last_prot_clk = 0;
37403595
37413596   esc_cb = 0;
3742   snd020_hack = 0;
37433597   resume_trigger = 0;
37443598
37453599   dmadelay_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(konamigx_state::dmaend_callback),this));
3600   boothack_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(konamigx_state::boothack_callback),this));
3601
37463602   i = match = 0;
37473603   while ((gameDefs[i].cfgport != -1) && (!match))
37483604   {
37493605      if (!strcmp(machine().system().name, gameDefs[i].romname))
3750   {
3606      {
37513607         match = 1;
37523608         konamigx_cfgport = gameDefs[i].cfgport;
3753         snd020_hack = gameDefs[i].sndhack;
37543609         readback = gameDefs[i].readback;
37553610
37563611         switch (gameDefs[i].special)
3757   {
3612         {
37583613            case 1: // LE2 guns
37593614               m_maincpu->space(AS_PROGRAM).install_read_handler(0xd44000, 0xd44003, read32_delegate(FUNC(konamigx_state::le2_gun_H_r),this));
37603615               m_maincpu->space(AS_PROGRAM).install_read_handler(0xd44004, 0xd44007, read32_delegate(FUNC(konamigx_state::le2_gun_V_r),this));
37613616               break;
3762
37633617            case 2: // tkmmpzdm hack
3764   {
3765      UINT32 *rom = (UINT32*)memregion("maincpu")->base();
3618            {
3619               UINT32 *rom = (UINT32*)memregion("maincpu")->base();
37663620
3767      // The display is initialized after POST but the copyright screen disabled
3768      // planes B,C,D and didn't bother restoring them. I've spent a good
3769      // amount of time chasing this bug but the cause remains inconclusive.
3770      // My guess is the CCU somehow masked or delayed vblank interrupts
3771      // during the copyright message.
3772      rom[0x810f1] &= ~1;      // fix checksum
3773      rom[0x872ea] |= 0xe0000; // enable plane B,C,D
3621               // The display is initialized after POST but the copyright screen disabled
3622               // planes B,C,D and didn't bother restoring them. I've spent a good
3623               // amount of time chasing this bug but the cause remains inconclusive.
3624               // My guess is the CCU somehow masked or delayed vblank interrupts
3625               // during the copyright message.
3626               rom[0x810f1] &= ~1;      // fix checksum
3627               rom[0x872ea] |= 0xe0000; // enable plane B,C,D
37743628
3775      esc_cb = tkmmpzdm_esc;
3776   }
3629               esc_cb = tkmmpzdm_esc;
37773630               break;
3631            }
37783632
37793633            case 3: // dragoon might
3780      esc_cb = dragoonj_esc;
3634               esc_cb = dragoonj_esc;
37813635               break;
37823636
37833637            case 4: // sexyparo
3784      esc_cb = sexyparo_esc;
3638               esc_cb = sexyparo_esc;
37853639               break;
37863640
37873641            case 5: // daiskiss
3788      esc_cb = daiskiss_esc;
3642               esc_cb = daiskiss_esc;
37893643               break;
37903644
37913645            case 6: // salamander 2
3792      esc_cb = sal2_esc;
3646               esc_cb = sal2_esc;
37933647               break;
37943648
37953649            case 7: // install type 4 Xilinx protection for non-type 3/4 games
3796      m_maincpu->space(AS_PROGRAM).install_write_handler(0xcc0000, 0xcc0007, write32_delegate(FUNC(konamigx_state::type4_prot_w),this));
3650               m_maincpu->space(AS_PROGRAM).install_write_handler(0xcc0000, 0xcc0007, write32_delegate(FUNC(konamigx_state::type4_prot_w),this));
37973651               break;
37983652
37993653            case 8: // tbyahhoo
r26235r26236
38013655               break;
38023656
38033657            case 9: // fantjour
3804      fantjour_dma_install(machine());
3658               fantjour_dma_install(machine());
38053659               break;
3660         }
3661      }
38063662
3807   }
3808   }
3809
38103663      i++;
38113664   }
38123665
trunk/src/mame/drivers/moo.c
r26235r26236
527527   MCFG_SOUND_ROUTE(0, "lspeaker", 0.50)
528528   MCFG_SOUND_ROUTE(1, "rspeaker", 0.50)
529529
530   MCFG_K054539_ADD("k054539", 48000, k054539_config)
530   MCFG_K054539_ADD("k054539", XTAL_18_432MHz, k054539_config)
531531   MCFG_SOUND_ROUTE(0, "lspeaker", 0.75)
532532   MCFG_SOUND_ROUTE(1, "rspeaker", 0.75)
533533MACHINE_CONFIG_END
trunk/src/mame/drivers/tmnt.c
r26235r26236
25002500MACHINE_CONFIG_END
25012501
25022502
2503static void sound_nmi( device_t *device )
2504{
2505   tmnt_state *state = device->machine().driver_data<tmnt_state>();
2506   state->m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
2507}
2508
25092503static const k054539_interface k054539_config =
25102504{
25112505   NULL,
25122506   NULL,
2513   sound_nmi
25142507};
25152508
25162509MACHINE_START_MEMBER(tmnt_state,prmrsocr)
r26235r26236
25592552   /* sound hardware */
25602553   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
25612554
2562   MCFG_K054539_ADD("k054539", 48000, k054539_config)
2555   MCFG_K054539_ADD("k054539", XTAL_18_432MHz, k054539_config)
2556   MCFG_K054539_TIMER_HANDLER(INPUTLINE("audiocpu", INPUT_LINE_NMI))
25632557   MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
25642558   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
25652559MACHINE_CONFIG_END
r26235r26236
26232617   MCFG_CPU_PROGRAM_MAP(ssriders_main_map)
26242618   MCFG_CPU_VBLANK_INT_DRIVER("screen", tmnt_state,  punkshot_interrupt)
26252619
2626   MCFG_CPU_ADD("audiocpu", Z80, 4000000)  /* ????? makes the ROM test sync */
2620   MCFG_CPU_ADD("audiocpu", Z80, 8000000)
26272621   MCFG_CPU_PROGRAM_MAP(ssriders_audio_map)
26282622                        /* NMIs are generated by the 053260 */
26292623
trunk/src/mame/drivers/konamigq.c
r26235r26236
4848#include "emu.h"
4949#include "cpu/m68000/m68000.h"
5050#include "cpu/psx/psx.h"
51#include "cpu/tms57002/tms57002.h"
5152#include "video/psx.h"
5253#include "machine/am53cf96.h"
5354#include "machine/eepromser.h"
5455#include "machine/mb89371.h"
5556#include "machine/scsibus.h"
5657#include "machine/scsihd.h"
58#include "sound/k056800.h"
5759#include "sound/k054539.h"
5860
5961class konamigq_state : public driver_device
r26235r26236
6163public:
6264   konamigq_state(const machine_config &mconfig, device_type type, const char *tag)
6365      : driver_device(mconfig, type, tag),
66      m_maincpu(*this, "maincpu"),
67      m_soundcpu(*this, "soundcpu"),
68      m_dasp(*this, "dasp"),
6469      m_am53cf96(*this, "scsi:am53cf96"),
65      m_maincpu(*this, "maincpu"),
66      m_soundcpu(*this, "soundcpu")
70      m_k056800(*this, "k056800")
6771   {
6872   }
6973
74   required_device<cpu_device> m_maincpu;
75   required_device<cpu_device> m_soundcpu;
76   required_device<tms57002_device> m_dasp;
7077   required_device<am53cf96_device> m_am53cf96;
78   required_device<k056800_device> m_k056800;
7179
72   UINT8 m_sndto000[ 16 ];
73   UINT8 m_sndtor3k[ 16 ];
7480   UINT8 *m_p_n_pcmram;
7581   UINT8 m_sector_buffer[ 512 ];
76   DECLARE_WRITE16_MEMBER(soundr3k_w);
77   DECLARE_READ16_MEMBER(soundr3k_r);
82   UINT8 m_sound_ctrl;
83   UINT8 m_sound_intck;
84
7885   DECLARE_WRITE16_MEMBER(eeprom_w);
7986   DECLARE_WRITE8_MEMBER(pcmram_w);
8087   DECLARE_READ8_MEMBER(pcmram_r);
81   DECLARE_READ16_MEMBER(sndcomm68k_r);
82   DECLARE_WRITE16_MEMBER(sndcomm68k_w);
8388   DECLARE_READ16_MEMBER(tms57002_data_word_r);
8489   DECLARE_WRITE16_MEMBER(tms57002_data_word_w);
8590   DECLARE_READ16_MEMBER(tms57002_status_word_r);
r26235r26236
8792   DECLARE_DRIVER_INIT(konamigq);
8893   DECLARE_MACHINE_START(konamigq);
8994   DECLARE_MACHINE_RESET(konamigq);
95   INTERRUPT_GEN_MEMBER(tms_sync);
96   DECLARE_WRITE_LINE_MEMBER(k054539_irq_gen);
97   
9098   void scsi_dma_read( UINT32 *p_n_psxram, UINT32 n_address, INT32 n_size );
9199   void scsi_dma_write( UINT32 *p_n_psxram, UINT32 n_address, INT32 n_size );
92   required_device<cpu_device> m_maincpu;
93   required_device<cpu_device> m_soundcpu;
94100};
95101
96/* Sound */
97
98WRITE16_MEMBER(konamigq_state::soundr3k_w)
99{
100   m_sndto000[ offset ] = data;
101   if( offset == 7 )
102   {
103      m_soundcpu->set_input_line(1, HOLD_LINE );
104   }
105}
106
107READ16_MEMBER(konamigq_state::soundr3k_r)
108{
109   /* hack to help the main program start up */
110   if( offset == 2 || offset == 3 )
111   {
112      return 0;
113   }
114
115   return m_sndtor3k[ offset ];
116}
117
118102/* EEPROM */
119103
120104static const UINT16 konamigq_def_eeprom[64] =
r26235r26236
152136
153137static ADDRESS_MAP_START( konamigq_map, AS_PROGRAM, 32, konamigq_state )
154138   AM_RANGE(0x1f000000, 0x1f00001f) AM_DEVREADWRITE8("scsi:am53cf96", am53cf96_device, read, write, 0x00ff00ff)
155   AM_RANGE(0x1f100000, 0x1f10000f) AM_WRITE16(soundr3k_w, 0xffffffff)
156   AM_RANGE(0x1f100010, 0x1f10001f) AM_READ16(soundr3k_r, 0xffffffff)
139   AM_RANGE(0x1f100000, 0x1f10001f) AM_DEVREADWRITE8("k056800", k056800_device, host_r, host_w, 0x00ff00ff)
157140   AM_RANGE(0x1f180000, 0x1f180003) AM_WRITE16(eeprom_w, 0x0000ffff)
158141   AM_RANGE(0x1f198000, 0x1f198003) AM_WRITENOP            /* cabinet lamps? */
159142   AM_RANGE(0x1f1a0000, 0x1f1a0003) AM_WRITENOP            /* indicates gun trigger */
r26235r26236
173156
174157/* SOUND CPU */
175158
176READ16_MEMBER(konamigq_state::sndcomm68k_r)
159INTERRUPT_GEN_MEMBER(konamigq_state::tms_sync)
177160{
178   return m_sndto000[ offset ];
161   // DASP is synced to the LRCLK of the 058141
162   if (m_sound_ctrl & 0x20)
163      m_dasp->sync_w(1);
179164}
180165
181WRITE16_MEMBER(konamigq_state::sndcomm68k_w)
182{
183   m_sndtor3k[ offset ] = data;
184}
185
186166READ16_MEMBER(konamigq_state::tms57002_data_word_r)
187167{
188   return 0;
168   return m_dasp->data_r(space, 0);
189169}
190170
191171WRITE16_MEMBER(konamigq_state::tms57002_data_word_w)
192172{
173   if (ACCESSING_BITS_0_7)
174      m_dasp->data_w(space, 0, data);
193175}
194176
195177READ16_MEMBER(konamigq_state::tms57002_status_word_r)
196178{
197   return 0;
179   return (m_dasp->dready_r() ? 4 : 0) |
180      (m_dasp->pc0_r() ? 2 : 0) |
181      (m_dasp->empty_r() ? 1 : 0);
198182}
199183
200184WRITE16_MEMBER(konamigq_state::tms57002_control_word_w)
201185{
186   if (ACCESSING_BITS_0_7)
187   {
188      if (!(data & 1))
189         m_soundcpu->set_input_line(M68K_IRQ_2, CLEAR_LINE);
190
191      m_dasp->pload_w(data & 4);
192      m_dasp->cload_w(data & 8);
193      m_dasp->set_input_line(INPUT_LINE_RESET, data & 0x10 ? CLEAR_LINE : ASSERT_LINE);
194
195      m_sound_ctrl = data;
196   }
202197}
203198
204/* 68000 memory handling */
199/* 68000 memory handling - near identical to Konami GX */
205200static ADDRESS_MAP_START( konamigq_sound_map, AS_PROGRAM, 16, konamigq_state )
206201   AM_RANGE(0x000000, 0x07ffff) AM_ROM
207202   AM_RANGE(0x100000, 0x10ffff) AM_RAM
208203   AM_RANGE(0x200000, 0x2004ff) AM_DEVREADWRITE8("k054539_1", k054539_device, read, write, 0xff00)
209204   AM_RANGE(0x200000, 0x2004ff) AM_DEVREADWRITE8("k054539_2", k054539_device, read, write, 0x00ff)
210205   AM_RANGE(0x300000, 0x300001) AM_READWRITE(tms57002_data_word_r,tms57002_data_word_w)
211   AM_RANGE(0x400000, 0x40000f) AM_WRITE(sndcomm68k_w)
212   AM_RANGE(0x400010, 0x40001f) AM_READ(sndcomm68k_r)
206   AM_RANGE(0x400000, 0x40001f) AM_DEVREADWRITE8("k056800", k056800_device, sound_r, sound_w, 0x00ff)
213207   AM_RANGE(0x500000, 0x500001) AM_READWRITE(tms57002_status_word_r,tms57002_control_word_w)
214   AM_RANGE(0x580000, 0x580001) AM_WRITENOP /* ?? */
208   AM_RANGE(0x580000, 0x580001) AM_WRITENOP // 'NRES' - D2: K056602 /RESET
215209ADDRESS_MAP_END
216210
217211
212/* TMS57002 memory handling */
213static ADDRESS_MAP_START( konamigq_dasp_map, AS_DATA, 8, konamigq_state )
214   AM_RANGE(0x00000, 0x3ffff) AM_RAM
215ADDRESS_MAP_END
216
217
218/* 058141 */
219WRITE_LINE_MEMBER(konamigq_state::k054539_irq_gen)
220{
221   if (m_sound_ctrl & 1)
222   {
223      // Trigger an interrupt on the rising edge
224      if (!m_sound_intck && state)
225         m_soundcpu->set_input_line(M68K_IRQ_2, ASSERT_LINE);
226   }
227
228   m_sound_intck = state;
229}
230
218231static const k054539_interface k054539_config =
219232{
220233   "shared"
r26235r26236
268281MACHINE_START_MEMBER(konamigq_state,konamigq)
269282{
270283   save_pointer(NAME(m_p_n_pcmram), 0x380000);
271   save_item(NAME(m_sndto000));
272   save_item(NAME(m_sndtor3k));
273284   save_item(NAME(m_sector_buffer));
285   save_item(NAME(m_sound_ctrl));
286   save_item(NAME(m_sound_intck));
274287}
275288
276289MACHINE_RESET_MEMBER(konamigq_state,konamigq)
r26235r26236
279292
280293static MACHINE_CONFIG_START( konamigq, konamigq_state )
281294   /* basic machine hardware */
282   MCFG_CPU_ADD( "maincpu", CXD8530BQ, XTAL_67_7376MHz )
283   MCFG_CPU_PROGRAM_MAP( konamigq_map )
295   MCFG_CPU_ADD("maincpu", CXD8530BQ, XTAL_67_7376MHz)
296   MCFG_CPU_PROGRAM_MAP(konamigq_map)
284297
285298   MCFG_RAM_MODIFY("maincpu:ram")
286299   MCFG_RAM_DEFAULT_SIZE("4M")
r26235r26236
288301   MCFG_PSX_DMA_CHANNEL_READ( "maincpu", 5, psx_dma_read_delegate( FUNC( konamigq_state::scsi_dma_read ), (konamigq_state *) owner ) )
289302   MCFG_PSX_DMA_CHANNEL_WRITE( "maincpu", 5, psx_dma_write_delegate( FUNC( konamigq_state::scsi_dma_write ), (konamigq_state *) owner ) )
290303
291   MCFG_CPU_ADD( "soundcpu", M68000, 8000000 )
292   MCFG_CPU_PROGRAM_MAP( konamigq_sound_map)
293   MCFG_CPU_PERIODIC_INT_DRIVER(konamigq_state, irq2_line_hold,  480)
304   MCFG_CPU_ADD("soundcpu", M68000, 8000000)
305   MCFG_CPU_PROGRAM_MAP(konamigq_sound_map)
294306
295   MCFG_MACHINE_START_OVERRIDE(konamigq_state, konamigq )
296   MCFG_MACHINE_RESET_OVERRIDE(konamigq_state, konamigq )
307   MCFG_CPU_ADD("dasp", TMS57002, 24000000/2)
308   MCFG_CPU_DATA_MAP(konamigq_dasp_map)
309   MCFG_CPU_PERIODIC_INT_DRIVER(konamigq_state, tms_sync, 48000)
297310
311   MCFG_MACHINE_START_OVERRIDE(konamigq_state, konamigq)
312   MCFG_MACHINE_RESET_OVERRIDE(konamigq_state, konamigq)
313
298314   MCFG_DEVICE_ADD("mb89371", MB89371, 0)
299315   MCFG_EEPROM_SERIAL_93C46_ADD("eeprom")
300316   MCFG_EEPROM_SERIAL_DATA(konamigq_def_eeprom, 128)
r26235r26236
305321   MCFG_AM53CF96_IRQ_HANDLER(DEVWRITELINE("^maincpu:irq", psxirq_device, intin10))
306322
307323   /* video hardware */
308   MCFG_PSXGPU_ADD( "maincpu", "gpu", CXD8538Q, 0x200000, XTAL_53_693175MHz )
324   MCFG_PSXGPU_ADD("maincpu", "gpu", CXD8538Q, 0x200000, XTAL_53_693175MHz)
309325
310326   /* sound hardware */
311327   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
312328
313   MCFG_K054539_ADD("k054539_1", 48000, k054539_config)
329   MCFG_K056800_ADD("k056800", XTAL_18_432MHz)
330   MCFG_K056800_INT_HANDLER(INPUTLINE("soundcpu", M68K_IRQ_1))
331
332   MCFG_K054539_ADD("k054539_1", XTAL_18_432MHz, k054539_config)
333   MCFG_K054539_TIMER_HANDLER(WRITELINE(konamigq_state, k054539_irq_gen))
314334   MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
315335   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
316336
317   MCFG_K054539_ADD("k054539_2", 48000, k054539_config)
337   MCFG_K054539_ADD("k054539_2", XTAL_18_432MHz, k054539_config)
318338   MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
319339   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
320340MACHINE_CONFIG_END
trunk/src/mame/drivers/gijoe.c
r26235r26236
137137   return soundlatch2_byte_r(space, 0);
138138}
139139
140static void sound_nmi( device_t *device )
141{
142   gijoe_state *state = device->machine().driver_data<gijoe_state>();
143   state->m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
144}
145
146140static ADDRESS_MAP_START( gijoe_map, AS_PROGRAM, 16, gijoe_state )
147141   AM_RANGE(0x000000, 0x0fffff) AM_ROM
148142   AM_RANGE(0x100000, 0x100fff) AM_RAM AM_SHARE("spriteram")                               // Sprites
r26235r26236
175169ADDRESS_MAP_END
176170
177171static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, gijoe_state )
178   AM_RANGE(0x0000, 0xebff) AM_ROM
179172   AM_RANGE(0xf000, 0xf7ff) AM_RAM
180173   AM_RANGE(0xf800, 0xfa2f) AM_DEVREADWRITE("k054539", k054539_device, read, write)
181174   AM_RANGE(0xfc00, 0xfc00) AM_WRITE(soundlatch2_byte_w)
182175   AM_RANGE(0xfc02, 0xfc02) AM_READ(soundlatch_byte_r)
176   AM_RANGE(0x0000, 0xffff) AM_ROM
183177ADDRESS_MAP_END
184178
185179static INPUT_PORTS_START( gijoe )
r26235r26236
192186   PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_er5911_device, ready_read)
193187   PORT_SERVICE_NO_TOGGLE( 0x0800, IP_ACTIVE_LOW )
194188
195   PORT_START( "EEPROMOUT" )
189   PORT_START("EEPROMOUT")
196190   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_er5911_device, di_write)
197191   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_er5911_device, cs_write)
198192   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_er5911_device, clk_write)
r26235r26236
230224{
231225   NULL,
232226   NULL,
233   sound_nmi
234227};
235228
236229static const k056832_interface gijoe_k056832_intf =
r26235r26236
287280
288281   MCFG_PALETTE_LENGTH(2048)
289282
290
291283   MCFG_K056832_ADD("k056832", gijoe_k056832_intf)
292284   MCFG_K053246_ADD("k053246", gijoe_k053247_intf)
293285   MCFG_K053251_ADD("k053251")
r26235r26236
295287   /* sound hardware */
296288   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
297289
298   MCFG_K054539_ADD("k054539", 48000, k054539_config)
290   MCFG_K054539_ADD("k054539", XTAL_18_432MHz, k054539_config)
291   MCFG_K054539_TIMER_HANDLER(INPUTLINE("audiocpu", INPUT_LINE_NMI))
299292   MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
300293   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
301294MACHINE_CONFIG_END
trunk/src/mame/drivers/rungun.c
r26235r26236
198198   m_sound_status = data;
199199}
200200
201WRITE8_MEMBER(rungun_state::z80ctrl_w)
201WRITE8_MEMBER(rungun_state::sound_ctrl_w)
202202{
203   m_z80_control = data;
203   /*
204      .... xxxx - Z80 ROM bank
205      ...x .... - NMI enable/acknowledge
206      xx.. .... - BLT2/1 (?)
207   */
204208
205209   membank("bank2")->set_entry(data & 0x07);
206210
207   if (data & 0x10)
211   if (!(data & 0x10))
208212      m_soundcpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
213
214   m_sound_ctrl = data;
209215}
210216
211INTERRUPT_GEN_MEMBER(rungun_state::audio_interrupt)
217WRITE_LINE_MEMBER(rungun_state::k054539_nmi_gen)
212218{
213   if (m_z80_control & 0x80)
214      return;
219   if (m_sound_ctrl & 0x10)
220   {
221      // Trigger an /NMI on the rising edge
222      if (!m_sound_nmi_clk && state)
223      {
224         m_soundcpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
225      }
226   }
215227
216   device.execute().set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
228   m_sound_nmi_clk = state;
217229}
218230
219231/* sound (this should be split into audio/xexex.c or pregx.c or so someday) */
r26235r26236
224236   AM_RANGE(0xc000, 0xdfff) AM_RAM
225237   AM_RANGE(0xe000, 0xe22f) AM_DEVREADWRITE("k054539_1", k054539_device, read, write)
226238   AM_RANGE(0xe230, 0xe3ff) AM_RAM
227   AM_RANGE(0xe400, 0xe62f) AM_DEVREADWRITE("k054539_1", k054539_device, read, write)
239   AM_RANGE(0xe400, 0xe62f) AM_DEVREADWRITE("k054539_2", k054539_device, read, write)
228240   AM_RANGE(0xe630, 0xe7ff) AM_RAM
229241   AM_RANGE(0xf000, 0xf000) AM_WRITE(sound_status_w)
230242   AM_RANGE(0xf002, 0xf002) AM_READ(soundlatch_byte_r)
231243   AM_RANGE(0xf003, 0xf003) AM_READ(soundlatch2_byte_r)
232   AM_RANGE(0xf800, 0xf800) AM_WRITE(z80ctrl_w)
244   AM_RANGE(0xf800, 0xf800) AM_WRITE(sound_ctrl_w)
233245   AM_RANGE(0xfff0, 0xfff3) AM_WRITENOP
234246ADDRESS_MAP_END
235247
r26235r26236
347359
348360   membank("bank2")->configure_entries(0, 8, &ROM[0x10000], 0x4000);
349361
350   save_item(NAME(m_z80_control));
362   save_item(NAME(m_sound_ctrl));
351363   save_item(NAME(m_sound_status));
364   save_item(NAME(m_sound_nmi_clk));
352365   save_item(NAME(m_ttl_vram));
353366}
354367
r26235r26236
359372   memset(m_sysreg, 0, 0x20);
360373   memset(m_ttl_vram, 0, 0x1000 * sizeof(UINT16));
361374
362   m_z80_control = 0;
375   m_sound_ctrl = 0;
363376   m_sound_status = 0;
364377}
365378
r26235r26236
368381   /* basic machine hardware */
369382   MCFG_CPU_ADD("maincpu", M68000, 16000000)
370383   MCFG_CPU_PROGRAM_MAP(rungun_map)
371   MCFG_CPU_VBLANK_INT_DRIVER("screen", rungun_state, rng_interrupt)
384   MCFG_CPU_VBLANK_INT_DRIVER("screen", rungun_state, rng_interrupt)
372385
373   MCFG_CPU_ADD("soundcpu", Z80, 10000000) // 8Mhz (10Mhz is much safer in self-test due to heavy sync)
386   MCFG_CPU_ADD("soundcpu", Z80, 8000000)
374387   MCFG_CPU_PROGRAM_MAP(rungun_sound_map)
375   MCFG_CPU_PERIODIC_INT_DRIVER(rungun_state, audio_interrupt,  480)
376388
377389   MCFG_QUANTUM_TIME(attotime::from_hz(6000)) // higher if sound stutters
378390
r26235r26236
392404
393405   MCFG_PALETTE_LENGTH(1024)
394406
395
396407   MCFG_K053936_ADD("k053936", rng_k053936_intf)
397408   MCFG_K055673_ADD("k055673", rng_k055673_intf)
398409   MCFG_K053252_ADD("k053252", 16000000/2, rng_k053252_intf)
r26235r26236
400411   /* sound hardware */
401412   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
402413
403   MCFG_K054539_ADD("k054539_1", 48000, k054539_config)
414   MCFG_K054539_ADD("k054539_1", XTAL_18_432MHz, k054539_config)
415   MCFG_K054539_TIMER_HANDLER(WRITELINE(rungun_state, k054539_nmi_gen))
404416   MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
405417   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
406418
407   MCFG_K054539_ADD("k054539_2", 48000, k054539_config)
419   MCFG_K054539_ADD("k054539_2", XTAL_18_432MHz, k054539_config)
408420   MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
409421   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
410422MACHINE_CONFIG_END
trunk/src/mame/drivers/ultrsprt.c
r26235r26236
1/*  Konami Ultra Sports hardware
1/*
2   Konami Ultra Sports hardware
23
3    Driver by Ville Linde
4
5TODO:
6- sound cpu irqs generation is unknown and very prone to get broken (i.e. if 4G and 2G returns as bad in POST screen).
7- sound is lagged, reason is probably the same as above.
8
4   Driver by Ville Linde
95*/
106
117#include "emu.h"
r26235r26236
1612#include "machine/konppc.h"
1713#include "sound/k056800.h"
1814
19
2015class ultrsprt_state : public driver_device
2116{
2217public:
2318   ultrsprt_state(const machine_config &mconfig, device_type type, const char *tag)
2419      : driver_device(mconfig, type, tag),
25      m_vram(*this, "vram"),
26      m_workram(*this, "workram"),
2720      m_maincpu(*this, "maincpu"),
2821      m_audiocpu(*this, "audiocpu"),
29      m_k056800(*this, "k056800") { }
22      m_k056800(*this, "k056800"),
23      m_workram(*this, "workram") { }
3024
31   required_shared_ptr<UINT32> m_vram;
25   static const UINT32 VRAM_PAGES      = 2;
26   static const UINT32 VRAM_PAGE_BYTES   = 512 * 1024;
27
28   required_device<cpu_device> m_maincpu;
29   required_device<cpu_device> m_audiocpu;
30   required_device<k056800_device> m_k056800;
3231   required_shared_ptr<UINT32> m_workram;
32
33   DECLARE_READ32_MEMBER(vram_r);
34   DECLARE_WRITE32_MEMBER(vram_w);
3335   DECLARE_WRITE32_MEMBER(palette_w);
3436   DECLARE_READ32_MEMBER(eeprom_r);
3537   DECLARE_WRITE32_MEMBER(eeprom_w);
3638   DECLARE_WRITE32_MEMBER(int_ack_w);
37   DECLARE_READ16_MEMBER(K056800_68k_r);
38   DECLARE_WRITE16_MEMBER(K056800_68k_w);
39   DECLARE_CUSTOM_INPUT_MEMBER(analog_ctrl_r);
40   virtual void machine_start();
39   DECLARE_CUSTOM_INPUT_MEMBER(flip_status_r);
40
4141   UINT32 screen_update_ultrsprt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
42   INTERRUPT_GEN_MEMBER(ultrsprt_vblank);
43   required_device<cpu_device> m_maincpu;
44   required_device<cpu_device> m_audiocpu;
45   required_device<k056800_device> m_k056800;
46};
4742
43protected:
44   virtual void machine_start();
45   virtual void machine_reset();
4846
47private:
48   UINT8 *m_vram;
49   UINT32 m_cpu_vram_page;
50};
4951
5052
53/*****************************************************************************/
54
5155UINT32 ultrsprt_state::screen_update_ultrsprt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
5256{
53   int i, j;
57   UINT8 *vram = m_vram + (m_cpu_vram_page ^ 1) * VRAM_PAGE_BYTES;
5458
55   UINT8 *ram = reinterpret_cast<UINT8 *>(m_vram.target());
56
57   for (j=0; j < 400; j++)
59   for (int y = cliprect.min_y; y <= cliprect.max_y; ++y)
5860   {
59      UINT16 *dest = &bitmap.pix16(j);
60      int fb_index = j * 1024;
61      int fb_index = y * 1024;
62      UINT16 *dest = &bitmap.pix16(y, cliprect.min_x);
6163
62      for (i=0; i < 512; i++)
64      for (int x = cliprect.min_x; x <= cliprect.max_x; ++x)
6365      {
64         UINT8 p1 = ram[BYTE4_XOR_BE(fb_index + i + 512)];
66         UINT8 p1 = vram[BYTE4_XOR_BE(fb_index + x + 512)];
67
6568         if (p1 == 0)
66            dest[i] = ram[BYTE4_XOR_BE(fb_index + i)];
69            *dest++ = vram[BYTE4_XOR_BE(fb_index + x)];
6770         else
68            dest[i] = 0x100 + p1;
71            *dest++ = 0x100 + p1;
6972      }
7073   }
7174
7275   return 0;
7376}
7477
78
7579WRITE32_MEMBER(ultrsprt_state::palette_w)
7680{
7781   COMBINE_DATA(&m_generic_paletteram_32[offset]);
r26235r26236
8185   palette_set_color(machine(), (offset*2)+1, MAKE_RGB(pal5bit(data >> 10), pal5bit(data >>  5), pal5bit(data >>  0)));
8286}
8387
88
89/*****************************************************************************/
90
91WRITE32_MEMBER(ultrsprt_state::int_ack_w)
92{
93   m_maincpu->set_input_line(INPUT_LINE_IRQ1, CLEAR_LINE);
94}
95
96
8497READ32_MEMBER(ultrsprt_state::eeprom_r)
8598{
8699   UINT32 r = 0;
r26235r26236
94107WRITE32_MEMBER(ultrsprt_state::eeprom_w)
95108{
96109   if (ACCESSING_BITS_24_31)
110   {
111      /*
112         .... ...x - EEPROM DI
113         .... ..x. - EEPROM CLK
114         .... .x.. - EEPROM /CS
115         .... x... - VRAM page (CPU access)
116         ...x .... - Coin counter
117         ..x. .... - Watchdog /Reset
118         .x.. .... - Trackball /Reset
119         x... .... - Sound CPU /Reset
120      */
97121      ioport("EEPROMOUT")->write(data, 0xffffffff);
98}
99122
100CUSTOM_INPUT_MEMBER(ultrsprt_state::analog_ctrl_r)
101{
102   const char *tag = (const char *)param;
103   return ioport(tag)->read() & 0xfff;
104}
123      UINT32 vram_page = (data & 0x08000000) >> 27;
105124
106WRITE32_MEMBER(ultrsprt_state::int_ack_w)
107{
108   m_maincpu->set_input_line(INPUT_LINE_IRQ1, CLEAR_LINE);
109}
125      if (vram_page != m_cpu_vram_page)
126      {
127         membank("vram")->set_entry(vram_page);
128         m_cpu_vram_page = vram_page;
129      }
110130
111void ultrsprt_state::machine_start()
112{
113   /* set conservative DRC options */
114   ppcdrc_set_options(m_maincpu, PPCDRC_COMPATIBLE_OPTIONS);
115
116   /* configure fast RAM regions for DRC */
117   ppcdrc_add_fastram(m_maincpu, 0x80000000, 0x8007ffff, FALSE, m_vram);
118   ppcdrc_add_fastram(m_maincpu, 0xff000000, 0xff01ffff, FALSE, m_workram);
131      coin_counter_w(machine(), 0, data & 0x10000000);
132      m_audiocpu->set_input_line(INPUT_LINE_RESET, data & 0x80000000 ? CLEAR_LINE : ASSERT_LINE);
133   }
119134}
120135
136/*****************************************************************************/
121137
122
123138static ADDRESS_MAP_START( ultrsprt_map, AS_PROGRAM, 32, ultrsprt_state )
124   AM_RANGE(0x00000000, 0x0007ffff) AM_RAM AM_SHARE("vram")
139   AM_RANGE(0x00000000, 0x0007ffff) AM_RAMBANK("vram")
125140   AM_RANGE(0x70000000, 0x70000003) AM_READWRITE(eeprom_r, eeprom_w)
126141   AM_RANGE(0x70000020, 0x70000023) AM_READ_PORT("P1")
127142   AM_RANGE(0x70000040, 0x70000043) AM_READ_PORT("P2")
128   AM_RANGE(0x70000080, 0x70000087) AM_DEVWRITE("k056800", k056800_device, host_w)
129   AM_RANGE(0x70000088, 0x7000008f) AM_DEVREAD("k056800", k056800_device, host_r)
143   AM_RANGE(0x70000080, 0x7000008f) AM_DEVREADWRITE8("k056800", k056800_device, host_r, host_w, 0xffffffff)
144   AM_RANGE(0x700000c0, 0x700000cf) AM_WRITENOP // Written following DMA interrupt - unused int ack?
130145   AM_RANGE(0x700000e0, 0x700000e3) AM_WRITE(int_ack_w)
131146   AM_RANGE(0x7f000000, 0x7f01ffff) AM_RAM AM_SHARE("workram")
132147   AM_RANGE(0x7f700000, 0x7f703fff) AM_RAM_WRITE(palette_w) AM_SHARE("paletteram")
133   AM_RANGE(0x7f800000, 0x7f9fffff) AM_MIRROR(0x00600000) AM_ROM AM_REGION("user1", 0)
148   AM_RANGE(0x7f800000, 0x7f9fffff) AM_MIRROR(0x00600000) AM_ROM AM_REGION("program", 0)
134149ADDRESS_MAP_END
135150
136151
137152/*****************************************************************************/
138153
139
140READ16_MEMBER(ultrsprt_state::K056800_68k_r)
141{
142   UINT16 r = 0;
143
144   if (ACCESSING_BITS_8_15)
145      r |= m_k056800->sound_r(space, (offset*2)+0, 0xffff) << 8;
146
147   if (ACCESSING_BITS_0_7)
148      r |= m_k056800->sound_r(space, (offset*2)+1, 0xffff) << 0;
149
150   return r;
151}
152
153WRITE16_MEMBER(ultrsprt_state::K056800_68k_w)
154{
155   if (ACCESSING_BITS_8_15)
156      m_k056800->sound_w(space, (offset*2)+0, (data >> 8) & 0xff, 0x00ff);
157
158   if (ACCESSING_BITS_0_7)
159      m_k056800->sound_w(space, (offset*2)+1, (data >> 0) & 0xff, 0x00ff);
160}
161
162154static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 16, ultrsprt_state )
163155   AM_RANGE(0x00000000, 0x0001ffff) AM_ROM
164156   AM_RANGE(0x00100000, 0x00101fff) AM_RAM
165   AM_RANGE(0x00200000, 0x00200007) AM_WRITE(K056800_68k_w)
166   AM_RANGE(0x00200008, 0x0020000f) AM_READ(K056800_68k_r)
157   AM_RANGE(0x00200000, 0x0020000f) AM_DEVREADWRITE8("k056800", k056800_device, sound_r, sound_w, 0xffff)
167158   AM_RANGE(0x00400000, 0x004002ff) AM_DEVREADWRITE8("k054539", k054539_device, read, write, 0xffff)
168159ADDRESS_MAP_END
169160
161
170162/*****************************************************************************/
171163
172164static INPUT_PORTS_START( ultrsprt )
173165   PORT_START("P1")
174   PORT_BIT( 0x00000fff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, ultrsprt_state,analog_ctrl_r, "STICKY1")
175   PORT_BIT( 0x0fff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, ultrsprt_state,analog_ctrl_r, "STICKX1")
166   PORT_BIT( 0x00000fff, 0x000, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(70) PORT_KEYDELTA(80) PORT_PLAYER(1)
167   PORT_BIT( 0x0fff0000, 0x000, IPT_TRACKBALL_X ) PORT_SENSITIVITY(70) PORT_KEYDELTA(80) PORT_REVERSE PORT_PLAYER(1)
176168   PORT_BIT( 0x40000000, IP_ACTIVE_HIGH, IPT_COIN1 )
177169   PORT_BIT( 0x20000000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1)
178170   PORT_BIT( 0x10000000, IP_ACTIVE_HIGH, IPT_START1 )
179171
180172   PORT_START("P2")
181   PORT_BIT( 0x00000fff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, ultrsprt_state,analog_ctrl_r, "STICKY2")
182   PORT_BIT( 0x0fff0000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, ultrsprt_state,analog_ctrl_r, "STICKX2")
173   PORT_BIT( 0x00000fff, 0x000, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(70) PORT_KEYDELTA(80) PORT_PLAYER(2)
174   PORT_BIT( 0x0fff0000, 0x000, IPT_TRACKBALL_X ) PORT_SENSITIVITY(70) PORT_KEYDELTA(80) PORT_REVERSE PORT_PLAYER(2)
183175   PORT_BIT( 0x40000000, IP_ACTIVE_HIGH, IPT_SERVICE1 )
184176   PORT_BIT( 0x20000000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2)
185177   PORT_BIT( 0x10000000, IP_ACTIVE_HIGH, IPT_START2 )
186178
187179   PORT_START("SERVICE")
180   PORT_BIT( 0x01000000, IP_ACTIVE_HIGH, IPT_UNUSED )
188181   PORT_BIT( 0x02000000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, do_read)
182   PORT_BIT( 0x04000000, IP_ACTIVE_HIGH, IPT_SPECIAL ) // VRAM page flip status?
189183   PORT_SERVICE_NO_TOGGLE( 0x08000000, IP_ACTIVE_LOW )
190184
191   PORT_START( "EEPROMOUT" )
185   PORT_START("EEPROMOUT")
192186   PORT_BIT( 0x01000000, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, di_write)
193187   PORT_BIT( 0x02000000, IP_ACTIVE_LOW, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, clk_write)
194188   PORT_BIT( 0x04000000, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, cs_write)
189INPUT_PORTS_END
195190
196   PORT_START("STICKX1")
197   PORT_BIT( 0xfff, 0x800, IPT_AD_STICK_X ) PORT_MINMAX(0x000,0xfff) PORT_SENSITIVITY(70) PORT_KEYDELTA(10) PORT_PLAYER(1)
198191
199   PORT_START("STICKY1")
200   PORT_BIT( 0xfff, 0x800, IPT_AD_STICK_Y ) PORT_MINMAX(0x000,0xfff) PORT_SENSITIVITY(70) PORT_KEYDELTA(10) PORT_REVERSE PORT_PLAYER(1)
192/*****************************************************************************/
201193
202   PORT_START("STICKX2")
203   PORT_BIT( 0xfff, 0x800, IPT_AD_STICK_X ) PORT_MINMAX(0x000,0xfff) PORT_SENSITIVITY(70) PORT_KEYDELTA(10) PORT_PLAYER(2)
194void ultrsprt_state::machine_start()
195{
196   /* set conservative DRC options */
197   ppcdrc_set_options(m_maincpu, PPCDRC_COMPATIBLE_OPTIONS);
204198
205   PORT_START("STICKY2")
206   PORT_BIT( 0xfff, 0x800, IPT_AD_STICK_Y ) PORT_MINMAX(0x000,0xfff) PORT_SENSITIVITY(70) PORT_KEYDELTA(10) PORT_REVERSE PORT_PLAYER(2)
207INPUT_PORTS_END
199   /* configure fast RAM regions for DRC */
200   ppcdrc_add_fastram(m_maincpu, 0xff000000, 0xff01ffff, FALSE, m_workram);
208201
202   m_vram = auto_alloc_array(machine(), UINT8, VRAM_PAGE_BYTES * VRAM_PAGES);
209203
210INTERRUPT_GEN_MEMBER(ultrsprt_state::ultrsprt_vblank)
211{
212   device.execute().set_input_line(INPUT_LINE_IRQ1, ASSERT_LINE);
204   membank("vram")->configure_entries(0, VRAM_PAGES, m_vram, VRAM_PAGE_BYTES);
205
206   save_pointer(NAME(m_vram), VRAM_PAGE_BYTES * VRAM_PAGES);
207   save_item(NAME(m_cpu_vram_page));
213208}
214209
215static void sound_irq_callback(running_machine &machine, int irq)
210void ultrsprt_state::machine_reset()
216211{
217   ultrsprt_state *state = machine.driver_data<ultrsprt_state>();
218   if (irq == 0)
219      /*generic_pulse_irq_line(machine.device("audiocpu"), INPUT_LINE_IRQ5, 1)*/;
220   else
221      state->m_audiocpu->set_input_line(INPUT_LINE_IRQ6, HOLD_LINE);
212   m_audiocpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
213
214   m_cpu_vram_page = 0;
215   membank("vram")->set_entry(m_cpu_vram_page);
222216}
223217
224static const k056800_interface ultrsprt_k056800_interface =
225{
226   sound_irq_callback
227};
228218
219/*****************************************************************************/
220
229221static k054539_interface k054539_config;
230222
223
231224static MACHINE_CONFIG_START( ultrsprt, ultrsprt_state )
232225   /* basic machine hardware */
233   MCFG_CPU_ADD("maincpu", PPC403GA, 25000000)     /* PowerPC 403GA 25MHz */
226   MCFG_CPU_ADD("maincpu", PPC403GA, 25000000)
234227   MCFG_CPU_PROGRAM_MAP(ultrsprt_map)
235   MCFG_CPU_VBLANK_INT_DRIVER("screen", ultrsprt_state, ultrsprt_vblank)
228   MCFG_CPU_VBLANK_INT_DRIVER("screen", ultrsprt_state, irq1_line_assert)
236229
237   MCFG_CPU_ADD("audiocpu", M68000, 8000000)       /* Not sure about the frequency */
230   MCFG_CPU_ADD("audiocpu", M68000, 8000000) // Unconfirmed
238231   MCFG_CPU_PROGRAM_MAP(sound_map)
239   MCFG_CPU_PERIODIC_INT_DRIVER(ultrsprt_state, irq5_line_hold,  1)    // ???
240232
241   MCFG_QUANTUM_TIME(attotime::from_hz(12000))
242
243233   MCFG_EEPROM_SERIAL_93C46_ADD("eeprom")
244234
245235   /* video hardware */
246236   MCFG_SCREEN_ADD("screen", RASTER)
247   MCFG_SCREEN_REFRESH_RATE(60)
248   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
249   MCFG_SCREEN_SIZE(512, 400)
237   MCFG_SCREEN_REFRESH_RATE(60) // TODO: Determine correct timings
238   MCFG_SCREEN_SIZE(640, 480)
250239   MCFG_SCREEN_VISIBLE_AREA(0, 511, 0, 399)
251240   MCFG_SCREEN_UPDATE_DRIVER(ultrsprt_state, screen_update_ultrsprt)
252241
253242   MCFG_PALETTE_LENGTH(8192)
254243
255244   /* sound hardware */
256   MCFG_K056800_ADD("k056800", ultrsprt_k056800_interface, XTAL_18_432MHz)
245   MCFG_K056800_ADD("k056800", XTAL_18_432MHz)
246   MCFG_K056800_INT_HANDLER(INPUTLINE("audiocpu", M68K_IRQ_6))
257247
258248   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
259249
260   MCFG_K054539_ADD("k054539", 48000, k054539_config)
250   MCFG_K054539_ADD("k054539", XTAL_18_432MHz, k054539_config)
251   MCFG_K054539_TIMER_HANDLER(INPUTLINE("audiocpu", M68K_IRQ_5))
261252   MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
262253   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
263254MACHINE_CONFIG_END
r26235r26236
266257/*****************************************************************************/
267258
268259ROM_START( fiveside )
269   ROM_REGION(0x200000, "user1", 0)    /* PowerPC program roms */
260   ROM_REGION(0x200000, "program", 0) /* PowerPC program ROMs */
270261   ROM_LOAD32_BYTE("479uaa01.bin", 0x000003, 0x80000, CRC(1bc4893d) SHA1(2c9df38ecb7efa7b686221ee98fa3aad9a63e152))
271262   ROM_LOAD32_BYTE("479uaa02.bin", 0x000002, 0x80000, CRC(ae74a6d0) SHA1(6113c2eea1628b22737c7b87af0e673d94984e88))
272263   ROM_LOAD32_BYTE("479uaa03.bin", 0x000001, 0x80000, CRC(5c0b176f) SHA1(9560259bc081d4cfd72eb485c3fdcecf484ba7a8))
273264   ROM_LOAD32_BYTE("479uaa04.bin", 0x000000, 0x80000, CRC(01a3e4cb) SHA1(819df79909d57fa12481698ffdb32b00586131d8))
274265
275   ROM_REGION(0x20000, "audiocpu", 0)      /* M68K program */
266   ROM_REGION(0x20000, "audiocpu", 0) /* M68K program */
276267   ROM_LOAD("479_a05.bin", 0x000000, 0x20000, CRC(251ae299) SHA1(5ffd74357e3c6ddb3a208c39a3b32b53fea90282))
277268
278   ROM_REGION(0x100000, "k054539", 0)   /* Sound roms */
269   ROM_REGION(0x100000, "k054539", 0) /* Sound ROMs */
279270   ROM_LOAD("479_a06.bin", 0x000000, 0x80000, CRC(8d6ac8a2) SHA1(7c4b8bd47cddc766cbdb6a486acc9221be55b579))
280271   ROM_LOAD("479_a07.bin", 0x080000, 0x80000, CRC(75835df8) SHA1(105b95c16f2ce6902c2e4c9c2fd9f2f7a848c546))
281272
r26235r26236
283274   ROM_LOAD( "fiveside.nv", 0x0000, 0x0080, CRC(aad11072) SHA1(8f777ee47801faa7ce8420c3052034720225aae7) )
284275ROM_END
285276
286GAME(1995, fiveside, 0, ultrsprt, ultrsprt, driver_device, 0, ROT90, "Konami", "Five a Side Soccer (ver UAA)", GAME_IMPERFECT_SOUND)
277// Undumped: Ultra Hockey
278GAME(1995, fiveside, 0, ultrsprt, ultrsprt, driver_device, 0, ROT90, "Konami", "Five a Side Soccer (ver UAA)", 0)
trunk/src/mame/drivers/lethal.c
r26235r26236
212212   return 0xf;
213213}
214214
215static void sound_nmi( device_t *device )
216{
217   lethal_state *state = device->machine().driver_data<lethal_state>();
218   state->m_soundcpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
219}
220
221215WRITE8_MEMBER(lethal_state::le_bankswitch_w)
222216{
223217   membank("bank1")->set_entry(data);
r26235r26236
460454ADDRESS_MAP_END
461455
462456static ADDRESS_MAP_START( le_sound, AS_PROGRAM, 8, lethal_state )
463   AM_RANGE(0x0000, 0xefff) AM_ROM
464457   AM_RANGE(0xf000, 0xf7ff) AM_RAM
465458   AM_RANGE(0xf800, 0xfa2f) AM_DEVREADWRITE("k054539", k054539_device, read, write)
466459   AM_RANGE(0xfc00, 0xfc00) AM_WRITE(soundlatch2_byte_w)
467460   AM_RANGE(0xfc02, 0xfc02) AM_READ(soundlatch_byte_r)
468461   AM_RANGE(0xfc03, 0xfc03) AM_READNOP
462   AM_RANGE(0x0000, 0xffff) AM_ROM
469463ADDRESS_MAP_END
470464
471465static INPUT_PORTS_START( lethalen )
r26235r26236
557551{
558552   NULL,
559553   NULL,
560   sound_nmi
561554};
562555
563556void lethal_state::machine_start()
r26235r26236
643636
644637   MCFG_PALETTE_LENGTH(7168+1)
645638
646
647639   MCFG_K056832_ADD("k056832", lethalen_k056832_intf)
648640   MCFG_K053244_ADD("k053244", lethalen_k05324x_intf)
649641   MCFG_K054000_ADD("k054000")
r26235r26236
651643   /* sound hardware */
652644   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
653645
654   MCFG_K054539_ADD("k054539", 48000, k054539_config)
646   MCFG_K054539_ADD("k054539", XTAL_18_432MHz, k054539_config)
647   MCFG_K054539_TIMER_HANDLER(INPUTLINE("soundcpu", INPUT_LINE_NMI))
655648   MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
656649   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
657650MACHINE_CONFIG_END
trunk/src/mame/drivers/nwk-tr.c
r26235r26236
239239      m_k001604(*this, "k001604"),
240240      m_adc12138(*this, "adc12138") { }
241241
242   // TODO: Needs verification on real hardware
243   static const int m_sound_timer_usec = 2400;
244
242245   UINT8 m_led_reg0;
243246   UINT8 m_led_reg1;
244247   required_shared_ptr<UINT32> m_work_ram;
r26235r26236
263266   DECLARE_WRITE32_MEMBER(lanc2_w);
264267   DECLARE_READ32_MEMBER(dsp_dataram_r);
265268   DECLARE_WRITE32_MEMBER(dsp_dataram_w);
269   DECLARE_WRITE16_MEMBER(soundtimer_en_w);
270   DECLARE_WRITE16_MEMBER(soundtimer_count_w);
266271   DECLARE_WRITE_LINE_MEMBER(voodoo_vblank_0);
272   TIMER_CALLBACK_MEMBER(sound_irq);
267273   DECLARE_DRIVER_INIT(nwktr);
268274   virtual void machine_start();
269275   virtual void machine_reset();
270276   UINT32 screen_update_nwktr(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
271   TIMER_CALLBACK_MEMBER(irq_off);
277
272278   void lanc2_init();
273279};
274280
r26235r26236
521527
522528/*****************************************************************************/
523529
524TIMER_CALLBACK_MEMBER(nwktr_state::irq_off)
530TIMER_CALLBACK_MEMBER(nwktr_state::sound_irq)
525531{
526   m_audiocpu->set_input_line(param, CLEAR_LINE);
532   m_audiocpu->set_input_line(M68K_IRQ_1, ASSERT_LINE);
527533}
528534
535
536WRITE16_MEMBER(nwktr_state::soundtimer_en_w)
537{
538   if (data & 1)
539   {
540      // Reset and disable timer
541      m_sound_irq_timer->adjust(attotime::from_usec(m_sound_timer_usec));
542      m_sound_irq_timer->enable(false);
543   }
544   else
545   {
546      // Enable timer
547      m_sound_irq_timer->enable(true);
548   }
549}
550
551WRITE16_MEMBER(nwktr_state::soundtimer_count_w)
552{
553   // Reset the count
554   m_sound_irq_timer->adjust(attotime::from_usec(m_sound_timer_usec));
555   m_audiocpu->set_input_line(M68K_IRQ_1, CLEAR_LINE);
556}
557
558
529559void nwktr_state::machine_start()
530560{
531561   /* set conservative DRC options */
r26235r26236
534564   /* configure fast RAM regions for DRC */
535565   ppcdrc_add_fastram(m_maincpu, 0x00000000, 0x003fffff, FALSE, m_work_ram);
536566
537   m_sound_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(nwktr_state::irq_off),this));
567   m_sound_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(nwktr_state::sound_irq), this));
538568}
539569
540570static ADDRESS_MAP_START( nwktr_map, AS_PROGRAM, 32, nwktr_state )
r26235r26236
548578   AM_RANGE(0x7d000000, 0x7d00ffff) AM_READ(sysreg_r)
549579   AM_RANGE(0x7d010000, 0x7d01ffff) AM_WRITE(sysreg_w)
550580   AM_RANGE(0x7d020000, 0x7d021fff) AM_DEVREADWRITE8("m48t58", timekeeper_device, read, write, 0xffffffff)  /* M48T58Y RTC/NVRAM */
551   AM_RANGE(0x7d030000, 0x7d030007) AM_DEVREAD("k056800", k056800_device, host_r)
552   AM_RANGE(0x7d030000, 0x7d030007) AM_DEVWRITE("k056800", k056800_device, host_w)
553   AM_RANGE(0x7d030008, 0x7d03000f) AM_DEVWRITE("k056800", k056800_device, host_w)
581   AM_RANGE(0x7d030000, 0x7d03000f) AM_DEVREADWRITE8("k056800", k056800_device, host_r, host_w, 0xffffffff)
554582   AM_RANGE(0x7d040000, 0x7d04ffff) AM_READWRITE(lanc1_r, lanc1_w)
555583   AM_RANGE(0x7d050000, 0x7d05ffff) AM_READWRITE(lanc2_r, lanc2_w)
556584   AM_RANGE(0x7e000000, 0x7e7fffff) AM_ROM AM_REGION("user2", 0)   /* Data ROM */
r26235r26236
562590
563591static ADDRESS_MAP_START( sound_memmap, AS_PROGRAM, 16, nwktr_state )
564592   AM_RANGE(0x000000, 0x07ffff) AM_ROM
565   AM_RANGE(0x100000, 0x10ffff) AM_RAM     /* Work RAM */
593   AM_RANGE(0x100000, 0x10ffff) AM_RAM
566594   AM_RANGE(0x200000, 0x200fff) AM_DEVREADWRITE("rfsnd", rf5c400_device, rf5c400_r, rf5c400_w)      /* Ricoh RF5C400 */
567   AM_RANGE(0x300000, 0x30000f) AM_DEVREADWRITE("k056800", k056800_device, sound_r, sound_w)
568   AM_RANGE(0x600000, 0x600001) AM_NOP
595   AM_RANGE(0x300000, 0x30001f) AM_DEVREADWRITE8("k056800", k056800_device, sound_r, sound_w, 0x00ff)
596   AM_RANGE(0x500000, 0x500001) AM_WRITE(soundtimer_en_w) AM_READNOP
597   AM_RANGE(0x600000, 0x600001) AM_WRITE(soundtimer_count_w) AM_READNOP
569598ADDRESS_MAP_END
570599
571600/*****************************************************************************/
r26235r26236
682711   adc12138_input_callback
683712};
684713
685static void sound_irq_callback(running_machine &machine, int irq)
686{
687   nwktr_state *state = machine.driver_data<nwktr_state>();
688   int line = (irq == 0) ? INPUT_LINE_IRQ1 : INPUT_LINE_IRQ2;
689714
690   state->m_audiocpu->set_input_line(line, ASSERT_LINE);
691   state->m_sound_irq_timer->adjust(attotime::from_usec(5), line);
692}
693
694static const k056800_interface nwktr_k056800_interface =
695{
696   sound_irq_callback
697};
698
699715static const k033906_interface nwktr_k033906_interface =
700716{
701717   "voodoo"
r26235r26236
734750static MACHINE_CONFIG_START( nwktr, nwktr_state )
735751
736752   /* basic machine hardware */
737   MCFG_CPU_ADD("maincpu", PPC403GA, 64000000/2)   /* PowerPC 403GA 32MHz */
753   MCFG_CPU_ADD("maincpu", PPC403GA, XTAL_64MHz/2)   /* PowerPC 403GA 32MHz */
738754   MCFG_CPU_PROGRAM_MAP(nwktr_map)
739755
740   MCFG_CPU_ADD("audiocpu", M68000, 64000000/4)    /* 16MHz */
756   MCFG_CPU_ADD("audiocpu", M68000, XTAL_64MHz/4)    /* 16MHz */
741757   MCFG_CPU_PROGRAM_MAP(sound_memmap)
742758
743   MCFG_CPU_ADD("dsp", ADSP21062, 36000000)
759   MCFG_CPU_ADD("dsp", ADSP21062, XTAL_36MHz)
744760   MCFG_CPU_CONFIG(sharc_cfg)
745761   MCFG_CPU_DATA_MAP(sharc_map)
746762
747763   MCFG_QUANTUM_TIME(attotime::from_hz(9000))
748764
765   MCFG_M48T58_ADD( "m48t58" )
766   MCFG_ADC12138_ADD( "adc12138", nwktr_adc_interface )
767   MCFG_K033906_ADD("k033906_1", nwktr_k033906_interface)
749768
769   /* video hardware */
750770   MCFG_3DFX_VOODOO_1_ADD("voodoo", STD_VOODOO_1_CLOCK, voodoo_intf)
751771
752   MCFG_K033906_ADD("k033906_1", nwktr_k033906_interface)
753
754   /* video hardware */
755772   MCFG_SCREEN_ADD("screen", RASTER)
756773   MCFG_SCREEN_REFRESH_RATE(60)
757774   MCFG_SCREEN_SIZE(512, 384)
r26235r26236
762779
763780   MCFG_K001604_ADD("k001604", racingj_k001604_intf)
764781
765   MCFG_K056800_ADD("k056800", nwktr_k056800_interface, 64000000/4)
766
767782   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
768783
769   MCFG_RF5C400_ADD("rfsnd", 16934400)  // as per Guru readme above
784   MCFG_K056800_ADD("k056800", XTAL_16_9344MHz)
785   MCFG_K056800_INT_HANDLER(INPUTLINE("audiocpu", M68K_IRQ_2))
786
787   MCFG_RF5C400_ADD("rfsnd", XTAL_16_9344MHz)  // as per Guru readme above
770788   MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
771789   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
772
773   MCFG_M48T58_ADD( "m48t58" )
774
775   MCFG_ADC12138_ADD( "adc12138", nwktr_adc_interface )
776790MACHINE_CONFIG_END
777791
778792static MACHINE_CONFIG_DERIVED( thrilld, nwktr )
trunk/src/mame/drivers/zr107.c
r26235r26236
182182class zr107_state : public driver_device
183183{
184184public:
185   enum
186   {
187      TIMER_IRQ_OFF
188   };
189
190185   zr107_state(const machine_config &mconfig, device_type type, const char *tag)
191186      : driver_device(mconfig, type, tag),
192      m_workram(*this, "workram"),
193187      m_maincpu(*this, "maincpu"),
194188      m_audiocpu(*this, "audiocpu"),
195189      m_dsp(*this, "dsp"),
196190      m_k001604(*this, "k001604"),
197191      m_k056800(*this, "k056800"),
198      m_k056832(*this, "k056832") { }
192      m_k056832(*this, "k056832"),
193      m_workram(*this, "workram") { }
199194
195   required_device<cpu_device> m_maincpu;
196   required_device<cpu_device> m_audiocpu;
197   required_device<cpu_device> m_dsp;
198   optional_device<k001604_device> m_k001604;
199   required_device<k056800_device> m_k056800;
200   optional_device<k056832_device> m_k056832;
201   optional_shared_ptr<UINT32> m_workram;
202
203   UINT32 *m_sharc_dataram;
200204   UINT8 m_led_reg0;
201205   UINT8 m_led_reg1;
202206   int m_ccu_vcth;
203207   int m_ccu_vctl;
204   optional_shared_ptr<UINT32> m_workram;
205   emu_timer *m_sound_irq_timer;
206   UINT32 *m_sharc_dataram;
208   UINT8 m_sound_ctrl;
209   UINT8 m_sound_intck;
210   
207211   DECLARE_WRITE32_MEMBER(paletteram32_w);
208212   DECLARE_READ8_MEMBER(sysreg_r);
209213   DECLARE_WRITE8_MEMBER(sysreg_w);
r26235r26236
212216   DECLARE_WRITE32_MEMBER(jetwave_palette_w);
213217   DECLARE_READ32_MEMBER(dsp_dataram_r);
214218   DECLARE_WRITE32_MEMBER(dsp_dataram_w);
219   DECLARE_WRITE16_MEMBER(sound_ctrl_w);
220
215221   DECLARE_DRIVER_INIT(common);
216222   DECLARE_DRIVER_INIT(zr107);
217223   DECLARE_DRIVER_INIT(jetwave);
218   virtual void machine_start();
219   virtual void machine_reset();
220224   DECLARE_VIDEO_START(zr107);
221225   DECLARE_VIDEO_START(jetwave);
222226   UINT32 screen_update_zr107(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
223227   UINT32 screen_update_jetwave(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
224228   INTERRUPT_GEN_MEMBER(zr107_vblank);
225   required_device<cpu_device> m_maincpu;
226   required_device<cpu_device> m_audiocpu;
227   required_device<cpu_device> m_dsp;
228   optional_device<k001604_device> m_k001604;
229   required_device<k056800_device> m_k056800;
230   optional_device<k056832_device> m_k056832;
229   WRITE_LINE_MEMBER(k054539_irq_gen);
231230
232231protected:
233   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
232   virtual void machine_start();
233   virtual void machine_reset();
234234};
235235
236236
r26235r26236
431431   /* set conservative DRC options */
432432   ppcdrc_set_options(m_maincpu, PPCDRC_COMPATIBLE_OPTIONS);
433433
434   m_sound_irq_timer = timer_alloc(TIMER_IRQ_OFF);
435
436434   /* configure fast RAM regions for DRC */
437435   ppcdrc_add_fastram(m_maincpu, 0x00000000, 0x000fffff, FALSE, m_workram);
438436}
r26235r26236
451449   AM_RANGE(0x7e000000, 0x7e003fff) AM_READWRITE8(sysreg_r, sysreg_w, 0xffffffff)
452450   AM_RANGE(0x7e008000, 0x7e009fff) AM_DEVREADWRITE8("k056230", k056230_device, k056230_r, k056230_w, 0xffffffff)               /* LANC registers */
453451   AM_RANGE(0x7e00a000, 0x7e00bfff) AM_DEVREADWRITE("k056230", k056230_device, lanc_ram_r, lanc_ram_w)      /* LANC Buffer RAM (27E) */
454   AM_RANGE(0x7e00c000, 0x7e00c007) AM_DEVWRITE("k056800", k056800_device, host_w)
455   AM_RANGE(0x7e00c008, 0x7e00c00f) AM_DEVREAD("k056800", k056800_device, host_r)
452   AM_RANGE(0x7e00c000, 0x7e00c00f) AM_DEVREADWRITE8("k056800", k056800_device, host_r, host_w, 0xffffffff)
456453   AM_RANGE(0x7f800000, 0x7f9fffff) AM_ROM AM_SHARE("share2")
457454   AM_RANGE(0x7fe00000, 0x7fffffff) AM_ROM AM_REGION("user1", 0) AM_SHARE("share2")    /* Program ROM */
458455ADDRESS_MAP_END
r26235r26236
479476   AM_RANGE(0x7e000000, 0x7e003fff) AM_MIRROR(0x80000000) AM_READWRITE8(sysreg_r, sysreg_w, 0xffffffff)
480477   AM_RANGE(0x7e008000, 0x7e009fff) AM_MIRROR(0x80000000) AM_DEVREADWRITE8("k056230", k056230_device, k056230_r, k056230_w, 0xffffffff)             /* LANC registers */
481478   AM_RANGE(0x7e00a000, 0x7e00bfff) AM_MIRROR(0x80000000) AM_DEVREADWRITE("k056230", k056230_device, lanc_ram_r, lanc_ram_w)    /* LANC Buffer RAM (27E) */
482   AM_RANGE(0x7e00c000, 0x7e00c007) AM_MIRROR(0x80000000) AM_DEVWRITE("k056800", k056800_device, host_w)
483   AM_RANGE(0x7e00c008, 0x7e00c00f) AM_MIRROR(0x80000000) AM_DEVREAD("k056800", k056800_device, host_r)
479   AM_RANGE(0x7e00c000, 0x7e00c00f) AM_MIRROR(0x80000000) AM_DEVREADWRITE8("k056800", k056800_device, host_r, host_w, 0xffffffff)
484480   AM_RANGE(0x7f000000, 0x7f3fffff) AM_MIRROR(0x80000000) AM_ROM AM_REGION("user2", 0)
485481   AM_RANGE(0x7f800000, 0x7f9fffff) AM_MIRROR(0x80000000) AM_ROM AM_SHARE("share2")
486482   AM_RANGE(0x7fe00000, 0x7fffffff) AM_MIRROR(0x80000000) AM_ROM AM_REGION("user1", 0) AM_SHARE("share2")  /* Program ROM */
r26235r26236
490486
491487/**********************************************************************/
492488
489WRITE16_MEMBER(zr107_state::sound_ctrl_w)
490{
491   if (ACCESSING_BITS_0_7)
492   {
493      if (!(data & 1))
494         m_audiocpu->set_input_line(M68K_IRQ_2, CLEAR_LINE);
495
496      m_sound_ctrl = data;
497   }
498}
499
493500static ADDRESS_MAP_START( sound_memmap, AS_PROGRAM, 16, zr107_state )
494501   AM_RANGE(0x000000, 0x01ffff) AM_ROM
495502   AM_RANGE(0x100000, 0x103fff) AM_RAM     /* Work RAM */
496503   AM_RANGE(0x200000, 0x2004ff) AM_DEVREADWRITE8("k054539_1", k054539_device, read, write, 0xff00)
497504   AM_RANGE(0x200000, 0x2004ff) AM_DEVREADWRITE8("k054539_2", k054539_device, read, write, 0x00ff)
498   AM_RANGE(0x400000, 0x40000f) AM_DEVWRITE("k056800", k056800_device, sound_w)
499   AM_RANGE(0x400010, 0x40001f) AM_DEVREAD("k056800", k056800_device, sound_r)
500   AM_RANGE(0x580000, 0x580001) AM_WRITENOP
505   AM_RANGE(0x400000, 0x40001f) AM_DEVREADWRITE8("k056800", k056800_device, sound_r, sound_w, 0x00ff)
506   AM_RANGE(0x500000, 0x500001) AM_WRITE(sound_ctrl_w)
507   AM_RANGE(0x580000, 0x580001) AM_WRITENOP // 'NRES' - D2: K056602 /RESET
501508ADDRESS_MAP_END
502509
503510static const k054539_interface k054539_config =
r26235r26236
694701}
695702
696703
697void zr107_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
704
705WRITE_LINE_MEMBER(zr107_state::k054539_irq_gen)
698706{
699   switch (id)
707   if (m_sound_ctrl & 1)
700708   {
701   case TIMER_IRQ_OFF:
702      m_audiocpu->set_input_line(param, CLEAR_LINE);
703      break;
704   default:
705      assert_always(FALSE, "Unknown id in zr107_state::device_timer");
709      // Trigger an interrupt on the rising edge
710      if (!m_sound_intck && state)
711         m_audiocpu->set_input_line(M68K_IRQ_2, ASSERT_LINE);
706712   }
707}
708713
709static void sound_irq_callback( running_machine &machine, int irq )
710{
711   zr107_state *state = machine.driver_data<zr107_state>();
712   int line = (irq == 0) ? INPUT_LINE_IRQ1 : INPUT_LINE_IRQ2;
713
714   state->m_audiocpu->set_input_line(line, ASSERT_LINE);
715   state->timer_set(attotime::from_usec(5), zr107_state::TIMER_IRQ_OFF, line);
714   m_sound_intck = state;
716715}
717716
718static const k056800_interface zr107_k056800_interface =
719{
720   sound_irq_callback
721};
722717
723718static const k056832_interface zr107_k056832_intf =
724719{
r26235r26236
766761   MCFG_CPU_CONFIG(sharc_cfg)
767762   MCFG_CPU_DATA_MAP(sharc_map)
768763
769   MCFG_QUANTUM_TIME(attotime::from_hz(30000))
764   MCFG_QUANTUM_TIME(attotime::from_hz(750000))// Very high sync needed to prevent lockups - why?
770765
771766   MCFG_EEPROM_SERIAL_93C46_ADD("eeprom")
772767
r26235r26236
785780
786781   MCFG_K056832_ADD("k056832", zr107_k056832_intf)
787782
788   MCFG_K056800_ADD("k056800", zr107_k056800_interface, XTAL_64MHz/4)
783   MCFG_K056800_ADD("k056800", XTAL_18_432MHz)
784   MCFG_K056800_INT_HANDLER(INPUTLINE("audiocpu", M68K_IRQ_1))
789785
790786   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
791787
792   MCFG_K054539_ADD("k054539_1", 48000, k054539_config)
788   MCFG_K054539_ADD("k054539_1", XTAL_18_432MHz, k054539_config)
789   MCFG_K054539_TIMER_HANDLER(WRITELINE(zr107_state, k054539_irq_gen))
793790   MCFG_SOUND_ROUTE(0, "lspeaker", 0.75)
794791   MCFG_SOUND_ROUTE(1, "rspeaker", 0.75)
795792
796   MCFG_K054539_ADD("k054539_2", 48000, k054539_config)
793   MCFG_K054539_ADD("k054539_2", XTAL_18_432MHz, k054539_config)
797794   MCFG_SOUND_ROUTE(0, "lspeaker", 0.75)
798795   MCFG_SOUND_ROUTE(1, "rspeaker", 0.75)
799796
r26235r26236
824821   MCFG_CPU_CONFIG(sharc_cfg)
825822   MCFG_CPU_DATA_MAP(sharc_map)
826823
827   MCFG_QUANTUM_TIME(attotime::from_hz(30000))
824   MCFG_QUANTUM_TIME(attotime::from_hz(2000000)) // Very high sync needed to prevent lockups - why?
828825
829826   MCFG_EEPROM_SERIAL_93C46_ADD("eeprom")
830827
r26235r26236
843840
844841   MCFG_K001604_ADD("k001604", jetwave_k001604_intf)
845842
846   MCFG_K056800_ADD("k056800", zr107_k056800_interface, XTAL_64MHz/4)
843   MCFG_K056800_ADD("k056800", XTAL_18_432MHz)
844   MCFG_K056800_INT_HANDLER(INPUTLINE("audiocpu", M68K_IRQ_1))   
847845
848846   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
849847
850   MCFG_K054539_ADD("k054539_1", 48000, k054539_config)
848   MCFG_K054539_ADD("k054539_1", XTAL_18_432MHz, k054539_config)
849   MCFG_K054539_TIMER_HANDLER(WRITELINE(zr107_state, k054539_irq_gen))   
851850   MCFG_SOUND_ROUTE(0, "lspeaker", 0.75)
852851   MCFG_SOUND_ROUTE(1, "rspeaker", 0.75)
853852
854   MCFG_K054539_ADD("k054539_2", 48000, k054539_config)
853   MCFG_K054539_ADD("k054539_2", XTAL_18_432MHz, k054539_config)
855854   MCFG_SOUND_CONFIG(k054539_config)
856855   MCFG_SOUND_ROUTE(0, "lspeaker", 0.75)
857856   MCFG_SOUND_ROUTE(1, "rspeaker", 0.75)
r26235r26236
10691068
10701069/*****************************************************************************/
10711070
1072GAME( 1995, midnrun,  0,        zr107,   midnrun,  zr107_state, zr107,   ROT0, "Konami", "Midnight Run (Euro v1.11)", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND )
1073GAME( 1996, windheat, 0,        zr107,   windheat, zr107_state, zr107,   ROT0, "Konami", "Winding Heat (EAA, Euro v2.11)", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND )
1074GAME( 1996, windheatu,windheat, zr107,   windheat, zr107_state, zr107,   ROT0, "Konami", "Winding Heat (UBC, USA v2.22)", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND )
1075GAME( 1996, windheatj,windheat, zr107,   windheat, zr107_state, zr107,   ROT0, "Konami", "Winding Heat (JAA, Japan v2.11)", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND )
1076GAME( 1996, windheata,windheat, zr107,   windheat, zr107_state, zr107,   ROT0, "Konami", "Winding Heat (AAA, Asia v2.11)", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND )
1077GAME( 1996, waveshrk, 0,        jetwave, jetwave,  zr107_state, jetwave, ROT0, "Konami", "Wave Shark (UAB, USA v1.04)", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
1078GAME( 1996, jetwave,  waveshrk, jetwave, jetwave,  zr107_state, jetwave, ROT0, "Konami", "Jet Wave (JAB, Japan v1.04)", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING )
1071GAME( 1995, midnrun,  0,        zr107,   midnrun,  zr107_state, zr107,   ROT0, "Konami", "Midnight Run (Euro v1.11)", GAME_IMPERFECT_GRAPHICS )
1072GAME( 1996, windheat, 0,        zr107,   windheat, zr107_state, zr107,   ROT0, "Konami", "Winding Heat (EAA, Euro v2.11)", GAME_IMPERFECT_GRAPHICS )
1073GAME( 1996, windheatu,windheat, zr107,   windheat, zr107_state, zr107,   ROT0, "Konami", "Winding Heat (UBC, USA v2.22)", GAME_IMPERFECT_GRAPHICS )
1074GAME( 1996, windheatj,windheat, zr107,   windheat, zr107_state, zr107,   ROT0, "Konami", "Winding Heat (JAA, Japan v2.11)", GAME_IMPERFECT_GRAPHICS )
1075GAME( 1996, windheata,windheat, zr107,   windheat, zr107_state, zr107,   ROT0, "Konami", "Winding Heat (AAA, Asia v2.11)", GAME_IMPERFECT_GRAPHICS )
1076GAME( 1996, waveshrk, 0,        jetwave, jetwave,  zr107_state, jetwave, ROT0, "Konami", "Wave Shark (UAB, USA v1.04)", GAME_IMPERFECT_GRAPHICS )
1077GAME( 1996, jetwave,  waveshrk, jetwave, jetwave,  zr107_state, jetwave, ROT0, "Konami", "Jet Wave (JAB, Japan v1.04)", GAME_IMPERFECT_GRAPHICS )
trunk/src/mame/drivers/gticlub.c
r26235r26236
239239class gticlub_state : public driver_device
240240{
241241public:
242   enum
243   {
244      TIMER_IRQ_OFF
245   };
246
247242   gticlub_state(const machine_config &mconfig, device_type type, const char *tag)
248243      : driver_device(mconfig, type, tag),
249244      m_work_ram(*this, "work_ram"),
250245      m_maincpu(*this, "maincpu"),
251246      m_audiocpu(*this, "audiocpu"),
252      m_k056800(*this, "k056800"),
253247      m_dsp(*this, "dsp"),
254248      m_dsp2(*this, "dsp2"),
249      m_k056800(*this, "k056800"),
255250      m_adc1038(*this, "adc1038"),
256251      m_eeprom(*this, "eeprom")  { }
257252
253   // TODO: Needs verification on real hardware
254   static const int m_sound_timer_usec = 2400;
255
258256   required_shared_ptr<UINT32> m_work_ram;
259257   required_device<cpu_device> m_maincpu;
260258   required_device<cpu_device> m_audiocpu;
261   required_device<k056800_device> m_k056800;
262259   required_device<cpu_device> m_dsp;
263260   optional_device<cpu_device> m_dsp2;
261   required_device<k056800_device> m_k056800;
264262   required_device<adc1038_device> m_adc1038;
265263   required_device<eeprom_serial_93cxx_device> m_eeprom;
266   UINT32 *m_sharc_dataram_0;
267   UINT32 *m_sharc_dataram_1;
264
268265   DECLARE_WRITE32_MEMBER(paletteram32_w);
269266   DECLARE_READ32_MEMBER(gticlub_k001604_tile_r);
270267   DECLARE_WRITE32_MEMBER(gticlub_k001604_tile_w);
r26235r26236
280277   DECLARE_WRITE32_MEMBER(dsp_dataram1_w);
281278   DECLARE_WRITE_LINE_MEMBER(voodoo_vblank_0);
282279   DECLARE_WRITE_LINE_MEMBER(voodoo_vblank_1);
280   DECLARE_WRITE16_MEMBER(soundtimer_en_w);
281   DECLARE_WRITE16_MEMBER(soundtimer_count_w);
282
283283   void init_hangplt_common();
284284   DECLARE_DRIVER_INIT(hangplt);
285285   DECLARE_DRIVER_INIT(hangpltu);
r26235r26236
289289   DECLARE_MACHINE_RESET(hangplt);
290290   DECLARE_VIDEO_START(gticlub);
291291   INTERRUPT_GEN_MEMBER(gticlub_vblank);
292   TIMER_CALLBACK_MEMBER(sound_irq);
292293
293294   UINT32 screen_update_gticlub(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
294295   UINT32 screen_update_hangplt(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
295296
296protected:
297   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
298297private:
299298   void gticlub_led_setreg(int offset, UINT8 data);
300299
301300   UINT8 gticlub_led_reg[2];
301   emu_timer *m_sound_irq_timer;
302   UINT32 *m_sharc_dataram_0;
303   UINT32 *m_sharc_dataram_1;
302304};
303305
304306
r26235r26236
424426
425427/******************************************************************/
426428
429TIMER_CALLBACK_MEMBER(gticlub_state::sound_irq)
430{
431   m_audiocpu->set_input_line(M68K_IRQ_1, ASSERT_LINE);
432}
433
434
435WRITE16_MEMBER(gticlub_state::soundtimer_en_w)
436{
437   if (data & 1)
438   {
439      // Reset and disable timer
440      m_sound_irq_timer->adjust(attotime::from_usec(m_sound_timer_usec));
441      m_sound_irq_timer->enable(false);
442   }
443   else
444   {
445      // Enable timer
446      m_sound_irq_timer->enable(true);
447   }
448}
449
450WRITE16_MEMBER(gticlub_state::soundtimer_count_w)
451{
452   // Reset the count
453   m_sound_irq_timer->adjust(attotime::from_usec(m_sound_timer_usec));
454   m_audiocpu->set_input_line(M68K_IRQ_1, CLEAR_LINE);
455}
456
457/******************************************************************/
458
427459MACHINE_START_MEMBER(gticlub_state,gticlub)
428460{
429461   /* set conservative DRC options */
r26235r26236
431463
432464   /* configure fast RAM regions for DRC */
433465   ppcdrc_add_fastram(m_maincpu, 0x00000000, 0x000fffff, FALSE, m_work_ram);
466
467   m_sound_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gticlub_state::sound_irq), this));
434468}
435469
436470static ADDRESS_MAP_START( gticlub_map, AS_PROGRAM, 32, gticlub_state )
r26235r26236
446480   AM_RANGE(0x7e000000, 0x7e003fff) AM_READWRITE8(sysreg_r, sysreg_w, 0xffffffff)
447481   AM_RANGE(0x7e008000, 0x7e009fff) AM_DEVREADWRITE8("k056230", k056230_device, k056230_r, k056230_w, 0xffffffff)
448482   AM_RANGE(0x7e00a000, 0x7e00bfff) AM_DEVREADWRITE("k056230", k056230_device, lanc_ram_r, lanc_ram_w)
449   AM_RANGE(0x7e00c000, 0x7e00c007) AM_DEVWRITE("k056800", k056800_device, host_w)
450   AM_RANGE(0x7e00c000, 0x7e00c007) AM_DEVREAD("k056800", k056800_device, host_r)       // Hang Pilot
451   AM_RANGE(0x7e00c008, 0x7e00c00f) AM_DEVREAD("k056800", k056800_device, host_r)
483   AM_RANGE(0x7e00c000, 0x7e00c00f) AM_DEVREADWRITE8("k056800", k056800_device, host_r, host_w, 0xffffffff)
452484   AM_RANGE(0x7f000000, 0x7f3fffff) AM_ROM AM_REGION("user2", 0)   /* Data ROM */
453485   AM_RANGE(0x7f800000, 0x7f9fffff) AM_ROM AM_SHARE("share2")
454486   AM_RANGE(0x7fe00000, 0x7fffffff) AM_ROM AM_REGION("user1", 0) AM_SHARE("share2")    /* Program ROM */
r26235r26236
459491static ADDRESS_MAP_START( sound_memmap, AS_PROGRAM, 16, gticlub_state )
460492   AM_RANGE(0x000000, 0x07ffff) AM_ROM
461493   AM_RANGE(0x200000, 0x20ffff) AM_RAM
462   AM_RANGE(0x300000, 0x30000f) AM_DEVREADWRITE("k056800", k056800_device, sound_r, sound_w)
494   AM_RANGE(0x300000, 0x30001f) AM_DEVREADWRITE8("k056800", k056800_device, sound_r, sound_w, 0x00ff)
463495   AM_RANGE(0x400000, 0x400fff) AM_DEVREADWRITE("rfsnd", rf5c400_device, rf5c400_r, rf5c400_w)      /* Ricoh RF5C400 */
464   AM_RANGE(0x580000, 0x580001) AM_WRITENOP
465   AM_RANGE(0x600000, 0x600001) AM_WRITENOP
496   AM_RANGE(0x500000, 0x500001) AM_WRITE(soundtimer_en_w) AM_READNOP
497   AM_RANGE(0x600000, 0x600001) AM_WRITE(soundtimer_count_w) AM_READNOP
466498ADDRESS_MAP_END
467499
468500/*****************************************************************************/
r26235r26236
722754};
723755
724756
725void gticlub_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
726{
727   switch (id)
728   {
729   case TIMER_IRQ_OFF:
730      m_audiocpu->set_input_line(param, CLEAR_LINE);
731      break;
732   default:
733      assert_always(FALSE, "Unknown id in gticlub_state::device_timer");
734   }
735}
736
737static void sound_irq_callback( running_machine &machine, int irq )
738{
739   gticlub_state *state = machine.driver_data<gticlub_state>();
740   int line = (irq == 0) ? INPUT_LINE_IRQ1 : INPUT_LINE_IRQ2;
741
742   state->m_audiocpu->set_input_line(line, ASSERT_LINE);
743   state->timer_set(attotime::from_usec(5), gticlub_state::TIMER_IRQ_OFF, line);
744}
745
746static const k056800_interface gticlub_k056800_interface =
747{
748   sound_irq_callback
749};
750
751
752757static int adc1038_input_callback( device_t *device, int input )
753758{
754759   int value = 0;
r26235r26236
986991
987992   MCFG_K001604_ADD("k001604_1", gticlub_k001604_intf)
988993
989   MCFG_K056800_ADD("k056800", gticlub_k056800_interface, XTAL_64MHz/4)
994   MCFG_K056800_ADD("k056800", XTAL_33_8688MHz/2)
995   MCFG_K056800_INT_HANDLER(INPUTLINE("audiocpu", M68K_IRQ_2))
990996
991997   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
992998
r26235r26236
11031109   MCFG_K001604_ADD("k001604_1", hangplt_k001604_intf_l)
11041110   MCFG_K001604_ADD("k001604_2", hangplt_k001604_intf_r)
11051111
1106   MCFG_K056800_ADD("k056800", gticlub_k056800_interface, XTAL_64MHz/4)
1112   MCFG_K056800_ADD("k056800", XTAL_33_8688MHz/2)
1113   MCFG_K056800_INT_HANDLER(INPUTLINE("audiocpu", M68K_IRQ_2))
11071114
11081115   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
11091116
trunk/src/mame/drivers/qdrmfgp.c
r26235r26236
1010Other(GE557):Konami 056832,058141,058143
1111
1212TODO:
13- enabling irq acks breaks both games, why?
13- qdrmfgp2 requires an interrupt hack following an IDE READ_MULTIPLE
14  command
1415
1516--
1617driver by Eisuke Watanabe
r26235r26236
2930#include "includes/qdrmfgp.h"
3031
3132
33#define IDE_HACK   1
34
35
3236/*************************************
3337 *
3438 *  68k CPU memory handlers
3539 *
3640 *************************************/
3741
38CUSTOM_INPUT_MEMBER(qdrmfgp_state::inputs_r)
42READ16_MEMBER(qdrmfgp_state::inputs_r)
3943{
40   const char *tag1 = (const char *)param;
41   const char *tag2 = tag1 + strlen(tag1) + 1;
42   return ioport((m_control & 0x0080) ? tag1 : tag2)->read();
44   return m_control & 0x0080 ? m_inputs_port->read() : m_dsw_port->read();
4345}
4446
4547CUSTOM_INPUT_MEMBER(qdrmfgp_state::battery_sensor_r)
r26235r26236
6668   COMBINE_DATA(&m_control);
6769   m_pal = m_control & 0x70;
6870
71   if (!(m_control & 1))
72      m_maincpu->set_input_line(M68K_IRQ_1, CLEAR_LINE);
73
74   if (!(m_control & 2))
75      m_maincpu->set_input_line(M68K_IRQ_2, CLEAR_LINE);
76
77   if (!(m_control & 4))
78      m_maincpu->set_input_line(M68K_IRQ_3, CLEAR_LINE);
79
80   if (!(m_control & 8))
81      m_maincpu->set_input_line(M68K_IRQ_4, CLEAR_LINE);
82
6983   if (m_control & 0x0100)
7084   {
7185      int vol = m_nvram[0x10] & 0xff;
r26235r26236
95109   COMBINE_DATA(&m_control);
96110   m_pal = 0;
97111
112   if (!(m_control & 4))
113      m_maincpu->set_input_line(M68K_IRQ_3, CLEAR_LINE);
114
115   if (!(m_control & 8))
116      m_maincpu->set_input_line(M68K_IRQ_4, CLEAR_LINE);
117
118   if (!(m_control & 0x10))
119      m_maincpu->set_input_line(M68K_IRQ_5, CLEAR_LINE);
120
98121   if (m_control & 0x0100)
99122   {
100123      int vol = m_nvram[0x8] & 0xff;
r26235r26236
190213            if ((m_workram[0x5fa4/2] - space.device().state().state_int(M68K_D0)) <= 0x10)
191214               m_gp2_irq_control = 1;
192215            break;
216
193217         case 0xdec2:
194218            m_gp2_irq_control = 1;
195219         default:
196220            break;
197221      }
198222   }
199
200223   return m_ata->read_cs0(space, offset, mem_mask);
201224}
202225
r26235r26236
211234{
212235   int scanline = param;
213236
214   if(scanline == 0)
215      if (m_control & 0x0001)
216         m_maincpu->set_input_line(1, HOLD_LINE);
217
218237   /* trigger V-blank interrupt */
219238   if(scanline == 240)
220239      if (m_control & 0x0004)
221         m_maincpu->set_input_line(3, HOLD_LINE);
240         m_maincpu->set_input_line(M68K_IRQ_3, ASSERT_LINE);
222241}
223242
224243WRITE_LINE_MEMBER(qdrmfgp_state::ide_interrupt)
225244{
226245   if (m_control & 0x0008)
227   {
228246      if (state != CLEAR_LINE)
229         m_maincpu->set_input_line(4, HOLD_LINE);
230      else
231         m_maincpu->set_input_line(4, CLEAR_LINE);
232   }
247         m_maincpu->set_input_line(M68K_IRQ_4, ASSERT_LINE);
233248}
234249
235250/*************/
r26235r26236
237252TIMER_CALLBACK_MEMBER(qdrmfgp_state::gp2_timer_callback)
238253{
239254   if (m_control & 0x0004)
240      m_maincpu->set_input_line(3, HOLD_LINE);
255      m_maincpu->set_input_line(M68K_IRQ_3, ASSERT_LINE);
241256}
242257
243258INTERRUPT_GEN_MEMBER(qdrmfgp_state::qdrmfgp2_interrupt)
244259{
245260   /* trigger V-blank interrupt */
246261   if (m_control & 0x0008)
247      device.execute().set_input_line(4, HOLD_LINE);
262      device.execute().set_input_line(M68K_IRQ_4, ASSERT_LINE);
248263}
249264
250265WRITE_LINE_MEMBER(qdrmfgp_state::gp2_ide_interrupt)
251266{
267#if IDE_HACK
252268   if (m_control & 0x0010)
253269   {
254270      if (state != CLEAR_LINE)
255271      {
256272         if (m_gp2_irq_control)
273         {
257274            m_gp2_irq_control = 0;
275         }
258276         else
259            m_maincpu->set_input_line(5, HOLD_LINE);
277         {
278            m_maincpu->set_input_line(M68K_IRQ_5, ASSERT_LINE);
279         }
260280      }
261281      else
262282      {
263283         m_maincpu->set_input_line(5, CLEAR_LINE);
264284      }
265285   }
286#else
287   if (m_control & 0x0010)
288      if (state != CLEAR_LINE)
289         m_maincpu->set_input_line(M68K_IRQ_5, ASSERT_LINE);
290#endif
266291}
267292
268293
r26235r26236
280305   AM_RANGE(0x300000, 0x30003f) AM_DEVWRITE("k056832", k056832_device, word_w)                                      /* video reg */
281306   AM_RANGE(0x320000, 0x32001f) AM_DEVREADWRITE8("k053252", k053252_device, read, write, 0x00ff)                    /* ccu */
282307   AM_RANGE(0x330000, 0x330001) AM_READ_PORT("SENSOR")                                         /* battery power & service sw */
283   AM_RANGE(0x340000, 0x340001) AM_READ_PORT("340000")                                         /* inputport */
308   AM_RANGE(0x340000, 0x340001) AM_READ(inputs_r)                                              /* inputport */
284309   AM_RANGE(0x350000, 0x350001) AM_WRITENOP                                                    /* unknown */
285310   AM_RANGE(0x360000, 0x360001) AM_WRITENOP                                                    /* unknown */
286311   AM_RANGE(0x370000, 0x370001) AM_WRITE(gp_control_w)                                         /* control reg */
r26235r26236
303328   AM_RANGE(0x300000, 0x30003f) AM_DEVWRITE("k056832", k056832_device, word_w)                                      /* video reg */
304329   AM_RANGE(0x320000, 0x32001f) AM_DEVREADWRITE8("k053252", k053252_device, read, write, 0xff00)                    /* ccu */
305330   AM_RANGE(0x330000, 0x330001) AM_READ_PORT("SENSOR")                                         /* battery power & service */
306   AM_RANGE(0x340000, 0x340001) AM_READ_PORT("340000")                                         /* inputport */
331   AM_RANGE(0x340000, 0x340001) AM_READ(inputs_r)                                              /* inputport */
307332   AM_RANGE(0x350000, 0x350001) AM_WRITENOP                                                    /* unknown */
308333   AM_RANGE(0x360000, 0x360001) AM_WRITENOP                                                    /* unknown */
309334   AM_RANGE(0x370000, 0x370001) AM_WRITE(gp2_control_w)                                        /* control reg */
r26235r26236
312337   AM_RANGE(0x880000, 0x881fff) AM_READWRITE(gp2_vram_r, gp2_vram_w)                           /* vram */
313338   AM_RANGE(0x89f000, 0x8a0fff) AM_READWRITE(gp2_vram_mirror_r, gp2_vram_mirror_w)             /* vram (mirror) */
314339   AM_RANGE(0x900000, 0x901fff) AM_READ(v_rom_r)                                               /* gfxrom through */
340#if IDE_HACK
315341   AM_RANGE(0xa00000, 0xa0000f) AM_READ(gp2_ide_std_r) AM_DEVWRITE("ata", ata_interface_device, write_cs0) /* IDE control regs */
342#else
343   AM_RANGE(0xa00000, 0xa0000f) AM_DEVREADWRITE("ata", ata_interface_device, read_cs0, write_cs0) /* IDE control regs */
344#endif
316345   AM_RANGE(0xa40000, 0xa4000f) AM_DEVREADWRITE("ata", ata_interface_device, read_cs1, write_cs1) /* IDE status control reg */
317346   AM_RANGE(0xc00000, 0xcbffff) AM_READWRITE(sndram_r,sndram_w)                                /* sound ram */
318347ADDRESS_MAP_END
r26235r26236
325354 *************************************/
326355
327356static INPUT_PORTS_START( qdrmfgp )
328   PORT_START("340000")
329   PORT_BIT( 0xffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, qdrmfgp_state,inputs_r, "INPUTS\0DSW")
330
331357   PORT_START("INPUTS")
332358   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
333359   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START2 )
r26235r26236
408434INPUT_PORTS_END
409435
410436static INPUT_PORTS_START( qdrmfgp2 )
411   PORT_START("340000")
412   PORT_BIT( 0xffff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, qdrmfgp_state,inputs_r, "INPUTS\0DSW")
413
414437   PORT_START("INPUTS")
415438   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
416439   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START2 )
r26235r26236
493516
494517/*************************************
495518 *
496 *  Graphics layouts
519 *  Sound interfaces
497520 *
498521 *************************************/
499522
523int m_sound_intck;
500524
501/*************************************
502 *
503 *  Sound interfaces
504 *
505 *************************************/
525WRITE_LINE_MEMBER(qdrmfgp_state::k054539_irq1_gen)
526{
527   if (m_control & 1)
528   {
529      // Trigger an interrupt on the rising edge
530      if (!m_sound_intck && state)
531         m_maincpu->set_input_line(M68K_IRQ_1, ASSERT_LINE);
532   }
506533
507static void sound_irq(device_t *device)
508{
509   qdrmfgp_state *state = device->machine().driver_data<qdrmfgp_state>();
510   if (state->m_control & 0x0001)
511      state->m_maincpu->set_input_line(1, HOLD_LINE);
534   m_sound_intck = state;
512535}
513536
514537static const k054539_interface k054539_config =
515538{
516539   NULL,
517540   NULL,
518   sound_irq
519541};
520542
521543
r26235r26236
543565   qdrmfgp2_tile_callback, "none"
544566};
545567
546WRITE_LINE_MEMBER(qdrmfgp_state::qdrmfgp_irq3_ack_w)
547{
548//  m_maincpu->set_input_line(M68K_IRQ_3, CLEAR_LINE);
549}
550
551WRITE_LINE_MEMBER(qdrmfgp_state::qdrmfgp_irq4_ack_w)
552{
553//  m_maincpu->set_input_line(M68K_IRQ_4, CLEAR_LINE);
554}
555
556568static const k053252_interface qdrmfgp_k053252_intf =
557569{
558570   DEVCB_NULL,
559571   DEVCB_NULL,
560   DEVCB_DRIVER_LINE_MEMBER(qdrmfgp_state,qdrmfgp_irq3_ack_w),
561572   DEVCB_NULL,
573   DEVCB_NULL,
562574   40, 16
563575};
564576
r26235r26236
566578{
567579   DEVCB_NULL,
568580   DEVCB_NULL,
569   DEVCB_DRIVER_LINE_MEMBER(qdrmfgp_state,qdrmfgp_irq4_ack_w),
570   DEVCB_DRIVER_LINE_MEMBER(qdrmfgp_state,qdrmfgp_irq3_ack_w),
581   DEVCB_NULL,
582   DEVCB_NULL,
571583   40, 16
572584};
573585
r26235r26236
581593MACHINE_START_MEMBER(qdrmfgp_state,qdrmfgp2)
582594{
583595   /* sound irq (CCU? 240Hz) */
584   machine().scheduler().timer_pulse(attotime::from_hz(18432000/76800), timer_expired_delegate(FUNC(qdrmfgp_state::gp2_timer_callback),this));
596   machine().scheduler().timer_pulse(attotime::from_hz(XTAL_18_432MHz/76800), timer_expired_delegate(FUNC(qdrmfgp_state::gp2_timer_callback),this));
585597
586598   MACHINE_START_CALL_MEMBER( qdrmfgp );
587599}
r26235r26236
603615static MACHINE_CONFIG_START( qdrmfgp, qdrmfgp_state )
604616
605617   /* basic machine hardware */
606   MCFG_CPU_ADD("maincpu", M68000, 32000000/2) /*  16.000 MHz */
618   MCFG_CPU_ADD("maincpu", M68000, XTAL_32MHz/2) /*  16.000 MHz */
607619   MCFG_CPU_PROGRAM_MAP(qdrmfgp_map)
608620   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", qdrmfgp_state, qdrmfgp_interrupt, "screen", 0, 1)
609621
r26235r26236
626638   MCFG_VIDEO_START_OVERRIDE(qdrmfgp_state,qdrmfgp)
627639
628640   MCFG_K056832_ADD("k056832", qdrmfgp_k056832_intf)
629   MCFG_K053252_ADD("k053252", 32000000/4, qdrmfgp_k053252_intf)
641   MCFG_K053252_ADD("k053252", XTAL_32MHz/4, qdrmfgp_k053252_intf)
630642
631643   /* sound hardware */
632644   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
633645
634   MCFG_K054539_ADD("k054539", 48000, k054539_config)
646   MCFG_K054539_ADD("k054539", XTAL_18_432MHz, k054539_config)
647   MCFG_K054539_TIMER_HANDLER(WRITELINE(qdrmfgp_state, k054539_irq1_gen))
635648   MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
636649   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
637650MACHINE_CONFIG_END
r26235r26236
639652static MACHINE_CONFIG_START( qdrmfgp2, qdrmfgp_state )
640653
641654   /* basic machine hardware */
642   MCFG_CPU_ADD("maincpu", M68000, 32000000/2) /*  16.000 MHz */
655   MCFG_CPU_ADD("maincpu", M68000, XTAL_32MHz/2) /*  16.000 MHz */
643656   MCFG_CPU_PROGRAM_MAP(qdrmfgp2_map)
644657   MCFG_CPU_VBLANK_INT_DRIVER("screen", qdrmfgp_state,  qdrmfgp2_interrupt)
645658
r26235r26236
662675   MCFG_VIDEO_START_OVERRIDE(qdrmfgp_state,qdrmfgp2)
663676
664677   MCFG_K056832_ADD("k056832", qdrmfgp2_k056832_intf)
665   MCFG_K053252_ADD("k053252", 32000000/4, qdrmfgp2_k053252_intf)
678   MCFG_K053252_ADD("k053252", XTAL_32MHz/4, qdrmfgp2_k053252_intf)
666679
667680   /* sound hardware */
668681   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
669682
670   MCFG_K054539_ADD("k054539", 48000, k054539_config)
683   MCFG_K054539_ADD("k054539", XTAL_18_432MHz, k054539_config)
671684   MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
672685   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
673686MACHINE_CONFIG_END
trunk/src/mame/drivers/hornet.c
r26235r26236
343343      m_k037122_2(*this, "k037122_2" ),
344344      m_adc12138(*this, "adc12138") { }
345345
346   UINT8 m_led_reg0;
347   UINT8 m_led_reg1;
346   // TODO: Needs verification on real hardware
347   static const int m_sound_timer_usec = 2800;
348
348349   required_shared_ptr<UINT32> m_workram;
349350   required_shared_ptr<UINT32> m_sharc_dataram0;
350351   optional_shared_ptr<UINT32> m_sharc_dataram1;
r26235r26236
358359   optional_device<k037122_device> m_k037122_1;
359360   optional_device<k037122_device> m_k037122_2;
360361   required_device<adc12138_device> m_adc12138;
362
363   emu_timer *m_sound_irq_timer;
364   UINT8 m_led_reg0;
365   UINT8 m_led_reg1;
361366   UINT8 *m_jvs_sdata;
362367   UINT32 m_jvs_sdata_ptr;
363   emu_timer *m_sound_irq_timer;
364368   UINT16 m_gn680_latch;
365369   UINT16 m_gn680_ret0;
366370   UINT16 m_gn680_ret1;
371
367372   DECLARE_READ32_MEMBER(hornet_k037122_sram_r);
368373   DECLARE_WRITE32_MEMBER(hornet_k037122_sram_w);
369374   DECLARE_READ32_MEMBER(hornet_k037122_char_r);
r26235r26236
386391   DECLARE_WRITE32_MEMBER(dsp_dataram1_w);
387392   DECLARE_WRITE_LINE_MEMBER(voodoo_vblank_0);
388393   DECLARE_WRITE_LINE_MEMBER(voodoo_vblank_1);
394   DECLARE_WRITE16_MEMBER(soundtimer_en_w);
395   DECLARE_WRITE16_MEMBER(soundtimer_count_w);
396   
389397   DECLARE_DRIVER_INIT(hornet);
390398   DECLARE_DRIVER_INIT(hornet_2board);
391399   virtual void machine_start();
r26235r26236
393401   DECLARE_MACHINE_RESET(hornet_2board);
394402   UINT32 screen_update_hornet(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
395403   UINT32 screen_update_hornet_2board(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
396   TIMER_CALLBACK_MEMBER(irq_off);
404   TIMER_CALLBACK_MEMBER(sound_irq);
397405   int jvs_encode_data(UINT8 *in, int length);
398406   int jvs_decode_data(UINT8 *in, UINT8 *out, int length);
399407   void jamma_jvs_cmd_exec();
r26235r26236
646654   }
647655}
648656
657/******************************************************************/
658
659TIMER_CALLBACK_MEMBER(hornet_state::sound_irq)
660{
661   m_audiocpu->set_input_line(M68K_IRQ_1, ASSERT_LINE);
662}
663
664
665WRITE16_MEMBER(hornet_state::soundtimer_en_w)
666{
667   if (data & 1)
668   {
669      // Reset and disable timer
670      m_sound_irq_timer->adjust(attotime::from_usec(m_sound_timer_usec));
671      m_sound_irq_timer->enable(false);
672   }
673   else
674   {
675      // Enable timer
676      m_sound_irq_timer->enable(true);
677   }
678}
679
680WRITE16_MEMBER(hornet_state::soundtimer_count_w)
681{
682   // Reset the count
683   m_sound_irq_timer->adjust(attotime::from_usec(m_sound_timer_usec));
684   m_audiocpu->set_input_line(M68K_IRQ_1, CLEAR_LINE);
685}
686
649687/*****************************************************************************/
650688
651689static ADDRESS_MAP_START( hornet_map, AS_PROGRAM, 32, hornet_state )
r26235r26236
659697   AM_RANGE(0x7d000000, 0x7d00ffff) AM_READ8(sysreg_r, 0xffffffff)
660698   AM_RANGE(0x7d010000, 0x7d01ffff) AM_WRITE8(sysreg_w, 0xffffffff)
661699   AM_RANGE(0x7d020000, 0x7d021fff) AM_DEVREADWRITE8("m48t58", timekeeper_device, read, write, 0xffffffff)  /* M48T58Y RTC/NVRAM */
662   AM_RANGE(0x7d030000, 0x7d030007) AM_DEVREADWRITE("k056800", k056800_device, host_r, host_w)
700   AM_RANGE(0x7d030000, 0x7d03000f) AM_DEVREADWRITE8("k056800", k056800_device, host_r, host_w, 0xffffffff)
663701   AM_RANGE(0x7d042000, 0x7d043fff) AM_RAM             /* COMM BOARD 0 */
664702   AM_RANGE(0x7d044000, 0x7d044007) AM_READ(comm0_unk_r)
665703   AM_RANGE(0x7d048000, 0x7d048003) AM_WRITE(comm1_w)
r26235r26236
676714   AM_RANGE(0x000000, 0x07ffff) AM_ROM
677715   AM_RANGE(0x100000, 0x10ffff) AM_RAM     /* Work RAM */
678716   AM_RANGE(0x200000, 0x200fff) AM_DEVREADWRITE("rfsnd", rf5c400_device, rf5c400_r, rf5c400_w)      /* Ricoh RF5C400 */
679   AM_RANGE(0x300000, 0x30000f) AM_DEVREADWRITE("k056800", k056800_device, sound_r, sound_w)
717   AM_RANGE(0x300000, 0x30001f) AM_DEVREADWRITE8("k056800", k056800_device, sound_r, sound_w, 0x00ff)
680718   AM_RANGE(0x480000, 0x480001) AM_WRITENOP
681719   AM_RANGE(0x4c0000, 0x4c0001) AM_WRITENOP
682   AM_RANGE(0x500000, 0x500001) AM_WRITENOP
683   AM_RANGE(0x600000, 0x600001) AM_NOP
720   AM_RANGE(0x500000, 0x500001) AM_WRITE(soundtimer_en_w) AM_READNOP
721   AM_RANGE(0x600000, 0x600001) AM_WRITE(soundtimer_count_w) AM_READNOP
684722ADDRESS_MAP_END
685723
686724/*****************************************************************************/
r26235r26236
879917   save_pointer(NAME(m_jvs_sdata), 1024);
880918   save_item(NAME(m_jvs_sdata_ptr));
881919
882   m_sound_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(hornet_state::irq_off),this));
920   m_sound_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(hornet_state::sound_irq), this));
883921}
884922
885923void hornet_state::machine_reset()
r26235r26236
914952   adc12138_input_callback
915953};
916954
917TIMER_CALLBACK_MEMBER(hornet_state::irq_off)
918{
919   m_audiocpu->set_input_line(param, CLEAR_LINE);
920}
921
922static void sound_irq_callback( running_machine &machine, int irq )
923{
924   hornet_state *state = machine.driver_data<hornet_state>();
925   int line = (irq == 0) ? INPUT_LINE_IRQ1 : INPUT_LINE_IRQ2;
926
927   state->m_audiocpu->set_input_line(line, ASSERT_LINE);
928   state->m_sound_irq_timer->adjust(attotime::from_usec(5), line);
929}
930
931static const k056800_interface hornet_k056800_interface =
932{
933   sound_irq_callback
934};
935
936955static const k033906_interface hornet_k033906_intf_0 =
937956{
938957   "voodoo0"
r26235r26236
9881007
9891008   MCFG_K037122_ADD("k037122_1", "screen", 0)
9901009
991   MCFG_K056800_ADD("k056800", hornet_k056800_interface, XTAL_64MHz/4)
1010   MCFG_K056800_ADD("k056800", XTAL_16_9344MHz)
1011   MCFG_K056800_INT_HANDLER(INPUTLINE("audiocpu", M68K_IRQ_2))
9921012
9931013   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
9941014
trunk/src/mame/drivers/plygonet.c
r26235r26236
9090          D25 = EEPROM CS
9191          D24 = EEPROM DATA
9292      */
93         m_eeprom->di_write(data & 1);
94         m_eeprom->cs_write((data & 2) ? ASSERT_LINE : CLEAR_LINE);
95         m_eeprom->clk_write((data & 4) ? ASSERT_LINE : CLEAR_LINE);
93         ioport("EEPROMOUT")->write(data, 0xffff);
9694
9795         m_sys0 = data;
9896         break;
r26235r26236
187185
188186WRITE32_MEMBER(polygonet_state::sound_irq_w)
189187{
190   m_audiocpu->set_input_line(0, HOLD_LINE); // where is ack?
188   // Auto-acknowledged interrupt
189   m_audiocpu->set_input_line(0, HOLD_LINE);
191190}
192191
193192/* DSP communications */
r26235r26236
543542/**********************************************************************************/
544543
545544
546WRITE8_MEMBER(polygonet_state::sound_bankswitch_w)
545WRITE8_MEMBER(polygonet_state::sound_ctrl_w)
547546{
548   // d0-d2: bank
549   // higher bits: ? (only used in plygonet)
550   if ((m_sound_bank & 7) != (data & 7))
547   // .... .xxx - Sound bank
548   // ...x .... - NMI clear (clocked?)
549   
550   if ((m_sound_ctrl & 7) != (data & 7))
551551      membank("bank1")->set_entry(data & 7);
552552
553   m_sound_bank = data;
553   // This behaves differently to the other games of this era
554   if (!(m_sound_ctrl & 0x10) && (data & 0x10))
555      m_audiocpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
556
557   m_sound_ctrl = data;
554558}
555559
556560
r26235r26236
561565   AM_RANGE(0xc000, 0xdfff) AM_RAM
562566   AM_RANGE(0xe000, 0xe22f) AM_DEVREADWRITE("k054539_1", k054539_device, read, write)
563567   AM_RANGE(0xe230, 0xe3ff) AM_RAM
564   AM_RANGE(0xe400, 0xe62f) AM_DEVREADWRITE("k054539_2", k054539_device, read, write)
568   AM_RANGE(0xe400, 0xe62f) AM_READNOP AM_WRITENOP // Second 054539 (not present)
565569   AM_RANGE(0xe630, 0xe7ff) AM_RAM
566570   AM_RANGE(0xf000, 0xf000) AM_WRITE(soundlatch_byte_w)
567571   AM_RANGE(0xf002, 0xf002) AM_READ(soundlatch2_byte_r)
568572   AM_RANGE(0xf003, 0xf003) AM_READ(soundlatch3_byte_r)
569   AM_RANGE(0xf800, 0xf800) AM_WRITE(sound_bankswitch_w)
573   AM_RANGE(0xf800, 0xf800) AM_WRITE(sound_ctrl_w)
570574ADDRESS_MAP_END
571575
572576
573static void sound_nmi( device_t *device )
574{
575   polygonet_state *state = device->machine().driver_data<polygonet_state>();
576   state->m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); // where is ack?
577}
578
579
580577static const k054539_interface k054539_config =
581578{
582579   "shared",
583580   NULL,
584   sound_nmi
585581};
586582
587583/**********************************************************************************/
r26235r26236
607603void polygonet_state::machine_reset()
608604{
609605   membank("bank1")->set_entry(0);
610   m_sound_bank = 0;
611606
612607   m_sys0 = 0;
613608   m_sys1 = 0;
609   m_sound_intck = 0;
610   m_sound_ctrl = 0;
614611
615612   /* It's presumed the hardware has hard-wired operating mode 1 (MODA = 1, MODB = 0) */
616613   m_dsp->set_input_line(DSP56K_IRQ_RESET, ASSERT_LINE);
r26235r26236
633630   save_item(NAME(m_dsp56k_bank04_ram));
634631   save_item(NAME(m_sys0));
635632   save_item(NAME(m_sys1));
636   save_item(NAME(m_sound_bank));
633   save_item(NAME(m_sound_ctrl));
634   save_item(NAME(m_sound_intck));
637635}
638636
637WRITE_LINE_MEMBER(polygonet_state::k054539_nmi_gen)
638{
639   // Trigger interrupt on rising clock edge
640   if (!m_sound_intck && state)
641      m_audiocpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
642
643   m_sound_intck = state;
644}
645
646
639647static const k053936_interface polygonet_k053936_intf =
640648{
641649   0, 0, 0 /* wrap, xoff, yoff */
r26235r26236
656664
657665   MCFG_QUANTUM_PERFECT_CPU("maincpu") /* TODO: TEMPORARY!  UNTIL A MORE LOCALIZED SYNC CAN BE MADE */
658666
659   MCFG_EEPROM_SERIAL_93C66_8BIT_ADD("eeprom")
667   MCFG_EEPROM_SERIAL_ER5911_8BIT_ADD("eeprom")
660668
661669   MCFG_GFXDECODE(plygonet)
662670
r26235r26236
675683   /* sound hardware */
676684   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
677685
678   MCFG_K054539_ADD("k054539_1", 48000, k054539_config)
686   MCFG_K054539_ADD("k054539_1", XTAL_18_432MHz, k054539_config)
687   MCFG_K054539_TIMER_HANDLER(WRITELINE(polygonet_state, k054539_nmi_gen))
679688   MCFG_SOUND_ROUTE(0, "lspeaker", 0.75)
680689   MCFG_SOUND_ROUTE(1, "rspeaker", 0.75)
681
682   MCFG_K054539_ADD("k054539_2", 48000, k054539_config)
683   MCFG_SOUND_ROUTE(0, "lspeaker", 0.75)
684   MCFG_SOUND_ROUTE(1, "rspeaker", 0.75)
685690MACHINE_CONFIG_END
686691
687692
r26235r26236
711716   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
712717
713718   PORT_START("IN2")
714   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, do_read)
715   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_TILT )
719   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_er5911_device, do_read)
720   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_er5911_device, ready_read)
716721   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )
717722   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) // Start 2, unused
718723   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
r26235r26236
729734   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
730735   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
731736   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
737
738   PORT_START( "EEPROMOUT" )
739   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_er5911_device, di_write)
740   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_er5911_device, cs_write)
741   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_er5911_device, clk_write)
732742INPUT_PORTS_END
733743
734744static INPUT_PORTS_START( polynetw )
r26235r26236
781791   ROM_REGION( 0x200000, "shared", 0 ) /* sound data */
782792   ROM_LOAD( "305b08.2e", 0x000000, 0x200000, CRC(874607df) SHA1(763b44a80abfbc355bcb9be8bf44373254976019) )
783793
784   ROM_REGION16_BE( 0x200, "eeprom", ROMREGION_ERASEFF )
794   ROM_REGION( 0x80, "eeprom", ROMREGION_ERASEFF )
785795   ROM_LOAD( "plygonet.nv", 0x0000, 0x0080, CRC(627748ac) SHA1(ea1b06739fee235b049ff8daffff7d43cb093112) )
786796ROM_END
787797
r26235r26236
805815   ROM_LOAD( "305a08.2e", 0x000000, 0x200000, CRC(7ddb8a52) SHA1(3199b347fc433ffe0de8521001df77672d40771e) )
806816   ROM_LOAD( "305a09.3e", 0x200000, 0x200000, CRC(6da1be58) SHA1(d63ac16ac551193ff8a6036724fb59e1d702e06b) )
807817
808   ROM_REGION16_BE( 0x200, "eeprom", ROMREGION_ERASEFF )
818   ROM_REGION( 0x80, "eeprom", ROMREGION_ERASEFF )
809819   ROM_LOAD( "polynetw.nv", 0x0000, 0x0080, CRC(8f39d644) SHA1(8733e1a288ba20c4b04b3aedde52801d05cebdf9) )
810820ROM_END
811821
trunk/src/mame/includes/rungun.h
r26235r26236
1414public:
1515   rungun_state(const machine_config &mconfig, device_type type, const char *tag)
1616      : driver_device(mconfig, type, tag),
17      m_sysreg(*this, "sysreg"),
18      m_936_videoram(*this, "936_videoram"),
1917      m_maincpu(*this, "maincpu"),
2018      m_soundcpu(*this, "soundcpu"),
2119      m_k054539_1(*this, "k054539_1"),
2220      m_k054539_2(*this, "k054539_2"),
2321      m_k053936(*this, "k053936"),
2422      m_k055673(*this, "k055673"),
25      m_k053252(*this, "k053252") { }
23      m_k053252(*this, "k053252"),
24      m_sysreg(*this, "sysreg"),
25      m_936_videoram(*this, "936_videoram") { }
2626
27   /* devices */
28   required_device<cpu_device> m_maincpu;
29   required_device<cpu_device> m_soundcpu;
30   required_device<k054539_device> m_k054539_1;
31   required_device<k054539_device> m_k054539_2;
32   required_device<k053936_device> m_k053936;
33   required_device<k055673_device> m_k055673;
34   required_device<k053252_device> m_k053252;
35
2736   /* memory pointers */
2837   required_shared_ptr<UINT16> m_sysreg;
2938   required_shared_ptr<UINT16> m_936_videoram;
r26235r26236
3645   int         m_ttl_gfx_index;
3746   int         m_sprite_colorbase;
3847
39   /* misc */
40   int         m_z80_control;
41   int         m_sound_status;
48   /* sound */
49   UINT8      m_sound_ctrl;
50   UINT8      m_sound_status;
51   UINT8      m_sound_nmi_clk;
4252
43   /* devices */
44   required_device<cpu_device> m_maincpu;
45   required_device<cpu_device> m_soundcpu;
46   required_device<k054539_device> m_k054539_1;
47   required_device<k054539_device> m_k054539_2;
48   required_device<k053936_device> m_k053936;
49   required_device<k055673_device> m_k055673;
50   required_device<k053252_device> m_k053252;
5153   DECLARE_READ16_MEMBER(rng_sysregs_r);
5254   DECLARE_WRITE16_MEMBER(rng_sysregs_w);
5355   DECLARE_WRITE16_MEMBER(sound_cmd1_w);
r26235r26236
5557   DECLARE_WRITE16_MEMBER(sound_irq_w);
5658   DECLARE_READ16_MEMBER(sound_status_msb_r);
5759   DECLARE_WRITE8_MEMBER(sound_status_w);
58   DECLARE_WRITE8_MEMBER(z80ctrl_w);
60   DECLARE_WRITE8_MEMBER(sound_ctrl_w);
5961   DECLARE_READ16_MEMBER(rng_ttl_ram_r);
6062   DECLARE_WRITE16_MEMBER(rng_ttl_ram_w);
6163   DECLARE_WRITE16_MEMBER(rng_936_videoram_w);
6264   TILE_GET_INFO_MEMBER(ttl_get_tile_info);
6365   TILE_GET_INFO_MEMBER(get_rng_936_tile_info);
66   DECLARE_WRITE_LINE_MEMBER(k054539_nmi_gen);
67
6468   virtual void machine_start();
6569   virtual void machine_reset();
6670   virtual void video_start();
trunk/src/mame/includes/qdrmfgp.h
r26235r26236
1515      m_k056832(*this, "k056832"),
1616      m_k054539(*this, "k054539"),
1717      m_k053252(*this, "k053252"),
18      m_ata(*this, "ata")
18      m_ata(*this, "ata"),
19      m_inputs_port(*this, "INPUTS"),
20      m_dsw_port(*this, "DSW")
1921   {
2022   }
2123
2224   required_device<cpu_device> m_maincpu;
2325   required_shared_ptr<UINT16> m_nvram;
24   UINT8 *m_sndram;
2526   required_shared_ptr<UINT16> m_workram;
2627   required_device<k056832_device> m_k056832;
2728   required_device<k054539_device> m_k054539;
2829   required_device<k053252_device> m_k053252;
2930   required_device<ata_interface_device> m_ata;
31   required_ioport m_inputs_port;
32   required_ioport m_dsw_port;
33
34   UINT8 *m_sndram;
3035   UINT16 m_control;
3136   INT32 m_gp2_irq_control;
3237   INT32 m_pal;
38
3339   DECLARE_WRITE16_MEMBER(gp_control_w);
3440   DECLARE_WRITE16_MEMBER(gp2_control_w);
3541   DECLARE_READ16_MEMBER(v_rom_r);
r26235r26236
4046   DECLARE_READ16_MEMBER(sndram_r);
4147   DECLARE_WRITE16_MEMBER(sndram_w);
4248   DECLARE_READ16_MEMBER(gp2_ide_std_r);
43   DECLARE_CUSTOM_INPUT_MEMBER(inputs_r);
49   DECLARE_READ16_MEMBER(inputs_r);
4450   DECLARE_CUSTOM_INPUT_MEMBER(battery_sensor_r);
45   DECLARE_WRITE_LINE_MEMBER(qdrmfgp_irq3_ack_w);
46   DECLARE_WRITE_LINE_MEMBER(qdrmfgp_irq4_ack_w);
51
4752   virtual void machine_reset();
53
4854   DECLARE_MACHINE_START(qdrmfgp);
4955   DECLARE_VIDEO_START(qdrmfgp);
5056   DECLARE_MACHINE_START(qdrmfgp2);
r26235r26236
5561   TIMER_DEVICE_CALLBACK_MEMBER(qdrmfgp_interrupt);
5662   DECLARE_WRITE_LINE_MEMBER(ide_interrupt);
5763   DECLARE_WRITE_LINE_MEMBER(gp2_ide_interrupt);
64   DECLARE_WRITE_LINE_MEMBER(k054539_irq1_gen);
5865};
5966
6067/*----------- defined in video/qdrmfgp.c -----------*/
trunk/src/mame/includes/plygonet.h
r26235r26236
2626   required_device<cpu_device> m_maincpu;
2727   required_device<cpu_device> m_audiocpu;
2828   required_device<cpu_device> m_dsp;
29   required_device<eeprom_serial_93cxx_device> m_eeprom;
29   required_device<eeprom_serial_er5911_device> m_eeprom;
3030   required_device<k053936_device> m_k053936;
3131
3232   /* 68k-side shared ram */
r26235r26236
3737   ioport_port *m_inputs[4];
3838   UINT8 m_sys0;
3939   UINT8 m_sys1;
40   UINT8 m_sound_bank;
4140
4241   direct_update_delegate m_dsp56k_update_handler;
4342
r26235r26236
4746   tilemap_t *m_roz_tilemap;
4847   UINT16 m_ttl_vram[0x800];
4948   UINT16 m_roz_vram[0x800];
49   
50   /* sound */
51   UINT8 m_sound_ctrl;   
52   UINT8 m_sound_intck;
5053
5154   /* memory buffers */
5255   UINT16 m_dsp56k_bank00_ram[2 * 8 * dsp56k_bank00_size]; /* 2 bank sets, 8 potential banks each */
r26235r26236
7780   DECLARE_WRITE16_MEMBER(dsp56k_shared_ram_write);
7881   DECLARE_READ16_MEMBER(dsp56k_ram_bank04_read);
7982   DECLARE_WRITE16_MEMBER(dsp56k_ram_bank04_write);
80   DECLARE_WRITE8_MEMBER(sound_bankswitch_w);
83   DECLARE_WRITE8_MEMBER(sound_ctrl_w);
8184   DECLARE_READ32_MEMBER(polygonet_ttl_ram_r);
8285   DECLARE_WRITE32_MEMBER(polygonet_ttl_ram_w);
8386   DECLARE_READ32_MEMBER(polygonet_roz_ram_r);
r26235r26236
9396   virtual void video_start();
9497   UINT32 screen_update_polygonet(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
9598   INTERRUPT_GEN_MEMBER(polygonet_interrupt);
99   DECLARE_WRITE_LINE_MEMBER(k054539_nmi_gen);
96100};
trunk/src/mame/includes/mystwarr.h
r26235r26236
2323   required_device<k055673_device> m_k055673;
2424   required_shared_ptr<UINT16> m_gx_workram;
2525   optional_shared_ptr<UINT16> m_spriteram;
26
2627   UINT8 m_mw_irq_control;
2728   int m_cur_sound_region;
2829   int m_layer_colorbase[6];
r26235r26236
3738   tilemap_t *m_ult_936_tilemap;
3839   UINT16 m_clip;
3940
41   UINT8 m_sound_ctrl;
42   UINT8 m_sound_nmi_clk;
43
4044   DECLARE_READ16_MEMBER(eeprom_r);
4145   DECLARE_WRITE16_MEMBER(mweeprom_w);
4246   DECLARE_READ16_MEMBER(dddeeprom_r);
r26235r26236
5559   DECLARE_WRITE16_MEMBER(k053247_martchmp_word_w);
5660   DECLARE_READ16_MEMBER(mccontrol_r);
5761   DECLARE_WRITE16_MEMBER(mccontrol_w);
58   DECLARE_WRITE8_MEMBER(sound_bankswitch_w);
62   DECLARE_WRITE8_MEMBER(sound_ctrl_w);
5963
6064   DECLARE_WRITE16_MEMBER(ddd_053936_enable_w);
6165   DECLARE_WRITE16_MEMBER(ddd_053936_clip_w);
r26235r26236
8488   UINT32 screen_update_dadandrn(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
8589   UINT32 screen_update_martchmp(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
8690   INTERRUPT_GEN_MEMBER(ddd_interrupt);
91   DECLARE_WRITE_LINE_MEMBER(k054539_nmi_gen);
8792   TIMER_DEVICE_CALLBACK_MEMBER(mystwarr_interrupt);
8893   TIMER_DEVICE_CALLBACK_MEMBER(metamrph_interrupt);
8994   TIMER_DEVICE_CALLBACK_MEMBER(mchamp_interrupt);
trunk/src/mame/includes/konamigx.h
r26235r26236
1#include "sound/k056800.h"
12#include "sound/k054539.h"
23#include "cpu/tms57002/tms57002.h"
34#include "video/k054156_k054157_k056832.h"
r26235r26236
1213   konamigx_state(const machine_config &mconfig, device_type type, const char *tag)
1314      : driver_device(mconfig, type, tag),
1415      m_maincpu(*this,"maincpu"),
16      m_soundcpu(*this, "soundcpu"),
17      m_dasp(*this, "dasp"),
1518      m_workram(*this,"workram"),
1619      m_psacram(*this,"psacram"),
1720      m_subpaletteram32(*this,"subpaletteram"),
r26235r26236
2326      m_k053936_0_ctrl_16(*this,"k053936_0_ct16",16),
2427      m_k053936_0_linectrl_16(*this,"k053936_0_li16",16),
2528      m_konamigx_type3_psac2_bank(*this,"psac2_bank"),
29      m_k056800(*this, "k056800"),
2630      m_k054539_1(*this,"k054539_1"),
27      m_k054539_2(*this,"k054539_2"),
28      m_soundcpu(*this, "soundcpu"),
29      m_dasp(*this, "dasp")
31      m_k054539_2(*this,"k054539_2")
3032      { }
3133
3234   required_device<cpu_device> m_maincpu;
35   optional_device<cpu_device> m_soundcpu;
36   optional_device<tms57002_device> m_dasp;
37
3338   optional_shared_ptr<UINT32> m_workram;
3439   optional_shared_ptr<UINT32> m_psacram;
3540   optional_shared_ptr<UINT32> m_subpaletteram32;
r26235r26236
4146   optional_shared_ptr<UINT16> m_k053936_0_ctrl_16;
4247   optional_shared_ptr<UINT16> m_k053936_0_linectrl_16;
4348   optional_shared_ptr<UINT32> m_konamigx_type3_psac2_bank;
49   optional_device<k056800_device> m_k056800;
4450   optional_device<k054539_device> m_k054539_1;
4551   optional_device<k054539_device> m_k054539_2;
52
4653   DECLARE_WRITE32_MEMBER(esc_w);
4754   DECLARE_WRITE32_MEMBER(eeprom_w);
4855   DECLARE_WRITE32_MEMBER(control_w);
r26235r26236
6067   DECLARE_READ32_MEMBER(type3_sync_r);
6168   DECLARE_WRITE32_MEMBER(type4_prot_w);
6269   DECLARE_WRITE32_MEMBER(type1_cablamps_w);
63   DECLARE_READ16_MEMBER(sndcomm68k_r);
64   DECLARE_WRITE16_MEMBER(sndcomm68k_w);
6570   DECLARE_READ16_MEMBER(tms57002_data_word_r);
6671   DECLARE_WRITE16_MEMBER(tms57002_data_word_w);
6772   DECLARE_READ16_MEMBER(tms57002_status_word_r);
r26235r26236
104109   UINT32 screen_update_konamigx_right(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
105110   INTERRUPT_GEN_MEMBER(konamigx_vbinterrupt);
106111   INTERRUPT_GEN_MEMBER(tms_sync);
112   DECLARE_WRITE_LINE_MEMBER(k054539_irq_gen);
107113   TIMER_CALLBACK_MEMBER(dmaend_callback);
114   TIMER_CALLBACK_MEMBER(boothack_callback);
108115   TIMER_DEVICE_CALLBACK_MEMBER(konamigx_hbinterrupt);
109   optional_device<cpu_device> m_soundcpu;
110   optional_device<tms57002_device> m_dasp;
111116
112117   void _gxcommoninitnosprites(running_machine &machine);
113118   void _gxcommoninit(running_machine &machine);
r26235r26236
135140   void konamigx_mixer_init(screen_device &screen, int objdma);
136141   void konamigx_objdma(void);
137142
138
143   UINT8 m_sound_ctrl;
144   UINT8 m_sound_intck;
139145};
140146
141147
r26235r26236
198204void konamigx_mixer_init(screen_device &screen, int objdma);
199205void konamigx_mixer_primode(int mode);
200206
201
202
203
204
205207extern int konamigx_current_frame;
206208
207209

Previous 199869 Revisions Next


© 1997-2024 The MAME Team