Previous 15994 Revisions Next

r15507 Wednesday 27th June, 2012 at 11:10:06 UTC by Michael Zapf
ti99: Using modern sound chip class implementation [Michael Zapf] (nw)
[src/emu/sound]sn76496.c sn76496.h
[src/mess/drivers]geneve.c ti99_4p.c ti99_4x.c ti99_8.c
[src/mess/machine/ti99]videowrp.c videowrp.h

src/emu/sound/sn76496.c
r15506r15507
111111        * Test the NCR7496; Smspower says the whitenoise taps are A and E,
112112          but this needs verification on real hardware.
113113        * Factor out common code so that the SAA1099 can share some code.
114        * Convert to modern device
114
115115***************************************************************************/
116116
117117#include "emu.h"
r15506r15507
613613DEFINE_LEGACY_SOUND_DEVICE(NCR7496, ncr7496);
614614DEFINE_LEGACY_SOUND_DEVICE(GAMEGEAR, gamegear);
615615DEFINE_LEGACY_SOUND_DEVICE(SEGAPSG, segapsg);
616
617/*****************************************************************
618    New class implementation
619    Michael Zapf, June 2012
620*****************************************************************/
621
622sn76496_base_device::sn76496_base_device(const machine_config &mconfig, device_type type,  const char *name,
623   const char *tag, int feedbackmask, int noisetap1, int noisetap2, bool negate, bool stereo, int clockdivider, int freq0,
624   device_t *owner, UINT32 clock)
625
626   : device_t(mconfig, type, name, tag, owner, clock),
627     device_sound_interface(mconfig, *this),
628     m_feedback_mask(feedbackmask),
629     m_whitenoise_tap1(noisetap1),
630     m_whitenoise_tap2(noisetap2),
631     m_negate(negate),
632     m_stereo(stereo),
633     m_clock_divider(clockdivider),
634     m_freq0_is_max(freq0)
635{
636}
637
638void sn76496_base_device::device_start()
639{
640   int sample_rate = clock()/2;
641   int i;
642   double out;
643   int gain;
644
645   const sn76496_config *conf = reinterpret_cast<const sn76496_config *>(static_config());
646   m_ready.resolve(conf->ready, *this);
647
648   m_sound = machine().sound().stream_alloc(*this, 0, (m_stereo? 2:1), sample_rate, this);
649
650   for (i = 0; i < 4; i++) m_volume[i] = 0;
651
652   m_last_register = 0;
653   for (i = 0; i < 8; i+=2)
654   {
655      m_register[i] = 0;
656      m_register[i + 1] = 0x0f;   // volume = 0
657   }
658
659   for (i = 0; i < 4; i++)
660   {
661      m_output[i] = 0;
662      m_period[i] = 0;
663      m_count[i] = 0;
664   }
665
666   m_RNG = m_feedback_mask;
667   m_output[3] = m_RNG & 1;
668
669   m_cycles_to_ready = 1;         // assume ready is not active immediately on init. is this correct?
670   m_stereo_mask = 0xFF;         // all channels enabled
671   m_current_clock = m_clock_divider-1;
672
673   // set gain
674   gain = 0;
675
676   gain &= 0xff;
677
678   // increase max output basing on gain (0.2 dB per step)
679   out = MAX_OUTPUT / 4; // four channels, each gets 1/4 of the total range
680   while (gain-- > 0)
681      out *= 1.023292992;   // = (10 ^ (0.2/20))
682
683   // build volume table (2dB per step)
684   for (i = 0; i < 15; i++)
685   {
686      // limit volume to avoid clipping
687      if (out > MAX_OUTPUT / 4) m_vol_table[i] = MAX_OUTPUT / 4;
688      else m_vol_table[i] = out;
689
690      out /= 1.258925412;   /* = 10 ^ (2/20) = 2dB */
691   }
692   m_vol_table[15] = 0;
693
694   m_ready_state = true;
695
696   register_for_save_states();
697}
698
699READ_LINE_MEMBER( sn76496_base_device::ready_r )
700{
701   m_sound->update();
702   return (m_cycles_to_ready > 0)? FALSE : TRUE;
703}
704
705WRITE8_MEMBER( sn76496_base_device::stereo_w )
706{
707   m_sound->update();
708   if (m_stereo) m_stereo_mask = data;
709   else fatalerror("sn76496_base_device: Call to stereo write with mono chip!\n");
710}
711
712WRITE8_MEMBER( sn76496_base_device::write )
713{
714   int n, r, c;
715
716   // update the output buffer before changing the registers
717   m_sound->update();
718
719   // set number of cycles until READY is active; this is always one
720   // 'sample', i.e. it equals the clock divider exactly; until the
721   // clock divider is fully supported, we delay until one sample has
722   // played. The fact that this below is '2' and not '1' is because
723   // of a ?race condition? in the mess crvision driver, where after
724   // any sample is played at all, no matter what, the cycles_to_ready
725   // ends up never being not ready, unless this value is greater than
726   // 1. Once the full clock divider stuff is written, this should no
727   // longer be an issue.
728
729   m_cycles_to_ready = 2;
730
731   if (data & 0x80)
732   {
733      r = (data & 0x70) >> 4;
734      m_last_register = r;
735      m_register[r] = (m_register[r] & 0x3f0) | (data & 0x0f);
736   }
737   else
738   {
739      r = m_last_register;
740   }
741
742   c = r >> 1;
743   switch (r)
744   {
745      case 0:   // tone 0: frequency
746      case 2:   // tone 1: frequency
747      case 4:   // tone 2: frequency
748         if ((data & 0x80) == 0) m_register[r] = (m_register[r] & 0x0f) | ((data & 0x3f) << 4);
749         if ((m_register[r] != 0) || (!m_freq0_is_max)) m_period[c] = m_register[r];
750         else m_period[c] = 0x400;
751
752         if (r == 4)
753         {
754            // update noise shift frequency
755            if ((m_register[6] & 0x03) == 0x03)   m_period[3] = m_period[2]<<1;
756         }
757         break;
758      case 1:   // tone 0: volume
759      case 3:   // tone 1: volume
760      case 5:   // tone 2: volume
761      case 7:   // noise: volume
762         m_volume[c] = m_vol_table[data & 0x0f];
763         if ((data & 0x80) == 0) m_register[r] = (m_register[r] & 0x3f0) | (data & 0x0f);
764         break;
765      case 6:   // noise: frequency, mode
766         {
767            if ((data & 0x80) == 0) logerror("sn76496_base_device: write to reg 6 with bit 7 clear; data was %03x, new write is %02x! report this to LN!\n", m_register[6], data);
768            if ((data & 0x80) == 0) m_register[r] = (m_register[r] & 0x3f0) | (data & 0x0f);
769            n = m_register[6];
770            // N/512,N/1024,N/2048,Tone #3 output
771            m_period[3] = ((n&3) == 3)? (m_period[2]<<1) : (1 << (5+(n&3)));
772            m_RNG = m_feedback_mask;
773         }
774         break;
775   }
776}
777
778inline bool sn76496_base_device::in_noise_mode()
779{
780   return ((m_register[6] & 4)!=0);
781}
782
783void sn76496_base_device::countdown_cycles()
784{
785   if (m_cycles_to_ready > 0)
786   {
787      m_cycles_to_ready--;
788      if (m_ready_state==true) m_ready(CLEAR_LINE);
789      m_ready_state = false;
790   }
791   else
792   {
793      if (m_ready_state==false) m_ready(ASSERT_LINE);
794      m_ready_state = true;
795   }
796}
797
798void sn76496_base_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
799{
800   int i;
801   stream_sample_t *lbuffer = outputs[0];
802   stream_sample_t *rbuffer = (m_stereo)? outputs[1] : NULL;
803
804   INT16 out = 0;
805   INT16 out2 = 0;
806
807   while (samples > 0)
808   {
809      // clock chip once
810      if (m_current_clock > 0) // not ready for new divided clock
811      {
812         m_current_clock--;
813      }
814      else // ready for new divided clock, make a new sample
815      {
816         m_current_clock = m_clock_divider-1;
817         // decrement Cycles to READY by one
818         countdown_cycles();
819
820         // handle channels 0,1,2
821         for (i = 0; i < 3; i++)
822         {
823            m_count[i]--;
824            if (m_count[i] <= 0)
825            {
826               m_output[i] ^= 1;
827               m_count[i] = m_period[i];
828            }
829         }
830
831         // handle channel 3
832         m_count[3]--;
833         if (m_count[3] <= 0)
834         {
835            // if noisemode is 1, both taps are enabled
836            // if noisemode is 0, the lower tap, whitenoisetap2, is held at 0
837            if (((m_RNG & m_whitenoise_tap1)!=0) != (((m_RNG & m_whitenoise_tap2)!=0) && in_noise_mode()))
838            {
839               m_RNG >>= 1;
840               m_RNG |= m_feedback_mask;
841            }
842            else
843            {
844               m_RNG >>= 1;
845            }
846            m_output[3] = m_RNG & 1;
847
848            m_count[3] = m_period[3];
849         }
850      }
851
852      if (m_stereo)
853      {
854         out = ((((m_stereo_mask & 0x10)!=0) && (m_output[0]!=0))? m_volume[0] : 0)
855            + ((((m_stereo_mask & 0x20)!=0) && (m_output[1]!=0))? m_volume[1] : 0)
856            + ((((m_stereo_mask & 0x40)!=0) && (m_output[2]!=0))? m_volume[2] : 0)
857            + ((((m_stereo_mask & 0x80)!=0) && (m_output[3]!=0))? m_volume[3] : 0);
858
859         out2= ((((m_stereo_mask & 0x1)!=0) && (m_output[0]!=0))? m_volume[0] : 0)
860            + ((((m_stereo_mask & 0x2)!=0) && (m_output[1]!=0))? m_volume[1] : 0)
861            + ((((m_stereo_mask & 0x4)!=0) && (m_output[2]!=0))? m_volume[2] : 0)
862            + ((((m_stereo_mask & 0x8)!=0) && (m_output[3]!=0))? m_volume[3] : 0);
863      }
864      else
865      {
866         out= ((m_output[0]!=0)? m_volume[0]:0)
867            +((m_output[1]!=0)? m_volume[1]:0)
868            +((m_output[2]!=0)? m_volume[2]:0)
869            +((m_output[3]!=0)? m_volume[3]:0);
870      }
871
872      if (m_negate) { out = -out; out2 = -out2; }
873
874      *(lbuffer++) = out;
875      if (m_stereo) *(rbuffer++) = out2;
876      samples--;
877   }
878}
879
880void sn76496_base_device::register_for_save_states()
881{
882   save_item(NAME(m_vol_table));
883   save_item(NAME(m_register));
884   save_item(NAME(m_last_register));
885   save_item(NAME(m_volume));
886   save_item(NAME(m_RNG));
887//  save_item(NAME(m_clock_divider));
888   save_item(NAME(m_current_clock));
889//  save_item(NAME(m_feedback_mask));
890//  save_item(NAME(m_whitenoise_tap1));
891//  save_item(NAME(m_whitenoise_tap2));
892//  save_item(NAME(m_negate));
893//  save_item(NAME(m_stereo));
894   save_item(NAME(m_stereo_mask));
895   save_item(NAME(m_period));
896   save_item(NAME(m_count));
897   save_item(NAME(m_output));
898   save_item(NAME(m_cycles_to_ready));
899//  save_item(NAME(m_freq0_is_max));
900}
901
902const device_type SN76496N = &device_creator<sn76496n_device>;
903const device_type U8106N = &device_creator<u8106n_device>;
904const device_type Y2404N = &device_creator<y2404n_device>;
905const device_type SN76489N = &device_creator<sn76489n_device>;
906const device_type SN76489AN = &device_creator<sn76489an_device>;
907const device_type SN76494N = &device_creator<sn76494n_device>;
908const device_type SN94624N = &device_creator<sn94624n_device>;
909const device_type NCR7496N = &device_creator<ncr7496n_device>;
910const device_type GAMEGEARN = &device_creator<gamegearn_device>;
911const device_type SEGAPSGN = &device_creator<segapsgn_device>;
912
src/emu/sound/sn76496.h
r15506r15507
2020DECLARE_LEGACY_SOUND_DEVICE(GAMEGEAR, gamegear);
2121DECLARE_LEGACY_SOUND_DEVICE(SEGAPSG, segapsg);
2222
23/*****************************************************************
24    New class implementation
25    Michael Zapf, June 2012
26*****************************************************************/
27
28extern const device_type SN76496N;
29extern const device_type U8106N;
30extern const device_type Y2404N;
31extern const device_type SN76489N;
32extern const device_type SN76489AN;
33extern const device_type SN76494N;
34extern const device_type SN94624N;
35extern const device_type NCR7496N;
36extern const device_type GAMEGEARN;
37extern const device_type SEGAPSGN;
38
39typedef struct _sn76496_config
40{
41   devcb_write_line      ready;
42} sn76496_config;
43
44class sn76496_base_device : public device_t, public device_sound_interface
45{
46public:
47   sn76496_base_device(const machine_config &mconfig, device_type type,  const char *name, const char *tag,
48      int feedbackmask, int noisetap1, int noisetap2, bool negate, bool stereo, int clockdivider, int freq0,
49      device_t *owner, UINT32 clock);
50   DECLARE_READ_LINE_MEMBER( ready_r );
51   DECLARE_WRITE8_MEMBER( stereo_w );
52   DECLARE_WRITE8_MEMBER( write );
53
54protected:
55   void   device_start();
56   void   sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
57
58private:
59   inline bool    in_noise_mode();
60   void         register_for_save_states();
61   void         countdown_cycles();
62
63   bool         m_ready_state;
64
65   devcb_resolved_write_line   m_ready;
66
67   sound_stream*   m_sound;
68
69   const INT32    m_feedback_mask;   // mask for feedback
70   const INT32    m_whitenoise_tap1;   // mask for white noise tap 1 (higher one, usually bit 14)
71   const INT32    m_whitenoise_tap2;   // mask for white noise tap 2 (lower one, usually bit 13)
72   const bool      m_negate;         // output negate flag
73   const bool      m_stereo;         // whether we're dealing with stereo or not
74   const INT32    m_clock_divider;   // clock divider
75   const bool      m_freq0_is_max;      // flag for if frequency zero acts as if it is one more than max (0x3ff+1) or if it acts like 0
76
77   INT32         m_vol_table[16];   // volume table (for 4-bit to db conversion)
78   INT32         m_register[8];      // registers
79   INT32         m_last_register;   // last register written
80   INT32         m_volume[4];      // db volume of voice 0-2 and noise
81   UINT32         m_RNG;            // noise generator LFSR
82   INT32         m_current_clock;
83   INT32         m_stereo_mask;      // the stereo output mask
84   INT32         m_period[4];      // Length of 1/2 of waveform
85   INT32         m_count[4];         // Position within the waveform
86   INT32         m_output[4];      // 1-bit output of each channel, pre-volume
87   INT32         m_cycles_to_ready;   // number of cycles until the READY line goes active
88};
89
90// SN76496: Whitenoise verified, phase verified, periodic verified (by Michael Zapf)
91class sn76496n_device : public sn76496_base_device
92{
93public:
94   sn76496n_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
95   :  sn76496_base_device(mconfig, SN76496N, "SN76496N", tag, 0x10000, 0x04, 0x08, false, false, 8, true, owner, clock)
96   { }
97};
98
99// U8106 not verified yet. todo: verify; (a custom marked sn76489? only used on mr. do and maybe other universal games)
100class u8106n_device : public sn76496_base_device
101{
102public:
103   u8106n_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
104   :  sn76496_base_device(mconfig, U8106N, "U8106N", tag, 0x4000, 0x01, 0x02, true, false, 8, true, owner, clock)
105   { }
106};
107
108// Y2404 not verified yet. todo: verify; (don't be fooled by the Y, it's a TI chip, not Yamaha)
109class y2404n_device : public sn76496_base_device
110{
111public:
112   y2404n_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
113   :  sn76496_base_device(mconfig, Y2404N, "Y2404N", tag, 0x10000, 0x04, 0x08, false, false, 8, true, owner, clock)
114   { }
115};
116
117// SN76489 not verified yet. todo: verify;
118class sn76489n_device : public sn76496_base_device
119{
120public:
121   sn76489n_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
122   :  sn76496_base_device(mconfig, SN76489N, "SN76489N", tag, 0x4000, 0x01, 0x02, true, false, 8, true, owner, clock)
123   { }
124};
125
126// SN76489A: whitenoise verified, phase verified, periodic verified (by plgdavid)
127class sn76489an_device : public sn76496_base_device
128{
129public:
130   sn76489an_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
131   :  sn76496_base_device(mconfig, SN76489AN, "SN76489AN", tag, 0x10000, 0x04, 0x08, false, false, 8, true, owner, clock)
132   { }
133};
134
135// SN76494 not verified, (according to datasheet: same as sn76489a but without the /8 divider)
136class sn76494n_device : public sn76496_base_device
137{
138public:
139   sn76494n_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
140   :  sn76496_base_device(mconfig, SN76494N, "SN76494N", tag, 0x10000, 0x04, 0x08, false, false, 1, true, owner, clock)
141   { }
142};
143
144// SN94624 whitenoise verified, phase verified, period verified; verified by PlgDavid
145class sn94624n_device : public sn76496_base_device
146{
147public:
148   sn94624n_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
149   :  sn76496_base_device(mconfig, SN94624N, "SN94624N", tag, 0x4000, 0x01, 0x02, true, false, 1, true, owner, clock)
150   { }
151};
152
153// NCR7496 not verified; info from smspower wiki
154class ncr7496n_device : public sn76496_base_device
155{
156public:
157   ncr7496n_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
158   :  sn76496_base_device(mconfig, NCR7496N, "NCR7496N", tag, 0x8000, 0x02, 0x20, false, false, 8, true, owner, clock)
159   { }
160};
161
162// Verified by Justin Kerk
163class gamegearn_device : public sn76496_base_device
164{
165public:
166   gamegearn_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
167   :  sn76496_base_device(mconfig, GAMEGEARN, "Game Gear PSGN", tag, 0x8000, 0x01, 0x08, true, true, 8, false, owner, clock)
168   { }
169};
170
171// todo: verify; from smspower wiki, assumed to have same invert as gamegear
172class segapsgn_device : public sn76496_base_device
173{
174public:
175   segapsgn_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
176   :  sn76496_base_device(mconfig, SEGAPSGN, "SEGA VDP PSGN", tag, 0x8000, 0x01, 0x08, true, false, 8, false, owner, clock)
177   { }
178};
179
23180#endif /* __SN76496_H__ */
src/mess/machine/ti99/videowrp.c
r15506r15507
177177
178178/**************************************************************************/
179179
180// TODO: Should propagate READY to the system. However, READY is implemented
181// to be read instead of pushing the level.
182
183ti_sound_system_device::ti_sound_system_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
184: bus8z_device(mconfig, TISOUND, "TI sound chip wrapper", tag, owner, clock)
180/*
181    Sound subsystem.
182    TODO: Seriously consider to simplify this by connecting to the datamux
183    directly. We don't do anything reasonable here.
184*/
185static const sn76496_config sound_config =
185186{
186}
187   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, ti_sound_system_device, sound_ready),
188};
187189
188190WRITE8_MEMBER( ti_sound_system_device::write )
189191{
190   sn76496_w(m_sound_chip, offset, data);
192   m_sound_chip->write(space, 0, data);
191193}
192194
193195void ti_sound_system_device::device_start(void)
194196{
195   m_sound_chip = machine().device(TISOUNDCHIP_TAG);
197   const ti_sound_config *conf = reinterpret_cast<const ti_sound_config *>(static_config());
198   m_console_ready.resolve(conf->ready, *this);
199   m_sound_chip = subdevice<sn76496_base_device>(TISOUNDCHIP_TAG);
196200}
197201
202WRITE_LINE_MEMBER( ti_sound_system_device::sound_ready )
203{
204   m_console_ready(state);
205}
206
207MACHINE_CONFIG_FRAGMENT( sn94624 )
208   MCFG_SPEAKER_STANDARD_MONO("sound_out")
209   MCFG_SOUND_ADD(TISOUNDCHIP_TAG, SN94624N, 3579545/8)   /* 3.579545 MHz */
210   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "sound_out", 0.75)
211   MCFG_SOUND_CONFIG(sound_config)
212MACHINE_CONFIG_END
213
214MACHINE_CONFIG_FRAGMENT( sn76496 )
215   MCFG_SPEAKER_STANDARD_MONO("sound_out")
216   MCFG_SOUND_ADD(TISOUNDCHIP_TAG, SN76496N, 3579545)   /* 3.579545 MHz */
217   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "sound_out", 0.75)
218   MCFG_SOUND_CONFIG(sound_config)
219MACHINE_CONFIG_END
220
221machine_config_constructor ti_sound_sn94624_device::device_mconfig_additions() const
222{
223   return MACHINE_CONFIG_NAME( sn94624 );
224}
225
226machine_config_constructor ti_sound_sn76496_device::device_mconfig_additions() const
227{
228   return MACHINE_CONFIG_NAME( sn76496 );
229}
230
198231/**************************************************************************/
199232
200233const device_type TI99VIDEO = &device_creator<ti_std_video_device>;
201234const device_type V9938VIDEO = &device_creator<ti_exp_video_device>;
202const device_type TISOUND = &device_creator<ti_sound_system_device>;
235const device_type TISOUND_94624 = &device_creator<ti_sound_sn94624_device>;
236const device_type TISOUND_76496 = &device_creator<ti_sound_sn76496_device>;
src/mess/machine/ti99/videowrp.h
r15506r15507
1515#include "video/tms9928a.h"
1616#include "video/v9938.h"
1717#include "ti99defs.h"
18#include "sound/sn76496.h"
1819
1920class ti_video_device : public bus8z_device
2021{
r15506r15507
5960   v9938_device   *m_v9938;
6061};
6162
63extern const device_type TI99VIDEO;
64extern const device_type V9938VIDEO;
65
66/****************************************************************************/
6267/*
63    Sound device wrapper (required until sn74296 is converted to a modern device);
64    let's hitchhike here - it is not required to create yet another file
65    that will be dropped later.
68    Sound device
6669*/
70
71extern const device_type TISOUND_94624;
72extern const device_type TISOUND_76496;
73
74typedef struct _ti_sound_config
75{
76   devcb_write_line            ready;
77} ti_sound_config;
78
79#define TI_SOUND_CONFIG(name) \
80   const ti_sound_config(name) =
81
6782class ti_sound_system_device : public bus8z_device
6883{
6984public:
70   ti_sound_system_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
85   ti_sound_system_device(const machine_config &mconfig, device_type type, const char *tag, const char *name, device_t *owner, UINT32 clock)
86   : bus8z_device(mconfig, type, name, tag, owner, clock) { };
87
7188   // Cannot read from sound; just ignore silently
7289   DECLARE_READ8Z_MEMBER(readz) { };
7390   DECLARE_WRITE8_MEMBER(write);
91   DECLARE_WRITE_LINE_MEMBER( sound_ready );   // connect to console READY
7492
7593protected:
7694   void device_start(void);
95   virtual machine_config_constructor device_mconfig_additions() const =0;
7796
7897private:
79   device_t *m_sound_chip;
98   sn76496_base_device*      m_sound_chip;
99   devcb_resolved_write_line   m_console_ready;
80100};
81101
102/*
103    The version that sits in the TI-99/4A
104*/
105class ti_sound_sn94624_device : public ti_sound_system_device
106{
107public:
108   ti_sound_sn94624_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
109   : ti_sound_system_device(mconfig, TISOUND_94624, tag, "Onboard sound (SN94624)", owner, clock) { }
110
111protected:
112   machine_config_constructor device_mconfig_additions() const;
113};
114
115/*
116    The version that sits in the TI-99/8 and Geneve
117*/
118class ti_sound_sn76496_device : public ti_sound_system_device
119{
120public:
121   ti_sound_sn76496_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
122   : ti_sound_system_device(mconfig, TISOUND_76496, tag, "Onboard sound (SN76496)", owner, clock) { }
123
124protected:
125   machine_config_constructor device_mconfig_additions() const;
126};
127
128
82129/****************************************************************************/
83130
84131#define MCFG_TI_TMS991x_ADD_NTSC(_tag, _chip, _tmsparam)   \
r15506r15507
118165   MCFG_PALETTE_LENGTH(512)                                    \
119166   MCFG_PALETTE_INIT(v9938)
120167
121#define MCFG_TI_SOUND_ADD(_tag)         \
122   MCFG_DEVICE_ADD(_tag, TISOUND, 0)
168#define MCFG_TI_SOUND_94624_ADD(_tag, _conf)         \
169   MCFG_DEVICE_ADD(_tag, TISOUND_94624, 0)   \
170   MCFG_DEVICE_CONFIG( _conf )
123171
124extern const device_type TI99VIDEO;
125extern const device_type V9938VIDEO;
126extern const device_type TISOUND;
172#define MCFG_TI_SOUND_76496_ADD(_tag, _conf)         \
173   MCFG_DEVICE_ADD(_tag, TISOUND_76496, 0)   \
174   MCFG_DEVICE_CONFIG( _conf )
127175
128176#endif /* __TIVIDEO__ */
129177
src/mess/drivers/ti99_8.c
r15506r15507
797797   NO_OVERFLOW_INT
798798};
799799
800static TI_SOUND_CONFIG( sound_conf )
801{
802   DEVCB_DRIVER_LINE_MEMBER(ti99_8, console_ready)   // READY
803};
804
800805/*
801806    Format:
802807    Name, mode, stop, mask, select, write, read8z function, write8 function
r15506r15507
960965   MCFG_PERIBOX_ADD( PERIBOX_TAG, peribox_conf )
961966
962967   /* Sound hardware */
963   MCFG_SPEAKER_STANDARD_MONO("mono")
964   MCFG_SOUND_ADD(TISOUNDCHIP_TAG, SN76496, 3579545) /* 3.579545 MHz */
965   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
966   MCFG_TI_SOUND_ADD( TISOUND_TAG )
968   MCFG_TI_SOUND_76496_ADD( TISOUND_TAG, sound_conf )
967969
968970   /* Cassette drives */
971   MCFG_SPEAKER_STANDARD_MONO("cass_out")
969972   MCFG_CASSETTE_ADD( CASSETTE_TAG, default_cassette_interface )
970973   MCFG_SOUND_WAVE_ADD(WAVE_TAG, CASSETTE_TAG)
971   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
974   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "cass_out", 0.25)
972975
973976   /* Console GROMs */
974977   MCFG_GROM_ADD( GROM0_TAG, grom0_config )
r15506r15507
10071010   MCFG_PERIBOX_ADD( PERIBOX_TAG, peribox_conf )
10081011
10091012   /* Sound hardware */
1010   MCFG_SPEAKER_STANDARD_MONO("mono")
1011   MCFG_SOUND_ADD(TISOUNDCHIP_TAG, SN76496, 3579545)   /* 3.579545 MHz */
1012   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
1013   MCFG_TI_SOUND_ADD( TISOUND_TAG )
1013   MCFG_TI_SOUND_76496_ADD( TISOUND_TAG, sound_conf )
10141014
10151015   /* Cassette drives */
1016   MCFG_SPEAKER_STANDARD_MONO("cass_out")
10161017   MCFG_CASSETTE_ADD( CASSETTE_TAG, default_cassette_interface )
10171018   MCFG_SOUND_WAVE_ADD(WAVE_TAG, CASSETTE_TAG)
1018   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
1019   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "cass_out", 0.25)
10191020
10201021   /* Console GROMs */
10211022   MCFG_GROM_ADD( GROM0_TAG, grom0_config )
src/mess/drivers/geneve.c
r15506r15507
693693   NO_OVERFLOW_INT      // The generally available versions of TMS9995 have a deactivated overflow interrupt
694694};
695695
696static TI_SOUND_CONFIG( sound_conf )
697{
698   DEVCB_DRIVER_LINE_MEMBER(geneve, ext_ready)   // READY
699};
700
696701static const mm58274c_interface geneve_mm58274c_interface =
697702{
698703   1,   /*  mode 24*/
r15506r15507
778783   MCFG_PERIBOX_GEN_ADD( PERIBOX_TAG, peribox_conf )
779784
780785   /* sound hardware */
781   MCFG_SPEAKER_STANDARD_MONO("mono")
782   MCFG_SOUND_ADD(TISOUNDCHIP_TAG, SN76496, 3579545)   /* 3.579545 MHz */
783   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
784   MCFG_TI_SOUND_ADD( TISOUND_TAG )
786   MCFG_TI_SOUND_76496_ADD( TISOUND_TAG, sound_conf )
785787
786788   /* User interface devices */
787789   MCFG_GENEVE_KEYBOARD_ADD( GKEYBOARD_TAG, geneve_keyb_conf )
src/mess/drivers/ti99_4p.c
r15506r15507
3939#include "cpu/tms9900/tms9900.h"
4040#include "sound/wave.h"
4141#include "sound/dac.h"
42#include "sound/sn76496.h"
4342
4443#include "machine/tms9901.h"
4544#include "machine/ti99/peribox.h"
r15506r15507
6463      : driver_device(mconfig, type, tag) { }
6564
6665   DECLARE_WRITE_LINE_MEMBER( console_ready );
66   DECLARE_WRITE_LINE_MEMBER( console_ready_dmux );
67
6768   DECLARE_WRITE_LINE_MEMBER( extint );
6869   DECLARE_WRITE_LINE_MEMBER( notconnected );
6970   DECLARE_READ8_MEMBER( interrupt_level );
r15506r15507
120121   UINT16 *m_scratchpad;
121122
122123   // READY line
123   bool m_ready_line, m_ready_line1;
124   int      m_ready_line, m_ready_line_dmux;
124125
125126private:
126127   DECLARE_READ16_MEMBER( datamux_read );
r15506r15507
152153   UINT8   m_highbyte;
153154   UINT8   m_latch;
154155
155   /* Mapper registers */
156   // Mapper registers
156157   UINT8 m_mapper[16];
158
159   int      m_ready_prev;      // for debugging purposes only
160
157161};
158162
159163static ADDRESS_MAP_START(memmap, AS_PROGRAM, 16, ti99_4p)
r15506r15507
431435   if (clock==ASSERT_LINE && m_waitcount!=0)
432436   {
433437      m_waitcount--;
434      if (m_waitcount==0) console_ready(ASSERT_LINE);
438      if (m_waitcount==0) console_ready_dmux(ASSERT_LINE);
435439   }
436440}
437441
r15506r15507
452456
453457   // Insert four wait states and let CPU enter wait state
454458   m_waitcount = 6;
455   console_ready(CLEAR_LINE);
459   console_ready_dmux(CLEAR_LINE);
456460
457461   return (hbyte<<8) | m_latch ;
458462}
r15506r15507
486490
487491   // Insert four wait states and let CPU enter wait state
488492   m_waitcount = 6;
489   console_ready(CLEAR_LINE);
493   console_ready_dmux(CLEAR_LINE);
490494}
491495
492496/***************************************************************************
r15506r15507
720724*/
721725WRITE_LINE_MEMBER( ti99_4p::console_ready )
722726{
723   if (VERBOSE>6) LOG("ti99_4p: READY level = %02x\n", state);
724727   m_ready_line = state;
728   int combined = (m_ready_line == ASSERT_LINE && m_ready_line_dmux == ASSERT_LINE)? ASSERT_LINE : CLEAR_LINE;
725729
726   m_cpu->set_ready((m_ready_line == ASSERT_LINE && m_ready_line1 == ASSERT_LINE)? ASSERT_LINE : CLEAR_LINE);
730   if (VERBOSE>6)
731   {
732      if (m_ready_prev != combined) LOG("ti99_4p: READY level = %d\n", combined);
733   }
734   m_ready_prev = combined;
735   m_cpu->set_ready(combined);
727736}
728737
738/*
739    The exception of the above rule. Memory access over the datamux also operates
740    the READY line, and the datamux raises READY depending on the clock pulse.
741    So we must make sure this does not interfere.
742*/
743WRITE_LINE_MEMBER( ti99_4p::console_ready_dmux )
744{
745   m_ready_line_dmux = state;
746   int combined = (m_ready_line == ASSERT_LINE && m_ready_line_dmux == ASSERT_LINE)? ASSERT_LINE : CLEAR_LINE;
747
748   if (VERBOSE>7)
749   {
750      if (m_ready_prev != combined) LOG("ti99_4p: READY dmux level = %d\n", state);
751   }
752   m_ready_prev = combined;
753   m_cpu->set_ready(combined);
754}
755
756
729757WRITE_LINE_MEMBER( ti99_4p::extint )
730758{
731759   if (VERBOSE>6) LOG("ti99_4p: EXTINT level = %02x\n", state);
r15506r15507
804832   driver->m_peribox->senila(CLEAR_LINE);
805833   driver->m_peribox->senilb(CLEAR_LINE);
806834
807   driver->m_ready_line = driver->m_ready_line1 = ASSERT_LINE;
835   driver->m_ready_line = driver->m_ready_line_dmux = ASSERT_LINE;
808836
809837   UINT16 *rom = (UINT16*)(*machine.root_device().memregion("maincpu"));
810838   driver->m_rom0  = rom + 0x2000;
r15506r15507
821849   m_tms9901->set_single_int(2, state);
822850}
823851
852static TI_SOUND_CONFIG( sound_conf )
853{
854   DEVCB_DRIVER_LINE_MEMBER(ti99_4p, console_ready)   // READY
855};
856
824857/*
825858    Reset the machine.
826859*/
r15506r15507
863896   MCFG_PERIBOX_SG_ADD( PERIBOX_TAG, peribox_conf )
864897
865898   /* sound hardware */
866   MCFG_SPEAKER_STANDARD_MONO("mono")
867   MCFG_SOUND_ADD(TISOUNDCHIP_TAG, SN94624, 3579545/8)   /* 3.579545 MHz */
868   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
869   MCFG_TI_SOUND_ADD( TISOUND_TAG )
899   MCFG_TI_SOUND_94624_ADD( TISOUND_TAG, sound_conf )
870900
871901   /* Cassette drives */
902   MCFG_SPEAKER_STANDARD_MONO("cass_out")
872903   MCFG_CASSETTE_ADD( CASSETTE_TAG, default_cassette_interface )
873904
874905   MCFG_SOUND_WAVE_ADD(WAVE_TAG, CASSETTE_TAG)
875   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
906   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "cass_out", 0.25)
876907MACHINE_CONFIG_END
877908
878909
src/mess/drivers/ti99_4x.c
r15506r15507
4040
4141#include "emu.h"
4242#include "cpu/tms9900/tms9900.h"
43#include "sound/sn76496.h"
4443
4544#include "sound/wave.h"
4645#include "video/v9938.h"
r15506r15507
364363   0x70000                                    // Address bus prefix (AMA/AMB/AMC)
365364};
366365
366static TI_SOUND_CONFIG( sound_conf )
367{
368   DEVCB_DRIVER_LINE_MEMBER(ti99_4x, console_ready)   // READY
369};
370
367371READ8_MEMBER( ti99_4x::cruread )
368372{
369373//  if (VERBOSE>6) LOG("read access to CRU address %04x\n", offset << 4);
r15506r15507
898902   MCFG_PERIBOX_ADD( PERIBOX_TAG, peribox_conf )
899903
900904   /* sound hardware */
901   MCFG_SPEAKER_STANDARD_MONO("mono")
902   MCFG_SOUND_ADD(TISOUNDCHIP_TAG, SN94624, 3579545/8)   /* 3.579545 MHz */
903   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
904   MCFG_TI_SOUND_ADD( TISOUND_TAG )
905   MCFG_TI_SOUND_94624_ADD( TISOUND_TAG, sound_conf )
905906
906907   /* Cassette drives */
908   MCFG_SPEAKER_STANDARD_MONO("cass_out")
907909   MCFG_CASSETTE_ADD( CASSETTE_TAG, default_cassette_interface )
908910   MCFG_CASSETTE_ADD( CASSETTE2_TAG, default_cassette_interface )
909911
910912   MCFG_SOUND_WAVE_ADD(WAVE_TAG, CASSETTE_TAG)
911   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
913   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "cass_out", 0.25)
912914
913915   /* GROM devices */
914916   MCFG_GROM_ADD( GROM0_TAG, grom0_config )
r15506r15507
944946   MCFG_PERIBOX_ADD( PERIBOX_TAG, peribox_conf )
945947
946948   /* sound hardware */
947   MCFG_SPEAKER_STANDARD_MONO("mono")
948   MCFG_SOUND_ADD(TISOUNDCHIP_TAG, SN94624, 3579545/8)   /* 3.579545 MHz */
949   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
950   MCFG_TI_SOUND_ADD( TISOUND_TAG )
949   MCFG_TI_SOUND_94624_ADD( TISOUND_TAG, sound_conf )
951950
952951   /* Cassette drives */
952   MCFG_SPEAKER_STANDARD_MONO("cass_out")
953953   MCFG_CASSETTE_ADD( CASSETTE_TAG, default_cassette_interface )
954954   MCFG_CASSETTE_ADD( CASSETTE2_TAG, default_cassette_interface )
955955
956956   MCFG_SOUND_WAVE_ADD(WAVE_TAG, CASSETTE_TAG)
957   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
957   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "cass_out", 0.25)
958958
959959   /* GROM devices */
960960   MCFG_GROM_ADD( GROM0_TAG, grom0_config )
r15506r15507
10231023   MCFG_PERIBOX_ADD( PERIBOX_TAG, peribox_conf )
10241024
10251025   /* sound hardware */
1026   MCFG_SPEAKER_STANDARD_MONO("mono")
1027   MCFG_SOUND_ADD(TISOUNDCHIP_TAG, SN94624, 3579545/8)   /* 3.579545 MHz */
1028   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
1029   MCFG_TI_SOUND_ADD( TISOUND_TAG )
1026   MCFG_TI_SOUND_94624_ADD( TISOUND_TAG, sound_conf )
10301027
10311028   /* Cassette drives */
1029   MCFG_SPEAKER_STANDARD_MONO("cass_out")
10321030   MCFG_CASSETTE_ADD( CASSETTE_TAG, default_cassette_interface )
10331031   MCFG_CASSETTE_ADD( CASSETTE2_TAG, default_cassette_interface )
10341032
10351033   MCFG_SOUND_WAVE_ADD(WAVE_TAG, CASSETTE_TAG)
1036   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
1034   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "cass_out", 0.25)
10371035
10381036   /* GROM devices */
10391037   MCFG_GROM_ADD( GROM0_TAG, grom0_config )
r15506r15507
10661064   MCFG_PERIBOX_ADD( PERIBOX_TAG, peribox_conf )
10671065
10681066   /* sound hardware */
1069   MCFG_SPEAKER_STANDARD_MONO("mono")
1070   MCFG_SOUND_ADD(TISOUNDCHIP_TAG, SN94624, 3579545/8)   /* 3.579545 MHz */
1071   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
1072   MCFG_TI_SOUND_ADD( TISOUND_TAG )
1067   MCFG_TI_SOUND_94624_ADD( TISOUND_TAG, sound_conf )
10731068
10741069   /* Cassette drives */
1070   MCFG_SPEAKER_STANDARD_MONO("cass_out")
10751071   MCFG_CASSETTE_ADD( CASSETTE_TAG, default_cassette_interface )
10761072   MCFG_CASSETTE_ADD( CASSETTE2_TAG, default_cassette_interface )
10771073
10781074   MCFG_SOUND_WAVE_ADD(WAVE_TAG, CASSETTE_TAG)
1079   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
1075   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "cass_out", 0.25)
10801076
10811077   /* GROM devices */
10821078   MCFG_GROM_ADD( GROM0_TAG, grom0_config )
r15506r15507
11241120   MCFG_PERIBOX_EV_ADD( PERIBOX_TAG, peribox_conf )
11251121
11261122   /* sound hardware */
1127   MCFG_SPEAKER_STANDARD_MONO("mono")
1128   MCFG_SOUND_ADD(TISOUNDCHIP_TAG, SN94624, 3579545/8)   /* 3.579545 MHz */
1129   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
1130   MCFG_TI_SOUND_ADD( TISOUND_TAG )
1123   MCFG_TI_SOUND_94624_ADD( TISOUND_TAG, sound_conf )
11311124
11321125   /* Cassette drives */
1126   MCFG_SPEAKER_STANDARD_MONO("cass_out")
11331127   MCFG_CASSETTE_ADD( CASSETTE_TAG, default_cassette_interface )
11341128   MCFG_CASSETTE_ADD( CASSETTE2_TAG, default_cassette_interface )
11351129
11361130   MCFG_SOUND_WAVE_ADD(WAVE_TAG, CASSETTE_TAG)
1137   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
1131   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "cass_out", 0.25)
11381132
11391133   /* GROM devices */
11401134   MCFG_GROM_ADD( GROM0_TAG, grom0_config )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team