Previous 15994 Revisions Next

r9590 Tuesday 16th November, 2010 at 10:23:25 UTC by Nathan Woods
[CHANNELF/LYNX/SPECIAL/SVISION/WSWAN] Tokenized audio state. [Atari Ace]
[docs]messnew.txt
[src/mess/audio]channelf.c lynx.c special.c svision.c wswan.c
[src/mess/drivers]channelf.c lynx.c svision.c
[src/mess/includes]channelf.h lynx.h special.h svision.h wswan.h
[src/mess/machine]lynx.c special.c wswan.c

src/mess/audio/wswan.c
r9589r9590
1212#include "includes/wswan.h"
1313#include "streams.h"
1414
15static sound_stream *channel;
1615
1716struct CHAN {
1817   UINT16   freq;         /* frequency */
r9589r9590
2423   INT8   signal;         /* signal */
2524};
2625
26typedef struct SND wswan_sound_state;
2727struct SND {
28   sound_stream *channel;
2829   struct CHAN audio1;      /* Audio channel 1 */
2930   struct CHAN audio2;      /* Audio channel 2 */
3031   struct CHAN audio3;      /* Audio channel 3 */
r9589r9590
4849   UINT8   master_volume;      /* Master volume */
4950};
5051
51static struct SND snd;
5252
53static void wswan_ch_set_freq( running_machine *machine, struct CHAN *ch, UINT16 freq ) {
53INLINE wswan_sound_state *get_safe_token(running_device *device)
54{
55   assert(device != NULL);
56   assert(device->type() == WSWAN);
57   return (wswan_sound_state *)downcast<legacy_device_base *>(device)->token();
58}
59
60static void wswan_ch_set_freq( running_machine *machine, struct CHAN *ch, UINT16 freq )
61{
5462   ch->freq = freq;
5563   ch->period = machine->sample_rate / ( 3072000  / ( ( 2048 - freq ) << 5 ) );
5664}
5765
58WRITE8_HANDLER( wswan_sound_port_w ) {
59   stream_update( channel);
66WRITE8_DEVICE_HANDLER( wswan_sound_port_w )
67{
68   wswan_sound_state *state = get_safe_token(device);
69   stream_update( state->channel);
6070   switch( offset ) {
6171   case 0x80:            /* Audio 1 freq (lo) */
62      wswan_ch_set_freq( space->machine, &snd.audio1, ( snd.audio1.freq & 0xFF00 ) | data );
72      wswan_ch_set_freq( device->machine, &state->audio1, ( state->audio1.freq & 0xFF00 ) | data );
6373      break;
6474   case 0x81:            /* Audio 1 freq (hi) */
65      wswan_ch_set_freq( space->machine, &snd.audio1, ( data << 8 ) | ( snd.audio1.freq & 0x00FF ) );
75      wswan_ch_set_freq( device->machine, &state->audio1, ( data << 8 ) | ( state->audio1.freq & 0x00FF ) );
6676      break;
6777   case 0x82:            /* Audio 2 freq (lo) */
68      wswan_ch_set_freq( space->machine, &snd.audio2, ( snd.audio2.freq & 0xFF00 ) | data );
78      wswan_ch_set_freq( device->machine, &state->audio2, ( state->audio2.freq & 0xFF00 ) | data );
6979      break;
7080   case 0x83:            /* Audio 2 freq (hi) */
71      wswan_ch_set_freq( space->machine, &snd.audio2, ( data << 8 ) | ( snd.audio2.freq & 0x00FF ) );
81      wswan_ch_set_freq( device->machine, &state->audio2, ( data << 8 ) | ( state->audio2.freq & 0x00FF ) );
7282      break;
7383   case 0x84:            /* Audio 3 freq (lo) */
74      wswan_ch_set_freq( space->machine, &snd.audio3, ( snd.audio3.freq & 0xFF00 ) | data );
84      wswan_ch_set_freq( device->machine, &state->audio3, ( state->audio3.freq & 0xFF00 ) | data );
7585      break;
7686   case 0x85:            /* Audio 3 freq (hi) */
77      wswan_ch_set_freq( space->machine, &snd.audio3, ( data << 8 ) | ( snd.audio3.freq & 0x00FF ) );
87      wswan_ch_set_freq( device->machine, &state->audio3, ( data << 8 ) | ( state->audio3.freq & 0x00FF ) );
7888      break;
7989   case 0x86:            /* Audio 4 freq (lo) */
80      wswan_ch_set_freq( space->machine, &snd.audio4, ( snd.audio4.freq & 0xFF00 ) | data );
90      wswan_ch_set_freq( device->machine, &state->audio4, ( state->audio4.freq & 0xFF00 ) | data );
8191      break;
8292   case 0x87:            /* Audio 4 freq (hi) */
83      wswan_ch_set_freq( space->machine, &snd.audio4, ( data << 8 ) | ( snd.audio4.freq & 0x00FF ) );
93      wswan_ch_set_freq( device->machine, &state->audio4, ( data << 8 ) | ( state->audio4.freq & 0x00FF ) );
8494      break;
8595   case 0x88:            /* Audio 1 volume */
86      snd.audio1.vol_left = ( data & 0xF0 ) >> 4;
87      snd.audio1.vol_right = data & 0x0F;
96      state->audio1.vol_left = ( data & 0xF0 ) >> 4;
97      state->audio1.vol_right = data & 0x0F;
8898      break;
8999   case 0x89:            /* Audio 2 volume */
90      snd.voice_data = data;
91      snd.audio2.vol_left = ( data & 0xF0 ) >> 4;
92      snd.audio2.vol_right = data & 0x0F;
100      state->voice_data = data;
101      state->audio2.vol_left = ( data & 0xF0 ) >> 4;
102      state->audio2.vol_right = data & 0x0F;
93103      break;
94104   case 0x8A:            /* Audio 3 volume */
95      snd.audio3.vol_left = ( data & 0xF0 ) >> 4;
96      snd.audio3.vol_right = data & 0x0F;
105      state->audio3.vol_left = ( data & 0xF0 ) >> 4;
106      state->audio3.vol_right = data & 0x0F;
97107      break;
98108   case 0x8B:            /* Audio 4 volume */
99      snd.audio4.vol_left = ( data & 0xF0 ) >> 4;
100      snd.audio4.vol_right = data & 0x0F;
109      state->audio4.vol_left = ( data & 0xF0 ) >> 4;
110      state->audio4.vol_right = data & 0x0F;
101111      break;
102112   case 0x8C:            /* Sweep step */
103      snd.sweep_step = (INT8)data;
113      state->sweep_step = (INT8)data;
104114      break;
105115   case 0x8D:            /* Sweep time */
106      snd.sweep_time = space->machine->sample_rate / ( 3072000 / ( 8192 * (data + 1) ) );
116      state->sweep_time = device->machine->sample_rate / ( 3072000 / ( 8192 * (data + 1) ) );
107117      break;
108118   case 0x8E:            /* Noise control */
109      snd.noise_type = data & 0x07;
110      snd.noise_reset = ( data & 0x08 ) >> 3;
111      snd.noise_enable = ( data & 0x10 ) >> 4;
119      state->noise_type = data & 0x07;
120      state->noise_reset = ( data & 0x08 ) >> 3;
121      state->noise_enable = ( data & 0x10 ) >> 4;
112122      break;
113123   case 0x8F:            /* Sample location */
114      snd.sample_address = data << 6;
124      state->sample_address = data << 6;
115125      break;
116126   case 0x90:            /* Audio control */
117      snd.audio1.on = data & 0x01;
118      snd.audio2.on = ( data & 0x02 ) >> 1;
119      snd.audio3.on = ( data & 0x04 ) >> 2;
120      snd.audio4.on = ( data & 0x08 ) >> 3;
121      snd.audio2_voice = ( data & 0x20 ) >> 5;
122      snd.audio3_sweep = ( data & 0x40 ) >> 6;
123      snd.audio4_noise = ( data & 0x80 ) >> 7;
127      state->audio1.on = data & 0x01;
128      state->audio2.on = ( data & 0x02 ) >> 1;
129      state->audio3.on = ( data & 0x04 ) >> 2;
130      state->audio4.on = ( data & 0x08 ) >> 3;
131      state->audio2_voice = ( data & 0x20 ) >> 5;
132      state->audio3_sweep = ( data & 0x40 ) >> 6;
133      state->audio4_noise = ( data & 0x80 ) >> 7;
124134      break;
125135   case 0x91:            /* Audio output */
126      snd.mono = data & 0x01;
127      snd.output_volume = ( data & 0x06 ) >> 1;
128      snd.external_stereo = ( data & 0x08 ) >> 3;
129      snd.external_speaker = 1;
136      state->mono = data & 0x01;
137      state->output_volume = ( data & 0x06 ) >> 1;
138      state->external_stereo = ( data & 0x08 ) >> 3;
139      state->external_speaker = 1;
130140      break;
131141   case 0x92:            /* Noise counter shift register (lo) */
132      snd.noise_shift = ( snd.noise_shift & 0xFF00 ) | data;
142      state->noise_shift = ( state->noise_shift & 0xFF00 ) | data;
133143      break;
134144   case 0x93:            /* Noise counter shift register (hi) */
135      snd.noise_shift = ( data << 8 ) | ( snd.noise_shift & 0x00FF );
145      state->noise_shift = ( data << 8 ) | ( state->noise_shift & 0x00FF );
136146      break;
137147   case 0x94:            /* Master volume */
138      snd.master_volume = data;
148      state->master_volume = data;
139149      break;
140150   }
141151}
142152
143153static STREAM_UPDATE( wswan_sh_update )
144154{
155   wswan_sound_state *state = get_safe_token(device);
145156   stream_sample_t sample, left, right;
146157
147158   while( samples-- > 0 )
148159   {
149160      left = right = 0;
150161
151      if ( snd.audio1.on ) {
152         sample = snd.audio1.signal;
153         snd.audio1.pos++;
154         if ( snd.audio1.pos >= snd.audio1.period / 2 ) {
155            snd.audio1.pos = 0;
156            snd.audio1.signal = -snd.audio1.signal;
162      if ( state->audio1.on ) {
163         sample = state->audio1.signal;
164         state->audio1.pos++;
165         if ( state->audio1.pos >= state->audio1.period / 2 ) {
166            state->audio1.pos = 0;
167            state->audio1.signal = -state->audio1.signal;
157168         }
158         left += snd.audio1.vol_left * sample;
159         right += snd.audio1.vol_right * sample;
169         left += state->audio1.vol_left * sample;
170         right += state->audio1.vol_right * sample;
160171      }
161172
162      if ( snd.audio2.on ) {
163         if ( snd.audio2_voice ) {
164            sample = (INT8)snd.voice_data;
173      if ( state->audio2.on ) {
174         if ( state->audio2_voice ) {
175            sample = (INT8)state->voice_data;
165176            left += sample;
166177            right += sample;
167178         } else {
168            sample = snd.audio2.signal;
169            snd.audio2.pos++;
170            if ( snd.audio2.pos >= snd.audio2.period / 2 ) {
171               snd.audio2.pos = 0;
172               snd.audio2.signal = -snd.audio2.signal;
179            sample = state->audio2.signal;
180            state->audio2.pos++;
181            if ( state->audio2.pos >= state->audio2.period / 2 ) {
182               state->audio2.pos = 0;
183               state->audio2.signal = -state->audio2.signal;
173184            }
174            left += snd.audio2.vol_left * sample;
175            right += snd.audio2.vol_right * sample;
185            left += state->audio2.vol_left * sample;
186            right += state->audio2.vol_right * sample;
176187         }
177188      }
178189
179      if ( snd.audio3.on ) {
180         sample = snd.audio3.signal;
181         snd.audio3.pos++;
182         if ( snd.audio3.pos >= snd.audio3.period / 2 ) {
183            snd.audio3.pos = 0;
184            snd.audio3.signal = -snd.audio3.signal;
190      if ( state->audio3.on ) {
191         sample = state->audio3.signal;
192         state->audio3.pos++;
193         if ( state->audio3.pos >= state->audio3.period / 2 ) {
194            state->audio3.pos = 0;
195            state->audio3.signal = -state->audio3.signal;
185196         }
186         if ( snd.audio3_sweep && snd.sweep_time ) {
187            snd.sweep_count++;
188            if ( snd.sweep_count >= snd.sweep_time ) {
189               snd.sweep_count = 0;
190               snd.audio3.freq += snd.sweep_step;
191               snd.audio3.period = device->machine->sample_rate / ( 3072000  / ( ( 2048 - snd.audio3.freq ) << 5 ) );
197         if ( state->audio3_sweep && state->sweep_time ) {
198            state->sweep_count++;
199            if ( state->sweep_count >= state->sweep_time ) {
200               state->sweep_count = 0;
201               state->audio3.freq += state->sweep_step;
202               state->audio3.period = device->machine->sample_rate / ( 3072000  / ( ( 2048 - state->audio3.freq ) << 5 ) );
192203            }
193204         }
194         left += snd.audio3.vol_left * sample;
195         right += snd.audio3.vol_right * sample;
205         left += state->audio3.vol_left * sample;
206         right += state->audio3.vol_right * sample;
196207      }
197208
198      if ( snd.audio4.on ) {
199         if ( snd.audio4_noise ) {
209      if ( state->audio4.on ) {
210         if ( state->audio4_noise ) {
200211            sample = 0;
201212         } else {
202            sample = snd.audio4.signal;
203            snd.audio4.pos++;
204            if ( snd.audio4.pos >= snd.audio4.period / 2 ) {
205               snd.audio4.pos = 0;
206               snd.audio4.signal = -snd.audio4.signal;
213            sample = state->audio4.signal;
214            state->audio4.pos++;
215            if ( state->audio4.pos >= state->audio4.period / 2 ) {
216               state->audio4.pos = 0;
217               state->audio4.signal = -state->audio4.signal;
207218            }
208219         }
209         left += snd.audio4.vol_left * sample;
210         right += snd.audio4.vol_right * sample;
220         left += state->audio4.vol_left * sample;
221         right += state->audio4.vol_right * sample;
211222      }
212223
213224      left <<= 5;
r9589r9590
220231
221232static DEVICE_START(wswan_sound)
222233{
223   channel = stream_create(device, 0, 2, device->machine->sample_rate, 0, wswan_sh_update);
234   wswan_sound_state *state = get_safe_token(device);
235   state->channel = stream_create(device, 0, 2, device->machine->sample_rate, 0, wswan_sh_update);
224236
225   snd.audio1.on = 0;
226   snd.audio1.signal = 16;
227   snd.audio1.pos = 0;
228   snd.audio2.on = 0;
229   snd.audio2.signal = 16;
230   snd.audio2.pos = 0;
231   snd.audio3.on = 0;
232   snd.audio3.signal = 16;
233   snd.audio3.pos = 0;
234   snd.audio4.on = 0;
235   snd.audio4.signal = 16;
236   snd.audio4.pos = 0;
237   state->audio1.on = 0;
238   state->audio1.signal = 16;
239   state->audio1.pos = 0;
240   state->audio2.on = 0;
241   state->audio2.signal = 16;
242   state->audio2.pos = 0;
243   state->audio3.on = 0;
244   state->audio3.signal = 16;
245   state->audio3.pos = 0;
246   state->audio4.on = 0;
247   state->audio4.signal = 16;
248   state->audio4.pos = 0;
237249}
238250
239251
r9589r9590
241253{
242254   switch (state)
243255   {
256      /* --- the following bits of info are returned as 64-bit signed integers --- */
257      case DEVINFO_INT_TOKEN_BYTES:               info->i = sizeof(wswan_sound_state);         break;
258
244259      /* --- the following bits of info are returned as pointers to data or functions --- */
245260      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(wswan_sound);   break;
246261
src/mess/audio/channelf.c
r9589r9590
44#include "streams.h"
55#include "includes/channelf.h"
66
7static sound_stream *channel;
8static int sound_mode;
9static int incr;
10static float decay_mult;
11static int envelope;
12static UINT32 sample_counter = 0;
13static int forced_ontime;           //  added for improved sound
14static int min_ontime;              //  added for improved sound
157
168static const int max_amplitude = 0x7fff;
179
10typedef struct _channelf_sound_state channelf_sound_state;
11struct _channelf_sound_state
12{
13   sound_stream *channel;
14   int sound_mode;
15   int incr;
16   float decay_mult;
17   int envelope;
18   UINT32 sample_counter;
19   int forced_ontime;           //  added for improved sound
20   int min_ontime;              //  added for improved sound
21};
1822
23INLINE channelf_sound_state *get_safe_token(running_device *device)
24{
25   assert(device != NULL);
26   assert(device->type() == CHANNELF);
27   return (channelf_sound_state *)downcast<legacy_device_base *>(device)->token();
28}
1929
20void channelf_sound_w(running_machine *machine, int mode)
30void channelf_sound_w(running_device *device, int mode)
2131{
22   if (mode == sound_mode)
32   channelf_sound_state *state = get_safe_token(device);
33   if (mode == state->sound_mode)
2334      return;
2435
25    stream_update(channel);
26   sound_mode = mode;
36   stream_update(state->channel);
37   state->sound_mode = mode;
2738
28    switch(mode)
29    {
39   switch(mode)
40   {
3041      case 0:
31         envelope = 0;
32         forced_ontime = 0;     //  added for improved sound
42         state->envelope = 0;
43         state->forced_ontime = 0;     //  added for improved sound
3344         break;
3445      case 1:
3546      case 2:
3647      case 3:
37         envelope = max_amplitude;
38         forced_ontime = min_ontime;   //  added for improved sound
48         state->envelope = max_amplitude;
49         state->forced_ontime = state->min_ontime;   //  added for improved sound
3950         break;
4051   }
4152}
r9589r9590
4455
4556static STREAM_UPDATE( channelf_sh_update )
4657{
58   channelf_sound_state *state = get_safe_token(device);
4759   UINT32 mask = 0, target = 0;
4860   stream_sample_t *buffer = outputs[0];
4961   stream_sample_t *sample = buffer;
5062
51   switch( sound_mode )
63   switch( state->sound_mode )
5264   {
5365      case 0: /* sound off */
5466         memset(buffer,0,sizeof(*buffer)*samples);
r9589r9590
7082
7183   while (samples-- > 0)
7284   {
73      if ((forced_ontime > 0) || ((sample_counter & mask) == target))   //  change made for improved sound
74         *sample++ = envelope;
85      if ((state->forced_ontime > 0) || ((state->sample_counter & mask) == target))   //  change made for improved sound
86         *sample++ = state->envelope;
7587      else
7688         *sample++ = 0;
77      sample_counter += incr;
78      envelope *= decay_mult;
79      if (forced_ontime > 0)          //  added for improved sound
80         forced_ontime -= 1;      //  added for improved sound
89      state->sample_counter += state->incr;
90      state->envelope *= state->decay_mult;
91      if (state->forced_ontime > 0)          //  added for improved sound
92         state->forced_ontime -= 1;      //  added for improved sound
8193   }
8294}
8395
r9589r9590
8597
8698static DEVICE_START(channelf_sound)
8799{
100   channelf_sound_state *state = get_safe_token(device);
88101   int rate;
89102
90   channel = stream_create(device, 0, 1, device->machine->sample_rate, 0, channelf_sh_update);
103   state->channel = stream_create(device, 0, 1, device->machine->sample_rate, 0, channelf_sh_update);
91104   rate = device->machine->sample_rate;
92105
93106   /*
r9589r9590
109122     */
110123
111124   /* This is the proper value to add per sample */
112   incr = 65536.0/(rate/1000.0/2.0);
125   state->incr = 65536.0/(rate/1000.0/2.0);
113126
114127   //  added for improved sound
115128   /* This is the minimum forced ontime, in samples */
116   min_ontime = rate/1000*2;  /* approx 2ms - estimated, not verified on HW */
129   state->min_ontime = rate/1000*2;  /* approx 2ms - estimated, not verified on HW */
117130
118   /* This was measured, decay envelope with half life of ~9ms */
131   /* This was measured, decay state->envelope with half life of ~9ms */
119132   /* (this is decay multiplier per sample) */
120   decay_mult = exp((-0.693/9e-3)/rate);
133   state->decay_mult = exp((-0.693/9e-3)/rate);
121134
122135   /* initial conditions */
123   envelope = 0;
136   state->envelope = 0;
124137}
125138
126139
r9589r9590
128141{
129142   switch (state)
130143   {
144      /* --- the following bits of info are returned as 64-bit signed integers --- */
145      case DEVINFO_INT_TOKEN_BYTES:               info->i = sizeof(channelf_sound_state);         break;
146
131147      /* --- the following bits of info are returned as pointers to data or functions --- */
132148      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(channelf_sound);   break;
133149
src/mess/audio/svision.c
r9589r9590
88#include "streams.h"
99#include "includes/svision.h"
1010
11typedef enum
12{
13   SVISION_NOISE_Type7Bit,
14   SVISION_NOISE_Type14Bit
15} SVISION_NOISE_Type;
1116
12static sound_stream *mixer_channel;
17typedef struct
18{
19   UINT8 reg[3];
20   int on, right, left, play;
21   SVISION_NOISE_Type type;
22   int state;
23   int volume;
24   int count;
25   double step, pos;
26   int value; // currently simple random function
27} SVISION_NOISE;
1328
14SVISION_DMA svision_dma;
29typedef struct
30{
31   UINT8 reg[5];
32   int on, right, left;
33   int ca14to16;
34   int start,size;
35   double pos, step;
36   int finished;
37} SVISION_DMA;
1538
16SVISION_NOISE svision_noise;
39typedef struct
40{
41   UINT8 reg[4];
42   int on;
43   int waveform, volume;
44   int pos;
45   int size;
46   int count;
47} SVISION_CHANNEL;
1748
18SVISION_CHANNEL svision_channel[2];
49typedef struct _svision_sound_state svision_sound_state;
50struct _svision_sound_state
51{
52   sound_stream *mixer_channel;
53   SVISION_DMA dma;
54   SVISION_NOISE noise;
55   SVISION_CHANNEL channel[2];
56};
1957
20WRITE8_HANDLER( svision_sounddma_w )
58
59INLINE svision_sound_state *get_safe_token(running_device *device)
2160{
22   logerror("%.6f svision snddma write %04x %02x\n", attotime_to_double(timer_get_time(space->machine)),offset+0x18,data);
23   svision_dma.reg[offset] = data;
61   assert(device != NULL);
62   assert(device->type() == SVISION);
63   return (svision_sound_state *)downcast<legacy_device_base *>(device)->token();
64}
65
66int *svision_dma_finished(running_device *device)
67{
68   svision_sound_state *state = get_safe_token(device);
69   return &state->dma.finished;
70}
71
72void svision_sound_decrement(running_device *device)
73{
74   svision_sound_state *state = get_safe_token(device);
75
76   if (state->channel[0].count > 0)
77      state->channel[0].count--;
78   if (state->channel[1].count > 0)
79      state->channel[1].count--;
80   if (state->noise.count > 0)
81      state->noise.count--;
82}
83
84WRITE8_DEVICE_HANDLER( svision_sounddma_w )
85{
86   svision_sound_state *state = get_safe_token(device);
87   logerror("%.6f svision snddma write %04x %02x\n", attotime_to_double(timer_get_time(device->machine)),offset+0x18,data);
88   state->dma.reg[offset] = data;
2489   switch (offset)
2590   {
2691      case 0:
2792      case 1:
28         svision_dma.start = (svision_dma.reg[0] | (svision_dma.reg[1] << 8));
93         state->dma.start = (state->dma.reg[0] | (state->dma.reg[1] << 8));
2994         break;
3095      case 2:
31         svision_dma.size = (data ? data : 0x100) * 32;
96         state->dma.size = (data ? data : 0x100) * 32;
3297         break;
3398      case 3:
34         svision_dma.step = cputag_get_clock(space->machine, "maincpu") / (256.0 * space->machine->sample_rate * (1 + (data & 3)));
35         svision_dma.right = data & 4;
36         svision_dma.left = data & 8;
37         svision_dma.ca14to16 = ((data & 0x70) >> 4) << 14;
99         state->dma.step = cputag_get_clock(device->machine, "maincpu") / (256.0 * device->machine->sample_rate * (1 + (data & 3)));
100         state->dma.right = data & 4;
101         state->dma.left = data & 8;
102         state->dma.ca14to16 = ((data & 0x70) >> 4) << 14;
38103         break;
39104      case 4:
40         svision_dma.on = data & 0x80;
41         if (svision_dma.on)
105         state->dma.on = data & 0x80;
106         if (state->dma.on)
42107         {
43            svision_dma.pos = 0.0;
108            state->dma.pos = 0.0;
44109         }
45110         break;
46111   }
47112}
48113
49WRITE8_HANDLER( svision_noise_w )
114WRITE8_DEVICE_HANDLER( svision_noise_w )
50115{
116   svision_sound_state *state = get_safe_token(device);
51117   //  logerror("%.6f svision noise write %04x %02x\n",timer_get_time(machine),offset+0x28,data);
52   svision_noise.reg[offset]=data;
118   state->noise.reg[offset]=data;
53119   switch (offset)
54120   {
55121      case 0:
56         svision_noise.volume=data&0xf;
57         svision_noise.step= cputag_get_clock(space->machine, "maincpu") / (256.0*space->machine->sample_rate*(1+(data>>4)));
122         state->noise.volume=data&0xf;
123         state->noise.step= cputag_get_clock(device->machine, "maincpu") / (256.0*device->machine->sample_rate*(1+(data>>4)));
58124         break;
59125      case 1:
60         svision_noise.count = data + 1;
126         state->noise.count = data + 1;
61127         break;
62128      case 2:
63         svision_noise.type = (SVISION_NOISE_Type) (data & 1);
64         svision_noise.play = data & 2;
65         svision_noise.right = data & 4;
66         svision_noise.left = data & 8;
67         svision_noise.on = data & 0x10; /* honey bee start */
68         svision_noise.state = 1;
129         state->noise.type = (SVISION_NOISE_Type) (data & 1);
130         state->noise.play = data & 2;
131         state->noise.right = data & 4;
132         state->noise.left = data & 8;
133         state->noise.on = data & 0x10; /* honey bee start */
134         state->noise.state = 1;
69135         break;
70136   }
71   svision_noise.pos=0.0;
137   state->noise.pos=0.0;
72138}
73139
74void svision_soundport_w (running_machine *machine, SVISION_CHANNEL *channel, int offset, int data)
140void svision_soundport_w(running_device *device, int which, int offset, int data)
75141{
142   svision_sound_state *state = get_safe_token(device);
143   SVISION_CHANNEL *channel = &state->channel[which];
76144   UINT16 size;
77145
78   stream_update(mixer_channel);
146   stream_update(state->mixer_channel);
79147   channel->reg[offset] = data;
80148
81149   switch (offset)
r9589r9590
85153         size = channel->reg[0] | ((channel->reg[1] & 7) << 8);
86154         if (size)
87155         {
88            //  channel->size=(int)(machine->sample_rate*(size<<5)/4e6);
89            channel->size= (int) (machine->sample_rate * (size << 5) / cputag_get_clock(machine, "maincpu"));
156            //  channel->size=(int)(device->machine->sample_rate*(size<<5)/4e6);
157            channel->size= (int) (device->machine->sample_rate * (size << 5) / cputag_get_clock(device->machine, "maincpu"));
90158         }
91159         else
92160         {
r9589r9590
110178/************************************/
111179static STREAM_UPDATE( svision_update )
112180{
181   svision_sound_state *state = get_safe_token(device);
113182   stream_sample_t *left=outputs[0], *right=outputs[1];
114183   int i, j;
115184   SVISION_CHANNEL *channel;
r9589r9590
118187   {
119188      *left = 0;
120189      *right = 0;
121      for (channel=svision_channel, j=0; j<ARRAY_LENGTH(svision_channel); j++, channel++)
190      for (channel=state->channel, j=0; j<ARRAY_LENGTH(state->channel); j++, channel++)
122191      {
123192         if (channel->size != 0)
124193         {
r9589r9590
154223               channel->pos = 0;
155224         }
156225      }
157      if (svision_noise.on && (svision_noise.play || svision_noise.count))
226      if (state->noise.on && (state->noise.play || state->noise.count))
158227      {
159         INT16 s = (svision_noise.value ? 1 << 8: 0) * svision_noise.volume;
228         INT16 s = (state->noise.value ? 1 << 8: 0) * state->noise.volume;
160229         int b1, b2;
161         if (svision_noise.left)
230         if (state->noise.left)
162231            *left += s;
163         if (svision_noise.right)
232         if (state->noise.right)
164233            *right += s;
165         svision_noise.pos += svision_noise.step;
166         if (svision_noise.pos >= 1.0)
234         state->noise.pos += state->noise.step;
235         if (state->noise.pos >= 1.0)
167236         {
168            switch (svision_noise.type)
237            switch (state->noise.type)
169238            {
170239               case SVISION_NOISE_Type7Bit:
171                  svision_noise.value = svision_noise.state & 0x40 ? 1 : 0;
172                  b1 = (svision_noise.state & 0x40) != 0;
173                  b2 = (svision_noise.state & 0x20) != 0;
174                  svision_noise.state=(svision_noise.state<<1)+(b1!=b2?1:0);
240                  state->noise.value = state->noise.state & 0x40 ? 1 : 0;
241                  b1 = (state->noise.state & 0x40) != 0;
242                  b2 = (state->noise.state & 0x20) != 0;
243                  state->noise.state=(state->noise.state<<1)+(b1!=b2?1:0);
175244                  break;
176245               case SVISION_NOISE_Type14Bit:
177246               default:
178                  svision_noise.value = svision_noise.state & 0x2000 ? 1 : 0;
179                  b1 = (svision_noise.state & 0x2000) != 0;
180                  b2 = (svision_noise.state & 0x1000) != 0;
181                  svision_noise.state = (svision_noise.state << 1) + (b1 != b2 ? 1 : 0);
247                  state->noise.value = state->noise.state & 0x2000 ? 1 : 0;
248                  b1 = (state->noise.state & 0x2000) != 0;
249                  b2 = (state->noise.state & 0x1000) != 0;
250                  state->noise.state = (state->noise.state << 1) + (b1 != b2 ? 1 : 0);
182251            }
183            svision_noise.pos -= 1;
252            state->noise.pos -= 1;
184253         }
185254      }
186      if (svision_dma.on)
255      if (state->dma.on)
187256      {
188257         UINT8 sample;
189258         INT16 s;
190         UINT16 addr = svision_dma.start + (unsigned) svision_dma.pos / 2;
259         UINT16 addr = state->dma.start + (unsigned) state->dma.pos / 2;
191260         if (addr >= 0x8000 && addr < 0xc000)
192261         {
193            sample = memory_region(device->machine, "user1")[(addr & 0x3fff) | svision_dma.ca14to16];
262            sample = memory_region(device->machine, "user1")[(addr & 0x3fff) | state->dma.ca14to16];
194263         }
195264         else
196265         {
197266            sample = cputag_get_address_space(device->machine,"maincpu", ADDRESS_SPACE_PROGRAM)->read_byte(addr);
198267         }
199         if (((unsigned)svision_dma.pos) & 1)
268         if (((unsigned)state->dma.pos) & 1)
200269            s = (sample & 0xf);
201270         else
202271            s = (sample & 0xf0) >> 4;
203272         s <<= 8;
204         if (svision_dma.left)
273         if (state->dma.left)
205274            *left += s;
206         if (svision_dma.right)
275         if (state->dma.right)
207276            *right += s;
208         svision_dma.pos += svision_dma.step;
209         if (svision_dma.pos >= svision_dma.size)
277         state->dma.pos += state->dma.step;
278         if (state->dma.pos >= state->dma.size)
210279         {
211            svision_dma.finished = TRUE;
212            svision_dma.on = FALSE;
280            state->dma.finished = TRUE;
281            state->dma.on = FALSE;
213282            svision_irq( device->machine );
214283         }
215284      }
r9589r9590
220289/* Sound handler start              */
221290/************************************/
222291
223static DEVICE_START(svision_sound)
292static DEVICE_START( svision_sound )
224293{
225   memset(&svision_dma, 0, sizeof(svision_dma));
226   memset(&svision_noise, 0, sizeof(svision_noise));
227   memset(svision_channel, 0, sizeof(svision_channel));
294   svision_sound_state *state = get_safe_token(device);
295   memset(&state->dma, 0, sizeof(state->dma));
296   memset(&state->noise, 0, sizeof(state->noise));
297   memset(state->channel, 0, sizeof(state->channel));
228298
229   mixer_channel = stream_create(device, 0, 2, device->machine->sample_rate, 0, svision_update);
299   state->mixer_channel = stream_create(device, 0, 2, device->machine->sample_rate, 0, svision_update);
230300}
231301
232302
r9589r9590
234304{
235305   switch (state)
236306   {
307      /* --- the following bits of info are returned as 64-bit signed integers --- */
308      case DEVINFO_INT_TOKEN_BYTES:               info->i = sizeof(svision_sound_state);         break;
309
237310      /* --- the following bits of info are returned as pointers to data or functions --- */
238311      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(svision_sound);   break;
239312
src/mess/audio/lynx.c
r9589r9590
7979AUD_A_RIGHT EQU %00000001
8080
8181 */
82static sound_stream *mixer_channel;
83static int usec_per_sample;
84static int *shift_mask;
85static int *shift_xor;
8682
8783typedef struct {
8884    union {
r9589r9590
104100    int ticks;
105101    int count;
106102} LYNX_AUDIO;
107static LYNX_AUDIO lynx_audio[4];
108103
104typedef struct _lynx_sound_state lynx_sound_state;
105struct _lynx_sound_state
106{
107   sound_stream *mixer_channel;
108   int usec_per_sample;
109   int *shift_mask;
110   int *shift_xor;
111   UINT8 attenuation_enable;
112   UINT8 master_enable;
113   LYNX_AUDIO audio[4];
114};
115
116INLINE lynx_sound_state *get_safe_token(running_device *device)
117{
118   assert(device != NULL);
119   assert(device->type() == LYNX || device->type() == LYNX2);
120   return (lynx_sound_state *)downcast<legacy_device_base *>(device)->token();
121}
122
109123static void lynx_audio_reset_channel(LYNX_AUDIO *This)
110124{
111125    memset(This->reg.data, 0, (char*)(This+1)-(char*)(This->reg.data));
112126}
113127
114void lynx_audio_count_down(running_machine *machine, int nr)
128void lynx_audio_count_down(running_device *device, int nr)
115129{
116    LYNX_AUDIO *This=lynx_audio+nr;
130    lynx_sound_state *state = get_safe_token(device);
131    LYNX_AUDIO *This=state->audio+nr;
117132    if (This->reg.n.control1&8 && (This->reg.n.control1&7)!=7) return;
118    if (nr==0) stream_update(mixer_channel);
133    if (nr==0) stream_update(state->mixer_channel);
119134    This->count--;
120135}
121136
122static void lynx_audio_shift(running_machine *machine, LYNX_AUDIO *channel)
137static void lynx_audio_shift(running_device *device, LYNX_AUDIO *channel)
123138{
124    int nr = (int)(channel - lynx_audio);
139    lynx_sound_state *state = get_safe_token(device);
140    int nr = (int)(channel - state->audio);
125141    channel->shifter=((channel->shifter<<1)&0x3ff)
126   |shift_xor[channel->shifter&channel->mask];
142   |state->shift_xor[channel->shifter&channel->mask];
127143
128144    if (channel->reg.n.control1&0x20) {
129145   if (channel->shifter&1) {
r9589r9590
133149   }
134150    }
135151    switch (nr) {
136    case 0: lynx_audio_count_down(machine, 1); break;
137    case 1: lynx_audio_count_down(machine, 2); break;
138    case 2: lynx_audio_count_down(machine, 3); break;
139    case 3: lynx_timer_count_down(machine, 1); break;
152    case 0: lynx_audio_count_down(device, 1); break;
153    case 1: lynx_audio_count_down(device, 2); break;
154    case 2: lynx_audio_count_down(device, 3); break;
155    case 3: lynx_timer_count_down(device->machine, 1); break;
140156    }
141157}
142158
143static void lynx_audio_execute(running_machine *machine, LYNX_AUDIO *channel)
159static void lynx_audio_execute(running_device *device, LYNX_AUDIO *channel)
144160{
161    lynx_sound_state *state = get_safe_token(device);
145162    if (channel->reg.n.control1&8) { // count_enable
146   channel->ticks+=usec_per_sample;
163        channel->ticks+=state->usec_per_sample;
147164   if ((channel->reg.n.control1&7)==7) { // timer input
148165       if (channel->count<0) {
149166      channel->count+=channel->reg.n.counter;
150      lynx_audio_shift(machine, channel);
167      lynx_audio_shift(device, channel);
151168       }
152169   } else {
153170       int t=1<<(channel->reg.n.control1&7);
r9589r9590
157174      if (channel->ticks<t) break;
158175      if (channel->count<0) {
159176          channel->count=channel->reg.n.counter;
160          lynx_audio_shift(machine, channel);
177          lynx_audio_shift(device, channel);
161178      }
162179       }
163180   }
r9589r9590
170187    }
171188}
172189
173static UINT8 attenuation_enable;
174static UINT8 master_enable;
175190
176UINT8 lynx_audio_read(int offset)
191UINT8 lynx_audio_read(running_device *device, int offset)
177192{
193    lynx_sound_state *state = get_safe_token(device);
178194    UINT8 data=0;
179    stream_update(mixer_channel);
195    stream_update(state->mixer_channel);
180196    switch (offset) {
181197    case 0x20: case 0x21: case 0x22: case 0x24: case 0x25:
182198    case 0x28: case 0x29: case 0x2a: case 0x2c: case 0x2d:
183199    case 0x30: case 0x31: case 0x32: case 0x34: case 0x35:
184200    case 0x38: case 0x39: case 0x3a: case 0x3c: case 0x3d:
185   data=lynx_audio[(offset>>3)&3].reg.data[offset&7];
201   data=state->audio[(offset>>3)&3].reg.data[offset&7];
186202   break;
187203    case 0x23: case 0x2b: case 0x33: case 0x3b:
188   data=lynx_audio[(offset>>3)&3].shifter&0xff;
204   data=state->audio[(offset>>3)&3].shifter&0xff;
189205   break;
190206    case 0x26:case 0x2e:case 0x36:case 0x3e:
191   data=lynx_audio[(offset>>3)&3].count;
207   data=state->audio[(offset>>3)&3].count;
192208   break;
193209    case 0x27: case 0x2f: case 0x37: case 0x3f:
194   data=(lynx_audio[(offset>>3)&3].shifter>>4)&0xf0;
195   data|=lynx_audio[(offset>>3)&3].reg.data[offset&7]&0x0f;
210   data=(state->audio[(offset>>3)&3].shifter>>4)&0xf0;
211   data|=state->audio[(offset>>3)&3].reg.data[offset&7]&0x0f;
196212   break;
197213    case 0x40: case 0x41: case 0x42: case 0x43:
198   data=lynx_audio[offset&3].attenuation;
214   data=state->audio[offset&3].attenuation;
199215   break;
200216    case 0x44:
201   data=attenuation_enable;
217   data=state->attenuation_enable;
202218   break;
203219    case 0x50:
204   data=master_enable;
220   data=state->master_enable;
205221   break;
206222    }
207223    return data;
208224}
209225
210void lynx_audio_write(int offset, UINT8 data)
226void lynx_audio_write(running_device *device, int offset, UINT8 data)
211227{
228   lynx_sound_state *state = get_safe_token(device);
212229//  logerror("%.6f audio write %.2x %.2x\n", timer_get_time(machine), offset, data);
213    LYNX_AUDIO *channel=lynx_audio+((offset>>3)&3);
214    stream_update(mixer_channel);
230    LYNX_AUDIO *channel=state->audio+((offset>>3)&3);
231    stream_update(state->mixer_channel);
215232    switch (offset) {
216233    case 0x20: case 0x22: case 0x24: case 0x26:
217234    case 0x28: case 0x2a: case 0x2c: case 0x2e:
218235    case 0x30: case 0x32: case 0x34: case 0x36:
219236    case 0x38: case 0x3a: case 0x3c: case 0x3e:
220   lynx_audio[(offset>>3)&3].reg.data[offset&7]=data;
237   state->audio[(offset>>3)&3].reg.data[offset&7]=data;
221238   break;
222239    case 0x23: case 0x2b: case 0x33: case 0x3b:
223   lynx_audio[(offset>>3)&3].reg.data[offset&7]=data;
224   lynx_audio[(offset>>3)&3].shifter&=~0xff;
225   lynx_audio[(offset>>3)&3].shifter|=data;
240   state->audio[(offset>>3)&3].reg.data[offset&7]=data;
241   state->audio[(offset>>3)&3].shifter&=~0xff;
242   state->audio[(offset>>3)&3].shifter|=data;
226243   break;
227244    case 0x27: case 0x2f: case 0x37: case 0x3f:
228   lynx_audio[(offset>>3)&3].reg.data[offset&7]=data;
229   lynx_audio[(offset>>3)&3].shifter&=~0xf00;
230   lynx_audio[(offset>>3)&3].shifter|=(data&0xf0)<<4;
245   state->audio[(offset>>3)&3].reg.data[offset&7]=data;
246   state->audio[(offset>>3)&3].shifter&=~0xf00;
247   state->audio[(offset>>3)&3].shifter|=(data&0xf0)<<4;
231248   break;
232249    case 0x21: case 0x25:
233250    case 0x29: case 0x2d:
r9589r9590
238255   channel->mask|=(channel->reg.data[5]&0x80)<<1;
239256   break;
240257    case 0x40: case 0x41: case 0x42: case 0x43: // lynx2 only, howard extension board
241   lynx_audio[offset&3].attenuation=data;
258   state->audio[offset&3].attenuation=data;
242259   break;
243260    case 0x44:
244   attenuation_enable=data; //lynx2 only, howard extension board
261   state->attenuation_enable=data; //lynx2 only, howard extension board
245262   break;
246263    case 0x50:
247   master_enable=data;//lynx2 only, howard write only
264   state->master_enable=data;//lynx2 only, howard write only
248265   break;
249266    }
250267}
r9589r9590
254271/************************************/
255272static STREAM_UPDATE( lynx_update )
256273{
274   lynx_sound_state *state = get_safe_token(device);
257275   int i, j;
258276   LYNX_AUDIO *channel;
259277   int v;
r9589r9590
262280   for (i = 0; i < samples; i++, buffer++)
263281   {
264282      *buffer = 0;
265      for (channel=lynx_audio, j=0; j<ARRAY_LENGTH(lynx_audio); j++, channel++)
283      for (channel=state->audio, j=0; j<ARRAY_LENGTH(state->audio); j++, channel++)
266284      {
267         lynx_audio_execute(device->machine, channel);
285         lynx_audio_execute(device, channel);
268286         v=channel->reg.n.output;
269287         *buffer+=v*15;
270288      }
r9589r9590
273291
274292static STREAM_UPDATE( lynx2_update )
275293{
294   lynx_sound_state *state = get_safe_token(device);
276295   stream_sample_t *left=outputs[0], *right=outputs[1];
277296   int i, j;
278297   LYNX_AUDIO *channel;
r9589r9590
282301   {
283302      *left = 0;
284303      *right= 0;
285      for (channel=lynx_audio, j=0; j<ARRAY_LENGTH(lynx_audio); j++, channel++)
304      for (channel=state->audio, j=0; j<ARRAY_LENGTH(state->audio); j++, channel++)
286305      {
287         lynx_audio_execute(device->machine, channel);
306         lynx_audio_execute(device, channel);
288307         v=channel->reg.n.output;
289         if (!(master_enable&(0x10<<j)))
308         if (!(state->master_enable&(0x10<<j)))
290309         {
291            if (attenuation_enable&(0x10<<j)) {
310            if (state->attenuation_enable&(0x10<<j)) {
292311               *left+=v*(channel->attenuation>>4);
293312            } else {
294313               *left+=v*15;
295314            }
296315         }
297         if (!(master_enable&(1<<j)))
316         if (!(state->master_enable&(1<<j)))
298317         {
299            if (attenuation_enable&(1<<j)) {
318            if (state->attenuation_enable&(1<<j)) {
300319               *right+=v*(channel->attenuation&0xf);
301320            } else {
302321               *right+=v*15;
r9589r9590
306325   }
307326}
308327
309static void lynx_audio_init(running_machine *machine)
328static void lynx_audio_init(running_device *device)
310329{
330   lynx_sound_state *state = get_safe_token(device);
311331   int i;
312   shift_mask = auto_alloc_array(machine, int, 512);
313   assert(shift_mask);
332   state->shift_mask = auto_alloc_array(device->machine, int, 512);
333   assert(state->shift_mask);
314334
315   shift_xor = auto_alloc_array(machine, int, 4096);
316   assert(shift_xor);
335   state->shift_xor = auto_alloc_array(device->machine, int, 4096);
336   assert(state->shift_xor);
317337
318338   for (i=0; i<512; i++)
319339   {
320      shift_mask[i]=0;
321      if (i&1) shift_mask[i]|=1;
322      if (i&2) shift_mask[i]|=2;
323      if (i&4) shift_mask[i]|=4;
324      if (i&8) shift_mask[i]|=8;
325      if (i&0x10) shift_mask[i]|=0x10;
326      if (i&0x20) shift_mask[i]|=0x20;
327      if (i&0x40) shift_mask[i]|=0x400;
328      if (i&0x80) shift_mask[i]|=0x800;
329      if (i&0x100) shift_mask[i]|=0x80;
340      state->shift_mask[i]=0;
341      if (i&1) state->shift_mask[i]|=1;
342      if (i&2) state->shift_mask[i]|=2;
343      if (i&4) state->shift_mask[i]|=4;
344      if (i&8) state->shift_mask[i]|=8;
345      if (i&0x10) state->shift_mask[i]|=0x10;
346      if (i&0x20) state->shift_mask[i]|=0x20;
347      if (i&0x40) state->shift_mask[i]|=0x400;
348      if (i&0x80) state->shift_mask[i]|=0x800;
349      if (i&0x100) state->shift_mask[i]|=0x80;
330350   }
331351   for (i=0; i<4096; i++)
332352   {
333353      int j;
334      shift_xor[i]=1;
354      state->shift_xor[i]=1;
335355      for (j=4096/2; j>0; j>>=1)
336356      {
337357         if (i & j)
338            shift_xor[i] ^= 1;
358            state->shift_xor[i] ^= 1;
339359      }
340360   }
341361}
342362
343void lynx_audio_reset(void)
363static DEVICE_RESET( lynx_sound )
344364{
365   lynx_sound_state *state = get_safe_token(device);
345366   int i;
346   for (i=0; i<ARRAY_LENGTH(lynx_audio); i++)
367   for (i=0; i<ARRAY_LENGTH(state->audio); i++)
347368   {
348      lynx_audio_reset_channel(lynx_audio+i);
369      lynx_audio_reset_channel(state->audio+i);
349370   }
350371}
351372
r9589r9590
357378
358379static DEVICE_START(lynx_sound)
359380{
360   mixer_channel = stream_create(device, 0, 1, device->machine->sample_rate, 0, lynx_update);
381   lynx_sound_state *state = get_safe_token(device);
382   state->mixer_channel = stream_create(device, 0, 1, device->machine->sample_rate, 0, lynx_update);
361383
362   usec_per_sample = 1000000 / device->machine->sample_rate;
384   state->usec_per_sample = 1000000 / device->machine->sample_rate;
363385
364   lynx_audio_init(device->machine);
386   lynx_audio_init(device);
365387}
366388
367389
368390static DEVICE_START(lynx2_sound)
369391{
370    mixer_channel = stream_create(device, 0, 2, device->machine->sample_rate, 0, lynx2_update);
392   lynx_sound_state *state = get_safe_token(device);
393   state->mixer_channel = stream_create(device, 0, 2, device->machine->sample_rate, 0, lynx2_update);
371394
372    usec_per_sample = 1000000 / device->machine->sample_rate;
395   state->usec_per_sample = 1000000 / device->machine->sample_rate;
373396
374    lynx_audio_init(device->machine);
397   lynx_audio_init(device);
375398}
376399
377400
r9589r9590
379402{
380403   switch (state)
381404   {
405      /* --- the following bits of info are returned as 64-bit signed integers --- */
406      case DEVINFO_INT_TOKEN_BYTES:               info->i = sizeof(lynx_sound_state);         break;
407
382408      /* --- the following bits of info are returned as pointers to data or functions --- */
383409      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(lynx_sound);   break;
410      case DEVINFO_FCT_RESET:                     info->start = DEVICE_RESET_NAME(lynx_sound);   break;
384411
385412      /* --- the following bits of info are returned as NULL-terminated strings --- */
386413      case DEVINFO_STR_NAME:                     strcpy(info->s, "Mikey");            break;
r9589r9590
393420{
394421   switch (state)
395422   {
423      /* --- the following bits of info are returned as 64-bit signed integers --- */
424      case DEVINFO_INT_TOKEN_BYTES:               info->i = sizeof(lynx_sound_state);         break;
425
396426      /* --- the following bits of info are returned as pointers to data or functions --- */
397427      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(lynx2_sound);   break;
428      case DEVINFO_FCT_RESET:                     info->start = DEVICE_RESET_NAME(lynx_sound);   break;
398429
399430      /* --- the following bits of info are returned as NULL-terminated strings --- */
400431      case DEVINFO_STR_NAME:                     strcpy(info->s, "Mikey (Lynx II)");            break;
src/mess/audio/special.c
r9589r9590
1313#include "streams.h"
1414#include "includes/special.h"
1515
16typedef struct _specimx_sound_state specimx_sound_state;
17struct _specimx_sound_state
18{
19   sound_stream *mixer_channel;
20   int specimx_input[3];
21};
22
1623static STREAM_UPDATE( specimx_sh_update );
1724
18static sound_stream *mixer_channel;
19static int specimx_input[3];
25INLINE specimx_sound_state *get_safe_token(running_device *device)
26{
27   assert(device != NULL);
28   assert(device->type() == SPECIMX);
29   return (specimx_sound_state *)downcast<legacy_device_base *>(device)->token();
30}
2031
2132static DEVICE_START(specimx_sound)
2233{
23   specimx_input[0] = specimx_input[1] = specimx_input[2] = 0;
24   mixer_channel = stream_create(device, 0, 1, device->machine->sample_rate, 0, specimx_sh_update);
34   specimx_sound_state *state = get_safe_token(device);
35   state->specimx_input[0] = state->specimx_input[1] = state->specimx_input[2] = 0;
36   state->mixer_channel = stream_create(device, 0, 1, device->machine->sample_rate, 0, specimx_sh_update);
2537}
2638
2739static STREAM_UPDATE( specimx_sh_update )
2840{
41   specimx_sound_state *state = get_safe_token(device);
2942   INT16 channel_0_signal;
3043   INT16 channel_1_signal;
3144   INT16 channel_2_signal;
3245
3346   stream_sample_t *sample_left = outputs[0];
3447
35   channel_0_signal = specimx_input[0] ? 3000 : -3000;
36   channel_1_signal = specimx_input[1] ? 3000 : -3000;
37   channel_2_signal = specimx_input[2] ? 3000 : -3000;
48   channel_0_signal = state->specimx_input[0] ? 3000 : -3000;
49   channel_1_signal = state->specimx_input[1] ? 3000 : -3000;
50   channel_2_signal = state->specimx_input[2] ? 3000 : -3000;
3851
3952   while (samples--)
4053   {
r9589r9590
5366   }
5467}
5568
56void specimx_set_input(running_machine *machine, int index, int state)
69void specimx_set_input(running_device *device, int index, int state)
5770{
58   if (mixer_channel!=NULL) {
59      stream_update( mixer_channel );
71   specimx_sound_state *sndstate = get_safe_token(device);
72   if (sndstate->mixer_channel!=NULL) {
73      stream_update( sndstate->mixer_channel );
6074   }
61   specimx_input[index] = state;
75   sndstate->specimx_input[index] = state;
6276}
6377
6478
r9589r9590
6680{
6781   switch (state)
6882   {
83      /* --- the following bits of info are returned as 64-bit signed integers --- */
84      case DEVINFO_INT_TOKEN_BYTES:               info->i = sizeof(specimx_sound_state);         break;
85
6986      /* --- the following bits of info are returned as pointers to data or functions --- */
7087      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(specimx_sound);   break;
7188
src/mess/machine/wswan.c
r9589r9590
887887                   Bit 0-3 - Master volume
888888                   Bit 4-7 - Unknown
889889                */
890         wswan_sound_port_w( space, offset, data );
890         wswan_sound_port_w( space->machine->device("custom"), offset, data );
891891         break;
892892      case 0xa0:   /* Hardware type - this is probably read only
893893                   Bit 0   - Enable cartridge slot and/or disable bios
src/mess/machine/lynx.c
r9589r9590
99#include "devices/cartslot.h"
1010#include "hash.h"
1111
12static UINT16 lynx_granularity = 1;
12static UINT16 lynx_granularity;
1313static int lynx_line;
1414static int lynx_line_y;
1515static int sign_AB = 0, sign_CD = 0;
1616
1717static UINT32 lynx_palette[0x10];
1818
19static int rotate = 0;
19static int rotate0 = 0;
2020static int lynx_rotate;
21static running_device *lynx_audio;
2122
2223#define MATH_A      0x55
2324#define MATH_B      0x54
r9589r9590
664665
665666         y = blitter.y;
666667         flip++;
667          continue;
668         continue;
668669      }
669670
670671      for ( ; (hi < blitter.height); hi += 0x100, y += ydir)
r9589r9590
11681169   UINT8 data[0x100];
11691170} MIKEY;
11701171
1171static MIKEY mikey={ { 0 } };
1172static MIKEY mikey;
11721173
11731174
11741175static UINT8 lynx_read_vram(UINT16 address)
r9589r9590
11971198; B1    1 EQU flip screen
11981199; B0    1 EQU video DMA enabled
11991200*/
1201static int lynx_height, lynx_width;
12001202static void lynx_draw_lines(running_machine *machine, int newline)
12011203{
1202   static int height = -1, width = -1;
12031204   int h,w;
12041205   int x, yend;
12051206   UINT16 j; // clipping needed!
r9589r9590
12891290   if (newline == -1)
12901291   {
12911292      lynx_line_y = 0;
1292      if ((w != width) || (h != height))
1293      if ((w != lynx_width) || (h != lynx_height))
12931294      {
1294         width = w;
1295         height = h;
1296         machine->primary_screen->set_visible_area(0, width - 1, 0, height - 1);
1295         lynx_width = w;
1296         lynx_height = h;
1297         machine->primary_screen->set_visible_area(0, w - 1, 0, h - 1);
12971298      }
12981299   }
12991300}
r9589r9590
13871388      lynx_timer_count_down( machine, 7 );
13881389      break;
13891390   case 7:
1390      lynx_audio_count_down( machine, 0 );
1391      lynx_audio_count_down( lynx_audio, 0 );
13911392      break;
13921393   }
13931394}
r9589r9590
15531554   {
15541555      mikey.data[0x81] |= 0x10;
15551556      cputag_set_input_line(machine, "maincpu", M65SC02_IRQ_LINE, ASSERT_LINE);
1556    }
1557   }
15571558}
15581559
15591560static  READ8_HANDLER(lynx_uart_r)
r9589r9590
16331634   case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: case 0x35: case 0x36: case 0x37:
16341635   case 0x38: case 0x39: case 0x3a: case 0x3b: case 0x3c: case 0x3d: case 0x3e: case 0x3f:
16351636   case 0x40: case 0x41: case 0x42: case 0x43: case 0x44: case 0x50:
1636      value = lynx_audio_read(offset);
1637      value = lynx_audio_read(lynx_audio, offset);
16371638      break;
16381639
16391640   case 0x80:
r9589r9590
17011702   case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: case 0x35: case 0x36: case 0x37:
17021703   case 0x38: case 0x39: case 0x3a: case 0x3b: case 0x3c: case 0x3d: case 0x3e: case 0x3f:
17031704   case 0x40: case 0x41: case 0x42: case 0x43: case 0x44: case 0x50:
1704      lynx_audio_write(offset, data);
1705      lynx_audio_write(lynx_audio, offset, data);
17051706      return;
17061707
17071708   case 0x80:
r9589r9590
18361837
18371838   lynx_uart_reset();
18381839
1839   lynx_audio_reset();
1840
18411840   // hack to allow current object loading to work
18421841#if 1
18431842   lynx_timer_write( 0, 0, 160 );
r9589r9590
18641863   memory_configure_bank(machine, "bank4", 0, 1, memory_region(machine, "maincpu") + 0x01fa, 0);
18651864   memory_configure_bank(machine, "bank4", 1, 1, lynx_mem_fffa, 0);
18661865
1866   lynx_audio = machine->device("custom");
1867   lynx_height = -1;
1868   lynx_width = -1;
1869   lynx_granularity = 1;
1870
18671871   memset(&suzy, 0, sizeof(suzy));
18681872
18691873   machine->add_notifier(MACHINE_NOTIFY_RESET, lynx_reset);
r9589r9590
19191923
19201924INTERRUPT_GEN( lynx_frame_int )
19211925{
1922    lynx_rotate = rotate;
1923    if ((input_port_read(device->machine, "ROTATION") & 0x03) != 0x03)
1926   lynx_rotate = rotate0;
1927   if ((input_port_read(device->machine, "ROTATION") & 0x03) != 0x03)
19241928      lynx_rotate=input_port_read(device->machine, "ROTATION") & 0x03;
19251929}
19261930
19271931void lynx_crc_keyword(device_image_interface &image)
19281932{
1929    const char *info = NULL;
1933   const char *info = NULL;
19301934
19311935   if (strcmp(image.extrainfo(), ""))
1932       info = image.extrainfo();
1936      info = image.extrainfo();
19331937
1934    rotate = 0;
1938   rotate0 = 0;
19351939
1936    if (info)
1940   if (info)
19371941   {
19381942      if(strcmp(info, "ROTATE90DEGREE") == 0)
1939         rotate = 1;
1943         rotate0 = 1;
19401944      else if (strcmp(info, "ROTATE270DEGREE") == 0)
1941         rotate = 2;
1942    }
1945         rotate0 = 2;
1946   }
19431947}
19441948
19451949static DEVICE_IMAGE_LOAD( lynx_cart )
src/mess/machine/special.c
r9589r9590
2121
2222static UINT8 specimx_color;
2323UINT8 *specimx_colorram;
24static running_device *specimx_audio;
2425
2526static int specialist_8255_porta;
2627static int specialist_8255_portb;
r9589r9590
210211
211212static WRITE_LINE_DEVICE_HANDLER( specimx_pit8253_out0_changed )
212213{
213   specimx_set_input( device->machine, 0, state );
214   specimx_set_input( specimx_audio, 0, state );
214215}
215216
216217
217218
218219static WRITE_LINE_DEVICE_HANDLER(specimx_pit8253_out1_changed)
219220{
220   specimx_set_input( device->machine, 1, state );
221   specimx_set_input( specimx_audio, 1, state );
221222}
222223
223224
224225
225226static WRITE_LINE_DEVICE_HANDLER(specimx_pit8253_out2_changed)
226227{
227   specimx_set_input( device->machine, 2, state );
228   specimx_set_input( specimx_audio, 2, state );
228229}
229230
230231
r9589r9590
252253
253254MACHINE_START( specimx )
254255{
256   specimx_audio = machine->device("custom");
255257}
256258
257259static TIMER_CALLBACK( setup_pit8253_gates )
r9589r9590
275277
276278READ8_HANDLER ( specimx_disk_ctrl_r )
277279{
278  return 0xff;
280   return 0xff;
279281}
280282
281283WRITE8_HANDLER( specimx_disk_ctrl_w )
src/mess/includes/wswan.h
r9589r9590
8888extern struct VDP wswan_vdp;
8989extern UINT8 ws_portram[256];
9090
91extern NVRAM_HANDLER( wswan );
92extern MACHINE_START( wswan );
93extern MACHINE_START( wscolor );
94extern MACHINE_RESET( wswan );
95extern READ8_HANDLER( wswan_port_r );
96extern WRITE8_HANDLER( wswan_port_w );
97extern READ8_HANDLER( wswan_sram_r );
98extern WRITE8_HANDLER( wswan_sram_w );
99extern DEVICE_START(wswan_cart);
100extern DEVICE_IMAGE_LOAD(wswan_cart);
91NVRAM_HANDLER( wswan );
92MACHINE_START( wswan );
93MACHINE_START( wscolor );
94MACHINE_RESET( wswan );
95READ8_HANDLER( wswan_port_r );
96WRITE8_HANDLER( wswan_port_w );
97READ8_HANDLER( wswan_sram_r );
98WRITE8_HANDLER( wswan_sram_w );
99DEVICE_START(wswan_cart);
100DEVICE_IMAGE_LOAD(wswan_cart);
101101
102102
103103/*----------- defined in video/wswan.c -----------*/
104104
105extern void wswan_refresh_scanline( running_machine *machine );
105void wswan_refresh_scanline( running_machine *machine );
106106
107107
108108/*----------- defined in audio/wswan.c -----------*/
109109
110110DECLARE_LEGACY_SOUND_DEVICE(WSWAN, wswan_sound);
111111
112WRITE8_HANDLER( wswan_sound_port_w );
112WRITE8_DEVICE_HANDLER( wswan_sound_port_w );
113113
114114#endif /* WSWAN_H_ */
src/mess/includes/lynx.h
r9589r9590
4343DECLARE_LEGACY_SOUND_DEVICE(LYNX, lynx_sound);
4444DECLARE_LEGACY_SOUND_DEVICE(LYNX2, lynx2_sound);
4545
46void lynx_audio_reset(void);
47void lynx_audio_write(int offset, UINT8 data);
48UINT8 lynx_audio_read(int offset);
49void lynx_audio_count_down(running_machine *machine, int nr);
46void lynx_audio_write(running_device *device, int offset, UINT8 data);
47UINT8 lynx_audio_read(running_device *device, int offset);
48void lynx_audio_count_down(running_device *device, int nr);
5049
5150
5251#endif /* LYNX_H_ */
src/mess/includes/channelf.h
r9589r9590
2525extern UINT8 channelf_row_reg;
2626extern UINT8 channelf_col_reg;
2727
28extern PALETTE_INIT( channelf );
29extern VIDEO_START( channelf );
30extern VIDEO_UPDATE( channelf );
28PALETTE_INIT( channelf );
29VIDEO_START( channelf );
30VIDEO_UPDATE( channelf );
3131
3232
3333/*----------- defined in audio/channelf.c -----------*/
3434
3535DECLARE_LEGACY_SOUND_DEVICE(CHANNELF, channelf_sound);
3636
37void channelf_sound_w(running_machine *machine, int mode);
37void channelf_sound_w(running_device *device, int mode);
3838
3939
4040#endif /* CHANNELF_H_ */
src/mess/includes/special.h
r9589r9590
1616extern const struct pit8253_config specimx_pit8253_intf;
1717extern const i8255a_interface specialist_ppi8255_interface;
1818
19extern DRIVER_INIT( special );
20extern MACHINE_RESET( special );
19DRIVER_INIT( special );
20MACHINE_RESET( special );
2121
22extern READ8_HANDLER( specialist_keyboard_r );
23extern WRITE8_HANDLER( specialist_keyboard_w );
22READ8_HANDLER( specialist_keyboard_r );
23WRITE8_HANDLER( specialist_keyboard_w );
2424
25extern MACHINE_RESET( specimx );
26extern MACHINE_START ( specimx );
25MACHINE_RESET( specimx );
26MACHINE_START ( specimx );
2727
28extern WRITE8_HANDLER( specimx_select_bank );
28WRITE8_HANDLER( specimx_select_bank );
2929
30extern READ8_HANDLER ( specimx_video_color_r );
31extern WRITE8_HANDLER( specimx_video_color_w );
30READ8_HANDLER ( specimx_video_color_r );
31WRITE8_HANDLER( specimx_video_color_w );
3232
33extern READ8_HANDLER ( specimx_disk_ctrl_r );
34extern WRITE8_HANDLER( specimx_disk_ctrl_w );
33READ8_HANDLER ( specimx_disk_ctrl_r );
34WRITE8_HANDLER( specimx_disk_ctrl_w );
3535
36extern DRIVER_INIT( erik );
37extern MACHINE_RESET( erik );
36DRIVER_INIT( erik );
37MACHINE_RESET( erik );
3838
39extern READ8_HANDLER ( erik_rr_reg_r );
40extern WRITE8_HANDLER( erik_rr_reg_w );
41extern READ8_HANDLER ( erik_rc_reg_r );
42extern WRITE8_HANDLER( erik_rc_reg_w );
43extern READ8_HANDLER ( erik_disk_reg_r );
44extern WRITE8_HANDLER( erik_disk_reg_w );
39READ8_HANDLER ( erik_rr_reg_r );
40WRITE8_HANDLER( erik_rr_reg_w );
41READ8_HANDLER ( erik_rc_reg_r );
42WRITE8_HANDLER( erik_rc_reg_w );
43READ8_HANDLER ( erik_disk_reg_r );
44WRITE8_HANDLER( erik_disk_reg_w );
4545
4646/*----------- defined in video/special.c -----------*/
4747
r9589r9590
5454extern UINT8 *erik_video_ram_page_1;
5555extern UINT8 *erik_video_ram_page_2;
5656
57extern VIDEO_START( special );
58extern VIDEO_UPDATE( special );
57VIDEO_START( special );
58VIDEO_UPDATE( special );
5959
60extern VIDEO_START( specialp );
61extern VIDEO_UPDATE( specialp );
60VIDEO_START( specialp );
61VIDEO_UPDATE( specialp );
6262
63extern VIDEO_START( specimx );
64extern VIDEO_UPDATE( specimx );
63VIDEO_START( specimx );
64VIDEO_UPDATE( specimx );
6565
66extern VIDEO_START( erik );
67extern VIDEO_UPDATE( erik );
68extern PALETTE_INIT( erik );
66VIDEO_START( erik );
67VIDEO_UPDATE( erik );
68PALETTE_INIT( erik );
6969
70extern PALETTE_INIT( specimx );
70PALETTE_INIT( specimx );
7171extern const rgb_t specimx_palette[16];
7272
7373/*----------- defined in audio/special.c -----------*/
7474
7575DECLARE_LEGACY_SOUND_DEVICE(SPECIMX, specimx_sound);
7676
77void specimx_set_input(running_machine *machine, int index, int state);
77void specimx_set_input(running_device *device, int index, int state);
7878
7979#endif /* SPECIAL_H_ */
src/mess/includes/svision.h
r9589r9590
2626
2727/*----------- defined in audio/svision.c -----------*/
2828
29typedef struct
30{
31   UINT8 reg[5];
32   int on, right, left;
33   int ca14to16;
34   int start,size;
35   double pos, step;
36   int finished;
37} SVISION_DMA;
38
39extern SVISION_DMA svision_dma;
40
41typedef enum
42{
43   SVISION_NOISE_Type7Bit,
44   SVISION_NOISE_Type14Bit
45} SVISION_NOISE_Type;
46
47typedef struct
48{
49   UINT8 reg[3];
50   int on, right, left, play;
51   SVISION_NOISE_Type type;
52   int state;
53   int volume;
54   int count;
55   double step, pos;
56   int value; // currently simple random function
57} SVISION_NOISE;
58
59extern SVISION_NOISE svision_noise;
60
61typedef struct
62{
63   UINT8 reg[4];
64   int on;
65   int waveform, volume;
66   int pos;
67   int size;
68   int count;
69} SVISION_CHANNEL;
70
71extern SVISION_CHANNEL svision_channel[2];
72
7329DECLARE_LEGACY_SOUND_DEVICE(SVISION, svision_sound);
74void svision_soundport_w (running_machine *machine, SVISION_CHANNEL *channel, int offset, int data);
75WRITE8_HANDLER( svision_sounddma_w );
76WRITE8_HANDLER( svision_noise_w );
7730
31int *svision_dma_finished(running_device *device);
32void svision_sound_decrement(running_device *device);
33void svision_soundport_w(running_device *device, int which, int offset, int data);
34WRITE8_DEVICE_HANDLER( svision_sounddma_w );
35WRITE8_DEVICE_HANDLER( svision_noise_w );
7836
37
7938#endif /* SVISION_H_ */
src/mess/drivers/lynx.c
r9589r9590
8686
8787   /* sound hardware */
8888   MDRV_SPEAKER_STANDARD_MONO("mono")
89   MDRV_SOUND_ADD("lynx", LYNX, 0)
89   MDRV_SOUND_ADD("custom", LYNX, 0)
9090   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
9191
9292   /* devices */
r9589r9590
102102   MDRV_DEVICE_REMOVE("mono")
103103   MDRV_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
104104   MDRV_DEVICE_REMOVE("lynx")
105   MDRV_SOUND_ADD("lynx2", LYNX2, 0)
105   MDRV_SOUND_ADD("custom", LYNX2, 0)
106106   MDRV_SOUND_ROUTE(0, "lspeaker", 0.50)
107107   MDRV_SOUND_ROUTE(1, "rspeaker", 0.50)
108108MACHINE_CONFIG_END
src/mess/drivers/channelf.c
r9589r9590
130130
131131   latch[0] = data;
132132
133    if (data & 0x20)
133   if (data & 0x20)
134134   {
135135      offs = channelf_row_reg*128+channelf_col_reg;
136136      if (videoram[offs] != channelf_val_reg)
r9589r9590
141141static WRITE8_HANDLER( channelf_port_1_w )
142142{
143143   latch[1] = data;
144    channelf_val_reg = ((data ^ 0xff) >> 6) & 0x03;
144   channelf_val_reg = ((data ^ 0xff) >> 6) & 0x03;
145145}
146146
147147static WRITE8_HANDLER( channelf_port_4_w )
148148{
149    latch[2] = data;
150    channelf_col_reg = (data | 0x80) ^ 0xff;
149   latch[2] = data;
150   channelf_col_reg = (data | 0x80) ^ 0xff;
151151}
152152
153153static WRITE8_HANDLER( channelf_port_5_w )
154154{
155    latch[3] = data;
156   channelf_sound_w(space->machine, (data>>6)&3);
157    channelf_row_reg = (data | 0xc0) ^ 0xff;
155   latch[3] = data;
156   channelf_sound_w(space->machine->device("custom"), (data>>6)&3);
157   channelf_row_reg = (data | 0xc0) ^ 0xff;
158158}
159159
160160static WRITE8_HANDLER( channelf_2102A_w )  /* SKR */
src/mess/drivers/svision.c
r9589r9590
2525#define BANK svision_reg[0x26]
2626
2727static UINT8 *svision_reg;
28static running_device *svision_sound;
29static int *dma_finished;
2830
2931static struct
3032{
r9589r9590
7577void svision_irq(running_machine *machine)
7678{
7779   int irq = svision.timer_shot && (BANK & 2);
78   irq = irq || (svision_dma.finished && (BANK & 4));
80   irq = irq || (*dma_finished && (BANK & 4));
7981
8082   cputag_set_input_line(machine, "maincpu", M6502_IRQ_LINE, irq ? ASSERT_LINE : CLEAR_LINE);
8183}
r9589r9590
110112         data &= ~3;
111113         if (svision.timer_shot)
112114            data|=1;
113         if (svision_dma.finished)
115         if (*dma_finished)
114116            data|=2;
115117         break;
116118      case 0x24:
r9589r9590
118120         svision_irq( space->machine );
119121         break;
120122      case 0x25:
121         svision_dma.finished = FALSE;
123         *dma_finished = FALSE;
122124         svision_irq( space->machine );
123125         break;
124126      default:
r9589r9590
158160         timer_reset(svision.timer1, space->machine->device<cpu_device>("maincpu")->cycles_to_attotime(value * delay));
159161         break;
160162      case 0x10: case 0x11: case 0x12: case 0x13:
161         svision_soundport_w(space->machine, svision_channel + 0, offset & 3, data);
163         svision_soundport_w(svision_sound, 0, offset & 3, data);
162164         break;
163165      case 0x14: case 0x15: case 0x16: case 0x17:
164         svision_soundport_w(space->machine, svision_channel + 1, offset & 3, data);
166         svision_soundport_w(svision_sound, 1, offset & 3, data);
165167         break;
166168      case 0x18: case 0x19: case 0x1a: case 0x1b: case 0x1c:
167         svision_sounddma_w(space, offset - 0x18, data);
169         svision_sounddma_w(svision_sound, offset - 0x18, data);
168170         break;
169171      case 0x28: case 0x29: case 0x2a:
170         svision_noise_w(space, offset - 0x28, data);
172         svision_noise_w(svision_sound, offset - 0x28, data);
171173         break;
172174      default:
173175         logerror("%.6f svision write %04x %02x\n", attotime_to_double(timer_get_time(space->machine)), offset, data);
r9589r9590
433435   if (BANK&1)
434436      cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE);
435437
436   if (svision_channel->count)
437      svision_channel->count--;
438   if (svision_channel[1].count)
439      svision_channel[1].count--;
440   if (svision_noise.count)
441      svision_noise.count--;
438   svision_sound_decrement(svision_sound);
442439}
443440
444441static DRIVER_INIT( svision )
445442{
446443   svision.timer1 = timer_alloc(machine, svision_timer, NULL);
444   svision_sound = machine->device("custom");
445   dma_finished = svision_dma_finished(svision_sound);
447446   svision_pet.on = FALSE;
448447   memory_set_bankptr(machine, "bank2", memory_region(machine, "user1") + 0x1c000);
449448}
r9589r9590
451450static DRIVER_INIT( svisions )
452451{
453452   svision.timer1 = timer_alloc(machine, svision_timer, NULL);
453   svision_sound = machine->device("custom");
454454   memory_set_bankptr(machine, "bank2", memory_region(machine, "user1") + 0x1c000);
455455   svision.timer1 = timer_alloc(machine, svision_timer, NULL);
456456   svision_pet.on = TRUE;
r9589r9590
504504static MACHINE_RESET( svision )
505505{
506506   svision.timer_shot = FALSE;
507   svision_dma.finished = FALSE;
507   *dma_finished = FALSE;
508508   memory_set_bankptr(machine, "bank1", memory_region(machine, "user1"));
509509}
510510
r9589r9590
512512static MACHINE_RESET( tvlink )
513513{
514514   svision.timer_shot = FALSE;
515   svision_dma.finished = FALSE;
515   *dma_finished = FALSE;
516516   memory_set_bankptr(machine, "bank1", memory_region(machine, "user1"));
517517   tvlink.palette_on = FALSE;
518518
docs/messnew.txt
r9589r9590
3232
3333- [ABC800C] Added Color version ROMs. [Ola Andersson]
3434
35- [CHANNELF/LYNX/SPECIAL/SVISION/WSWAN] Tokenized audio state.  [Atari Ace]
36
3537- [SMS] Improved Light Phaser emulation and converted it to use timers
3638  that control when the beam will reach the aim area, to run the function
3739  that checks if the pixel displayed is bright enough to activate the

Previous 15994 Revisions Next


© 1998-2018 The MESS Team