Previous 15994 Revisions Next

r14022 Saturday 14th January, 2012 at 17:45:16 UTC by Angelo Salese
Added ISA Sound Blaster 1.5, and added bare-bones DSP ports
[src/mess/drivers]at.c genpc.c ibmpc.c
[src/mess/machine]isa_sblaster.c isa_sblaster.h

src/mess/machine/isa_sblaster.c
r14021r14022
22
33  ISA 8 bit Creative Labs Sound Blaster Sound Card
44
5  TODO:
6  - DSP type is unknown at current time, and probably has an internal ROM
7    that needs decapping;
8  - joystick port;
9  - implement jumpers dip-sw;
10  - state machine + read/write members
11
512***************************************************************************/
613
714#include "emu.h"
r14021r14022
2734
2835  jumperable? normally 0x220
2936*/
30#define ym3812_StdClock 3579545
37#define ym3812_StdClock XTAL_3_579545MHz
3138
39static struct {
40   UINT8 reset_latch;
41   UINT8 rbuf_status;
42   UINT8 wbuf_status;
43   UINT8 in_data;
44   UINT8 fifo_cmd;
45   UINT8 cmd;
46}m_dsp;
47
48static UINT8 m_fifo[16],m_fifo_ptr;
49
50static const int m_cmd_fifo_length[256] =
51{
52/*   0   1   2   3   4   5   6   7   8   9   A   B   C   D   E   F        */
53   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,   -1, -1, -1, -1, -1, /* 0x */
54   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,   -1, -1, -1, -1, -1, /* 1x */
55   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,   -1, -1, -1, -1, -1, /* 2x */
56   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,   -1, -1, -1, -1, -1, /* 3x */
57   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,   -1, -1, -1, -1, -1, /* 4x */
58   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,   -1, -1, -1, -1, -1, /* 5x */
59   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,   -1, -1, -1, -1, -1, /* 6x */
60   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,   -1, -1, -1, -1, -1, /* 7x */
61   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,   -1, -1, -1, -1, -1, /* 8x */
62   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,   -1, -1, -1, -1, -1, /* 9x */
63   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,   -1, -1, -1, -1, -1, /* Ax */
64   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,   -1, -1, -1, -1, -1, /* Bx */
65   -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,   -1, -1, -1, -1, -1, /* Cx */
66   -1, -1, -1,  1, -1, -1, -1, -1, -1, -1, -1,   -1, -1, -1, -1, -1, /* Dx */
67    2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,   -1, -1, -1, -1, -1, /* Ex */
68   -1, -1, -1, -1, -1, -1, -1, -1,  1, -1, -1,   -1, -1, -1, -1, -1  /* Fx */
69};
70
3271static const ym3812_interface pc_ym3812_interface =
3372{
3473   NULL
3574};
3675
37static MACHINE_CONFIG_FRAGMENT( sblaster_config )
76static MACHINE_CONFIG_FRAGMENT( sblaster1_0_config )
3877   MCFG_SPEAKER_STANDARD_MONO("mono")
3978   MCFG_SOUND_ADD("ym3812", YM3812, ym3812_StdClock)
4079   MCFG_SOUND_CONFIG(pc_ym3812_interface)
r14021r14022
4584   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
4685MACHINE_CONFIG_END
4786
87static MACHINE_CONFIG_FRAGMENT( sblaster1_5_config )
88   MCFG_SPEAKER_STANDARD_MONO("mono")
89   MCFG_SOUND_ADD("ym3812", YM3812, ym3812_StdClock)
90   MCFG_SOUND_CONFIG(pc_ym3812_interface)
91   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
92   /* no CM/S support (empty sockets) */
93
94MACHINE_CONFIG_END
95
96
4897static READ8_DEVICE_HANDLER( ym3812_16_r )
4998{
5099   UINT8 retVal = 0xff;
r14021r14022
78127   }
79128}
80129
130static READ8_DEVICE_HANDLER( dsp_reset_r )
131{
132   if(offset)
133      return 0xff;
134   logerror("Soundblaster DSP Reset port undocumented read\n");
135   return 0xff;
136}
137
138static WRITE8_DEVICE_HANDLER( dsp_reset_w )
139{
140   if(offset)
141      return;
142
143   if(data == 0 && m_dsp.reset_latch == 1)
144   {
145      // reset routine
146      m_dsp.rbuf_status |= 0x80;
147      m_dsp.in_data = 0xaa; // reset OK ID
148      //m_dsp.fifo_cmd = 0;
149   }
150
151   m_dsp.reset_latch = data;
152
153   printf("%02x\n",data);
154}
155
156static READ8_DEVICE_HANDLER( dsp_data_r )
157{
158   if(offset)
159      return 0xff;
160
161   return m_dsp.in_data;
162}
163
164static WRITE8_DEVICE_HANDLER( dsp_data_w )
165{
166   if(offset)
167      return;
168   logerror("Soundblaster DSP data port undocumented write\n");
169}
170
171static READ8_DEVICE_HANDLER(dsp_rbuf_status_r)
172{
173   UINT8 res;
174
175   res = 0;
176
177   if(offset)
178      return 0xff;
179
180   if(m_dsp.rbuf_status & 0x80)
181   {
182      m_dsp.rbuf_status &= ~0x80;
183      res |= 0x80;
184   }
185
186   return res;
187}
188
189static READ8_DEVICE_HANDLER(dsp_wbuf_status_r)
190{
191   if(offset)
192      return 0xff;
193
194   return m_dsp.wbuf_status;
195}
196
197static WRITE8_DEVICE_HANDLER(dsp_rbuf_status_w)
198{
199   if(offset)
200      return;
201
202   logerror("Soundblaster DSP Read Buffer status undocumented write\n");
203}
204
205static void queue(UINT8 data)
206{
207   if (m_fifo_ptr < 15)
208   {
209      m_fifo_ptr++;
210
211      m_fifo[m_fifo_ptr] = data;
212   }
213   else
214   {
215      // FIFO gets to la-la-land
216      //logerror("FIFO?\n");
217   }
218}
219
220static void process_fifo(UINT8 cmd)
221{
222   if (m_cmd_fifo_length[cmd] == -1)
223   {
224      logerror("unemulated or undefined fifo command %02x\n",cmd);
225   }
226   else if(m_fifo_ptr == m_cmd_fifo_length[cmd])
227   {
228      /* get FIFO params */
229      switch(cmd)
230      {
231         case 0xd3: // speaker off
232            m_dsp.rbuf_status |= 0x80;
233            m_dsp.in_data = 0;
234            break;
235         case 0xe0: // get DSP identification
236            m_dsp.rbuf_status |= 0x80;
237            m_dsp.in_data = m_fifo[2] ^ 0xff;
238            break;
239         case 0xf8: // ???
240            m_dsp.rbuf_status |= 0x80;
241            m_dsp.in_data = 0;
242            break;
243      }
244
245      m_fifo_ptr = 0;
246   }
247}
248
249static WRITE8_DEVICE_HANDLER(dsp_cmd_w)
250{
251   if(offset)
252      return;
253
254   printf("%02x %02x\n",m_dsp.fifo_cmd,m_dsp.cmd);
255
256   queue(data);
257
258   process_fifo(m_fifo[1]);
259}
260
81261//**************************************************************************
82262//  GLOBAL VARIABLES
83263//**************************************************************************
84264
85const device_type ISA8_SOUND_BLASTER_1_0 = &device_creator<isa8_sblaster_device>;
265const device_type ISA8_SOUND_BLASTER_1_0 = &device_creator<isa8_sblaster1_0_device>;
266const device_type ISA8_SOUND_BLASTER_1_5 = &device_creator<isa8_sblaster1_5_device>;
86267
87268//-------------------------------------------------
88269//  machine_config_additions - device-specific
89270//  machine configurations
90271//-------------------------------------------------
91272
92machine_config_constructor isa8_sblaster_device::device_mconfig_additions() const
273machine_config_constructor isa8_sblaster1_0_device::device_mconfig_additions() const
93274{
94   return MACHINE_CONFIG_NAME( sblaster_config );
275   return MACHINE_CONFIG_NAME( sblaster1_0_config );
95276}
96277
278machine_config_constructor isa8_sblaster1_5_device::device_mconfig_additions() const
279{
280   return MACHINE_CONFIG_NAME( sblaster1_5_config );
281}
282
97283//**************************************************************************
98284//  LIVE DEVICE
99285//**************************************************************************
r14021r14022
102288//  isa8_sblaster_device - constructor
103289//-------------------------------------------------
104290
105isa8_sblaster_device::isa8_sblaster_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
291isa8_sblaster1_0_device::isa8_sblaster1_0_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
106292        device_t(mconfig, ISA8_SOUND_BLASTER_1_0, "ISA8_SOUND_BLASTER_1_0", tag, owner, clock),
107293      device_isa8_card_interface(mconfig, *this)
108294{
109295}
110296
297isa8_sblaster1_5_device::isa8_sblaster1_5_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
298        device_t(mconfig, ISA8_SOUND_BLASTER_1_5, "ISA8_SOUND_BLASTER_1_5", tag, owner, clock),
299      device_isa8_card_interface(mconfig, *this)
300{
301}
302
111303//-------------------------------------------------
112304//  device_start - device-specific startup
113305//-------------------------------------------------
114306
115void isa8_sblaster_device::device_start()
307void isa8_sblaster1_0_device::device_start()
116308{
117309    set_isa_device();
118   m_isa->install_device(subdevice("ym3812"), 0x0388, 0x0389, 0, 0, FUNC(ym3812_16_r), FUNC(ym3812_16_w) );
119310   m_isa->install_device(subdevice("saa1099.1"), 0x0220, 0x0221, 0, 0, FUNC(saa1099_16_r), FUNC(saa1099_16_w) );
120311   m_isa->install_device(subdevice("saa1099.2"), 0x0222, 0x0223, 0, 0, FUNC(saa1099_16_r), FUNC(saa1099_16_w) );
312   m_isa->install_device(this,                   0x0226, 0x0227, 0, 0, FUNC(dsp_reset_r), FUNC(dsp_reset_w) );
313   m_isa->install_device(subdevice("ym3812"),    0x0228, 0x0229, 0, 0, FUNC(ym3812_16_r), FUNC(ym3812_16_w) );
314   m_isa->install_device(this,                   0x022a, 0x022b, 0, 0, FUNC(dsp_data_r),  FUNC(dsp_data_w) );
315   m_isa->install_device(this,                   0x022c, 0x022d, 0, 0, FUNC(dsp_wbuf_status_r),  FUNC(dsp_cmd_w) );
316   m_isa->install_device(this,                   0x022e, 0x022f, 0, 0, FUNC(dsp_rbuf_status_r),  FUNC(dsp_rbuf_status_w) );
317   m_isa->install_device(subdevice("ym3812"),    0x0388, 0x0389, 0, 0, FUNC(ym3812_16_r), FUNC(ym3812_16_w) );
121318}
122319
320void isa8_sblaster1_5_device::device_start()
321{
322    set_isa_device();
323   /* 1.5 ditches CM/S support (empty sockets) */
324   m_isa->install_device(this,                   0x0226, 0x0227, 0, 0, FUNC(dsp_reset_r), FUNC(dsp_reset_w) );
325   m_isa->install_device(subdevice("ym3812"),    0x0228, 0x0229, 0, 0, FUNC(ym3812_16_r), FUNC(ym3812_16_w) );
326   m_isa->install_device(this,                   0x022a, 0x022b, 0, 0, FUNC(dsp_data_r),  FUNC(dsp_data_w) );
327   m_isa->install_device(this,                   0x022c, 0x022d, 0, 0, FUNC(dsp_wbuf_status_r),  FUNC(dsp_cmd_w) );
328   m_isa->install_device(this,                   0x022e, 0x022f, 0, 0, FUNC(dsp_rbuf_status_r),  FUNC(dsp_rbuf_status_w) );
329   m_isa->install_device(subdevice("ym3812"),    0x0388, 0x0389, 0, 0, FUNC(ym3812_16_r), FUNC(ym3812_16_w) );
330}
331
123332//-------------------------------------------------
124333//  device_reset - device-specific reset
125334//-------------------------------------------------
126335
127void isa8_sblaster_device::device_reset()
336void isa8_sblaster1_0_device::device_reset()
128337{
338//   ...
129339}
340
341void isa8_sblaster1_5_device::device_reset()
342{
343// ...
344}
345
src/mess/machine/isa_sblaster.h
r14021r14022
1212
1313// ======================> isa8_sblaster_device
1414
15class isa8_sblaster_device :
15class isa8_sblaster1_0_device :
1616      public device_t,
1717      public device_isa8_card_interface
1818{
1919public:
2020        // construction/destruction
21        isa8_sblaster_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
21        isa8_sblaster1_0_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
2222
2323      // optional information overrides
2424      virtual machine_config_constructor device_mconfig_additions() const;
r14021r14022
2929
3030private:
3131        // internal state
32};
33
34class isa8_sblaster1_5_device :
35      public device_t,
36      public device_isa8_card_interface
37{
3238public:
39        // construction/destruction
40        isa8_sblaster1_5_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
41
42      // optional information overrides
43      virtual machine_config_constructor device_mconfig_additions() const;
44protected:
45        // device-level overrides
46        virtual void device_start();
47        virtual void device_reset();
48
49private:
50        // internal state
3351};
3452
35
3653// device type definition
3754extern const device_type ISA8_SOUND_BLASTER_1_0;
55extern const device_type ISA8_SOUND_BLASTER_1_5;
3856
3957#endif  /* __ISA_SOUND_BLASTER_H__ */
src/mess/drivers/genpc.c
r14021r14022
115115   SLOT_INTERFACE("adlib", ISA8_ADLIB)
116116   SLOT_INTERFACE("hercules", ISA8_HERCULES)
117117   SLOT_INTERFACE("gblaster", ISA8_GAME_BLASTER)
118   SLOT_INTERFACE("sblaster", ISA8_SOUND_BLASTER_1_0)
118   SLOT_INTERFACE("sblaster1_0", ISA8_SOUND_BLASTER_1_0)
119   SLOT_INTERFACE("sblaster1_5", ISA8_SOUND_BLASTER_1_5)
119120   SLOT_INTERFACE("ne1000", NE1000)
120121   SLOT_INTERFACE("3c503", EL2_3C503)
121122SLOT_INTERFACE_END
src/mess/drivers/at.c
r14021r14022
352352   SLOT_INTERFACE("adlib", ISA8_ADLIB)
353353   SLOT_INTERFACE("hercules", ISA8_HERCULES)
354354   SLOT_INTERFACE("gblaster", ISA8_GAME_BLASTER)
355   SLOT_INTERFACE("sblaster", ISA8_SOUND_BLASTER_1_0)
355   SLOT_INTERFACE("sblaster1_0", ISA8_SOUND_BLASTER_1_0)
356   SLOT_INTERFACE("sblaster1_5", ISA8_SOUND_BLASTER_1_5)
356357   SLOT_INTERFACE("ne1000", NE1000)
357358   SLOT_INTERFACE("3c503", EL2_3C503)
358359   // ISA 16 bit
r14021r14022
599600   MCFG_PCI_BUS_DEVICE(1, "i82371ab", i82371ab_pci_read, i82371ab_pci_write)
600601
601602   MCFG_ISA16_SLOT_ADD("isabus","isa5", pc_isa16_cards, "ide", ide_2nd) //2nd-ary IDE
602   
603
603604   MCFG_DEVICE_REMOVE(RAM_TAG)
604605   MCFG_RAM_ADD(RAM_TAG)
605606   MCFG_RAM_DEFAULT_SIZE("4M")
src/mess/drivers/ibmpc.c
r14021r14022
323323   SLOT_INTERFACE("hdc", ISA8_HDC)
324324   SLOT_INTERFACE("adlib", ISA8_ADLIB)
325325   SLOT_INTERFACE("gblaster", ISA8_GAME_BLASTER)
326   SLOT_INTERFACE("sblaster", ISA8_SOUND_BLASTER_1_0)
326   SLOT_INTERFACE("sblaster1_0", ISA8_SOUND_BLASTER_1_0)
327   SLOT_INTERFACE("sblaster1_5", ISA8_SOUND_BLASTER_1_5)
327328   SLOT_INTERFACE("ne1000", NE1000)
328329   SLOT_INTERFACE("3c503", EL2_3C503)
329330SLOT_INTERFACE_END

Previous 15994 Revisions Next


© 1998-2018 The MESS Team