Previous 199869 Revisions Next

r20644 Friday 1st February, 2013 at 01:50:05 UTC by R. Belmont
(MESS) isa_sblaster: improved MIDI throttling (nw)
[src/mess/machine]isa_sblaster.c isa_sblaster.h

trunk/src/mess/machine/isa_sblaster.c
r20643r20644
272272   m_tx_busy = false;
273273   m_xmit_read = m_xmit_write = 0;
274274   m_recv_read = m_recv_write = 0;
275   m_uart_xmitfull = false;
275276
276277   //printf("%02x\n",data);
277278}
r20643r20644
320321//    printf("Clear IRQ5\n");
321322   irq_w(0, IRQ_DMA8);   // reading this port ACKs the card's IRQ, 8-bit dma only?
322323
323   // in UART MIDI mode, bit 7 indicates if a character is available
324   // in either SB-MIDI mode, bit 7 indicates if a character is available
324325   // to read.
325   if (m_uart_midi)
326   if (m_uart_midi || m_onebyte_midi)
326327   {
327328      if (m_recv_read != m_recv_write)
328329      {
r20643r20644
338339READ8_MEMBER(sb_device::dsp_wbuf_status_r)
339340{
340341//    printf("read Wbufstat @ %x\n", offset);
342
341343   if(offset)
342344      return 0xff;
343345
346   // in either SB-MIDI mode, bit 7 indicates if there's space to write.
347   // set = buffer full
348   if (m_uart_midi || m_onebyte_midi)
349   {
350      if (m_uart_xmitfull)
351      {
352          return 0x80;
353      }
354
355      return 0x00;
356   }
357
344358   return m_dsp.wbuf_status;
345359}
346360
r20643r20644
12071221   m_dsp.dma_no_irq = false;
12081222   mixer_reset();
12091223
1224   m_onebyte_midi = false;
1225   m_uart_midi = false;
1226   m_uart_irq = false;
1227   m_mpu_midi = false;
1228   m_tx_busy = false;
1229   m_xmit_read = m_xmit_write = 0;
1230   m_recv_read = m_recv_write = 0;
1231   m_uart_xmitfull = false;
1232
12101233   // MIDI is 31250 baud, 8-N-1
12111234   set_rcv_rate(31250);
12121235   set_tra_rate(31250);
r20643r20644
15461569
15471570void sb_device::tra_complete()    // Tx completed sending byte
15481571{
1549//  printf("Tx complete\n");
1572//   printf("Tx complete\n");
15501573   // is there more waiting to send?
1551   if (m_xmit_read != m_xmit_write)
1574   if ((m_xmit_read != m_xmit_write) || (m_uart_xmitfull))
15521575   {
15531576      transmit_register_setup(m_xmitring[m_xmit_read++]);
15541577      if (m_xmit_read >= MIDI_RING_SIZE)
15551578      {
15561579         m_xmit_read = 0;
15571580      }
1581      m_uart_xmitfull = false;
15581582   }
15591583   else
15601584   {
r20643r20644
15891613
15901614      if (m_xmit_write == m_xmit_read)
15911615      {
1592         printf("Overflow xmitring!\n");
1616         m_uart_xmitfull = true;
15931617      }
15941618   }
15951619}
trunk/src/mess/machine/isa_sblaster.h
r20643r20644
135135      virtual void tra_callback();    // Tx send bit
136136      void input_callback(UINT8 state) {}
137137
138      static const int MIDI_RING_SIZE = 1024;
138      static const int MIDI_RING_SIZE = 2048;
139139
140140      struct sb8_dsp_state m_dsp;
141141      UINT8 m_dack_out;
142142      void xmit_char(UINT8 data);
143      bool m_onebyte_midi, m_uart_midi, m_uart_irq, m_mpu_midi;
143      bool m_onebyte_midi, m_uart_midi, m_uart_irq, m_mpu_midi, m_uart_xmitfull;
144144      UINT8 m_recvring[MIDI_RING_SIZE];
145145      UINT8 m_xmitring[MIDI_RING_SIZE];
146146      int m_xmit_read, m_xmit_write;

Previous 199869 Revisions Next


© 1997-2024 The MAME Team