From 8becbe6e2ea71db714ee5fe0d9a94866e1f0394e Mon Sep 17 00:00:00 2001 From: Sergey Svishchev Date: Sat, 8 Feb 2020 00:42:53 +0300 Subject: [PATCH] sblaster: support more playback commands (nw) gus: active channels are numbered from 0 (nw) hp95lx: add DAC (nw) --- src/devices/bus/isa/gus.cpp | 14 +++++++------- src/devices/bus/isa/sblaster.cpp | 11 ++++++++--- src/mame/drivers/hp95lx.cpp | 17 ++++++++++++++++- 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/src/devices/bus/isa/gus.cpp b/src/devices/bus/isa/gus.cpp index bb0d6e30b26..c4784b205b2 100644 --- a/src/devices/bus/isa/gus.cpp +++ b/src/devices/bus/isa/gus.cpp @@ -592,7 +592,7 @@ READ8_MEMBER(gf1_device::global_reg_data_r) return m_voice[m_current_voice].vol_ramp_ctrl; case 0x8e: // Active voices (6 bits, high 2 bits are always 1) if(offset == 1) - return m_active_voices | 0xc0; + return (m_active_voices - 1) | 0xc0; case 0x8f: // IRQ source register if(offset == 1) { @@ -738,15 +738,15 @@ WRITE8_MEMBER(gf1_device::global_reg_data_w) case 0x0e: // Active voices (6 bits, high 2 bits are always 1) if(offset == 1) { - m_active_voices = data & 0x3f; - if((data & 0x3f) < 14) + m_active_voices = (data & 0x3f) + 1; + if(m_active_voices < 14) m_active_voices = 14; - if((data & 0x3f) > 32) + if(m_active_voices > 32) m_active_voices = 32; m_stream->set_sample_rate(rate_table[m_active_voices]); m_voltimer->adjust(attotime::zero,0,attotime::from_usec(1000/(1.6*m_active_voices))); } - logerror("GUS: Active Voices write %02x (%i Hz)\n", data, rate_table[m_active_voices]); + logerror("GUS: Active Voices write %02x (%d voices at %u Hz)\n", data, m_active_voices, rate_table[m_active_voices]); break; case 0x41: /* bit 0 - Enable the DMA channel. @@ -826,7 +826,7 @@ WRITE8_MEMBER(gf1_device::global_reg_data_w) { m_timer1_count = data; m_timer1_value = data; - logerror("GUS: Timer 1 count write %02x\n",data); + logerror("GUS: Timer 1 count write %02x (%d usec)\n",data,data*80); } break; case 0x47: // Timer 2 count @@ -834,7 +834,7 @@ WRITE8_MEMBER(gf1_device::global_reg_data_w) { m_timer2_count = data; m_timer2_value = data; - logerror("GUS: Timer 2 count write %02x\n",data); + logerror("GUS: Timer 2 count write %02x (%d usec)\n",data,data*320); } break; case 0x48: // Sampling Frequency - 9878400/(16*(FREQ+2)) diff --git a/src/devices/bus/isa/sblaster.cpp b/src/devices/bus/isa/sblaster.cpp index 3e4ba9beca1..8cefe5d70eb 100644 --- a/src/devices/bus/isa/sblaster.cpp +++ b/src/devices/bus/isa/sblaster.cpp @@ -66,10 +66,10 @@ static const int m_cmd_fifo_length[256] = -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 6x */ -1, -1, -1, -1, 3, 3, 3, 3, -1, -1, -1, -1, -1, 1, -1, 1, /* 7x */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 8x */ - 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 9x */ + 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 9x */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* Ax */ - 4, -1, -1, -1, -1, -1, 4, -1, 4, -1, -1, -1, -1, -1, 4, -1, /* Bx */ - 4, -1, -1, -1, -1, -1, 4, -1, 4, -1, -1, -1, -1, -1, 4, -1, /* Cx */ + 4, -1, 4, -1, 4, -1, 4, -1, 4, -1, -1, -1, -1, -1, 4, -1, /* Bx */ + 4, -1, 4, -1, 4, -1, 4, -1, 4, -1, -1, -1, -1, -1, 4, -1, /* Cx */ 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, -1, -1, /* Dx */ 2, 1, 2, 1, 2, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, /* Ex */ -1, -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1 /* Fx */ @@ -331,6 +331,7 @@ void sb_device::process_fifo(uint8_t cmd) break; case 0x14: // 8-bit DMA, no autoinit + case 0x91: // 8-bit DMA, no autoinit, high speed. XXX only on DSP 3.xx m_dsp.dma_length = (m_dsp.fifo[1] + (m_dsp.fifo[2]<<8)) + 1; // printf("Start DMA (not autoinit, size = %x)\n", m_dsp.dma_length); m_dsp.dma_transferred = 0; @@ -578,8 +579,12 @@ void sb_device::process_fifo(uint8_t cmd) m_dsp.dma_autoinit = 0; break; case 0xb0: + case 0xb2: + case 0xb4: case 0xb6: case 0xc0: + case 0xc2: + case 0xc4: case 0xc6: mode = m_dsp.fifo[1]; m_dsp.flags = 0; diff --git a/src/mame/drivers/hp95lx.cpp b/src/mame/drivers/hp95lx.cpp index f53599061c7..7ab7658ad24 100644 --- a/src/mame/drivers/hp95lx.cpp +++ b/src/mame/drivers/hp95lx.cpp @@ -65,17 +65,20 @@ #include "cpu/nec/nec.h" #include "machine/bankdev.h" #include "machine/ram.h" +#include "sound/dac.h" +#include "sound/volt_reg.h" #include "screen.h" #include "emupal.h" #include "softlist.h" +#include "speaker.h" //#define LOG_GENERAL (1U << 0) //defined in logmacro.h already #define LOG_KEYBOARD (1U << 1) #define LOG_DEBUG (1U << 2) -#define VERBOSE (LOG_DEBUG) +//#define VERBOSE (LOG_GENERAL) //#define LOG_OUTPUT_FUNC printf #include "logmacro.h" @@ -103,6 +106,7 @@ public: , m_isabus(*this, "isa") , m_pic8259(*this, "pic8259") , m_pit8254(*this, "pit8254") + , m_dac(*this, "dac") , m_screen(*this, "screen") , m_p_videoram(*this, "video") , m_p_chargen(*this, "gfx1") @@ -133,6 +137,7 @@ protected: required_device m_isabus; required_device m_pic8259; required_device m_pit8254; + required_device m_dac; required_device m_screen; private: @@ -287,6 +292,8 @@ void hp95lx_state::machine_reset() m_kbit = 0; m_scancode = 0; m_kbdflag = 0; + + m_dac->write(0x7f); } @@ -356,6 +363,7 @@ WRITE8_MEMBER(hp95lx_state::e300_w) break; case 5: // DAC out (per snd.c) + m_dac->write(data); break; case 9: // b1 = 'a2d power' (per snd.c) @@ -746,6 +754,13 @@ void hp95lx_state::hp95lx(machine_config &config) NVRAM(config, "nvram2", nvram_device::DEFAULT_ALL_0); // RAM NVRAM(config, "nvram3", nvram_device::DEFAULT_ALL_0); // card slot + SPEAKER(config, "speaker").front_center(); + DAC_8BIT_R2R(config, m_dac, 0).add_route(ALL_OUTPUTS, "speaker", 0.5); // unknown DAC + + voltage_regulator_device &vref(VOLTAGE_REGULATOR(config, "vref", 0)); + vref.add_route(0, m_dac, 1.0, DAC_VREF_POS_INPUT); + vref.add_route(0, m_dac, -1.0, DAC_VREF_NEG_INPUT); + // XXX When the AC adapter is plugged in, the LCD refresh rate is 73.14 Hz. // XXX When the AC adapter is not plugged in (ie, running off of batteries) the refresh rate is 56.8 Hz. SCREEN(config, m_screen, SCREEN_TYPE_LCD, rgb_t::white());