[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bochs-cvs
Subject:    [Bochs-cvs] [13507] trunk/bochs/iodev/sound
From:       vruppert--- via Bochs-cvs <bochs-cvs () lists ! sourceforge ! net>
Date:       2018-05-13 18:10:24
Message-ID: 1526235024.995046.23714 () sfp-scm-6 ! v30 ! lw ! sourceforge ! com
[Download RAW message or body]

Revision: 13507
Author:   vruppert
Date:     2018-05-13 18:10:23 +0000 (Sun, 13 May 2018)
Log Message:
-----------
Added support for DSP command 0x10 (Sending 8-bit samples directly to DSP).

Modified Paths:
--------------
    trunk/bochs/iodev/sound/sb16.cc
    trunk/bochs/iodev/sound/sb16.h

Modified: trunk/bochs/iodev/sound/sb16.cc
===================================================================
--- trunk/bochs/iodev/sound/sb16.cc	2018-05-11 07:44:49 UTC (rev 13506)
+++ trunk/bochs/iodev/sound/sb16.cc	2018-05-13 18:10:23 UTC (rev 13507)
@@ -338,6 +338,8 @@
   DSP.dma.mode = 0;
   DSP.irqpending = 0;
   DSP.midiuartmode = 0;
+  DSP.nondma_mode = 0;
+  DSP.samplebyte = 0;
   DSP.resetport = 1;  // so that one call to dsp_reset is sufficient
   dsp_reset(0);       // (reset is 1 to 0 transition)
   DSP.testreg = 0;
@@ -474,6 +476,8 @@
   new bx_shadow_num_c(dsp, "prostereo", &DSP.prostereo, BASE_HEX);
   new bx_shadow_bool_c(dsp, "irqpending", &DSP.irqpending);
   new bx_shadow_bool_c(dsp, "midiuartmode", &DSP.midiuartmode);
+  new bx_shadow_bool_c(dsp, "nondma_mode", &DSP.nondma_mode);
+  new bx_shadow_num_c(dsp, "samplebyte", &DSP.samplebyte);
   new bx_shadow_num_c(dsp, "testreg", &DSP.testreg, BASE_HEX);
   bx_list_c *dma = new bx_list_c(dsp, "dma");
   new bx_shadow_num_c(dma, "mode", &DSP.dma.mode);
@@ -590,16 +594,20 @@
   // output buffer and the output functions are not ready yet
   // or if buffer is empty in input mode.
 
-  if ((This->dsp.dma.chunkindex + 1 < BX_SOUNDLOW_WAVEPACKETSIZE) &&
+  if (!This->dsp.nondma_mode) {
+    if ((This->dsp.dma.chunkindex + 1 < BX_SOUNDLOW_WAVEPACKETSIZE) &&
         (This->dsp.dma.count > 0)) {
-    if (((This->dsp.dma.output == 0) && (This->dsp.dma.chunkcount > 0)) ||
-        (This->dsp.dma.output == 1)) {
-      if ((DSP.dma.param.bits == 8) || (BX_SB16_DMAH == 0)) {
-        DEV_dma_set_drq(BX_SB16_DMAL, 1);
-      } else {
-        DEV_dma_set_drq(BX_SB16_DMAH, 1);
+      if (((This->dsp.dma.output == 0) && (This->dsp.dma.chunkcount > 0)) ||
+          (This->dsp.dma.output == 1)) {
+        if ((DSP.dma.param.bits == 8) || (BX_SB16_DMAH == 0)) {
+          DEV_dma_set_drq(BX_SB16_DMAL, 1);
+        } else {
+          DEV_dma_set_drq(BX_SB16_DMAH, 1);
+        }
       }
     }
+  } else {
+    dsp_getsamplebyte(DSP.samplebyte);
   }
 }
 
@@ -618,6 +626,11 @@
 {
   writelog(WAVELOG(4), "DSP Reset port write value %x", value);
 
+  if (DSP.nondma_mode) {
+    bx_pc_system.deactivate_timer(DSP.timer_handle);
+    DSP.nondma_mode = 0;
+  }
+
   // just abort high speed mode if it is set
   if (DSP.dma.highspeed != 0)
   {
@@ -836,7 +849,17 @@
          // direct mode DAC
        case 0x10:
          // 1: 8bit sample
-         DSP.datain.get(&value8);   // sample is ignored
+         if (!DSP.nondma_mode) {
+           DSP.dma.param.samplerate = 22050;
+           DSP.dma.param.bits = 8;
+           DSP.dma.param.channels = 1;
+           DSP.dma.param.format = 1;
+           DSP.dma.chunkcount = 2205;
+           DSP.dma.chunkindex = 0;
+           bx_pc_system.activate_timer(DSP.timer_handle, 45, 1);
+           DSP.nondma_mode = 1;
+         }
+         DSP.datain.get(&DSP.samplebyte);
          break;
 
          // uncomp'd, normal DAC DMA
@@ -1235,6 +1258,10 @@
   writelog(WAVELOG(4), "DMA initialized. Cmd %02x, mode %02x, length %d, comp %d",
            command, mode, length, comp);
 
+  if (DSP.nondma_mode) {
+    bx_pc_system.deactivate_timer(DSP.timer_handle);
+    DSP.nondma_mode = 0;
+  }
   if ((command >> 4) == 0xb)  // 0xb? = 16 bit DMA
   {
     DSP.dma.param.bits = 16;

Modified: trunk/bochs/iodev/sound/sb16.h
===================================================================
--- trunk/bochs/iodev/sound/sb16.h	2018-05-11 07:44:49 UTC (rev 13506)
+++ trunk/bochs/iodev/sound/sb16.h	2018-05-13 18:10:23 UTC (rev 13507)
@@ -2,7 +2,7 @@
 // $Id$
 /////////////////////////////////////////////////////////////////////////
 //
-//  Copyright (C) 2001-2015  The Bochs Project
+//  Copyright (C) 2001-2018  The Bochs Project
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of the GNU Lesser General Public
@@ -183,6 +183,8 @@
     Bit8u speaker,prostereo;                   // properties of the sound input/output
     bx_bool irqpending;                        // Is an IRQ pending (not ack'd)
     bx_bool midiuartmode;                      // Is the DSP in MIDI UART mode
+    bx_bool nondma_mode;                       // Set if DSP command 0x10 active
+    Bit8u samplebyte;                          // Current data from DSP command 0x10
     Bit8u testreg;
     struct bx_sb16_dsp_dma_struct {
       // Properties of the current DMA transfer:


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Bochs-cvs mailing list
Bochs-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bochs-cvs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic