Changes to logging - nothing (other than some parts of pc.c) uses the global pclog anymore (and logs will be almost empty (until the base set logging flags is agreed upon);
Fixes to various hard disk controllers; Added the Packard Bell PB640; Fixed the InPort mouse emulation - now it works correctly on Windows NT 3.1; Removed the status window and the associated variables; Completely removed the Green B 486 machine; Fixed the MDSI Genius; Fixed the single-sided 5.25" floppy drive; Ported a CPU-related commit from VARCem.
This commit is contained in:
@@ -42,7 +42,6 @@ enum fluid_interp {
|
||||
|
||||
|
||||
extern void givealbuffer_midi(void *buf, uint32_t size);
|
||||
extern void pclog(const char *format, ...);
|
||||
extern void al_set_midi(int freq, int buf_size);
|
||||
extern int soundon;
|
||||
|
||||
@@ -224,7 +223,6 @@ void fluidsynth_msg(uint8_t *msg)
|
||||
case 0xF0: /* SysEx */
|
||||
break;
|
||||
default:
|
||||
/* pclog("fluidsynth: unknown send() command 0x%02X", cmd); */
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -331,8 +329,6 @@ void* fluidsynth_init(const device_t *info)
|
||||
|
||||
al_set_midi(data->samplerate, data->buf_size);
|
||||
|
||||
/* pclog("fluidsynth (%s) initialized, samplerate %d, buf_size %d\n", f_fluid_version_str(), data->samplerate, data->buf_size); */
|
||||
|
||||
midi_device_t* dev = malloc(sizeof(midi_device_t));
|
||||
memset(dev, 0, sizeof(midi_device_t));
|
||||
|
||||
@@ -386,8 +382,6 @@ void fluidsynth_close(void* p)
|
||||
dynld_close(fluidsynth_handle);
|
||||
fluidsynth_handle = NULL;
|
||||
}
|
||||
|
||||
/* pclog("fluidsynth closed\n"); */
|
||||
}
|
||||
|
||||
static const device_config_t fluidsynth_config[] =
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
|
||||
|
||||
extern void givealbuffer_midi(void *buf, uint32_t size);
|
||||
extern void pclog(const char *format, ...);
|
||||
extern void al_set_midi(int freq, int buf_size);
|
||||
|
||||
static const mt32emu_report_handler_i_v0 handler_v0 = {
|
||||
@@ -63,7 +62,6 @@ mt32emu_return_code mt32_check(const char* func, mt32emu_return_code ret, mt32em
|
||||
{
|
||||
if (ret != expected)
|
||||
{
|
||||
/* pclog("%s() failed, expected %d but returned %d\n", func, expected, ret); */
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
@@ -201,15 +199,8 @@ void* mt32emu_init(wchar_t *control_rom, wchar_t *pcm_rom)
|
||||
mt32emu_set_reversed_stereo_enabled(context, device_get_config_int("reversed_stereo"));
|
||||
mt32emu_set_nice_amp_ramp_enabled(context, device_get_config_int("nice_ramp"));
|
||||
|
||||
/* pclog("mt32 output gain: %f\n", mt32emu_get_output_gain(context));
|
||||
pclog("mt32 reverb output gain: %f\n", mt32emu_get_reverb_output_gain(context));
|
||||
pclog("mt32 reverb: %d\n", mt32emu_is_reverb_enabled(context));
|
||||
pclog("mt32 reversed stereo: %d\n", mt32emu_is_reversed_stereo_enabled(context)); */
|
||||
|
||||
al_set_midi(samplerate, buf_size);
|
||||
|
||||
/* pclog("mt32 (Munt %s) initialized, samplerate %d, buf_size %d\n", mt32emu_get_library_version_string(), samplerate, buf_size); */
|
||||
|
||||
midi_device_t* dev = malloc(sizeof(midi_device_t));
|
||||
memset(dev, 0, sizeof(midi_device_t));
|
||||
|
||||
@@ -261,8 +252,6 @@ void mt32_close(void* p)
|
||||
midi_close();
|
||||
|
||||
free((midi_device_t*)p);
|
||||
|
||||
/* pclog("mt32 closed\n"); */
|
||||
}
|
||||
|
||||
static const device_config_t mt32_config[] =
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#define HAVE_STDARG_H
|
||||
#include "../86box.h"
|
||||
#include "../io.h"
|
||||
#include "../mca.h"
|
||||
@@ -12,6 +14,26 @@
|
||||
#include "snd_opl.h"
|
||||
|
||||
|
||||
#ifdef ENABLE_ADLIB_LOG
|
||||
int adlib_do_log = ENABLE_ADLIB_LOG;
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
adlib_log(const char *fmt, ...)
|
||||
{
|
||||
#ifdef ENABLE_ADLIB_LOG
|
||||
va_list ap;
|
||||
|
||||
if (adlib_do_log) {
|
||||
va_start(ap, fmt);
|
||||
pclog_ex(fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
typedef struct adlib_t
|
||||
{
|
||||
opl_t opl;
|
||||
@@ -37,7 +59,7 @@ uint8_t adlib_mca_read(int port, void *p)
|
||||
{
|
||||
adlib_t *adlib = (adlib_t *)p;
|
||||
|
||||
pclog("adlib_mca_read: port=%04x\n", port);
|
||||
adlib_log("adlib_mca_read: port=%04x\n", port);
|
||||
|
||||
return adlib->pos_regs[port & 7];
|
||||
}
|
||||
@@ -49,7 +71,7 @@ void adlib_mca_write(int port, uint8_t val, void *p)
|
||||
if (port < 0x102)
|
||||
return;
|
||||
|
||||
pclog("adlib_mca_write: port=%04x val=%02x\n", port, val);
|
||||
adlib_log("adlib_mca_write: port=%04x val=%02x\n", port, val);
|
||||
|
||||
switch (port)
|
||||
{
|
||||
@@ -68,7 +90,7 @@ void *adlib_init(const device_t *info)
|
||||
adlib_t *adlib = malloc(sizeof(adlib_t));
|
||||
memset(adlib, 0, sizeof(adlib_t));
|
||||
|
||||
pclog("adlib_init\n");
|
||||
adlib_log("adlib_init\n");
|
||||
opl2_init(&adlib->opl);
|
||||
io_sethandler(0x0388, 0x0002, opl2_read, NULL, NULL, opl2_write, NULL, NULL, &adlib->opl);
|
||||
sound_add_handler(adlib_get_buffer, adlib);
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#define HAVE_STDARG_H
|
||||
#include "../86box.h"
|
||||
#include "../io.h"
|
||||
#include "../device.h"
|
||||
@@ -180,7 +182,6 @@ void *cms_init(const device_t *info)
|
||||
cms_t *cms = malloc(sizeof(cms_t));
|
||||
memset(cms, 0, sizeof(cms_t));
|
||||
|
||||
pclog("cms_init\n");
|
||||
io_sethandler(0x0220, 0x0010, cms_read, NULL, NULL, cms_write, NULL, NULL, cms);
|
||||
sound_add_handler(cms_get_buffer, cms);
|
||||
return cms;
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#define HAVE_STDARG_H
|
||||
#include "../86box.h"
|
||||
#include "../io.h"
|
||||
#include "../nmi.h"
|
||||
@@ -1006,8 +1008,6 @@ void *gus_init(const device_t *info)
|
||||
gus->ram = malloc(1 << 20);
|
||||
memset(gus->ram, 0, 1 << 20);
|
||||
|
||||
pclog("gus_init\n");
|
||||
|
||||
for (c=0;c<32;c++)
|
||||
{
|
||||
gus->ctrl[c]=1;
|
||||
@@ -1020,7 +1020,6 @@ void *gus_init(const device_t *info)
|
||||
out/=1.002709201; /* 0.0235 dB Steps */
|
||||
}
|
||||
|
||||
pclog("GUS: top volume %f %f %f %f\n",vol16bit[4095],vol16bit[3800],vol16bit[3000],vol16bit[2048]);
|
||||
gus->voices=14;
|
||||
|
||||
gus->samp_timer = gus->samp_latch = (int64_t)(TIMER_USEC * (1000000.0 / 44100.0));
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Roland MPU-401 emulation.
|
||||
*
|
||||
* Version: @(#)snd_mpu401.c 1.0.9 2018/04/26
|
||||
* Version: @(#)snd_mpu401.c 1.0.10 2018/04/29
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* DOSBox Team,
|
||||
@@ -19,12 +19,14 @@
|
||||
* Copyright 2008-2018 DOSBox Team.
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <wchar.h>
|
||||
#define HAVE_STDARG_H
|
||||
#include "../86box.h"
|
||||
#include "../device.h"
|
||||
#include "../io.h"
|
||||
@@ -47,33 +49,29 @@ static int64_t mpu401_event_callback = 0LL;
|
||||
static int64_t mpu401_eoi_callback = 0LL;
|
||||
static int64_t mpu401_reset_callback = 0LL;
|
||||
|
||||
#ifdef ENABLE_MPU401_LOG
|
||||
static int mpu401_do_log = ENABLE_MPU401_LOG;
|
||||
static char logfmt[512];
|
||||
#endif
|
||||
|
||||
|
||||
static void MPU401_WriteCommand(mpu_t *mpu, uint8_t val);
|
||||
static void MPU401_EOIHandlerDispatch(void *p);
|
||||
|
||||
|
||||
#ifdef ENABLE_MPU401_LOG
|
||||
int mpu401_do_log = ENABLE_MPU401_LOG;
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
mpulog(const char *fmt, ...)
|
||||
mpu401_log(const char *fmt, ...)
|
||||
{
|
||||
#ifdef ENABLE_MPU401_LOG
|
||||
va_list ap;
|
||||
|
||||
if (mpu401_do_log) {
|
||||
va_start(ap, fmt);
|
||||
memset(logfmt, 0, 512);
|
||||
strcpy(logfmt, "MPU-401: ");
|
||||
strcpy(logfmt + strlen(logfmt), fmt);
|
||||
vprintf(logfmt, ap);
|
||||
pclog_ex(fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#define pclog mpulog
|
||||
|
||||
|
||||
static void
|
||||
@@ -100,7 +98,7 @@ QueueByte(mpu_t *mpu, uint8_t data)
|
||||
mpu->queue_used++;
|
||||
mpu->queue[pos]=data;
|
||||
} else
|
||||
pclog("MPU401:Data queue full\n");
|
||||
mpu401_log("MPU401:Data queue full\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -161,7 +159,7 @@ MPU401_ResetDone(void *priv)
|
||||
{
|
||||
mpu_t *mpu = (mpu_t *)priv;
|
||||
|
||||
pclog("MPU-401 reset callback\n");
|
||||
mpu401_log("MPU-401 reset callback\n");
|
||||
|
||||
mpu401_reset_callback = 0LL;
|
||||
|
||||
@@ -197,10 +195,6 @@ MPU401_WriteCommand(mpu_t *mpu, uint8_t val)
|
||||
break;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (val&0x20)
|
||||
pclog("MPU-401:Unhandled Recording Command %x",(int)val);
|
||||
#endif
|
||||
switch (val & 0xc) {
|
||||
case 0x4: /* Stop */
|
||||
mpu->state.playing = 0;
|
||||
@@ -215,7 +209,6 @@ MPU401_WriteCommand(mpu_t *mpu, uint8_t val)
|
||||
break;
|
||||
|
||||
case 0x8: /* Play */
|
||||
// pclog("MPU-401:Intelligent mode playback started");
|
||||
mpu->state.playing = 1;
|
||||
mpu401_event_callback = (MPU401_TIMECONSTANT / (mpu->clock.tempo*mpu->clock.timebase)) * 1000LL * TIMER_USEC;
|
||||
ClrQueue(mpu);
|
||||
@@ -332,7 +325,7 @@ MPU401_WriteCommand(mpu_t *mpu, uint8_t val)
|
||||
break;
|
||||
|
||||
case 0xff: /* Reset MPU-401 */
|
||||
pclog("MPU-401:Reset %X\n",val);
|
||||
mpu401_log("MPU-401:Reset %X\n",val);
|
||||
mpu401_reset_callback = MPU401_RESETBUSY * 33LL * TIMER_USEC;
|
||||
mpu->state.reset=1;
|
||||
MPU401_Reset(mpu);
|
||||
@@ -342,12 +335,12 @@ MPU401_WriteCommand(mpu_t *mpu, uint8_t val)
|
||||
break;
|
||||
|
||||
case 0x3f: /* UART mode */
|
||||
pclog("MPU-401:Set UART mode %X\n",val);
|
||||
mpu401_log("MPU-401:Set UART mode %X\n",val);
|
||||
mpu->mode=M_UART;
|
||||
break;
|
||||
|
||||
default:;
|
||||
//pclog("MPU-401:Unhandled command %X",val);
|
||||
//mpu401_log("MPU-401:Unhandled command %X",val);
|
||||
}
|
||||
|
||||
QueueByte(mpu, MSG_MPU_ACK);
|
||||
@@ -371,7 +364,7 @@ MPU401_WriteData(mpu_t *mpu, uint8_t val)
|
||||
case 0xe1: /* Set relative tempo */
|
||||
mpu->state.command_byte=0;
|
||||
if (val!=0x40) //default value
|
||||
pclog("MPU-401:Relative tempo change not implemented\n");
|
||||
mpu401_log("MPU-401:Relative tempo change not implemented\n");
|
||||
return;
|
||||
|
||||
case 0xe7: /* Set internal clock to host interval */
|
||||
@@ -428,7 +421,7 @@ MPU401_WriteData(mpu_t *mpu, uint8_t val)
|
||||
break;
|
||||
|
||||
case 0xf0:
|
||||
//pclog("MPU-401:Illegal WSD byte\n");
|
||||
//mpu401_log("MPU-401:Illegal WSD byte\n");
|
||||
mpu->state.wsd=0;
|
||||
mpu->state.channel=mpu->state.old_chan;
|
||||
return;
|
||||
@@ -656,7 +649,7 @@ MPU401_EOIHandler(void *priv)
|
||||
mpu_t *mpu = (mpu_t *)priv;
|
||||
uint8_t i;
|
||||
|
||||
pclog("MPU-401 end of input callback\n");
|
||||
mpu401_log("MPU-401 end of input callback\n");
|
||||
|
||||
mpu401_eoi_callback = 0LL;
|
||||
mpu->state.eoi_scheduled=0;
|
||||
@@ -697,7 +690,7 @@ MPU401_EOIHandlerDispatch(void *priv)
|
||||
static void
|
||||
imf_write(uint16_t addr, uint8_t val, void *priv)
|
||||
{
|
||||
pclog("IMF:Wr %4X,%X\n", addr, val);
|
||||
mpu401_log("IMF:Wr %4X,%X\n", addr, val);
|
||||
}
|
||||
|
||||
|
||||
@@ -750,16 +743,16 @@ mpu401_write(uint16_t addr, uint8_t val, void *priv)
|
||||
{
|
||||
mpu_t *mpu = (mpu_t *)priv;
|
||||
|
||||
/* pclog("MPU401 Write Port %04X, val %x\n", addr, val); */
|
||||
/* mpu401_log("MPU401 Write Port %04X, val %x\n", addr, val); */
|
||||
switch (addr & 1) {
|
||||
case 0: /*Data*/
|
||||
MPU401_WriteData(mpu, val);
|
||||
pclog("Write Data (0x330) %X\n", val);
|
||||
mpu401_log("Write Data (0x330) %X\n", val);
|
||||
break;
|
||||
|
||||
case 1: /*Command*/
|
||||
MPU401_WriteCommand(mpu, val);
|
||||
pclog("Write Command (0x331) %x\n", val);
|
||||
mpu401_log("Write Command (0x331) %x\n", val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -774,7 +767,7 @@ mpu401_read(uint16_t addr, void *priv)
|
||||
switch (addr & 1) {
|
||||
case 0: //Read Data
|
||||
ret = MPU401_ReadData(mpu);
|
||||
pclog("Read Data (0x330) %X\n", ret);
|
||||
mpu401_log("Read Data (0x330) %X\n", ret);
|
||||
break;
|
||||
|
||||
case 1: //Read Status
|
||||
@@ -782,11 +775,11 @@ mpu401_read(uint16_t addr, void *priv)
|
||||
if (!mpu->queue_used) ret=STATUS_INPUT_NOT_READY;
|
||||
ret |= 0x3f; //FIXME: check with MPU401 TechRef
|
||||
|
||||
pclog("Read Status (0x331) %x\n", ret);
|
||||
mpu401_log("Read Status (0x331) %x\n", ret);
|
||||
break;
|
||||
}
|
||||
|
||||
/* pclog("MPU401 Read Port %04X, ret %x\n", addr, ret); */
|
||||
/* mpu401_log("MPU401 Read Port %04X, ret %x\n", addr, ret); */
|
||||
return(ret);
|
||||
}
|
||||
|
||||
@@ -798,7 +791,7 @@ MPU401_Event(void *priv)
|
||||
int new_time;
|
||||
uint8_t i;
|
||||
|
||||
pclog("MPU-401 event callback\n");
|
||||
mpu401_log("MPU-401 event callback\n");
|
||||
|
||||
if (mpu->mode==M_UART) {
|
||||
mpu401_event_callback = 0LL;
|
||||
@@ -838,7 +831,7 @@ next_event:
|
||||
return;
|
||||
} else {
|
||||
mpu401_event_callback += (MPU401_TIMECONSTANT/new_time) * 1000LL * TIMER_USEC;
|
||||
pclog("Next event after %i us (time constant: %i)\n", (int) ((MPU401_TIMECONSTANT/new_time) * 1000 * TIMER_USEC), (int) MPU401_TIMECONSTANT);
|
||||
mpu401_log("Next event after %i us (time constant: %i)\n", (int) ((MPU401_TIMECONSTANT/new_time) * 1000 * TIMER_USEC), (int) MPU401_TIMECONSTANT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -860,7 +853,7 @@ mpu401_init(mpu_t *mpu, uint16_t addr, int irq, int mode)
|
||||
mpu->mode = M_UART;
|
||||
|
||||
mpu->intelligent = (mode == M_INTELLIGENT) ? 1 : 0;
|
||||
pclog("Starting as %s (mode is %s)\n", mpu->intelligent ? "INTELLIGENT" : "UART", (mode == M_INTELLIGENT) ? "INTELLIGENT" : "UART");
|
||||
mpu401_log("Starting as %s (mode is %s)\n", mpu->intelligent ? "INTELLIGENT" : "UART", (mode == M_INTELLIGENT) ? "INTELLIGENT" : "UART");
|
||||
|
||||
mpu401_event_callback = 0LL;
|
||||
mpu401_eoi_callback = 0LL;
|
||||
@@ -902,7 +895,7 @@ mpu401_standalone_init(const device_t *info)
|
||||
mpu = malloc(sizeof(mpu_t));
|
||||
memset(mpu, 0, sizeof(mpu_t));
|
||||
|
||||
pclog("mpu_init\n");
|
||||
mpu401_log("mpu_init\n");
|
||||
mpu401_init(mpu, device_get_config_hex16("base"), device_get_config_int("irq"), device_get_config_int("mode"));
|
||||
|
||||
return(mpu);
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#define HAVE_STDARG_H
|
||||
#include "../86box.h"
|
||||
#include "../cpu/cpu.h"
|
||||
#include "../io.h"
|
||||
@@ -176,6 +178,27 @@ enum
|
||||
PAS16_FILT_MUTE = 0x20
|
||||
};
|
||||
|
||||
|
||||
#ifdef ENABLE_PAS16_LOG
|
||||
int pas16_do_log = ENABLE_PAS16_LOG;
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
pas16_log(const char *fmt, ...)
|
||||
{
|
||||
#ifdef ENABLE_PAS16_LOG
|
||||
va_list ap;
|
||||
|
||||
if (pas16_do_log) {
|
||||
va_start(ap, fmt);
|
||||
pclog_ex(fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static uint8_t pas16_in(uint16_t port, void *p)
|
||||
{
|
||||
pas16_t *pas16 = (pas16_t *)p;
|
||||
@@ -272,7 +295,7 @@ static uint8_t pas16_in(uint16_t port, void *p)
|
||||
temp = 0xff;
|
||||
break;
|
||||
}
|
||||
/* if (port != 0x388 && port != 0x389 && port != 0xb8b) */pclog("pas16_in : port %04X return %02X %04X:%04X\n", port, temp, CS,cpu_state.pc);
|
||||
/* if (port != 0x388 && port != 0x389 && port != 0xb8b) */pas16_log("pas16_in : port %04X return %02X %04X:%04X\n", port, temp, CS,cpu_state.pc);
|
||||
/* if (CS == 0x1FF4 && pc == 0x0585)
|
||||
{
|
||||
if (output)
|
||||
@@ -285,7 +308,7 @@ static uint8_t pas16_in(uint16_t port, void *p)
|
||||
static void pas16_out(uint16_t port, uint8_t val, void *p)
|
||||
{
|
||||
pas16_t *pas16 = (pas16_t *)p;
|
||||
/* if (port != 0x388 && port != 0x389) */pclog("pas16_out : port %04X val %02X %04X:%04X\n", port, val, CS,cpu_state.pc);
|
||||
/* if (port != 0x388 && port != 0x389) */pas16_log("pas16_out : port %04X val %02X %04X:%04X\n", port, val, CS,cpu_state.pc);
|
||||
/* if (CS == 0x369 && pc == 0x2AC5)
|
||||
fatal("here\n");*/
|
||||
switch ((port - pas16->base) + 0x388)
|
||||
@@ -352,12 +375,12 @@ static void pas16_out(uint16_t port, uint8_t val, void *p)
|
||||
case 0xf389:
|
||||
pas16->io_conf_2 = val;
|
||||
pas16->dma = pas16_dmas[val & 0x7];
|
||||
pclog("pas16_out : set PAS DMA %i\n", pas16->dma);
|
||||
pas16_log("pas16_out : set PAS DMA %i\n", pas16->dma);
|
||||
break;
|
||||
case 0xf38a:
|
||||
pas16->io_conf_3 = val;
|
||||
pas16->irq = pas16_irqs[val & 0xf];
|
||||
pclog("pas16_out : set PAS IRQ %i\n", pas16->irq);
|
||||
pas16_log("pas16_out : set PAS IRQ %i\n", pas16->irq);
|
||||
break;
|
||||
case 0xf38b:
|
||||
pas16->io_conf_4 = val;
|
||||
@@ -380,11 +403,11 @@ static void pas16_out(uint16_t port, uint8_t val, void *p)
|
||||
pas16->sb_irqdma = val;
|
||||
sb_dsp_setirq(&pas16->dsp, pas16_sb_irqs[(val >> 3) & 7]);
|
||||
sb_dsp_setdma8(&pas16->dsp, pas16_sb_dmas[(val >> 6) & 3]);
|
||||
pclog("pas16_out : set SB IRQ %i DMA %i\n", pas16_sb_irqs[(val >> 3) & 7], pas16_sb_dmas[(val >> 6) & 3]);
|
||||
pas16_log("pas16_out : set SB IRQ %i DMA %i\n", pas16_sb_irqs[(val >> 3) & 7], pas16_sb_dmas[(val >> 6) & 3]);
|
||||
break;
|
||||
|
||||
default:
|
||||
pclog("pas16_out : unknown %04X\n", port);
|
||||
pas16_log("pas16_out : unknown %04X\n", port);
|
||||
}
|
||||
if (cpu_state.pc == 0x80048CF3)
|
||||
{
|
||||
@@ -417,7 +440,7 @@ static void pas16_pit_out(uint16_t port, uint8_t val, void *p)
|
||||
pas16->pit.ctrls[t] = pas16->pit.ctrl = val;
|
||||
if (t == 3)
|
||||
{
|
||||
pclog("PAS16: bad PIT reg select\n");
|
||||
pas16_log("PAS16: bad PIT reg select\n");
|
||||
return;
|
||||
}
|
||||
if (!(pas16->pit.ctrl & 0x30))
|
||||
@@ -627,7 +650,7 @@ static void pas16_pcm_poll(void *p)
|
||||
pas16->irq_stat |= PAS16_INT_PCM;
|
||||
if (pas16->irq_ena & PAS16_INT_PCM)
|
||||
{
|
||||
pclog("pas16_pcm_poll : cause IRQ %i %02X\n", pas16->irq, 1 << pas16->irq);
|
||||
pas16_log("pas16_pcm_poll : cause IRQ %i %02X\n", pas16->irq, 1 << pas16->irq);
|
||||
picint(1 << pas16->irq);
|
||||
}
|
||||
}
|
||||
@@ -658,7 +681,7 @@ static void pas16_out_base(uint16_t port, uint8_t val, void *p)
|
||||
io_removehandler((pas16->base - 0x388) + 0xff88, 0x0004, pas16_in, NULL, NULL, pas16_out, NULL, NULL, pas16);
|
||||
|
||||
pas16->base = val << 2;
|
||||
pclog("pas16_write_base : PAS16 base now at %04X\n", pas16->base);
|
||||
pas16_log("pas16_write_base : PAS16 base now at %04X\n", pas16->base);
|
||||
|
||||
io_sethandler((pas16->base - 0x388) + 0x0388, 0x0004, pas16_in, NULL, NULL, pas16_out, NULL, NULL, pas16);
|
||||
io_sethandler((pas16->base - 0x388) + 0x0788, 0x0004, pas16_in, NULL, NULL, pas16_out, NULL, NULL, pas16);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Sound Blaster emulation.
|
||||
*
|
||||
* Version: @(#)sound_sb.c 1.0.8 2018/04/26
|
||||
* Version: @(#)sound_sb.c 1.0.9 2018/04/29
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -17,11 +17,13 @@
|
||||
* Copyright 2008-2017 Sarah Walker.
|
||||
* Copyright 2016,2017 Miran Grca.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#define HAVE_STDARG_H
|
||||
#include "../86box.h"
|
||||
#include "../io.h"
|
||||
#include "../mca.h"
|
||||
@@ -168,6 +170,27 @@ const int32_t sb_att_7dbstep_2bits[]=
|
||||
164,6537,14637,32767
|
||||
};
|
||||
|
||||
|
||||
#ifdef ENABLE_SB_LOG
|
||||
int sb_do_log = ENABLE_SB_LOG;
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
sb_log(const char *fmt, ...)
|
||||
{
|
||||
#ifdef ENABLE_SB_LOG
|
||||
va_list ap;
|
||||
|
||||
if (sb_do_log) {
|
||||
va_start(ap, fmt);
|
||||
pclog_ex(fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* sb 1, 1.5, 2, 2 mvc do not have a mixer, so signal is hardwired */
|
||||
static void sb_get_buffer_sb2(int32_t *buffer, int len, void *p)
|
||||
{
|
||||
@@ -533,7 +556,7 @@ void sb_ct1335_mixer_write(uint16_t addr, uint8_t val, void *p)
|
||||
break;
|
||||
|
||||
default:
|
||||
/* pclog("sb_ct1335: Unknown register WRITE: %02X\t%02X\n", mixer->index, mixer->regs[mixer->index]); */
|
||||
sb_log("sb_ct1335: Unknown register WRITE: %02X\t%02X\n", mixer->index, mixer->regs[mixer->index]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -560,7 +583,7 @@ uint8_t sb_ct1335_mixer_read(uint16_t addr, void *p)
|
||||
case 0x00: case 0x02: case 0x06: case 0x08: case 0x0A:
|
||||
return mixer->regs[mixer->index];
|
||||
default:
|
||||
/* pclog("sb_ct1335: Unknown register READ: %02X\t%02X\n", mixer->index, mixer->regs[mixer->index]); */
|
||||
sb_log("sb_ct1335: Unknown register READ: %02X\t%02X\n", mixer->index, mixer->regs[mixer->index]);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -624,7 +647,7 @@ void sb_ct1345_mixer_write(uint16_t addr, uint8_t val, void *p)
|
||||
|
||||
|
||||
default:
|
||||
/* pclog("sb_ct1345: Unknown register WRITE: %02X\t%02X\n", mixer->index, mixer->regs[mixer->index]); */
|
||||
sb_log("sb_ct1345: Unknown register WRITE: %02X\t%02X\n", mixer->index, mixer->regs[mixer->index]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -684,7 +707,7 @@ uint8_t sb_ct1345_mixer_read(uint16_t addr, void *p)
|
||||
return mixer->regs[mixer->index];
|
||||
|
||||
default:
|
||||
/* pclog("sb_ct1345: Unknown register READ: %02X\t%02X\n", mixer->index, mixer->regs[mixer->index]); */
|
||||
sb_log("sb_ct1345: Unknown register READ: %02X\t%02X\n", mixer->index, mixer->regs[mixer->index]);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -831,7 +854,7 @@ void sb_ct1745_mixer_write(uint16_t addr, uint8_t val, void *p)
|
||||
/*TODO: pcspeaker volume, with "output_selector" check? or better not? */
|
||||
sound_set_cd_volume(((uint32_t)mixer->master_l * (uint32_t)mixer->cd_l) / 65535,
|
||||
((uint32_t)mixer->master_r * (uint32_t)mixer->cd_r) / 65535);
|
||||
// pclog("sb_ct1745: Received register WRITE: %02X\t%02X\n", mixer->index, mixer->regs[mixer->index]);
|
||||
sb_log("sb_ct1745: Received register WRITE: %02X\t%02X\n", mixer->index, mixer->regs[mixer->index]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -843,7 +866,7 @@ uint8_t sb_ct1745_mixer_read(uint16_t addr, void *p)
|
||||
if (!(addr & 1))
|
||||
return mixer->index;
|
||||
|
||||
// pclog("sb_ct1745: received register READ: %02X\t%02X\n", mixer->index, mixer->regs[mixer->index]);
|
||||
sb_log("sb_ct1745: received register READ: %02X\t%02X\n", mixer->index, mixer->regs[mixer->index]);
|
||||
|
||||
if (mixer->index>=0x30 && mixer->index<=0x47)
|
||||
{
|
||||
@@ -925,7 +948,7 @@ uint8_t sb_ct1745_mixer_read(uint16_t addr, void *p)
|
||||
|
||||
|
||||
default:
|
||||
/* pclog("sb_ct1745: Unknown register READ: %02X\t%02X\n", mixer->index, mixer->regs[mixer->index]); */
|
||||
sb_log("sb_ct1745: Unknown register READ: %02X\t%02X\n", mixer->index, mixer->regs[mixer->index]);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -945,8 +968,8 @@ uint8_t sb_mcv_read(int port, void *p)
|
||||
{
|
||||
sb_t *sb = (sb_t *)p;
|
||||
|
||||
/* pclog("sb_mcv_read: port=%04x\n", port); */
|
||||
|
||||
sb_log("sb_mcv_read: port=%04x\n", port);
|
||||
|
||||
return sb->pos_regs[port & 7];
|
||||
}
|
||||
|
||||
@@ -958,7 +981,7 @@ void sb_mcv_write(int port, uint8_t val, void *p)
|
||||
if (port < 0x102)
|
||||
return;
|
||||
|
||||
/* pclog("sb_mcv_write: port=%04x val=%02x\n", port, val); */
|
||||
sb_log("sb_mcv_write: port=%04x val=%02x\n", port, val);
|
||||
|
||||
addr = sb_mcv_addr[sb->pos_regs[4] & 7];
|
||||
if (sb->opl_enabled) {
|
||||
@@ -989,8 +1012,8 @@ uint8_t sb_pro_mcv_read(int port, void *p)
|
||||
{
|
||||
sb_t *sb = (sb_t *)p;
|
||||
|
||||
/* pclog("sb_pro_mcv_read: port=%04x\n", port); */
|
||||
|
||||
sb_log("sb_pro_mcv_read: port=%04x\n", port);
|
||||
|
||||
return sb->pos_regs[port & 7];
|
||||
}
|
||||
|
||||
@@ -1002,7 +1025,7 @@ void sb_pro_mcv_write(int port, uint8_t val, void *p)
|
||||
if (port < 0x102)
|
||||
return;
|
||||
|
||||
/* pclog("sb_pro_mcv_write: port=%04x val=%02x\n", port, val); */
|
||||
sb_log("sb_pro_mcv_write: port=%04x val=%02x\n", port, val);
|
||||
|
||||
addr = (sb->pos_regs[2] & 0x20) ? 0x220 : 0x240;
|
||||
io_removehandler(addr+0, 0x0004, opl3_read, NULL, NULL, opl3_write, NULL, NULL, &sb->opl);
|
||||
|
||||
@@ -5,11 +5,13 @@
|
||||
Pentium - 45kHz*/
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#define HAVE_STDARG_H
|
||||
#include "../86box.h"
|
||||
#include "../io.h"
|
||||
#include "../pic.h"
|
||||
@@ -29,17 +31,6 @@
|
||||
void pollsb(void *p);
|
||||
void sb_poll_i(void *p);
|
||||
|
||||
//#define SB_DSP_RECORD_DEBUG
|
||||
//#define SB_TEST_RECORDING_SAW
|
||||
|
||||
#ifdef SB_DSP_RECORD_DEBUG
|
||||
FILE* soundf = 0/*NULL*/;
|
||||
#endif
|
||||
|
||||
#ifdef SB_TEST_RECORDING_SAW
|
||||
int counttest;
|
||||
#endif
|
||||
|
||||
static int sbe2dat[4][9] = {
|
||||
{ 0x01, -0x02, -0x04, 0x08, -0x10, 0x20, 0x40, -0x80, -106 },
|
||||
{ -0x01, 0x02, -0x04, 0x08, 0x10, -0x20, 0x40, -0x80, 165 },
|
||||
@@ -119,6 +110,27 @@ uint16_t sb_dsp_versions[] = {0, 0, 0x105, 0x200, 0x201, 0x300, 0x302, 0x405, 0x
|
||||
|
||||
float low_fir_sb16_coef[SB16_NCoef];
|
||||
|
||||
|
||||
#ifdef ENABLE_SB_DSP_LOG
|
||||
int sb_dsp_do_log = ENABLE_SB_DSP_LOG;
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
sb_dsp_log(const char *fmt, ...)
|
||||
{
|
||||
#ifdef ENABLE_SB_DSP_LOG
|
||||
va_list ap;
|
||||
|
||||
if (sb_dsp_do_log) {
|
||||
va_start(ap, fmt);
|
||||
pclog_ex(fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static inline double sinc(double x)
|
||||
{
|
||||
return sin(M_PI * x) / (M_PI * x);
|
||||
@@ -156,7 +168,7 @@ static void recalc_sb16_filter(int playback_freq)
|
||||
|
||||
void sb_irq(sb_dsp_t *dsp, int irq8)
|
||||
{
|
||||
// pclog("IRQ %i %02X\n",irq8,pic.mask);
|
||||
sb_dsp_log("IRQ %i %02X\n",irq8,pic.mask);
|
||||
if (irq8) dsp->sb_irq8 = 1;
|
||||
else dsp->sb_irq16 = 1;
|
||||
picint(1 << dsp->sb_irqnum);
|
||||
@@ -195,14 +207,6 @@ void sb_dsp_reset(sb_dsp_t *dsp)
|
||||
picintc(1 << dsp->sb_irqnum);
|
||||
|
||||
dsp->asp_data_len = 0;
|
||||
|
||||
#ifdef SB_DSP_RECORD_DEBUG
|
||||
if (soundf != 0)
|
||||
{
|
||||
fclose(soundf);
|
||||
soundf=0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void sb_doreset(sb_dsp_t *dsp)
|
||||
@@ -260,7 +264,6 @@ void sb_start_dma(sb_dsp_t *dsp, int dma8, int autoinit, uint8_t format, int len
|
||||
timer_update_outstanding();
|
||||
dsp->sbleftright = 0;
|
||||
dsp->sbdacpos = 0;
|
||||
// pclog("Start 8-bit DMA addr %06X len %04X\n",dma.ac[1]+(dma.page[1]<<16),len);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -274,7 +277,6 @@ void sb_start_dma(sb_dsp_t *dsp, int dma8, int autoinit, uint8_t format, int len
|
||||
timer_process();
|
||||
dsp->sbenable = dsp->sb_16_enable;
|
||||
timer_update_outstanding();
|
||||
// pclog("Start 16-bit DMA addr %06X len %04X\n",dma16.ac[1]+(dma16.page[1]<<16),len);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,13 +284,6 @@ void sb_start_dma_i(sb_dsp_t *dsp, int dma8, int autoinit, uint8_t format, int l
|
||||
{
|
||||
if (dma8)
|
||||
{
|
||||
#ifdef SB_TEST_RECORDING_SAW
|
||||
switch (dsp->sb_8_format)
|
||||
{
|
||||
case 00:case 20:counttest=0x80;break;
|
||||
case 10:case 30:counttest=0;break;
|
||||
}
|
||||
#endif
|
||||
dsp->sb_8_length = len;
|
||||
dsp->sb_8_format = format;
|
||||
dsp->sb_8_autoinit = autoinit;
|
||||
@@ -299,17 +294,9 @@ void sb_start_dma_i(sb_dsp_t *dsp, int dma8, int autoinit, uint8_t format, int l
|
||||
timer_process();
|
||||
dsp->sb_enable_i = dsp->sb_8_enable;
|
||||
timer_update_outstanding();
|
||||
// pclog("Start 8-bit input DMA addr %06X len %04X\n",dma.ac[1]+(dma.page[1]<<16),len);
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef SB_TEST_RECORDING_SAW
|
||||
switch (dsp->sb_16_format)
|
||||
{
|
||||
case 00:case 20:counttest=0x8000;break;
|
||||
case 10:case 30:counttest=0;break;
|
||||
}
|
||||
#endif
|
||||
dsp->sb_16_length = len;
|
||||
dsp->sb_16_format = format;
|
||||
dsp->sb_16_autoinit = autoinit;
|
||||
@@ -320,18 +307,8 @@ void sb_start_dma_i(sb_dsp_t *dsp, int dma8, int autoinit, uint8_t format, int l
|
||||
timer_process();
|
||||
dsp->sb_enable_i = dsp->sb_16_enable;
|
||||
timer_update_outstanding();
|
||||
// pclog("Start 16-bit input DMA addr %06X len %04X\n",dma.ac[1]+(dma.page[1]<<16),len);
|
||||
}
|
||||
memset(dsp->record_buffer,0,sizeof(dsp->record_buffer));
|
||||
|
||||
#ifdef SB_DSP_RECORD_DEBUG
|
||||
if (soundf != 0)
|
||||
{
|
||||
fclose(soundf);
|
||||
soundf=0;
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
int sb_8_read_dma(sb_dsp_t *dsp)
|
||||
@@ -341,10 +318,6 @@ int sb_8_read_dma(sb_dsp_t *dsp)
|
||||
void sb_8_write_dma(sb_dsp_t *dsp, uint8_t val)
|
||||
{
|
||||
dma_channel_write(dsp->sb_8_dmanum, val);
|
||||
#ifdef SB_DSP_RECORD_DEBUG
|
||||
if (!soundf) soundf=fopen("sound_dsp.pcm","wb");
|
||||
fwrite(&val,1,1,soundf);
|
||||
#endif
|
||||
}
|
||||
int sb_16_read_dma(sb_dsp_t *dsp)
|
||||
{
|
||||
@@ -353,10 +326,6 @@ int sb_16_read_dma(sb_dsp_t *dsp)
|
||||
int sb_16_write_dma(sb_dsp_t *dsp, uint16_t val)
|
||||
{
|
||||
int ret = dma_channel_write(dsp->sb_16_dmanum, val);
|
||||
#ifdef SB_DSP_RECORD_DEBUG
|
||||
if (!soundf) soundf=fopen("sound_dsp.pcm","wb");
|
||||
fwrite(&val,2,1,soundf);
|
||||
#endif
|
||||
return (ret == DMA_NODATA);
|
||||
}
|
||||
|
||||
@@ -377,7 +346,7 @@ void sb_dsp_setdma16(sb_dsp_t *dsp, int dma)
|
||||
void sb_exec_command(sb_dsp_t *dsp)
|
||||
{
|
||||
int temp,c;
|
||||
// pclog("sb_exec_command : SB command %02X\n", dsp->sb_command);
|
||||
sb_dsp_log("sb_exec_command : SB command %02X\n", dsp->sb_command);
|
||||
switch (dsp->sb_command)
|
||||
{
|
||||
case 0x01: /*???*/
|
||||
@@ -397,7 +366,6 @@ void sb_exec_command(sb_dsp_t *dsp)
|
||||
case 0x17: /*2-bit ADPCM output with reference*/
|
||||
dsp->sbref = sb_8_read_dma(dsp);
|
||||
dsp->sbstep = 0;
|
||||
// pclog("Ref byte 2 %02X\n",sbref);
|
||||
case 0x16: /*2-bit ADPCM output*/
|
||||
sb_start_dma(dsp, 1, 0, ADPCM_2, dsp->sb_data[0] + (dsp->sb_data[1] << 8));
|
||||
dsp->sbdat2 = sb_8_read_dma(dsp);
|
||||
@@ -459,7 +427,7 @@ void sb_exec_command(sb_dsp_t *dsp)
|
||||
dsp->sblatcho = dsp->sblatchi = TIMER_USEC * (256 - dsp->sb_data[0]);
|
||||
temp = 256 - dsp->sb_data[0];
|
||||
temp = 1000000 / temp;
|
||||
// pclog("Sample rate - %ihz (%i)\n",temp, dsp->sblatcho);
|
||||
sb_dsp_log("Sample rate - %ihz (%i)\n",temp, dsp->sblatcho);
|
||||
if (dsp->sb_freq != temp && dsp->sb_type >= SB16)
|
||||
recalc_sb16_filter(temp);
|
||||
dsp->sb_freq = temp;
|
||||
@@ -468,7 +436,7 @@ void sb_exec_command(sb_dsp_t *dsp)
|
||||
case 0x42: /*Set input sampling rate*/
|
||||
if (dsp->sb_type < SB16) break;
|
||||
dsp->sblatcho = (int)(TIMER_USEC * (1000000.0f / (float)(dsp->sb_data[1] + (dsp->sb_data[0] << 8))));
|
||||
// pclog("Sample rate - %ihz (%i)\n",dsp->sb_data[1]+(dsp->sb_data[0]<<8), dsp->sblatcho);
|
||||
sb_dsp_log("Sample rate - %ihz (%i)\n",dsp->sb_data[1]+(dsp->sb_data[0]<<8), dsp->sblatcho);
|
||||
temp = dsp->sb_freq;
|
||||
dsp->sb_freq = dsp->sb_data[1] + (dsp->sb_data[0] << 8);
|
||||
dsp->sb_timeo = 256LL + dsp->sb_freq;
|
||||
@@ -483,7 +451,6 @@ void sb_exec_command(sb_dsp_t *dsp)
|
||||
case 0x75: /*4-bit ADPCM output with reference*/
|
||||
dsp->sbref = sb_8_read_dma(dsp);
|
||||
dsp->sbstep = 0;
|
||||
// pclog("Ref byte 4 %02X\n",sbref);
|
||||
case 0x74: /*4-bit ADPCM output*/
|
||||
sb_start_dma(dsp, 1, 0, ADPCM_4, dsp->sb_data[0] + (dsp->sb_data[1] << 8));
|
||||
dsp->sbdat2 = sb_8_read_dma(dsp);
|
||||
@@ -494,7 +461,6 @@ void sb_exec_command(sb_dsp_t *dsp)
|
||||
case 0x77: /*2.6-bit ADPCM output with reference*/
|
||||
dsp->sbref = sb_8_read_dma(dsp);
|
||||
dsp->sbstep = 0;
|
||||
// pclog("Ref byte 26 %02X\n",sbref);
|
||||
case 0x76: /*2.6-bit ADPCM output*/
|
||||
sb_start_dma(dsp, 1, 0, ADPCM_26, dsp->sb_data[0] + (dsp->sb_data[1] << 8));
|
||||
dsp->sbdat2 = sb_8_read_dma(dsp);
|
||||
@@ -516,7 +482,6 @@ void sb_exec_command(sb_dsp_t *dsp)
|
||||
break;
|
||||
case 0x80: /*Pause DAC*/
|
||||
dsp->sb_pausetime = dsp->sb_data[0] + (dsp->sb_data[1] << 8);
|
||||
// pclog("SB pause %04X\n",sb_pausetime);
|
||||
timer_process();
|
||||
dsp->sbenable = 1;
|
||||
timer_update_outstanding();
|
||||
@@ -540,7 +505,7 @@ void sb_exec_command(sb_dsp_t *dsp)
|
||||
case 0xA0: /*Set input mode to mono*/
|
||||
case 0xA8: /*Set input mode to stereo*/
|
||||
if (dsp->sb_type < SB2 || dsp->sb_type > SBPRO2) break;
|
||||
//TODO: Implement. 3.xx-only command.
|
||||
/* TODO: Implement. 3.xx-only command. */
|
||||
break;
|
||||
case 0xB0: case 0xB1: case 0xB2: case 0xB3:
|
||||
case 0xB4: case 0xB5: case 0xB6: case 0xB7: /*16-bit DMA output*/
|
||||
@@ -632,11 +597,11 @@ void sb_exec_command(sb_dsp_t *dsp)
|
||||
sb_add_data(dsp, dsp->sb_test);
|
||||
break;
|
||||
case 0xF2: /*Trigger 8-bit IRQ*/
|
||||
// pclog("Trigger IRQ\n");
|
||||
sb_dsp_log("Trigger IRQ\n");
|
||||
sb_irq(dsp, 1);
|
||||
break;
|
||||
case 0xF3: /*Trigger 16-bit IRQ*/
|
||||
// pclog("Trigger IRQ\n");
|
||||
sb_dsp_log("Trigger IRQ\n");
|
||||
sb_irq(dsp, 0);
|
||||
break;
|
||||
case 0xE7: /*???*/
|
||||
@@ -652,13 +617,10 @@ void sb_exec_command(sb_dsp_t *dsp)
|
||||
case 0x0E: /*ASP set register*/
|
||||
if (dsp->sb_type < SB16) break;
|
||||
dsp->sb_asp_regs[dsp->sb_data[0]] = dsp->sb_data[1];
|
||||
// pclog("ASP write reg %02X %02X\n", sb_data[0], sb_data[1]);
|
||||
break;
|
||||
case 0x0F: /*ASP get register*/
|
||||
if (dsp->sb_type < SB16) break;
|
||||
// sb_add_data(0);
|
||||
sb_add_data(dsp, dsp->sb_asp_regs[dsp->sb_data[0]]);
|
||||
// pclog("ASP read reg %02X %02X\n", sb_data[0], sb_asp_regs[sb_data[0]]);
|
||||
break;
|
||||
case 0xF8:
|
||||
if (dsp->sb_type >= SB16) break;
|
||||
@@ -673,10 +635,7 @@ void sb_exec_command(sb_dsp_t *dsp)
|
||||
case 0x04:
|
||||
case 0x05:
|
||||
break;
|
||||
// default:
|
||||
// fatal("Exec bad SB command %02X\n",sb_command);
|
||||
|
||||
|
||||
|
||||
/*TODO: Some more data about the DSP registeres
|
||||
* http://the.earth.li/~tfm/oldpage/sb_dsp.html
|
||||
* http://www.synchrondata.com/pheaven/www/area19.htm
|
||||
@@ -697,7 +656,6 @@ void sb_exec_command(sb_dsp_t *dsp)
|
||||
void sb_write(uint16_t a, uint8_t v, void *priv)
|
||||
{
|
||||
sb_dsp_t *dsp = (sb_dsp_t *)priv;
|
||||
// pclog("sb_write : Write soundblaster %04X %02X %04X:%04X %02X\n",a,v,CS,pc,dsp->sb_command);
|
||||
switch (a&0xF)
|
||||
{
|
||||
case 6: /*Reset*/
|
||||
@@ -721,7 +679,7 @@ void sb_write(uint16_t a, uint8_t v, void *priv)
|
||||
timer_update_outstanding();
|
||||
if (dsp->asp_data_len)
|
||||
{
|
||||
// pclog("ASP data %i\n", dsp->asp_data_len);
|
||||
sb_dsp_log("ASP data %i\n", dsp->asp_data_len);
|
||||
dsp->asp_data_len--;
|
||||
if (!dsp->asp_data_len)
|
||||
sb_add_data(dsp, 0);
|
||||
@@ -732,8 +690,6 @@ void sb_write(uint16_t a, uint8_t v, void *priv)
|
||||
dsp->sb_command = v;
|
||||
if (v == 0x01)
|
||||
sb_add_data(dsp, 0);
|
||||
// if (sb_commands[v]==-1)
|
||||
// fatal("Bad SB command %02X\n",v);
|
||||
dsp->sb_data_stat++;
|
||||
}
|
||||
else
|
||||
@@ -750,7 +706,6 @@ void sb_write(uint16_t a, uint8_t v, void *priv)
|
||||
uint8_t sb_read(uint16_t a, void *priv)
|
||||
{
|
||||
sb_dsp_t *dsp = (sb_dsp_t *)priv;
|
||||
// pclog("sb_read : Read soundblaster %04X %04X:%04X\n",a,CS,pc);
|
||||
switch (a & 0xf)
|
||||
{
|
||||
case 0xA: /*Read data*/
|
||||
@@ -764,7 +719,6 @@ uint8_t sb_read(uint16_t a, void *priv)
|
||||
dsp->sb_read_rp++;
|
||||
dsp->sb_read_rp &= 0xFF;
|
||||
}
|
||||
// pclog("SB read %02X\n",sbreaddat);
|
||||
return dsp->sbreaddat;
|
||||
case 0xC: /*Write data ready*/
|
||||
if (dsp->sb_8_enable || dsp->sb_type >= SB16)
|
||||
@@ -823,7 +777,7 @@ void sb_dsp_init(sb_dsp_t *dsp, int type)
|
||||
|
||||
void sb_dsp_setaddr(sb_dsp_t *dsp, uint16_t addr)
|
||||
{
|
||||
// pclog("sb_dsp_setaddr : %04X\n", addr);
|
||||
sb_dsp_log("sb_dsp_setaddr : %04X\n", addr);
|
||||
if (dsp->sb_addr != 0) {
|
||||
io_removehandler(dsp->sb_addr + 6, 0x0002, sb_read, NULL, NULL, sb_write, NULL, NULL, dsp);
|
||||
io_removehandler(dsp->sb_addr + 0xa, 0x0006, sb_read, NULL, NULL, sb_write, NULL, NULL, dsp);
|
||||
@@ -846,13 +800,11 @@ void pollsb(void *p)
|
||||
int tempi,ref;
|
||||
|
||||
dsp->sbcount += dsp->sblatcho;
|
||||
// pclog("PollSB %i %i %i %i\n",sb_8_enable,sb_8_pause,sb_pausetime,sb_8_output);
|
||||
if (dsp->sb_8_enable && !dsp->sb_8_pause && dsp->sb_pausetime < 0 && dsp->sb_8_output)
|
||||
{
|
||||
int data[2];
|
||||
|
||||
sb_dsp_update(dsp);
|
||||
// pclog("Dopoll %i %02X %i\n", sb_8_length, sb_8_format, sblatcho);
|
||||
switch (dsp->sb_8_format)
|
||||
{
|
||||
case 0x00: /*Mono unsigned*/
|
||||
@@ -1054,13 +1006,11 @@ void pollsb(void *p)
|
||||
dsp->sbdatr = data[1];
|
||||
dsp->sb_16_length -= 2;
|
||||
break;
|
||||
// default:
|
||||
// fatal("Unrecognised SB 16-bit format %02X\n",sb_16_format);
|
||||
}
|
||||
|
||||
if (dsp->sb_16_length < 0)
|
||||
{
|
||||
// pclog("16DMA over %i\n",dsp->sb_16_autoinit);
|
||||
sb_dsp_log("16DMA over %i\n",dsp->sb_16_autoinit);
|
||||
if (dsp->sb_16_autoinit) dsp->sb_16_length = dsp->sb_16_autolen;
|
||||
else dsp->sb_16_enable = dsp->sbenable = 0;
|
||||
sb_irq(dsp, 0);
|
||||
@@ -1073,7 +1023,7 @@ void pollsb(void *p)
|
||||
{
|
||||
sb_irq(dsp, 1);
|
||||
dsp->sbenable = dsp->sb_8_enable;
|
||||
// pclog("SB pause over\n");
|
||||
sb_dsp_log("SB pause over\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1083,28 +1033,10 @@ void sb_poll_i(void *p)
|
||||
sb_dsp_t *dsp = (sb_dsp_t *)p;
|
||||
int processed=0;
|
||||
dsp->sb_count_i += dsp->sblatchi;
|
||||
// pclog("PollSBi %i %i %i %i\n",sb_8_enable,sb_8_pause,sb_pausetime,sb_8_output);
|
||||
if (dsp->sb_8_enable && !dsp->sb_8_pause && dsp->sb_pausetime < 0 && !dsp->sb_8_output)
|
||||
{
|
||||
switch (dsp->sb_8_format)
|
||||
{
|
||||
#ifdef SB_TEST_RECORDING_SAW
|
||||
case 0x00: /*Unsigned mono. As the manual says, only the left channel is recorded*/
|
||||
case 0x10: /*Signed mono. As the manual says, only the left channel is recorded*/
|
||||
sb_8_write_dma(dsp, counttest);
|
||||
counttest+=0x10;
|
||||
counttest&=0xFF;
|
||||
dsp->sb_8_length--;
|
||||
break;
|
||||
case 0x20: /*Unsigned stereo*/
|
||||
case 0x30: /*Signed stereo*/
|
||||
sb_8_write_dma(dsp, counttest);
|
||||
sb_8_write_dma(dsp, counttest);
|
||||
counttest+=0x10;
|
||||
counttest&=0xFF;
|
||||
dsp->sb_8_length -= 2;
|
||||
break;
|
||||
#else
|
||||
case 0x00: /*Mono unsigned As the manual says, only the left channel is recorded*/
|
||||
sb_8_write_dma(dsp, (dsp->record_buffer[dsp->record_pos_read]>>8) ^0x80);
|
||||
dsp->sb_8_length--;
|
||||
@@ -1131,14 +1063,10 @@ void sb_poll_i(void *p)
|
||||
dsp->record_pos_read+=2;
|
||||
dsp->record_pos_read&=0xFFFF;
|
||||
break;
|
||||
#endif
|
||||
// default:
|
||||
// fatal("Unrecognised SB 8-bit input format %02X\n",sb_8_format);
|
||||
}
|
||||
|
||||
if (dsp->sb_8_length < 0)
|
||||
{
|
||||
// pclog("Input DMA over %i\n",sb_8_autoinit);
|
||||
if (dsp->sb_8_autoinit) dsp->sb_8_length = dsp->sb_8_autolen;
|
||||
else dsp->sb_8_enable = dsp->sb_enable_i = 0;
|
||||
sb_irq(dsp, 1);
|
||||
@@ -1149,25 +1077,6 @@ void sb_poll_i(void *p)
|
||||
{
|
||||
switch (dsp->sb_16_format)
|
||||
{
|
||||
#ifdef SB_TEST_RECORDING_SAW
|
||||
case 0x00: /*Unsigned mono. As the manual says, only the left channel is recorded*/
|
||||
case 0x10: /*Signed mono. As the manual says, only the left channel is recorded*/
|
||||
if (sb_16_write_dma(dsp, counttest))
|
||||
return;
|
||||
counttest+=0x1000;
|
||||
counttest&=0xFFFF;
|
||||
dsp->sb_16_length--;
|
||||
break;
|
||||
case 0x20: /*Unsigned stereo*/
|
||||
case 0x30: /*Signed stereo*/
|
||||
if (sb_16_write_dma(dsp, counttest))
|
||||
return;
|
||||
sb_16_write_dma(dsp, counttest);
|
||||
counttest+=0x1000;
|
||||
counttest&=0xFFFF;
|
||||
dsp->sb_16_length -= 2;
|
||||
break;
|
||||
#else
|
||||
case 0x00: /*Unsigned mono. As the manual says, only the left channel is recorded*/
|
||||
if (sb_16_write_dma(dsp, dsp->record_buffer[dsp->record_pos_read]^0x8000))
|
||||
return;
|
||||
@@ -1198,21 +1107,17 @@ void sb_poll_i(void *p)
|
||||
dsp->record_pos_read+=2;
|
||||
dsp->record_pos_read&=0xFFFF;
|
||||
break;
|
||||
#endif
|
||||
// default:
|
||||
// fatal("Unrecognised SB 16-bit input format %02X\n",sb_16_format);
|
||||
}
|
||||
|
||||
if (dsp->sb_16_length < 0)
|
||||
{
|
||||
// pclog("16iDMA over %i\n",sb_16_autoinit);
|
||||
if (dsp->sb_16_autoinit) dsp->sb_16_length = dsp->sb_16_autolen;
|
||||
else dsp->sb_16_enable = dsp->sb_enable_i = 0;
|
||||
sb_irq(dsp, 0);
|
||||
}
|
||||
processed=1;
|
||||
}
|
||||
//Assume this is direct mode
|
||||
/* Assume this is direct mode */
|
||||
if (!processed)
|
||||
{
|
||||
dsp->record_pos_read+=2;
|
||||
@@ -1233,13 +1138,7 @@ void sb_dsp_update(sb_dsp_t *dsp)
|
||||
dsp->buffer[dsp->pos*2 + 1] = dsp->sbdatr;
|
||||
}
|
||||
}
|
||||
|
||||
void sb_dsp_close(sb_dsp_t *dsp)
|
||||
{
|
||||
#ifdef SB_DSP_RECORD_DEBUG
|
||||
if (soundf != 0)
|
||||
{
|
||||
fclose(soundf);
|
||||
soundf=0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#define HAVE_STDARG_H
|
||||
#include "../86box.h"
|
||||
#include "../io.h"
|
||||
#include "../device.h"
|
||||
@@ -61,8 +63,7 @@ void *ssi2001_init(const device_t *info)
|
||||
{
|
||||
ssi2001_t *ssi2001 = malloc(sizeof(ssi2001_t));
|
||||
memset(ssi2001, 0, sizeof(ssi2001_t));
|
||||
|
||||
pclog("ssi2001_init\n");
|
||||
|
||||
ssi2001->psid = sid_init();
|
||||
sid_reset(ssi2001->psid);
|
||||
io_sethandler(0x0280, 0x0020, ssi2001_read, NULL, NULL, ssi2001_write, NULL, NULL, ssi2001);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Sound emulation core.
|
||||
*
|
||||
* Version: @(#)sound.c 1.0.16 2018/03/26
|
||||
* Version: @(#)sound.c 1.0.17 2018/04/29
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -16,11 +16,13 @@
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#define HAVE_STDARG_H
|
||||
#include "../86box.h"
|
||||
#include "../device.h"
|
||||
#include "../timer.h"
|
||||
@@ -106,6 +108,26 @@ static const SOUND_CARD sound_cards[] =
|
||||
};
|
||||
|
||||
|
||||
#ifdef ENABLE_SOUND_LOG
|
||||
int sound_do_log = ENABLE_SOUND_LOG;
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
sound_log(const char *fmt, ...)
|
||||
{
|
||||
#ifdef ENABLE_SOUND_LOG
|
||||
va_list ap;
|
||||
|
||||
if (sound_do_log) {
|
||||
va_start(ap, fmt);
|
||||
pclog_ex(fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int sound_card_available(int card)
|
||||
{
|
||||
if (sound_cards[card].device)
|
||||
@@ -370,10 +392,10 @@ void sound_init(void)
|
||||
sound_cd_event = thread_create_event();
|
||||
sound_cd_thread_h = thread_create(sound_cd_thread, NULL);
|
||||
|
||||
/* pclog("Waiting for CD start event...\n"); */
|
||||
sound_log("Waiting for CD start event...\n");
|
||||
thread_wait_event(sound_cd_start_event, -1);
|
||||
thread_reset_event(sound_cd_start_event);
|
||||
/* pclog("Done!\n"); */
|
||||
sound_log("Done!\n");
|
||||
}
|
||||
else
|
||||
cdaudioon = 0;
|
||||
@@ -493,10 +515,10 @@ void sound_cd_thread_end(void)
|
||||
if (cdaudioon) {
|
||||
cdaudioon = 0;
|
||||
|
||||
/* pclog("Waiting for CD Audio thread to terminate...\n"); */
|
||||
sound_log("Waiting for CD Audio thread to terminate...\n");
|
||||
thread_set_event(sound_cd_event);
|
||||
thread_wait(sound_cd_thread_h, -1);
|
||||
/* pclog("CD Audio thread terminated...\n"); */
|
||||
sound_log("CD Audio thread terminated...\n");
|
||||
|
||||
if (sound_cd_event) {
|
||||
thread_destroy_event(sound_cd_event);
|
||||
|
||||
Reference in New Issue
Block a user