Previous 199869 Revisions Next

r34806 Monday 2nd February, 2015 at 01:38:25 UTC by R. Belmont
(nw)
[src/emu/bus/snes_ctrl]miracle.c miracle.h

trunk/src/emu/bus/snes_ctrl/miracle.c
r243317r243318
11/**********************************************************************
22
3    Nintendo SNES - Miracle Piano Keyboard
3    Super Nintendo Entertainment System - Miracle Piano Keyboard
44
5    TODO: ???
6
75    Copyright MESS Team.
86    Visit http://mamedev.org for licensing and usage restrictions.
9
7 
8    recv at PC = 008a4a
9    xmit at PC = 008adb
10 
1011**********************************************************************/
1112
1213#include "miracle.h"
r243317r243318
6061//-------------------------------------------------
6162
6263snes_miracle_device::snes_miracle_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
63               device_t(mconfig, SNES_MIRACLE, "Miracle Piano Controller (SNES)", tag, owner, clock, "snes_miracle", __FILE__),
64               device_t(mconfig, SNES_MIRACLE, "Miracle Piano SNES Cable", tag, owner, clock, "snes_miracle", __FILE__),
6465               device_serial_interface(mconfig, *this),
6566               device_snes_control_port_interface(mconfig, *this),
6667               m_midiin(*this, "mdin"),
r243317r243318
106107   m_tx_busy = false;
107108}
108109
109
110//-------------------------------------------------
111//  read
112//-------------------------------------------------
113
114110UINT8 snes_miracle_device::read_pin4()
115111{
116112   UINT8 ret = 0;
r243317r243318
132128   return ret;
133129}
134130
135//-------------------------------------------------
136//  write
137//-------------------------------------------------
131void snes_miracle_device::write_pin6(UINT8 data)
132{
133//   printf("%02x to pin6\n", data);
134}
138135
139// c4fc = start of recv routine
140// c53a = start of send routine
141
142136void snes_miracle_device::write_strobe(UINT8 data)
143137{
144//   printf("write: %d (%d %02x %d)\n", data & 1, m_sent_bits, m_data_sent, m_midi_mode);
138//   printf("%02x to strobe\n", data);
145139
146140   if (m_midi_mode == MIRACLE_MIDI_SEND)
147141   {
148      //SNES writes (data & 1) to Miracle Piano!
142      // console writes (data & 1) to Miracle Piano.
149143      // 1st write is data present flag (1=data present)
150144      // next 8 writes are actual data bits (with ^1)
151145      m_sent_bits++;
r243317r243318
177171      {
178172//         printf("got strobe at %d clocks\n", m_strobe_clock);
179173
180         if (m_strobe_clock < 528 && data == 0)
174         if (m_strobe_clock < 500 && data == 0)
181175         {
182176            // short delay is recieve mode
183177            m_midi_mode = MIRACLE_MIDI_RECEIVE;
r243317r243318
203197            }
204198            return;
205199         }
206         else if (m_strobe_clock >= 528)
200         else if (m_strobe_clock >= 500)
207201         {
208            // more than 528 clocks since strobe on write means send mode
202            // more than ~520 clocks since strobe on write means send mode
203            // (ranges from 522-528 have been seen)
209204            m_midi_mode = MIRACLE_MIDI_SEND;
210205            strobe_timer->reset();
211206            m_strobe_on = 0;
trunk/src/emu/bus/snes_ctrl/miracle.h
r243317r243318
11/**********************************************************************
22
3    Nintendo Entertainment System - Miracle Piano Keyboard
3    Super Nintendo Entertainment System - Miracle Piano Keyboard
44
55    Copyright MESS Team.
66    Visit http://mamedev.org for licensing and usage restrictions.
r243317r243318
5151   virtual void device_start();
5252   virtual void device_reset();
5353
54   virtual UINT8 read_pin4();
55   virtual void write_strobe(UINT8 data);
54   UINT8 read_pin4();
55   void write_pin6(UINT8 data);
56   void write_strobe(UINT8 data);
5657
5758   static const device_timer_id TIMER_STROBE_ON = 0;
5859   emu_timer *strobe_timer;


Previous 199869 Revisions Next


© 1997-2024 The MAME Team