Previous 15994 Revisions Next

r866 Thursday 23rd August, 2007 at 13:37:56 UTC by Curt Coder
[ATARISTE] Added microwire interface and LMC1992 skeleton
[src/mess]mess.mak
[src/mess/audio]lmc1992.c* lmc1992.h*
[src/mess/drivers]atarist.c

src/mess/audio/lmc1992.c
r0r866
1#include "lmc1992.h"
2 
3static struct LMC1992
4{
5   const lmc1992_interface *intf;
6 
7   int enable;
8   int data;
9   int clock;
10   UINT16 si;
11 
12   int input;
13   int bass, treble;
14   int volume;
15   int fader_rf, fader_lf, fader_rr, fader_lr;
16} lmc;
17 
18static void lmc1992_command_w(int addr, int data)
19{
20   switch (addr)
21   {
22   case LMC1992_FUNCTION_INPUT_SELECT:
23      if (data == LCM1992_INPUT_SELECT_OPEN)
24      {
25         logerror("LMC1992 Input Select : OPEN\n");
26      }
27      else
28      {
29         logerror("LMC1992 Input Select : INPUT%u\n", data);
30      }
31      lmc.input = data;
32      break;
33   case LMC1992_FUNCTION_BASS:
34      logerror("LMC1992 Bass : %i dB\n", -40 + (data * 2));
35      lmc.bass = data;
36      break;
37   case LMC1992_FUNCTION_TREBLE:
38      logerror("LMC1992 Treble : %i dB\n", -40 + (data * 2));
39      lmc.treble = data;
40      break;
41   case LMC1992_FUNCTION_VOLUME:
42      logerror("LMC1992 Volume : %i dB\n", -80 + (data * 2));
43      lmc.volume = data;
44      break;
45   case LMC1992_FUNCTION_RIGHT_FRONT_FADER:
46      logerror("LMC1992 Right Front Fader : %i dB\n", -40 + (data * 2));
47      lmc.fader_rf = data;
48      break;
49   case LMC1992_FUNCTION_LEFT_FRONT_FADER:
50      logerror("LMC1992 Left Front Fader : %i dB\n", -40 + (data * 2));
51      lmc.fader_lf = data;
52      break;
53   case LMC1992_FUNCTION_RIGHT_REAR_FADER:
54      logerror("LMC1992 Right Rear Fader : %i dB\n", -40 + (data * 2));
55      lmc.fader_rr = data;
56      break;
57   case LMC1992_FUNCTION_LEFT_REAR_FADER:
58      logerror("LMC1992 Left Rear Fader : %i dB\n", -40 + (data * 2));
59      lmc.fader_lr = data;
60      break;
61   }
62}
63 
64void lmc1992_clock_w(int level)
65{
66   // clock data in on rising edge
67 
68   if ((lmc.enable == 0) && ((lmc.clock == 0) && (level == 1)))
69   {
70      lmc.si >>= 1;
71      lmc.si = lmc.si & 0x7fff;
72 
73      if (lmc.data)
74      {
75         lmc.si &= 0x8000;
76      }
77   }
78 
79   lmc.clock = level;
80}
81 
82void lmc1992_data_w(int level)
83{
84   lmc.data = level;
85}
86 
87void lmc1992_enable_w(int level)
88{
89   if ((lmc.enable == 0) && (level == 1))
90   {
91      UINT8 device = (lmc.si & 0xc000) >> 14;
92      UINT8 addr = (lmc.si & 0x3800) >> 11;
93      UINT8 data = (lmc.si & 0x07e0) >> 5;
94 
95      if (device == LMC1992_MICROWIRE_DEVICE_ADDRESS)
96      {
97         lmc1992_command_w(addr, data);
98      }
99   }
100 
101   lmc.enable = level;
102}
103 
104void lmc1992_config(const lmc1992_interface *intf)
105{
106   memset(&lmc, 0, sizeof(lmc));
107 
108   lmc.intf = intf;
109 
110   state_save_register_global(lmc.enable);
111   state_save_register_global(lmc.data);
112   state_save_register_global(lmc.clock);
113   state_save_register_global(lmc.si);
114   state_save_register_global(lmc.input);
115   state_save_register_global(lmc.bass);
116   state_save_register_global(lmc.treble);
117   state_save_register_global(lmc.volume);
118   state_save_register_global(lmc.fader_rf);
119   state_save_register_global(lmc.fader_lf);
120   state_save_register_global(lmc.fader_rr);
121   state_save_register_global(lmc.fader_lr);
122}
src/mess/audio/lmc1992.h
r0r866
1/*
2 
3            LMC1992 Digitally-Controlled Stereo Tone and Volume
4               Circuit with Four-Channel Input-Selector
5 
6                        ________________
7              Data    1   ---|      \/      |---  28  V+
8              Clock    2   ---|            |---  27  Bypass
9             Enable    3   ---|            |---  26  Right Input 1
10        Left Input 1    4   ---|            |---  25  Right Input 2
11        Left Input 2    5   ---|            |---  24  Right Input 3
12        Left Input 3    6   ---|              |---  23  Right Input 4
13        Left Input 4    7   ---|   LMC1992    |---  22  Right Select Out
14      Left Select Out    8   ---|   top view   |---  21  Right Select In
15      Left Select In    9   ---|            |---  20  Right Tone In
16        Left Tone In   10   ---|             |---  19  Right Tone Out
17       Left Tone Out   11   ---|            |---  18  Right Op Amp Out
18      Left Op Amp Out   12   ---|            |---  17  Right Rear Out
19       Left Rear Out   13  ---|            |---  16  Right Front Out
20      Left Front Out   14   ---|________________|---  15  Ground
21 
22*/
23 
24#ifndef __LMC1992_AUDIO__
25#define __LMC1992_AUDIO__
26 
27#include "driver.h"
28 
29typedef struct
30{
31   int dummy;
32   // left input 1
33   // left input 2
34   // left input 3
35   // left input 4
36   // right input 1
37   // right input 2
38   // right input 3
39   // right input 4
40} lmc1992_interface;
41 
42enum
43{
44   LMC1992_FUNCTION_INPUT_SELECT = 0,
45   LMC1992_FUNCTION_BASS,
46   LMC1992_FUNCTION_TREBLE,
47   LMC1992_FUNCTION_VOLUME,
48   LMC1992_FUNCTION_RIGHT_FRONT_FADER,
49   LMC1992_FUNCTION_LEFT_FRONT_FADER,
50   LMC1992_FUNCTION_RIGHT_REAR_FADER,
51   LMC1992_FUNCTION_LEFT_REAR_FADER
52};
53 
54enum
55{
56   LCM1992_INPUT_SELECT_OPEN = 0,
57   LCM1992_INPUT_SELECT_INPUT1,
58   LCM1992_INPUT_SELECT_INPUT2,
59   LCM1992_INPUT_SELECT_INPUT3,
60   LCM1992_INPUT_SELECT_INPUT4
61};
62 
63#define LMC1992_MICROWIRE_DEVICE_ADDRESS   2
64 
65void lmc1992_clock_w(int level);
66void lmc1992_data_w(int level);
67void lmc1992_enable_w(int level);
68 
69void lmc1992_config(const lmc1992_interface *intf);
70 
71#endif
src/mess/mess.mak
r865r866
534534   $(MESS_FORMATS)/a26_cas.o   \
535535   $(MESS_DRIVERS)/atarist.o \
536536   $(MESS_VIDEO)/atarist.o \
537   $(MESS_MACHINE)/68901mfp.o
537   $(MESS_MACHINE)/68901mfp.o \
538   $(MESS_AUDIO)/lmc1992.o
538539
539540$(MESSOBJ)/gce.a:                        \
540541   $(MESS_DRIVERS)/vectrex.o   \
src/mess/drivers/atarist.c
r865r866
1616#include "machine/rp5c15.h"
1717#include "machine/wd17xx.h"
1818#include "sound/ay8910.h"
19#include "audio/lmc1992.h"
1920
2021/*
2122
r865r866
446447   if (~data & 0x80) ikbd.keylatch = readinputportbytag("P47");
447448}
448449
450/* Microwire */
451
452static struct MICROWIRE
453{
454   UINT16 data, mask;
455   int shift;
456} mwire;
457
458static mame_timer *microwire_timer;
459
460static void atariste_microwire_shift(void)
461{
462   if (BIT(mwire.mask, mwire.shift))
463   {
464      lmc1992_data_w((mwire.data & 0x8000) >> 15);
465      lmc1992_clock_w(1);
466      lmc1992_clock_w(0);
467   }
468
469   // rotate data left
470
471   mwire.data = (mwire.data << 1) | ((mwire.data & 0x8000) >> 15);
472   mwire.shift++;
473}
474
475static TIMER_CALLBACK( atariste_microwire_tick )
476{
477   switch (mwire.shift)
478   {
479   case 0:
480      lmc1992_enable_w(0);
481      atariste_microwire_shift();
482      break;
483
484   default:
485      atariste_microwire_shift();
486      break;
487
488   case 15:
489      atariste_microwire_shift();
490      lmc1992_enable_w(1);
491      mwire.shift = 0;
492      mame_timer_enable(microwire_timer, 0);
493      break;
494   }
495}
496
497static READ16_HANDLER( atariste_microwire_data_r )
498{
499   return mwire.data;
500}
501
502static WRITE16_HANDLER( atariste_microwire_data_w )
503{
504   if (!mame_timer_enabled(microwire_timer))
505   {
506      mwire.data = data;
507      mame_timer_pulse(MAME_TIME_IN_USEC(2), 0, atariste_microwire_tick);
508   }
509}
510
511static READ16_HANDLER( atariste_microwire_mask_r )
512{
513   return mwire.mask;
514}
515
516static WRITE16_HANDLER( atariste_microwire_mask_w )
517{
518   if (!mame_timer_enabled(microwire_timer))
519   {
520      mwire.mask = data;
521   }
522}
523
449524/* Memory Maps */
450525
451526static ADDRESS_MAP_START( ikbd_map, ADDRESS_SPACE_PROGRAM, 8 )
r865r866
537612//   AM_RANGE(0xff8908, 0xff890d) AM_READ(atariste_sound_dma_counter_r)
538613//   AM_RANGE(0xff890e, 0xff8912) AM_READWRITE(atariste_sound_dma_end_r, atariste_sound_dma_end_w)
539614//   AM_RANGE(0xff8920, 0xff8920) AM_READWRITE(atariste_sound_mode_r, atariste_sound_mode_w)
540//   AM_RANGE(0xff8922, 0xff8923) AM_READWRITE(atariste_mixer_data_r, atariste_mixer_data_w)
541//   AM_RANGE(0xff8924, 0xff8925) AM_READWRITE(atariste_mixer_mask_r, atariste_mixer_mask_w)
615   AM_RANGE(0xff8922, 0xff8923) AM_READWRITE(atariste_microwire_data_r, atariste_microwire_data_w)
616   AM_RANGE(0xff8924, 0xff8925) AM_READWRITE(atariste_microwire_mask_r, atariste_microwire_mask_w)
542617//   AM_RANGE(0xff8a00, 0xff8a3f) AM_READWRITE(atariste_blitter_r, atariste_blitter_w)
543618   AM_RANGE(0xff9200, 0xff9201) AM_READ(port_tag_to_handler16("JOY0"))
544619   AM_RANGE(0xff9202, 0xff9203) AM_READ(port_tag_to_handler16("JOY1"))
r865r866
581656//   AM_RANGE(0xff8908, 0xff890d) AM_READ(atariste_sound_dma_counter_r)
582657//   AM_RANGE(0xff890e, 0xff8912) AM_READWRITE(atariste_sound_dma_end_r, atariste_sound_dma_end_w)
583658//   AM_RANGE(0xff8920, 0xff8920) AM_READWRITE(atariste_sound_mode_r, atariste_sound_mode_w)
584//   AM_RANGE(0xff8922, 0xff8923) AM_READWRITE(atariste_mixer_data_r, atariste_mixer_data_w)
585//   AM_RANGE(0xff8924, 0xff8925) AM_READWRITE(atariste_mixer_mask_r, atariste_mixer_mask_w)
659   AM_RANGE(0xff8922, 0xff8923) AM_READWRITE(atariste_microwire_data_r, atariste_microwire_data_w)
660   AM_RANGE(0xff8924, 0xff8925) AM_READWRITE(atariste_microwire_mask_r, atariste_microwire_mask_w)
586661//   AM_RANGE(0xff8a00, 0xff8a3f) AM_READWRITE(atariste_blitter_r, atariste_blitter_w)
587662//   AM_RANGE(0xff8e20, 0xff8e21) AM_READWRITE(megaste_cache_r, megaste_cache_w)
588663   AM_RANGE(0xfffa00, 0xfffa3f) AM_READWRITE(mfp68901_0_register_lsb_r, mfp68901_0_register_msb_w)
r865r866
10321107static MACHINE_START( atariste )
10331108{
10341109   machine_start_atarist(machine);
1110
1111   memset(&mwire, 0, sizeof(mwire));
1112
1113   state_save_register_global(mwire.data);
1114   state_save_register_global(mwire.mask);
1115   state_save_register_global(mwire.shift);
10351116}
10361117
10371118static MACHINE_START( megaste )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team