mirror of
https://github.com/86Box/86Box.git
synced 2026-02-24 20:35:32 -07:00
More sonarlint work
This commit is contained in:
@@ -408,7 +408,7 @@ midi_clear_buffer(void)
|
||||
}
|
||||
|
||||
void
|
||||
midi_in_handler(int set, void (*msg)(void *p, uint8_t *msg, uint32_t len), int (*sysex)(void *p, uint8_t *buffer, uint32_t len, int abort), void *p)
|
||||
midi_in_handler(int set, void (*msg)(void *priv, uint8_t *msg, uint32_t len), int (*sysex)(void *priv, uint8_t *buffer, uint32_t len, int abort), void *priv)
|
||||
{
|
||||
midi_in_handler_t *temp = NULL;
|
||||
midi_in_handler_t *next;
|
||||
@@ -425,7 +425,7 @@ midi_in_handler(int set, void (*msg)(void *p, uint8_t *msg, uint32_t len), int (
|
||||
memset(temp, 0, sizeof(midi_in_handler_t));
|
||||
temp->msg = msg;
|
||||
temp->sysex = sysex;
|
||||
temp->p = p;
|
||||
temp->priv = priv;
|
||||
|
||||
if (mih_last == NULL)
|
||||
mih_first = mih_last = temp;
|
||||
@@ -440,7 +440,7 @@ midi_in_handler(int set, void (*msg)(void *p, uint8_t *msg, uint32_t len), int (
|
||||
if (temp == NULL)
|
||||
break;
|
||||
|
||||
if ((temp->msg == msg) && (temp->sysex == sysex) && (temp->p == p)) {
|
||||
if ((temp->msg == msg) && (temp->sysex == sysex) && (temp->priv == priv)) {
|
||||
if (temp->prev != NULL)
|
||||
temp->prev->next = temp->next;
|
||||
|
||||
@@ -500,7 +500,7 @@ midi_in_msg(uint8_t *msg, uint32_t len)
|
||||
break;
|
||||
|
||||
if (temp->msg)
|
||||
temp->msg(temp->p, msg, len);
|
||||
temp->msg(temp->priv, msg, len);
|
||||
|
||||
temp = temp->next;
|
||||
|
||||
@@ -548,9 +548,9 @@ midi_do_sysex(void)
|
||||
ret = 0;
|
||||
if (temp->sysex) {
|
||||
if (temp->cnt == 0)
|
||||
ret = temp->sysex(temp->p, temp->buf, 0, 0);
|
||||
ret = temp->sysex(temp->priv, temp->buf, 0, 0);
|
||||
else
|
||||
ret = temp->sysex(temp->p, temp->buf, temp->len, 0);
|
||||
ret = temp->sysex(temp->priv, temp->buf, temp->len, 0);
|
||||
}
|
||||
|
||||
/* If count is 0 and length is 0, then this is just a finishing
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
# include <86box/midi.h>
|
||||
# include <86box/thread.h>
|
||||
# include <86box/sound.h>
|
||||
# include <86box/plat_unused.h>
|
||||
|
||||
# define RENDER_RATE 100
|
||||
# define BUFFER_SEGMENTS 10
|
||||
@@ -151,7 +152,7 @@ fluidsynth_sysex(uint8_t *data, unsigned int len)
|
||||
}
|
||||
|
||||
void *
|
||||
fluidsynth_init(const device_t *info)
|
||||
fluidsynth_init(UNUSED(const device_t *info))
|
||||
{
|
||||
fluidsynth_t *data = &fsdev;
|
||||
midi_device_t *dev;
|
||||
@@ -165,7 +166,7 @@ fluidsynth_init(const device_t *info)
|
||||
|
||||
data->synth = new_fluid_synth(data->settings);
|
||||
|
||||
const char *sound_font = (char *) device_get_config_string("sound_font");
|
||||
const char *sound_font = device_get_config_string("sound_font");
|
||||
# ifdef __unix__
|
||||
if (!sound_font || sound_font[0] == 0)
|
||||
sound_font = (access("/usr/share/sounds/sf2/FluidR3_GM.sf2", F_OK) == 0 ? "/usr/share/sounds/sf2/FluidR3_GM.sf2" :
|
||||
@@ -286,9 +287,9 @@ fluidsynth_init(const device_t *info)
|
||||
}
|
||||
|
||||
void
|
||||
fluidsynth_close(void *p)
|
||||
fluidsynth_close(void *priv)
|
||||
{
|
||||
if (!p)
|
||||
if (!priv)
|
||||
return;
|
||||
|
||||
fluidsynth_t *data = &fsdev;
|
||||
|
||||
@@ -110,7 +110,7 @@ static mt32emu_context context = NULL;
|
||||
static int roms_present[2] = { -1, -1 };
|
||||
|
||||
mt32emu_return_code
|
||||
mt32_check(const char *func, mt32emu_return_code ret, mt32emu_return_code expected)
|
||||
mt32_check(UNUSED(const char *func), mt32emu_return_code ret, mt32emu_return_code expected)
|
||||
{
|
||||
if (ret != expected) {
|
||||
return 0;
|
||||
@@ -165,13 +165,13 @@ static int16_t *buffer_int16 = NULL;
|
||||
static int midi_pos = 0;
|
||||
|
||||
static mt32emu_report_handler_version
|
||||
get_mt32_report_handler_version(mt32emu_report_handler_i i)
|
||||
get_mt32_report_handler_version(UNUSED(mt32emu_report_handler_i i))
|
||||
{
|
||||
return MT32EMU_REPORT_HANDLER_VERSION_0;
|
||||
}
|
||||
|
||||
static void
|
||||
display_mt32_message(void *instance_data, const char *message)
|
||||
display_mt32_message(UNUSED(void *instance_data), const char *message)
|
||||
{
|
||||
int sz = 0;
|
||||
char *ui_msg = NULL;
|
||||
@@ -209,7 +209,7 @@ mt32_poll(void)
|
||||
}
|
||||
|
||||
static void
|
||||
mt32_thread(void *param)
|
||||
mt32_thread(UNUSED(void *param))
|
||||
{
|
||||
int buf_pos = 0;
|
||||
int bsize = buf_size / BUFFER_SEGMENTS;
|
||||
@@ -321,33 +321,33 @@ mt32emu_init(char *control_rom, char *pcm_rom)
|
||||
}
|
||||
|
||||
void *
|
||||
mt32_old_init(const device_t *info)
|
||||
mt32_old_init(UNUSED(const device_t *info))
|
||||
{
|
||||
return mt32emu_init(MT32_OLD_CTRL_ROM, MT32_OLD_PCM_ROM);
|
||||
}
|
||||
|
||||
void *
|
||||
mt32_new_init(const device_t *info)
|
||||
mt32_new_init(UNUSED(const device_t *info))
|
||||
{
|
||||
return mt32emu_init(MT32_NEW_CTRL_ROM, MT32_NEW_PCM_ROM);
|
||||
}
|
||||
|
||||
void *
|
||||
cm32l_init(const device_t *info)
|
||||
cm32l_init(UNUSED(const device_t *info))
|
||||
{
|
||||
return mt32emu_init(CM32L_CTRL_ROM, CM32L_PCM_ROM);
|
||||
}
|
||||
|
||||
void *
|
||||
cm32ln_init(const device_t *info)
|
||||
cm32ln_init(UNUSED(const device_t *info))
|
||||
{
|
||||
return mt32emu_init(CM32LN_CTRL_ROM, CM32LN_PCM_ROM);
|
||||
}
|
||||
|
||||
void
|
||||
mt32_close(void *p)
|
||||
mt32_close(void *priv)
|
||||
{
|
||||
if (!p)
|
||||
if (!priv)
|
||||
return;
|
||||
|
||||
mt32_on = 0;
|
||||
|
||||
@@ -35,6 +35,7 @@ extern "C" {
|
||||
#include <86box/midi_rtmidi.h>
|
||||
#include <86box/ini.h>
|
||||
#include <86box/config.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
// Disable c99-designator to avoid the warnings in rtmidi_*_device
|
||||
#ifdef __clang__
|
||||
@@ -50,7 +51,7 @@ static int midi_out_id = 0, midi_in_id = 0;
|
||||
static const int midi_lengths[8] = { 3, 3, 3, 3, 2, 2, 3, 1 };
|
||||
|
||||
int
|
||||
rtmidi_write(uint8_t val)
|
||||
rtmidi_write(UNUSED(uint8_t val))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -70,7 +71,7 @@ rtmidi_play_sysex(uint8_t *sysex, unsigned int len)
|
||||
}
|
||||
|
||||
void *
|
||||
rtmidi_output_init(const device_t *info)
|
||||
rtmidi_output_init(UNUSED(const device_t *info))
|
||||
{
|
||||
midi_device_t *dev = (midi_device_t *) malloc(sizeof(midi_device_t));
|
||||
memset(dev, 0, sizeof(midi_device_t));
|
||||
@@ -110,7 +111,7 @@ rtmidi_output_init(const device_t *info)
|
||||
}
|
||||
|
||||
void
|
||||
rtmidi_output_close(void *p)
|
||||
rtmidi_output_close(UNUSED(void *priv))
|
||||
{
|
||||
if (!midiout)
|
||||
return;
|
||||
@@ -144,7 +145,7 @@ rtmidi_out_get_dev_name(int num, char *s)
|
||||
}
|
||||
|
||||
void
|
||||
rtmidi_input_callback(double timeStamp, std::vector<unsigned char> *message, void *userData)
|
||||
rtmidi_input_callback(UNUSED(double timeStamp), std::vector<unsigned char> *message, UNUSED(void *userData))
|
||||
{
|
||||
if (message->front() == 0xF0)
|
||||
midi_in_sysex(message->data(), message->size());
|
||||
@@ -153,7 +154,7 @@ rtmidi_input_callback(double timeStamp, std::vector<unsigned char> *message, voi
|
||||
}
|
||||
|
||||
void *
|
||||
rtmidi_input_init(const device_t *info)
|
||||
rtmidi_input_init(UNUSED(const device_t *info))
|
||||
{
|
||||
midi_device_t *dev = (midi_device_t *) malloc(sizeof(midi_device_t));
|
||||
memset(dev, 0, sizeof(midi_device_t));
|
||||
@@ -198,7 +199,7 @@ rtmidi_input_init(const device_t *info)
|
||||
}
|
||||
|
||||
void
|
||||
rtmidi_input_close(void *p)
|
||||
rtmidi_input_close(UNUSED(void *priv))
|
||||
{
|
||||
midiin->cancelCallback();
|
||||
midiin->closePort();
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <86box/86box.h>
|
||||
#include <86box/midi.h>
|
||||
#include <86box/sound.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
#define FREQ SOUND_FREQ
|
||||
#define BUFLEN SOUNDBUFLEN
|
||||
@@ -58,7 +59,7 @@ al_set_midi(int freq, int buf_size)
|
||||
|
||||
void closeal(void);
|
||||
ALvoid
|
||||
alutInit(ALint *argc, ALbyte **argv)
|
||||
alutInit(UNUSED(ALint *argc), UNUSED(ALbyte **argv))
|
||||
{
|
||||
/* Open device */
|
||||
Device = alcOpenDevice((ALCchar *) "");
|
||||
|
||||
@@ -418,7 +418,7 @@ rate: /* Writable only if VRA/VRM is set. */
|
||||
prev = dev->vendor_reg_pages[(i << 3) | ((reg & 0x0e) >> 1)];
|
||||
}
|
||||
|
||||
/* fall-through */
|
||||
[[fallthrough]];
|
||||
|
||||
case 0x5a ... 0x5e: /* Vendor Reserved */
|
||||
case 0x70 ... 0x7a:
|
||||
|
||||
@@ -30,38 +30,59 @@
|
||||
#include <86box/snd_ac97.h>
|
||||
#include <86box/sound.h>
|
||||
#include <86box/timer.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
typedef struct {
|
||||
uint8_t id, always_run;
|
||||
typedef struct ac97_via_sgd_t {
|
||||
uint8_t id;
|
||||
uint8_t always_run;
|
||||
struct _ac97_via_ *dev;
|
||||
|
||||
uint32_t entry_ptr, sample_ptr, fifo_pos, fifo_end;
|
||||
uint32_t entry_ptr;
|
||||
uint32_t sample_ptr;
|
||||
uint32_t fifo_pos;
|
||||
uint32_t fifo_end;
|
||||
int32_t sample_count;
|
||||
uint8_t entry_flags, fifo[32], restart;
|
||||
uint8_t entry_flags;
|
||||
uint8_t fifo[32];
|
||||
uint8_t restart;
|
||||
|
||||
int16_t out_l, out_r;
|
||||
int vol_l, vol_r, pos;
|
||||
int16_t out_l;
|
||||
int16_t out_r;
|
||||
int vol_l;
|
||||
int vol_r;
|
||||
int pos;
|
||||
int32_t buffer[SOUNDBUFLEN * 2];
|
||||
uint64_t timer_latch;
|
||||
|
||||
pc_timer_t dma_timer, poll_timer;
|
||||
pc_timer_t dma_timer;
|
||||
pc_timer_t poll_timer;
|
||||
} ac97_via_sgd_t;
|
||||
|
||||
typedef struct _ac97_via_ {
|
||||
uint16_t audio_sgd_base, audio_codec_base, modem_sgd_base, modem_codec_base;
|
||||
uint8_t sgd_regs[256], pcm_enabled : 1, fm_enabled : 1, vsr_enabled : 1;
|
||||
uint16_t audio_sgd_base;
|
||||
uint16_t audio_codec_base;
|
||||
uint16_t modem_sgd_base;
|
||||
uint16_t modem_codec_base;
|
||||
uint8_t sgd_regs[256];
|
||||
uint8_t pcm_enabled : 1;
|
||||
uint8_t fm_enabled : 1;
|
||||
uint8_t vsr_enabled : 1;
|
||||
struct {
|
||||
union {
|
||||
uint8_t regs_codec[2][128];
|
||||
uint8_t regs_linear[256];
|
||||
};
|
||||
} codec_shadow[2];
|
||||
int slot, irq_pin;
|
||||
int slot;
|
||||
int irq_pin;
|
||||
|
||||
ac97_codec_t *codec[2][2];
|
||||
ac97_via_sgd_t sgd[6];
|
||||
|
||||
int master_vol_l, master_vol_r, cd_vol_l, cd_vol_r;
|
||||
int master_vol_l;
|
||||
int master_vol_r;
|
||||
int cd_vol_l;
|
||||
int cd_vol_r;
|
||||
} ac97_via_t;
|
||||
|
||||
#ifdef ENABLE_AC97_VIA_LOG
|
||||
@@ -350,6 +371,9 @@ ac97_via_sgd_write(uint16_t addr, uint8_t val, void *priv)
|
||||
case 0x8 ... 0xf:
|
||||
/* Read-only registers. */
|
||||
return;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
/* Process regular registers. */
|
||||
@@ -404,6 +428,9 @@ ac97_via_sgd_write(uint16_t addr, uint8_t val, void *priv)
|
||||
val = dev->sgd_regs[addr] | (val & 0xc0);
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -676,6 +703,9 @@ ac97_via_poll_stereo(void *priv)
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* Feed silence if the FIFO is empty. */
|
||||
@@ -753,7 +783,7 @@ ac97_via_speed_changed(void *priv)
|
||||
}
|
||||
|
||||
static void *
|
||||
ac97_via_init(const device_t *info)
|
||||
ac97_via_init(UNUSED(const device_t *info))
|
||||
{
|
||||
ac97_via_t *dev = malloc(sizeof(ac97_via_t));
|
||||
memset(dev, 0, sizeof(ac97_via_t));
|
||||
|
||||
@@ -111,6 +111,9 @@ ad1848_updatefreq(ad1848_t *ad1848)
|
||||
case 0x20:
|
||||
freq /= 256 * set;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
set = 1;
|
||||
}
|
||||
@@ -143,6 +146,9 @@ ad1848_updatefreq(ad1848_t *ad1848)
|
||||
case 7:
|
||||
freq /= 2560;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,12 +200,18 @@ ad1848_read(uint16_t addr, void *priv)
|
||||
ret = ad1848->xregs[ad1848->xindex];
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
ret = ad1848->status;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -229,7 +241,7 @@ ad1848_write(uint16_t addr, uint8_t val, void *priv)
|
||||
case 10:
|
||||
if (ad1848->type < AD1848_TYPE_CS4235)
|
||||
break;
|
||||
/* fall-through */
|
||||
[[fallthrough]];
|
||||
|
||||
case 8:
|
||||
updatefreq = 1;
|
||||
@@ -359,6 +371,9 @@ ad1848_write(uint16_t addr, uint8_t val, void *priv)
|
||||
|
||||
case 25:
|
||||
return;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
ad1848->xregs[ad1848->xindex] = val;
|
||||
|
||||
@@ -383,6 +398,9 @@ ad1848_write(uint16_t addr, uint8_t val, void *priv)
|
||||
if (ad1848->type != AD1848_TYPE_DEFAULT)
|
||||
return;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
ad1848->regs[ad1848->index] = val;
|
||||
|
||||
@@ -406,6 +424,9 @@ ad1848_write(uint16_t addr, uint8_t val, void *priv)
|
||||
ad1848->status &= 0xfe;
|
||||
ad1848->regs[24] &= 0x0f;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -561,6 +582,9 @@ ad1848_poll(void *priv)
|
||||
break;
|
||||
|
||||
/* 0xe0 and 0xf0 reserved */
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (ad1848->regs[6] & 0x80)
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <86box/sound.h>
|
||||
#include <86box/timer.h>
|
||||
#include <86box/snd_opl.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
#ifdef ENABLE_ADLIB_LOG
|
||||
int adlib_do_log = ENABLE_ADLIB_LOG;
|
||||
@@ -39,22 +40,22 @@ typedef struct adlib_t {
|
||||
} adlib_t;
|
||||
|
||||
static void
|
||||
adlib_get_buffer(int32_t *buffer, int len, void *p)
|
||||
adlib_get_buffer(int32_t *buffer, int len, void *priv)
|
||||
{
|
||||
adlib_t *adlib = (adlib_t *) p;
|
||||
adlib_t *adlib = (adlib_t *) priv;
|
||||
|
||||
int32_t *opl_buf = adlib->opl.update(adlib->opl.priv);
|
||||
|
||||
for (int c = 0; c < len * 2; c++)
|
||||
buffer[c] += (int32_t) opl_buf[c];
|
||||
buffer[c] += opl_buf[c];
|
||||
|
||||
adlib->opl.reset_buffer(adlib->opl.priv);
|
||||
}
|
||||
|
||||
uint8_t
|
||||
adlib_mca_read(int port, void *p)
|
||||
adlib_mca_read(int port, void *priv)
|
||||
{
|
||||
adlib_t *adlib = (adlib_t *) p;
|
||||
adlib_t *adlib = (adlib_t *) priv;
|
||||
|
||||
adlib_log("adlib_mca_read: port=%04x\n", port);
|
||||
|
||||
@@ -62,9 +63,9 @@ adlib_mca_read(int port, void *p)
|
||||
}
|
||||
|
||||
void
|
||||
adlib_mca_write(int port, uint8_t val, void *p)
|
||||
adlib_mca_write(int port, uint8_t val, void *priv)
|
||||
{
|
||||
adlib_t *adlib = (adlib_t *) p;
|
||||
adlib_t *adlib = (adlib_t *) priv;
|
||||
|
||||
if (port < 0x102)
|
||||
return;
|
||||
@@ -84,20 +85,23 @@ adlib_mca_write(int port, uint8_t val, void *p)
|
||||
adlib->opl.write, NULL, NULL,
|
||||
adlib->opl.priv);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
adlib->pos_regs[port & 7] = val;
|
||||
}
|
||||
|
||||
uint8_t
|
||||
adlib_mca_feedb(void *p)
|
||||
adlib_mca_feedb(void *priv)
|
||||
{
|
||||
adlib_t *adlib = (adlib_t *) p;
|
||||
adlib_t *adlib = (adlib_t *) priv;
|
||||
|
||||
return (adlib->pos_regs[2] & 1);
|
||||
}
|
||||
|
||||
void *
|
||||
adlib_init(const device_t *info)
|
||||
adlib_init(UNUSED(const device_t *info))
|
||||
{
|
||||
adlib_t *adlib = malloc(sizeof(adlib_t));
|
||||
memset(adlib, 0, sizeof(adlib_t));
|
||||
@@ -133,9 +137,9 @@ adlib_mca_init(const device_t *info)
|
||||
}
|
||||
|
||||
void
|
||||
adlib_close(void *p)
|
||||
adlib_close(void *priv)
|
||||
{
|
||||
adlib_t *adlib = (adlib_t *) p;
|
||||
adlib_t *adlib = (adlib_t *) priv;
|
||||
free(adlib);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,15 +17,18 @@
|
||||
#include <86box/sound.h>
|
||||
#include <86box/snd_opl.h>
|
||||
#include <86box/snd_ym7128.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
typedef struct adgold_t {
|
||||
int adgold_irq_status;
|
||||
int irq, dma;
|
||||
int irq;
|
||||
int dma;
|
||||
|
||||
uint8_t adgold_eeprom[0x1a];
|
||||
|
||||
uint8_t adgold_status;
|
||||
int adgold_38x_state, adgold_38x_addr;
|
||||
int adgold_38x_state;
|
||||
int adgold_38x_addr;
|
||||
uint8_t adgold_38x_regs[0x1a];
|
||||
|
||||
int adgold_mma_addr;
|
||||
@@ -33,7 +36,8 @@ typedef struct adgold_t {
|
||||
|
||||
int adgold_mma_enable[2];
|
||||
uint8_t adgold_mma_fifo[2][256];
|
||||
int adgold_mma_fifo_start[2], adgold_mma_fifo_end[2];
|
||||
int adgold_mma_fifo_start[2];
|
||||
int adgold_mma_fifo_end[2];
|
||||
uint8_t adgold_mma_status;
|
||||
|
||||
int16_t adgold_mma_out[2];
|
||||
@@ -41,28 +45,42 @@ typedef struct adgold_t {
|
||||
|
||||
pc_timer_t adgold_mma_timer_count;
|
||||
|
||||
uint8_t adgold_midi_ctrl, midi_queue[16];
|
||||
int midi_r, midi_w;
|
||||
int uart_in, uart_out, sysex;
|
||||
uint8_t adgold_midi_ctrl;
|
||||
uint8_t midi_queue[16];
|
||||
int midi_r;
|
||||
int midi_w;
|
||||
int uart_in;
|
||||
int uart_out;
|
||||
int sysex;
|
||||
|
||||
struct
|
||||
{
|
||||
int timer0_latch, timer0_count;
|
||||
int timerbase_latch, timerbase_count;
|
||||
int timer1_latch, timer1_count;
|
||||
int timer2_latch, timer2_count, timer2_read;
|
||||
struct {
|
||||
int timer0_latch;
|
||||
int timer0_count;
|
||||
int timerbase_latch;
|
||||
int timerbase_count;
|
||||
int timer1_latch;
|
||||
int timer1_count;
|
||||
int timer2_latch;
|
||||
int timer2_count;
|
||||
int timer2_read;
|
||||
|
||||
int voice_count[2], voice_latch[2];
|
||||
int voice_count[2];
|
||||
int voice_latch[2];
|
||||
} adgold_mma;
|
||||
|
||||
fm_drv_t opl;
|
||||
ym7128_t ym7128;
|
||||
|
||||
int fm_vol_l, fm_vol_r;
|
||||
int samp_vol_l, samp_vol_r;
|
||||
int aux_vol_l, aux_vol_r;
|
||||
int vol_l, vol_r;
|
||||
int treble, bass;
|
||||
int fm_vol_l;
|
||||
int fm_vol_r;
|
||||
int samp_vol_l;
|
||||
int samp_vol_r;
|
||||
int aux_vol_l;
|
||||
int aux_vol_r;
|
||||
int vol_l;
|
||||
int vol_r;
|
||||
int treble;
|
||||
int bass;
|
||||
|
||||
int16_t opl_buffer[SOUNDBUFLEN * 2];
|
||||
int16_t mma_buffer[2][SOUNDBUFLEN];
|
||||
@@ -131,7 +149,7 @@ static int treble_cut[6] = {
|
||||
(int) (0.354 * 16384) /*-3 dB - filter output is at +6 dB*/
|
||||
};
|
||||
|
||||
void adgold_timer_poll(void *p);
|
||||
void adgold_timer_poll(void *priv);
|
||||
void adgold_update(adgold_t *adgold);
|
||||
|
||||
void
|
||||
@@ -192,9 +210,9 @@ adgold_getsamp_dma(adgold_t *adgold, int channel)
|
||||
}
|
||||
|
||||
void
|
||||
adgold_write(uint16_t addr, uint8_t val, void *p)
|
||||
adgold_write(uint16_t addr, uint8_t val, void *priv)
|
||||
{
|
||||
adgold_t *adgold = (adgold_t *) p;
|
||||
adgold_t *adgold = (adgold_t *) priv;
|
||||
switch (addr & 7) {
|
||||
case 0:
|
||||
case 1:
|
||||
@@ -337,6 +355,9 @@ adgold_write(uint16_t addr, uint8_t val, void *p)
|
||||
case 0x18:
|
||||
adgold->adgold_mma.voice_latch[0] = 72;
|
||||
break; /* 7350 Hz*/
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (val & 0x80) {
|
||||
adgold->adgold_mma_enable[0] = 0;
|
||||
@@ -438,6 +459,9 @@ adgold_write(uint16_t addr, uint8_t val, void *p)
|
||||
adgold_update_irq_status(adgold);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
adgold->adgold_mma_regs[0][adgold->adgold_mma_addr] = val;
|
||||
break;
|
||||
@@ -460,6 +484,9 @@ adgold_write(uint16_t addr, uint8_t val, void *p)
|
||||
case 0x18:
|
||||
adgold->adgold_mma.voice_latch[1] = 72;
|
||||
break; /* 7350 Hz*/
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (val & 0x80) {
|
||||
adgold->adgold_mma_enable[1] = 0;
|
||||
@@ -497,16 +524,22 @@ adgold_write(uint16_t addr, uint8_t val, void *p)
|
||||
case 0xc:
|
||||
adgold->adgold_mma_intpos[1] = (7 - ((val >> 2) & 7)) * 8;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
adgold->adgold_mma_regs[1][adgold->adgold_mma_addr] = val;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t
|
||||
adgold_read(uint16_t addr, void *p)
|
||||
adgold_read(uint16_t addr, void *priv)
|
||||
{
|
||||
adgold_t *adgold = (adgold_t *) p;
|
||||
adgold_t *adgold = (adgold_t *) priv;
|
||||
uint8_t temp = 0;
|
||||
|
||||
switch (addr & 7) {
|
||||
@@ -586,6 +619,9 @@ adgold_read(uint16_t addr, void *p)
|
||||
else
|
||||
temp = adgold->adgold_mma_regs[1][adgold->adgold_mma_addr];
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
@@ -633,6 +669,9 @@ adgold_mma_poll(adgold_t *adgold, int channel)
|
||||
adgold->adgold_mma_fifo_start[channel] = (adgold->adgold_mma_fifo_start[channel] + 1) & 255;
|
||||
adgold->adgold_mma_out[channel] = dat;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (adgold->adgold_mma_regs[channel][0xc] & 1) {
|
||||
@@ -649,9 +688,9 @@ adgold_mma_poll(adgold_t *adgold, int channel)
|
||||
}
|
||||
|
||||
void
|
||||
adgold_timer_poll(void *p)
|
||||
adgold_timer_poll(void *priv)
|
||||
{
|
||||
adgold_t *adgold = (adgold_t *) p;
|
||||
adgold_t *adgold = (adgold_t *) priv;
|
||||
|
||||
/*A small timer period will result in hangs.*/
|
||||
timer_on_auto(&adgold->adgold_mma_timer_count, 4.88964);
|
||||
@@ -718,9 +757,9 @@ adgold_timer_poll(void *p)
|
||||
}
|
||||
|
||||
static void
|
||||
adgold_get_buffer(int32_t *buffer, int len, void *p)
|
||||
adgold_get_buffer(int32_t *buffer, int len, void *priv)
|
||||
{
|
||||
adgold_t *adgold = (adgold_t *) p;
|
||||
adgold_t *adgold = (adgold_t *) priv;
|
||||
int16_t *adgold_buffer = malloc(sizeof(int16_t) * len * 2);
|
||||
if (adgold_buffer == NULL)
|
||||
fatal("adgold_buffer = NULL");
|
||||
@@ -755,6 +794,9 @@ adgold_get_buffer(int32_t *buffer, int len, void *p)
|
||||
break;
|
||||
case 6: /*Left and right channels*/
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (adgold->adgold_38x_regs[0x8] & 0x18) {
|
||||
@@ -781,6 +823,9 @@ adgold_get_buffer(int32_t *buffer, int len, void *p)
|
||||
adgold_buffer[c + 1] += (l / 3) + ((r * 2) / 3);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
for (c = 0; c < len * 2; c += 2) {
|
||||
@@ -831,9 +876,9 @@ adgold_get_buffer(int32_t *buffer, int len, void *p)
|
||||
}
|
||||
|
||||
static void
|
||||
adgold_filter_cd_audio(int channel, double *buffer, void *p)
|
||||
adgold_filter_cd_audio(int channel, double *buffer, void *priv)
|
||||
{
|
||||
adgold_t *adgold = (adgold_t *) p;
|
||||
adgold_t *adgold = (adgold_t *) priv;
|
||||
double c;
|
||||
int aux = channel ? adgold->aux_vol_r : adgold->aux_vol_l;
|
||||
int vol = channel ? adgold->vol_r : adgold->vol_l;
|
||||
@@ -883,7 +928,7 @@ adgold_input_sysex(void *p, uint8_t *buffer, uint32_t len, int abort)
|
||||
}
|
||||
|
||||
void *
|
||||
adgold_init(const device_t *info)
|
||||
adgold_init(UNUSED(const device_t *info))
|
||||
{
|
||||
FILE *f;
|
||||
int c;
|
||||
@@ -957,6 +1002,9 @@ adgold_init(const device_t *info)
|
||||
case 7:
|
||||
adgold->adgold_eeprom[0x13] |= 0x03;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
adgold->adgold_eeprom[0x13] |= (adgold->dma << 3);
|
||||
adgold->adgold_eeprom[0x14] |= (adgold->dma << 4);
|
||||
@@ -993,15 +1041,15 @@ adgold_init(const device_t *info)
|
||||
}
|
||||
|
||||
void
|
||||
adgold_close(void *p)
|
||||
adgold_close(void *priv)
|
||||
{
|
||||
FILE *f;
|
||||
adgold_t *adgold = (adgold_t *) p;
|
||||
FILE *fp;
|
||||
adgold_t *adgold = (adgold_t *) priv;
|
||||
|
||||
f = nvr_fopen("adgold.bin", "wb");
|
||||
if (f) {
|
||||
fwrite(adgold->adgold_eeprom, 0x1a, 1, f);
|
||||
fclose(f);
|
||||
fp = nvr_fopen("adgold.bin", "wb");
|
||||
if (fp) {
|
||||
fwrite(adgold->adgold_eeprom, 0x1a, 1, fp);
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
free(adgold);
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include <86box/snd_ac97.h>
|
||||
#include <86box/sound.h>
|
||||
#include <86box/timer.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
#define N 16
|
||||
|
||||
@@ -45,8 +46,9 @@
|
||||
|
||||
static float low_fir_es1371_coef[ES1371_NCoef];
|
||||
|
||||
typedef struct {
|
||||
uint8_t pci_command, pci_serr;
|
||||
typedef struct es1371_t {
|
||||
uint8_t pci_command;
|
||||
uint8_t pci_serr;
|
||||
|
||||
uint32_t base_addr;
|
||||
|
||||
@@ -54,9 +56,10 @@ typedef struct {
|
||||
|
||||
uint16_t pmcsr;
|
||||
|
||||
uint32_t int_ctrl, int_status,
|
||||
legacy_ctrl;
|
||||
void *gameport;
|
||||
uint32_t int_ctrl;
|
||||
uint32_t int_status;
|
||||
uint32_t legacy_ctrl;
|
||||
void *gameport;
|
||||
|
||||
int mem_page;
|
||||
|
||||
@@ -65,17 +68,22 @@ typedef struct {
|
||||
uint32_t sr_cir;
|
||||
uint16_t sr_ram[128];
|
||||
|
||||
uint8_t uart_data, uart_ctrl,
|
||||
uart_status, uart_res;
|
||||
uint8_t uart_data;
|
||||
uint8_t uart_ctrl;
|
||||
uint8_t uart_status;
|
||||
uint8_t uart_res;
|
||||
uint32_t uart_fifo[8];
|
||||
uint8_t read_fifo_pos, write_fifo_pos;
|
||||
uint8_t read_fifo_pos;
|
||||
uint8_t write_fifo_pos;
|
||||
|
||||
ac97_codec_t *codec;
|
||||
uint32_t codec_ctrl;
|
||||
|
||||
struct {
|
||||
uint32_t addr, addr_latch;
|
||||
uint16_t count, size;
|
||||
uint32_t addr;
|
||||
uint32_t addr_latch;
|
||||
uint16_t count;
|
||||
uint16_t size;
|
||||
|
||||
uint16_t samp_ct;
|
||||
int curr_samp_ct;
|
||||
@@ -83,24 +91,34 @@ typedef struct {
|
||||
pc_timer_t timer;
|
||||
uint64_t latch;
|
||||
|
||||
uint32_t vf, ac;
|
||||
uint32_t vf;
|
||||
uint32_t ac;
|
||||
|
||||
int16_t buffer_l[64], buffer_r[64];
|
||||
int buffer_pos, buffer_pos_end;
|
||||
int16_t buffer_l[64];
|
||||
int16_t buffer_r[64];
|
||||
int buffer_pos;
|
||||
int buffer_pos_end;
|
||||
|
||||
int filtered_l[32], filtered_r[32];
|
||||
int filtered_l[32];
|
||||
int filtered_r[32];
|
||||
int f_pos;
|
||||
|
||||
int16_t out_l, out_r;
|
||||
int16_t out_l;
|
||||
int16_t out_r;
|
||||
|
||||
int32_t vol_l, vol_r;
|
||||
int32_t vol_l;
|
||||
int32_t vol_r;
|
||||
} dac[2], adc;
|
||||
|
||||
int64_t dac_latch, dac_time;
|
||||
int64_t dac_latch;
|
||||
int64_t dac_time;
|
||||
|
||||
int master_vol_l, master_vol_r,
|
||||
pcm_vol_l, pcm_vol_r,
|
||||
cd_vol_l, cd_vol_r;
|
||||
int master_vol_l;
|
||||
int master_vol_r;
|
||||
int pcm_vol_l;
|
||||
int pcm_vol_r;
|
||||
int cd_vol_l;
|
||||
int cd_vol_r;
|
||||
|
||||
int card;
|
||||
|
||||
@@ -299,9 +317,9 @@ es1371_reset_fifo(es1371_t *dev)
|
||||
}
|
||||
|
||||
static void
|
||||
es1371_reset(void *p)
|
||||
es1371_reset(void *priv)
|
||||
{
|
||||
es1371_t *dev = (es1371_t *) p;
|
||||
es1371_t *dev = (es1371_t *) priv;
|
||||
|
||||
nmi = 0;
|
||||
|
||||
@@ -435,6 +453,9 @@ es1371_read_frame_reg(es1371_t *dev, int frame, int page)
|
||||
dev->uart_fifo[((page & 0x01) << 2) + ((frame >> 2) & 0x03)]);
|
||||
ret = dev->uart_fifo[((page & 0x01) << 2) + ((frame >> 2) & 0x03)];
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 0x34:
|
||||
@@ -458,6 +479,9 @@ es1371_read_frame_reg(es1371_t *dev, int frame, int page)
|
||||
dev->uart_fifo[((page & 0x01) << 2) + ((frame >> 2) & 0x03)]);
|
||||
ret = dev->uart_fifo[((page & 0x01) << 2) + ((frame >> 2) & 0x03)];
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 0x38:
|
||||
@@ -476,6 +500,9 @@ es1371_read_frame_reg(es1371_t *dev, int frame, int page)
|
||||
dev->uart_fifo[((page & 0x01) << 2) + ((frame >> 2) & 0x03)]);
|
||||
ret = dev->uart_fifo[((page & 0x01) << 2) + ((frame >> 2) & 0x03)];
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 0x3c:
|
||||
@@ -494,8 +521,14 @@ es1371_read_frame_reg(es1371_t *dev, int frame, int page)
|
||||
dev->uart_fifo[((page & 0x01) << 2) + ((frame >> 2) & 0x03)]);
|
||||
ret = dev->uart_fifo[((page & 0x01) << 2) + ((frame >> 2) & 0x03)];
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -525,6 +558,9 @@ es1371_write_frame_reg(es1371_t *dev, int frame, int page, uint32_t val)
|
||||
((page & 0x01) << 2) + ((frame >> 2) & 0x03), val);
|
||||
dev->uart_fifo[((page & 0x01) << 2) + ((frame >> 2) & 0x03)] = val;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 0x34:
|
||||
@@ -549,6 +585,9 @@ es1371_write_frame_reg(es1371_t *dev, int frame, int page, uint32_t val)
|
||||
((page & 0x01) << 2) + ((frame >> 2) & 0x03), val);
|
||||
dev->uart_fifo[((page & 0x01) << 2) + ((frame >> 2) & 0x03)] = val;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 0x38:
|
||||
@@ -566,6 +605,9 @@ es1371_write_frame_reg(es1371_t *dev, int frame, int page, uint32_t val)
|
||||
((page & 0x01) << 2) + ((frame >> 2) & 0x03), val);
|
||||
dev->uart_fifo[((page & 0x01) << 2) + ((frame >> 2) & 0x03)] = val;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 0x3c:
|
||||
@@ -584,8 +626,14 @@ es1371_write_frame_reg(es1371_t *dev, int frame, int page, uint32_t val)
|
||||
((page & 0x01) << 2) + ((frame >> 2) & 0x03), val);
|
||||
dev->uart_fifo[((page & 0x01) << 2) + ((frame >> 2) & 0x03)] = val;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (page == 0x0e || page == 0x0f) {
|
||||
@@ -594,9 +642,9 @@ es1371_write_frame_reg(es1371_t *dev, int frame, int page, uint32_t val)
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
es1371_inb(uint16_t port, void *p)
|
||||
es1371_inb(uint16_t port, void *priv)
|
||||
{
|
||||
es1371_t *dev = (es1371_t *) p;
|
||||
es1371_t *dev = (es1371_t *) priv;
|
||||
uint8_t ret = 0xff;
|
||||
|
||||
switch (port & 0x3f) {
|
||||
@@ -705,9 +753,9 @@ es1371_inb(uint16_t port, void *p)
|
||||
}
|
||||
|
||||
static uint16_t
|
||||
es1371_inw(uint16_t port, void *p)
|
||||
es1371_inw(uint16_t port, void *priv)
|
||||
{
|
||||
es1371_t *dev = (es1371_t *) p;
|
||||
es1371_t *dev = (es1371_t *) priv;
|
||||
uint16_t ret = 0xffff;
|
||||
|
||||
switch (port & 0x3e) {
|
||||
@@ -786,6 +834,9 @@ es1371_inw(uint16_t port, void *p)
|
||||
case 0x3e:
|
||||
ret = es1371_read_frame_reg(dev, port & 0x3c, dev->mem_page) >> 16;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
audiopci_log("es1371_inw: port=%04x ret=%04x\n", port, ret);
|
||||
@@ -794,9 +845,9 @@ es1371_inw(uint16_t port, void *p)
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
es1371_inl(uint16_t port, void *p)
|
||||
es1371_inl(uint16_t port, void *priv)
|
||||
{
|
||||
es1371_t *dev = (es1371_t *) p;
|
||||
es1371_t *dev = (es1371_t *) priv;
|
||||
uint32_t ret = 0xffffffff;
|
||||
|
||||
switch (port & 0x3c) {
|
||||
@@ -868,6 +919,9 @@ es1371_inl(uint16_t port, void *p)
|
||||
case 0x3c:
|
||||
ret = es1371_read_frame_reg(dev, port & 0x3c, dev->mem_page);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
audiopci_log("es1371_inl: port=%04x ret=%08x\n", port, ret);
|
||||
@@ -875,9 +929,9 @@ es1371_inl(uint16_t port, void *p)
|
||||
}
|
||||
|
||||
static void
|
||||
es1371_outb(uint16_t port, uint8_t val, void *p)
|
||||
es1371_outb(uint16_t port, uint8_t val, void *priv)
|
||||
{
|
||||
es1371_t *dev = (es1371_t *) p;
|
||||
es1371_t *dev = (es1371_t *) priv;
|
||||
uint32_t old_legacy_ctrl;
|
||||
|
||||
audiopci_log("es1371_outb: port=%04x val=%02x\n", port, val);
|
||||
@@ -995,9 +1049,9 @@ es1371_outb(uint16_t port, uint8_t val, void *p)
|
||||
}
|
||||
|
||||
static void
|
||||
es1371_outw(uint16_t port, uint16_t val, void *p)
|
||||
es1371_outw(uint16_t port, uint16_t val, void *priv)
|
||||
{
|
||||
es1371_t *dev = (es1371_t *) p;
|
||||
es1371_t *dev = (es1371_t *) priv;
|
||||
uint32_t old_legacy_ctrl;
|
||||
|
||||
switch (port & 0x3f) {
|
||||
@@ -1074,13 +1128,16 @@ es1371_outw(uint16_t port, uint16_t val, void *p)
|
||||
case 0x2c:
|
||||
dev->adc.samp_ct = val;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
es1371_outl(uint16_t port, uint32_t val, void *p)
|
||||
es1371_outl(uint16_t port, uint32_t val, void *priv)
|
||||
{
|
||||
es1371_t *dev = (es1371_t *) p;
|
||||
es1371_t *dev = (es1371_t *) priv;
|
||||
uint32_t old_legacy_ctrl;
|
||||
|
||||
audiopci_log("es1371_outl: port=%04x val=%08x\n", port, val);
|
||||
@@ -1160,6 +1217,9 @@ es1371_outl(uint16_t port, uint32_t val, void *p)
|
||||
case 0x7f:
|
||||
dev->dac[1].vol_r = (int32_t) (int16_t) (val & 0xffff);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1225,6 +1285,9 @@ es1371_outl(uint16_t port, uint32_t val, void *p)
|
||||
case 0x3c:
|
||||
es1371_write_frame_reg(dev, port & 0x3c, dev->mem_page, val);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1243,106 +1306,106 @@ capture_event(es1371_t *dev, int type, int rw, uint16_t port)
|
||||
}
|
||||
|
||||
static void
|
||||
capture_write_sscape(uint16_t port, uint8_t val, void *p)
|
||||
capture_write_sscape(uint16_t port, UNUSED(uint8_t val), void *priv)
|
||||
{
|
||||
capture_event(p, LEGACY_EVENT_SSCAPE, 1, port);
|
||||
capture_event(priv, LEGACY_EVENT_SSCAPE, 1, port);
|
||||
}
|
||||
|
||||
static void
|
||||
capture_write_codec(uint16_t port, uint8_t val, void *p)
|
||||
capture_write_codec(uint16_t port, UNUSED(uint8_t val), void *priv)
|
||||
{
|
||||
capture_event(p, LEGACY_EVENT_CODEC, 1, port);
|
||||
capture_event(priv, LEGACY_EVENT_CODEC, 1, port);
|
||||
}
|
||||
|
||||
static void
|
||||
capture_write_sb(uint16_t port, uint8_t val, void *p)
|
||||
capture_write_sb(uint16_t port, UNUSED(uint8_t val), void *priv)
|
||||
{
|
||||
capture_event(p, LEGACY_EVENT_SB, 1, port);
|
||||
capture_event(priv, LEGACY_EVENT_SB, 1, port);
|
||||
}
|
||||
|
||||
static void
|
||||
capture_write_adlib(uint16_t port, uint8_t val, void *p)
|
||||
capture_write_adlib(uint16_t port, UNUSED(uint8_t val), void *priv)
|
||||
{
|
||||
capture_event(p, LEGACY_EVENT_ADLIB, 1, port);
|
||||
capture_event(priv, LEGACY_EVENT_ADLIB, 1, port);
|
||||
}
|
||||
|
||||
static void
|
||||
capture_write_master_pic(uint16_t port, uint8_t val, void *p)
|
||||
capture_write_master_pic(uint16_t port, UNUSED(uint8_t val), void *priv)
|
||||
{
|
||||
capture_event(p, LEGACY_EVENT_MASTER_PIC, 1, port);
|
||||
capture_event(priv, LEGACY_EVENT_MASTER_PIC, 1, port);
|
||||
}
|
||||
|
||||
static void
|
||||
capture_write_master_dma(uint16_t port, uint8_t val, void *p)
|
||||
capture_write_master_dma(uint16_t port, UNUSED(uint8_t val), void *priv)
|
||||
{
|
||||
capture_event(p, LEGACY_EVENT_MASTER_DMA, 1, port);
|
||||
capture_event(priv, LEGACY_EVENT_MASTER_DMA, 1, port);
|
||||
}
|
||||
|
||||
static void
|
||||
capture_write_slave_pic(uint16_t port, uint8_t val, void *p)
|
||||
capture_write_slave_pic(uint16_t port, UNUSED(uint8_t val), void *priv)
|
||||
{
|
||||
capture_event(p, LEGACY_EVENT_SLAVE_PIC, 1, port);
|
||||
capture_event(priv, LEGACY_EVENT_SLAVE_PIC, 1, port);
|
||||
}
|
||||
|
||||
static void
|
||||
capture_write_slave_dma(uint16_t port, uint8_t val, void *p)
|
||||
capture_write_slave_dma(uint16_t port, UNUSED(uint8_t val), void *priv)
|
||||
{
|
||||
capture_event(p, LEGACY_EVENT_SLAVE_DMA, 1, port);
|
||||
capture_event(priv, LEGACY_EVENT_SLAVE_DMA, 1, port);
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
capture_read_sscape(uint16_t port, void *p)
|
||||
capture_read_sscape(uint16_t port, void *priv)
|
||||
{
|
||||
capture_event(p, LEGACY_EVENT_SSCAPE, 0, port);
|
||||
capture_event(priv, LEGACY_EVENT_SSCAPE, 0, port);
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
capture_read_codec(uint16_t port, void *p)
|
||||
capture_read_codec(uint16_t port, void *priv)
|
||||
{
|
||||
capture_event(p, LEGACY_EVENT_CODEC, 0, port);
|
||||
capture_event(priv, LEGACY_EVENT_CODEC, 0, port);
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
capture_read_sb(uint16_t port, void *p)
|
||||
capture_read_sb(uint16_t port, void *priv)
|
||||
{
|
||||
capture_event(p, LEGACY_EVENT_SB, 0, port);
|
||||
capture_event(priv, LEGACY_EVENT_SB, 0, port);
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
capture_read_adlib(uint16_t port, void *p)
|
||||
capture_read_adlib(uint16_t port, void *priv)
|
||||
{
|
||||
capture_event(p, LEGACY_EVENT_ADLIB, 0, port);
|
||||
capture_event(priv, LEGACY_EVENT_ADLIB, 0, port);
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
capture_read_master_pic(uint16_t port, void *p)
|
||||
capture_read_master_pic(uint16_t port, void *priv)
|
||||
{
|
||||
capture_event(p, LEGACY_EVENT_MASTER_PIC, 0, port);
|
||||
capture_event(priv, LEGACY_EVENT_MASTER_PIC, 0, port);
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
capture_read_master_dma(uint16_t port, void *p)
|
||||
capture_read_master_dma(uint16_t port, void *priv)
|
||||
{
|
||||
capture_event(p, LEGACY_EVENT_MASTER_DMA, 0, port);
|
||||
capture_event(priv, LEGACY_EVENT_MASTER_DMA, 0, port);
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
capture_read_slave_pic(uint16_t port, void *p)
|
||||
capture_read_slave_pic(uint16_t port, void *priv)
|
||||
{
|
||||
capture_event(p, LEGACY_EVENT_SLAVE_PIC, 0, port);
|
||||
capture_event(priv, LEGACY_EVENT_SLAVE_PIC, 0, port);
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
capture_read_slave_dma(uint16_t port, void *p)
|
||||
capture_read_slave_dma(uint16_t port, void *priv)
|
||||
{
|
||||
capture_event(p, LEGACY_EVENT_SLAVE_DMA, 0, port);
|
||||
capture_event(priv, LEGACY_EVENT_SLAVE_DMA, 0, port);
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
@@ -1371,6 +1434,9 @@ update_legacy(es1371_t *dev, uint32_t old_legacy_ctrl)
|
||||
capture_read_sscape, NULL, NULL,
|
||||
capture_write_sscape, NULL, NULL, dev);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1391,6 +1457,9 @@ update_legacy(es1371_t *dev, uint32_t old_legacy_ctrl)
|
||||
capture_read_codec, NULL, NULL,
|
||||
capture_write_codec, NULL, NULL, dev);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1458,6 +1527,9 @@ update_legacy(es1371_t *dev, uint32_t old_legacy_ctrl)
|
||||
capture_read_sscape, NULL, NULL,
|
||||
capture_write_sscape, NULL, NULL, dev);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1478,6 +1550,9 @@ update_legacy(es1371_t *dev, uint32_t old_legacy_ctrl)
|
||||
capture_read_codec, NULL, NULL,
|
||||
capture_write_codec, NULL, NULL, dev);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1525,9 +1600,9 @@ update_legacy(es1371_t *dev, uint32_t old_legacy_ctrl)
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
es1371_pci_read(int func, int addr, void *p)
|
||||
es1371_pci_read(int func, int addr, void *priv)
|
||||
{
|
||||
es1371_t *dev = (es1371_t *) p;
|
||||
es1371_t *dev = (es1371_t *) priv;
|
||||
|
||||
if (func > 0)
|
||||
return 0xff;
|
||||
@@ -1609,6 +1684,9 @@ es1371_pci_read(int func, int addr, void *p)
|
||||
return dev->pmcsr & 0xff;
|
||||
case 0xe1:
|
||||
return dev->pmcsr >> 8;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0x00;
|
||||
@@ -1625,9 +1703,9 @@ es1371_io_set(es1371_t *dev, int set)
|
||||
}
|
||||
|
||||
static void
|
||||
es1371_pci_write(int func, int addr, uint8_t val, void *p)
|
||||
es1371_pci_write(int func, int addr, uint8_t val, void *priv)
|
||||
{
|
||||
es1371_t *dev = (es1371_t *) p;
|
||||
es1371_t *dev = (es1371_t *) priv;
|
||||
|
||||
if (func)
|
||||
return;
|
||||
@@ -1669,6 +1747,9 @@ es1371_pci_write(int func, int addr, uint8_t val, void *p)
|
||||
case 0xe1:
|
||||
dev->pmcsr = (dev->pmcsr & 0x00ff) | ((val & 0x01) << 8);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1754,6 +1835,9 @@ es1371_fetch(es1371_t *dev, int dac_nr)
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1845,9 +1929,9 @@ es1371_update(es1371_t *dev)
|
||||
}
|
||||
|
||||
static void
|
||||
es1371_poll(void *p)
|
||||
es1371_poll(void *priv)
|
||||
{
|
||||
es1371_t *dev = (es1371_t *) p;
|
||||
es1371_t *dev = (es1371_t *) priv;
|
||||
int frac;
|
||||
int idx;
|
||||
int samp1_l;
|
||||
@@ -1913,9 +1997,9 @@ es1371_poll(void *p)
|
||||
}
|
||||
|
||||
static void
|
||||
es1371_get_buffer(int32_t *buffer, int len, void *p)
|
||||
es1371_get_buffer(int32_t *buffer, int len, void *priv)
|
||||
{
|
||||
es1371_t *dev = (es1371_t *) p;
|
||||
es1371_t *dev = (es1371_t *) priv;
|
||||
|
||||
es1371_update(dev);
|
||||
|
||||
@@ -1926,9 +2010,9 @@ es1371_get_buffer(int32_t *buffer, int len, void *p)
|
||||
}
|
||||
|
||||
static void
|
||||
es1371_filter_cd_audio(int channel, double *buffer, void *p)
|
||||
es1371_filter_cd_audio(int channel, double *buffer, void *priv)
|
||||
{
|
||||
es1371_t *dev = (es1371_t *) p;
|
||||
es1371_t *dev = (es1371_t *) priv;
|
||||
double c;
|
||||
int cd = channel ? dev->cd_vol_r : dev->cd_vol_l;
|
||||
int master = channel ? dev->master_vol_r : dev->master_vol_l;
|
||||
@@ -2041,17 +2125,17 @@ es1371_init(const device_t *info)
|
||||
}
|
||||
|
||||
static void
|
||||
es1371_close(void *p)
|
||||
es1371_close(void *priv)
|
||||
{
|
||||
es1371_t *dev = (es1371_t *) p;
|
||||
es1371_t *dev = (es1371_t *) priv;
|
||||
|
||||
free(dev);
|
||||
}
|
||||
|
||||
static void
|
||||
es1371_speed_changed(void *p)
|
||||
es1371_speed_changed(void *priv)
|
||||
{
|
||||
es1371_t *dev = (es1371_t *) p;
|
||||
es1371_t *dev = (es1371_t *) priv;
|
||||
|
||||
dev->dac[1].latch = (uint64_t) ((double) TIMER_USEC * (1000000.0 / (double) SOUND_FREQ));
|
||||
}
|
||||
|
||||
@@ -150,6 +150,7 @@
|
||||
#include <86box/snd_ad1848.h>
|
||||
#include <86box/snd_azt2316a.h>
|
||||
#include <86box/snd_sb.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
/*530, 11, 3 - 530=23*/
|
||||
/*530, 11, 1 - 530=22*/
|
||||
@@ -164,7 +165,9 @@
|
||||
|
||||
static int azt2316a_wss_dma[4] = { 0, 0, 1, 3 };
|
||||
static int azt2316a_wss_irq[8] = { 5, 7, 9, 10, 11, 12, 14, 15 }; /* W95 only uses 7-10, others may be wrong */
|
||||
// static uint16_t azt2316a_wss_addr[4] = {0x530, 0x604, 0xe80, 0xf40};
|
||||
#if 0
|
||||
static uint16_t azt2316a_wss_addr[4] = {0x530, 0x604, 0xe80, 0xf40};
|
||||
#endif
|
||||
|
||||
typedef struct azt2316a_t {
|
||||
int type;
|
||||
@@ -172,10 +175,14 @@ typedef struct azt2316a_t {
|
||||
|
||||
uint8_t wss_config;
|
||||
|
||||
uint16_t cur_addr, cur_wss_addr, cur_mpu401_addr;
|
||||
uint16_t cur_addr;
|
||||
uint16_t cur_wss_addr;
|
||||
uint16_t cur_mpu401_addr;
|
||||
|
||||
int cur_irq, cur_dma;
|
||||
int cur_wss_enabled, cur_wss_irq, cur_wss_dma;
|
||||
int cur_wss_enabled;
|
||||
int cur_wss_irq;
|
||||
int cur_wss_dma;
|
||||
int cur_mpu401_irq;
|
||||
int cur_mpu401_enabled;
|
||||
|
||||
@@ -191,9 +198,9 @@ typedef struct azt2316a_t {
|
||||
} azt2316a_t;
|
||||
|
||||
static uint8_t
|
||||
azt2316a_wss_read(uint16_t addr, void *p)
|
||||
azt2316a_wss_read(uint16_t addr, void *priv)
|
||||
{
|
||||
azt2316a_t *azt2316a = (azt2316a_t *) p;
|
||||
azt2316a_t *azt2316a = (azt2316a_t *) priv;
|
||||
uint8_t temp;
|
||||
|
||||
/* TODO: when windows is initializing, writing 0x48, 0x58 and 0x60 to
|
||||
@@ -208,9 +215,9 @@ azt2316a_wss_read(uint16_t addr, void *p)
|
||||
}
|
||||
|
||||
static void
|
||||
azt2316a_wss_write(uint16_t addr, uint8_t val, void *p)
|
||||
azt2316a_wss_write(UNUSED(uint16_t addr), uint8_t val, void *priv)
|
||||
{
|
||||
azt2316a_t *azt2316a = (azt2316a_t *) p;
|
||||
azt2316a_t *azt2316a = (azt2316a_t *) priv;
|
||||
int interrupt = 0;
|
||||
|
||||
if (azt2316a->wss_interrupt_after_config) {
|
||||
@@ -231,9 +238,9 @@ azt2316a_wss_write(uint16_t addr, uint8_t val, void *p)
|
||||
|
||||
/* generate a config word based on current settings */
|
||||
static void
|
||||
azt1605_create_config_word(void *p)
|
||||
azt1605_create_config_word(void *priv)
|
||||
{
|
||||
azt2316a_t *azt2316a = (azt2316a_t *) p;
|
||||
azt2316a_t *azt2316a = (azt2316a_t *) priv;
|
||||
uint32_t temp = 0;
|
||||
|
||||
/* not implemented / hardcoded */
|
||||
@@ -244,8 +251,10 @@ azt1605_create_config_word(void *p)
|
||||
|
||||
switch (azt2316a->cur_addr) {
|
||||
case 0x220:
|
||||
/* do nothing
|
||||
temp += 0 << 0; */
|
||||
// do nothing
|
||||
#if 0
|
||||
temp += 0 << 0;
|
||||
#endif
|
||||
break;
|
||||
case 0x240:
|
||||
temp += 1 << 0;
|
||||
@@ -258,6 +267,8 @@ azt1605_create_config_word(void *p)
|
||||
temp += 3 << 0;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (azt2316a->cur_irq) {
|
||||
@@ -273,12 +284,17 @@ azt1605_create_config_word(void *p)
|
||||
case 7:
|
||||
temp += 1 << 11;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (azt2316a->cur_wss_addr) {
|
||||
case 0x530:
|
||||
/* do nothing
|
||||
temp += 0 << 16; */
|
||||
// do nothing
|
||||
#if 0
|
||||
temp += 0 << 16;
|
||||
#endif
|
||||
break;
|
||||
case 0x604:
|
||||
temp += 1 << 16;
|
||||
@@ -289,6 +305,9 @@ azt1605_create_config_word(void *p)
|
||||
case 0xF40:
|
||||
temp += 3 << 16;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (azt2316a->cur_wss_enabled)
|
||||
@@ -299,12 +318,17 @@ azt1605_create_config_word(void *p)
|
||||
|
||||
switch (azt2316a->cur_mpu401_addr) {
|
||||
case 0x300:
|
||||
/* do nothing
|
||||
temp += 0 << 2; */
|
||||
// do nothing
|
||||
#if 0
|
||||
temp += 0 << 2;
|
||||
#endif
|
||||
break;
|
||||
case 0x330:
|
||||
temp += 1 << 2;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (azt2316a->cur_mpu401_enabled)
|
||||
@@ -336,6 +360,9 @@ azt1605_create_config_word(void *p)
|
||||
case 7: // unused
|
||||
temp += 7 << 5;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (cd_dma8) {
|
||||
@@ -352,6 +379,9 @@ azt1605_create_config_word(void *p)
|
||||
case 3:
|
||||
temp += 3 << 22;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (azt2316a->cur_mpu401_irq) {
|
||||
@@ -367,6 +397,9 @@ azt1605_create_config_word(void *p)
|
||||
case 7:
|
||||
temp += 1 << 15;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (cd_irq) {
|
||||
@@ -382,15 +415,18 @@ azt1605_create_config_word(void *p)
|
||||
case 15:
|
||||
temp += 1 << 21;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
azt2316a->config_word = temp;
|
||||
}
|
||||
|
||||
static void
|
||||
azt2316a_create_config_word(void *p)
|
||||
azt2316a_create_config_word(void *priv)
|
||||
{
|
||||
azt2316a_t *azt2316a = (azt2316a_t *) p;
|
||||
azt2316a_t *azt2316a = (azt2316a_t *) priv;
|
||||
uint32_t temp = 0;
|
||||
|
||||
/* not implemented / hardcoded */
|
||||
@@ -402,14 +438,16 @@ azt2316a_create_config_word(void *p)
|
||||
uint8_t cd_irq = 15;
|
||||
|
||||
if (azt2316a->type == SB_SUBTYPE_CLONE_AZT1605_0X0C) {
|
||||
azt1605_create_config_word(p);
|
||||
azt1605_create_config_word(priv);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (azt2316a->cur_addr) {
|
||||
case 0x220:
|
||||
/* do nothing
|
||||
temp += 0 << 0; */
|
||||
// do nothing
|
||||
#if 0
|
||||
temp += 0 << 0;
|
||||
#endif
|
||||
break;
|
||||
case 0x240:
|
||||
temp += 1 << 0;
|
||||
@@ -422,6 +460,8 @@ azt2316a_create_config_word(void *p)
|
||||
temp += 3 << 0;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (azt2316a->cur_irq) {
|
||||
@@ -437,6 +477,9 @@ azt2316a_create_config_word(void *p)
|
||||
case 10:
|
||||
temp += 1 << 5;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (azt2316a->cur_dma) {
|
||||
@@ -456,12 +499,17 @@ azt2316a_create_config_word(void *p)
|
||||
case 3:
|
||||
temp += 3 << 6;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (azt2316a->cur_wss_addr) {
|
||||
case 0x530:
|
||||
// do nothing
|
||||
// temp += 0 << 8;
|
||||
#if 0
|
||||
temp += 0 << 8;
|
||||
#endif
|
||||
break;
|
||||
case 0x604:
|
||||
temp += 1 << 8;
|
||||
@@ -472,6 +520,9 @@ azt2316a_create_config_word(void *p)
|
||||
case 0xF40:
|
||||
temp += 3 << 8;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (azt2316a->cur_wss_enabled)
|
||||
temp += 1 << 10;
|
||||
@@ -480,11 +531,16 @@ azt2316a_create_config_word(void *p)
|
||||
switch (azt2316a->cur_mpu401_addr) {
|
||||
case 0x300:
|
||||
// do nothing
|
||||
// temp += 0 << 12;
|
||||
#if 0
|
||||
temp += 0 << 12;
|
||||
#endif
|
||||
break;
|
||||
case 0x330:
|
||||
temp += 1 << 12;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (azt2316a->cur_mpu401_enabled)
|
||||
@@ -493,7 +549,9 @@ azt2316a_create_config_word(void *p)
|
||||
switch (cd_addr) {
|
||||
case 0x310:
|
||||
// do nothing
|
||||
// temp += 0 << 14;
|
||||
#if 0
|
||||
temp += 0 << 14;
|
||||
#endif
|
||||
break;
|
||||
case 0x320:
|
||||
temp += 1 << 14;
|
||||
@@ -504,11 +562,16 @@ azt2316a_create_config_word(void *p)
|
||||
case 0x350:
|
||||
temp += 3 << 14;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch (cd_type) {
|
||||
case 0: /* disabled
|
||||
do nothing
|
||||
case 0: /* disabled */
|
||||
// do nothing
|
||||
#if 0
|
||||
temp += 0 << 16; */
|
||||
#endif
|
||||
break;
|
||||
case 1: /* panasonic */
|
||||
temp += 1 << 16;
|
||||
@@ -531,6 +594,9 @@ azt2316a_create_config_word(void *p)
|
||||
case 7: /* unused */
|
||||
temp += 7 << 16;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (cd_dma8) {
|
||||
@@ -549,6 +615,9 @@ azt2316a_create_config_word(void *p)
|
||||
case 3:
|
||||
temp += 3 << 20;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (cd_dma16) {
|
||||
@@ -565,6 +634,9 @@ azt2316a_create_config_word(void *p)
|
||||
case 7:
|
||||
temp += 3 << 22;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (azt2316a->cur_mpu401_irq) {
|
||||
@@ -580,6 +652,9 @@ azt2316a_create_config_word(void *p)
|
||||
case 10:
|
||||
temp += 1 << 27;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (cd_irq) {
|
||||
@@ -595,15 +670,18 @@ azt2316a_create_config_word(void *p)
|
||||
case 15:
|
||||
temp += 1 << 31;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
azt2316a->config_word = temp;
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
azt2316a_config_read(uint16_t addr, void *p)
|
||||
azt2316a_config_read(uint16_t addr, void *priv)
|
||||
{
|
||||
azt2316a_t *azt2316a = (azt2316a_t *) p;
|
||||
azt2316a_t *azt2316a = (azt2316a_t *) priv;
|
||||
uint8_t temp = 0;
|
||||
|
||||
/* Some WSS config here + config change enable bit
|
||||
@@ -635,6 +713,9 @@ azt2316a_config_read(uint16_t addr, void *p)
|
||||
case 3:
|
||||
temp = (azt2316a->config_word >> 24);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -642,9 +723,9 @@ azt2316a_config_read(uint16_t addr, void *p)
|
||||
}
|
||||
|
||||
static void
|
||||
azt1605_config_write(uint16_t addr, uint8_t val, void *p)
|
||||
azt1605_config_write(uint16_t addr, uint8_t val, void *priv)
|
||||
{
|
||||
azt2316a_t *azt2316a = (azt2316a_t *) p;
|
||||
azt2316a_t *azt2316a = (azt2316a_t *) priv;
|
||||
uint8_t temp;
|
||||
|
||||
if (addr == (azt2316a->cur_addr + 0x404)) {
|
||||
@@ -731,6 +812,9 @@ azt1605_config_write(uint16_t addr, uint8_t val, void *p)
|
||||
break;
|
||||
case 3:
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
/* update sbprov2 configs */
|
||||
sb_dsp_setaddr(&azt2316a->sb->dsp, azt2316a->cur_addr);
|
||||
@@ -743,9 +827,9 @@ azt1605_config_write(uint16_t addr, uint8_t val, void *p)
|
||||
}
|
||||
|
||||
static void
|
||||
azt2316a_config_write(uint16_t addr, uint8_t val, void *p)
|
||||
azt2316a_config_write(uint16_t addr, uint8_t val, void *priv)
|
||||
{
|
||||
azt2316a_t *azt2316a = (azt2316a_t *) p;
|
||||
azt2316a_t *azt2316a = (azt2316a_t *) priv;
|
||||
uint8_t temp;
|
||||
|
||||
if (azt2316a->type == SB_SUBTYPE_CLONE_AZT1605_0X0C) {
|
||||
@@ -839,6 +923,9 @@ azt2316a_config_write(uint16_t addr, uint8_t val, void *p)
|
||||
azt2316a->cur_mpu401_irq = 10;
|
||||
/* else undefined? */
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
/* update sbprov2 configs */
|
||||
sb_dsp_setaddr(&azt2316a->sb->dsp, azt2316a->cur_addr);
|
||||
@@ -852,9 +939,9 @@ azt2316a_config_write(uint16_t addr, uint8_t val, void *p)
|
||||
|
||||
/* How it behaves when one or another is activated may affect games auto-detecting (and will also use more of the limited system resources!) */
|
||||
void
|
||||
azt2316a_enable_wss(uint8_t enable, void *p)
|
||||
azt2316a_enable_wss(uint8_t enable, void *priv)
|
||||
{
|
||||
azt2316a_t *azt2316a = (azt2316a_t *) p;
|
||||
azt2316a_t *azt2316a = (azt2316a_t *) priv;
|
||||
|
||||
if (enable)
|
||||
azt2316a->cur_mode = 1;
|
||||
@@ -863,9 +950,9 @@ azt2316a_enable_wss(uint8_t enable, void *p)
|
||||
}
|
||||
|
||||
static void
|
||||
azt2316a_get_buffer(int32_t *buffer, int len, void *p)
|
||||
azt2316a_get_buffer(int32_t *buffer, int len, void *priv)
|
||||
{
|
||||
azt2316a_t *azt2316a = (azt2316a_t *) p;
|
||||
azt2316a_t *azt2316a = (azt2316a_t *) priv;
|
||||
|
||||
/* wss part */
|
||||
ad1848_update(&azt2316a->ad1848);
|
||||
@@ -1182,9 +1269,9 @@ azt_init(const device_t *info)
|
||||
}
|
||||
|
||||
static void
|
||||
azt_close(void *p)
|
||||
azt_close(void *priv)
|
||||
{
|
||||
azt2316a_t *azt2316a = (azt2316a_t *) p;
|
||||
azt2316a_t *azt2316a = (azt2316a_t *) priv;
|
||||
char *fn = NULL;
|
||||
FILE *f;
|
||||
uint8_t checksum = 0x7f;
|
||||
@@ -1217,9 +1304,9 @@ azt_close(void *p)
|
||||
}
|
||||
|
||||
static void
|
||||
azt_speed_changed(void *p)
|
||||
azt_speed_changed(void *priv)
|
||||
{
|
||||
azt2316a_t *azt2316a = (azt2316a_t *) p;
|
||||
azt2316a_t *azt2316a = (azt2316a_t *) priv;
|
||||
|
||||
ad1848_speed_changed(&azt2316a->ad1848);
|
||||
sb_speed_changed(azt2316a->sb);
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <86box/gameport.h>
|
||||
#include <86box/nmi.h>
|
||||
#include <86box/ui.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
enum {
|
||||
/* [23:16] = reg 0F [7:0] (reg 0C [31:24])
|
||||
@@ -53,37 +54,67 @@ enum {
|
||||
TRAP_MAX
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
uint8_t id, reg, always_run, playback_enabled, channels;
|
||||
typedef struct cmi8x38_dma_t {
|
||||
uint8_t id;
|
||||
uint8_t reg;
|
||||
uint8_t always_run;
|
||||
uint8_t playback_enabled;
|
||||
uint8_t channels;
|
||||
struct _cmi8x38_ *dev;
|
||||
|
||||
uint32_t sample_ptr, fifo_pos, fifo_end;
|
||||
int32_t frame_count_dma, frame_count_fragment, sample_count_out;
|
||||
uint8_t fifo[256], restart;
|
||||
uint32_t sample_ptr;
|
||||
uint32_t fifo_pos;
|
||||
uint32_t fifo_end;
|
||||
int32_t frame_count_dma;
|
||||
int32_t frame_count_fragment;
|
||||
int32_t sample_count_out;
|
||||
uint8_t fifo[256];
|
||||
uint8_t restart;
|
||||
|
||||
int16_t out_fl, out_fr, out_rl, out_rr, out_c, out_lfe;
|
||||
int vol_l, vol_r, pos;
|
||||
int16_t out_fl;
|
||||
int16_t out_fr;
|
||||
int16_t out_rl;
|
||||
int16_t out_rr;
|
||||
int16_t out_c;
|
||||
int16_t out_lfe;
|
||||
int vol_l;
|
||||
int vol_r;
|
||||
int pos;
|
||||
int32_t buffer[SOUNDBUFLEN * 2];
|
||||
uint64_t timer_latch;
|
||||
double dma_latch;
|
||||
|
||||
pc_timer_t dma_timer, poll_timer;
|
||||
pc_timer_t dma_timer;
|
||||
pc_timer_t poll_timer;
|
||||
} cmi8x38_dma_t;
|
||||
|
||||
typedef struct _cmi8x38_ {
|
||||
uint32_t type;
|
||||
uint16_t io_base, sb_base, opl_base, mpu_base;
|
||||
uint8_t pci_regs[256], io_regs[256];
|
||||
uint16_t io_base;
|
||||
uint16_t sb_base;
|
||||
uint16_t opl_base;
|
||||
uint16_t mpu_base;
|
||||
uint8_t pci_regs[256];
|
||||
uint8_t io_regs[256];
|
||||
int slot;
|
||||
|
||||
sb_t *sb;
|
||||
void *gameport, *io_traps[TRAP_MAX];
|
||||
void *gameport;
|
||||
void *io_traps[TRAP_MAX];
|
||||
|
||||
cmi8x38_dma_t dma[2];
|
||||
uint16_t tdma_base_addr, tdma_base_count;
|
||||
int tdma_8, tdma_16, tdma_mask, prev_mask, tdma_irq_mask;
|
||||
uint16_t tdma_base_addr;
|
||||
uint16_t tdma_base_count;
|
||||
int tdma_8;
|
||||
int tdma_16;
|
||||
int tdma_mask;
|
||||
int prev_mask;
|
||||
int tdma_irq_mask;
|
||||
|
||||
int master_vol_l, master_vol_r, cd_vol_l, cd_vol_r;
|
||||
int master_vol_l;
|
||||
int master_vol_r;
|
||||
int cd_vol_l;
|
||||
int cd_vol_r;
|
||||
} cmi8x38_t;
|
||||
|
||||
#ifdef ENABLE_CMI8X38_LOG
|
||||
@@ -307,7 +338,7 @@ cmi8x38_sb_dma_writew(void *priv, uint16_t val)
|
||||
}
|
||||
|
||||
static void
|
||||
cmi8x38_dma_write(uint16_t addr, uint8_t val, void *priv)
|
||||
cmi8x38_dma_write(uint16_t addr, UNUSED(uint8_t val), void *priv)
|
||||
{
|
||||
cmi8x38_t *dev = (cmi8x38_t *) priv;
|
||||
|
||||
@@ -348,7 +379,7 @@ cmi8x38_dma_write(uint16_t addr, uint8_t val, void *priv)
|
||||
}
|
||||
|
||||
static void
|
||||
cmi8x38_dma_mask_write(uint16_t addr, uint8_t val, void *priv)
|
||||
cmi8x38_dma_mask_write(UNUSED(uint16_t addr), UNUSED(uint8_t val), void *priv)
|
||||
{
|
||||
cmi8x38_t *dev = (cmi8x38_t *) priv;
|
||||
|
||||
@@ -365,7 +396,7 @@ cmi8x38_dma_mask_write(uint16_t addr, uint8_t val, void *priv)
|
||||
}
|
||||
|
||||
static void
|
||||
cmi8338_io_trap(int size, uint16_t addr, uint8_t write, uint8_t val, void *priv)
|
||||
cmi8338_io_trap(UNUSED(int size), uint16_t addr, uint8_t write, uint8_t val, void *priv)
|
||||
{
|
||||
cmi8x38_t *dev = (cmi8x38_t *) priv;
|
||||
|
||||
@@ -435,10 +466,13 @@ cmi8x38_sb_mixer_write(uint16_t addr, uint8_t val, void *priv)
|
||||
case 0xf8 ... 0xff:
|
||||
if (dev->type == CMEDIA_CMI8338)
|
||||
mixer->regs[mixer->index] = val;
|
||||
/* fall-through */
|
||||
[[fallthrough]];
|
||||
|
||||
case 0xf1 ... 0xf7:
|
||||
return;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
sb_ct1745_mixer_write(addr, val, dev->sb);
|
||||
@@ -446,8 +480,8 @@ cmi8x38_sb_mixer_write(uint16_t addr, uint8_t val, void *priv)
|
||||
/* No [3F:47] controls. */
|
||||
mixer->input_gain_L = 0;
|
||||
mixer->input_gain_R = 0;
|
||||
mixer->output_gain_L = (double) 1.0;
|
||||
mixer->output_gain_R = (double) 1.0;
|
||||
mixer->output_gain_L = 1.0;
|
||||
mixer->output_gain_R = 1.0;
|
||||
mixer->bass_l = 8;
|
||||
mixer->bass_r = 8;
|
||||
mixer->treble_l = 8;
|
||||
@@ -1201,8 +1235,14 @@ cmi8x38_poll(void *priv)
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* Feed silence if the FIFO is empty. */
|
||||
|
||||
@@ -10,17 +10,16 @@
|
||||
#include <86box/io.h>
|
||||
#include <86box/snd_cms.h>
|
||||
#include <86box/sound.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
void
|
||||
cms_update(cms_t *cms)
|
||||
{
|
||||
for (; cms->pos < sound_pos_global; cms->pos++) {
|
||||
int c;
|
||||
int d;
|
||||
int16_t out_l = 0;
|
||||
int16_t out_r = 0;
|
||||
|
||||
for (c = 0; c < 4; c++) {
|
||||
for (uint8_t c = 0; c < 4; c++) {
|
||||
switch (cms->noisetype[c >> 1][c & 1]) {
|
||||
case 0:
|
||||
cms->noisefreq[c >> 1][c & 1] = MASTER_CLOCK / 256;
|
||||
@@ -34,11 +33,14 @@ cms_update(cms_t *cms)
|
||||
case 3:
|
||||
cms->noisefreq[c >> 1][c & 1] = cms->freq[c >> 1][(c & 1) * 3];
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (c = 0; c < 2; c++) {
|
||||
for (uint8_t c = 0; c < 2; c++) {
|
||||
if (cms->regs[c][0x1C] & 1) {
|
||||
for (d = 0; d < 6; d++) {
|
||||
for (uint8_t d = 0; d < 6; d++) {
|
||||
if (cms->regs[c][0x14] & (1 << d)) {
|
||||
if (cms->stat[c][d])
|
||||
out_l += (cms->vol[c][d][0] * 90);
|
||||
@@ -56,7 +58,7 @@ cms_update(cms_t *cms)
|
||||
out_r += (cms->vol[c][d][0] * 90);
|
||||
}
|
||||
}
|
||||
for (d = 0; d < 2; d++) {
|
||||
for (uint8_t d = 0; d < 2; d++) {
|
||||
cms->noisecount[c][d] += cms->noisefreq[c][d];
|
||||
while (cms->noisecount[c][d] >= 24000) {
|
||||
cms->noisecount[c][d] -= 24000;
|
||||
@@ -73,9 +75,9 @@ cms_update(cms_t *cms)
|
||||
}
|
||||
|
||||
void
|
||||
cms_get_buffer(int32_t *buffer, int len, void *p)
|
||||
cms_get_buffer(int32_t *buffer, int len, void *priv)
|
||||
{
|
||||
cms_t *cms = (cms_t *) p;
|
||||
cms_t *cms = (cms_t *) priv;
|
||||
|
||||
cms_update(cms);
|
||||
|
||||
@@ -86,9 +88,9 @@ cms_get_buffer(int32_t *buffer, int len, void *p)
|
||||
}
|
||||
|
||||
void
|
||||
cms_write(uint16_t addr, uint8_t val, void *p)
|
||||
cms_write(uint16_t addr, uint8_t val, void *priv)
|
||||
{
|
||||
cms_t *cms = (cms_t *) p;
|
||||
cms_t *cms = (cms_t *) priv;
|
||||
int voice;
|
||||
int chip = (addr & 2) >> 1;
|
||||
|
||||
@@ -138,19 +140,25 @@ cms_write(uint16_t addr, uint8_t val, void *p)
|
||||
cms->noisetype[chip][0] = val & 3;
|
||||
cms->noisetype[chip][1] = (val >> 4) & 3;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 0x6:
|
||||
case 0x7:
|
||||
cms->latched_data = val;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t
|
||||
cms_read(uint16_t addr, void *p)
|
||||
cms_read(uint16_t addr, void *priv)
|
||||
{
|
||||
cms_t *cms = (cms_t *) p;
|
||||
cms_t *cms = (cms_t *) priv;
|
||||
|
||||
switch (addr & 0xf) {
|
||||
case 0x1:
|
||||
@@ -162,12 +170,15 @@ cms_read(uint16_t addr, void *p)
|
||||
case 0xa:
|
||||
case 0xb:
|
||||
return cms->latched_data;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
void *
|
||||
cms_init(const device_t *info)
|
||||
cms_init(UNUSED(const device_t *info))
|
||||
{
|
||||
cms_t *cms = malloc(sizeof(cms_t));
|
||||
memset(cms, 0, sizeof(cms_t));
|
||||
@@ -179,9 +190,9 @@ cms_init(const device_t *info)
|
||||
}
|
||||
|
||||
void
|
||||
cms_close(void *p)
|
||||
cms_close(void *priv)
|
||||
{
|
||||
cms_t *cms = (cms_t *) p;
|
||||
cms_t *cms = (cms_t *) priv;
|
||||
|
||||
free(cms);
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <86box/snd_ad1848.h>
|
||||
#include <86box/snd_opl.h>
|
||||
#include <86box/snd_sb.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
#define CRYSTAL_NOEEPROM 0x100
|
||||
|
||||
@@ -133,14 +134,32 @@ typedef struct cs423x_t {
|
||||
ad1848_t ad1848;
|
||||
sb_t *sb;
|
||||
void *gameport;
|
||||
void *i2c, *eeprom;
|
||||
void *i2c;
|
||||
void *eeprom;
|
||||
|
||||
uint16_t wss_base, opl_base, sb_base, ctrl_base, ram_addr, eeprom_size : 11, pnp_offset;
|
||||
uint8_t type, ad1848_type, regs[8], indirect_regs[16],
|
||||
eeprom_data[2048], ram_data[65536], ram_dl : 2, opl_wss : 1;
|
||||
char *nvr_path;
|
||||
uint16_t wss_base;
|
||||
uint16_t opl_base;
|
||||
uint16_t sb_base;
|
||||
uint16_t ctrl_base;
|
||||
uint16_t ram_addr;
|
||||
uint16_t eeprom_size : 11;
|
||||
uint16_t pnp_offset;
|
||||
uint8_t type;
|
||||
uint8_t ad1848_type;
|
||||
uint8_t regs[8];
|
||||
uint8_t indirect_regs[16];
|
||||
uint8_t eeprom_data[2048];
|
||||
uint8_t ram_data[65536];
|
||||
uint8_t ram_dl : 2;
|
||||
uint8_t opl_wss : 1;
|
||||
char *nvr_path;
|
||||
|
||||
uint8_t pnp_enable : 1, key_pos : 5, slam_enable : 1, slam_state : 2, slam_ld, slam_reg;
|
||||
uint8_t pnp_enable : 1;
|
||||
uint8_t key_pos : 5;
|
||||
uint8_t slam_enable : 1;
|
||||
uint8_t slam_state : 2;
|
||||
uint8_t slam_ld;
|
||||
uint8_t slam_reg;
|
||||
isapnp_device_config_t *slam_config;
|
||||
} cs423x_t;
|
||||
|
||||
@@ -198,6 +217,9 @@ cs423x_read(uint16_t addr, void *priv)
|
||||
ret |= 0x20;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -264,6 +286,9 @@ cs423x_write(uint16_t addr, uint8_t val, void *priv)
|
||||
dev->ad1848.wten = !!(val & 0x08);
|
||||
ad1848_updatevolmask(&dev->ad1848);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
dev->indirect_regs[dev->regs[3]] = val;
|
||||
break;
|
||||
@@ -274,7 +299,7 @@ cs423x_write(uint16_t addr, uint8_t val, void *priv)
|
||||
switch (val) {
|
||||
case 0x55: /* Disable PnP Key */
|
||||
dev->pnp_enable = 0;
|
||||
/* fall-through */
|
||||
[[fallthrough]];
|
||||
|
||||
case 0x5a: /* Update Hardware Configuration Data */
|
||||
cs423x_pnp_enable(dev, 0, 1);
|
||||
@@ -290,6 +315,9 @@ cs423x_write(uint16_t addr, uint8_t val, void *priv)
|
||||
case 0xaa: /* Download RAM */
|
||||
dev->ram_dl = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -306,6 +334,9 @@ cs423x_write(uint16_t addr, uint8_t val, void *priv)
|
||||
case 3: /* data */
|
||||
dev->ram_data[dev->ram_addr++] = val;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -321,13 +352,16 @@ cs423x_write(uint16_t addr, uint8_t val, void *priv)
|
||||
|
||||
case 7: /* Global Status */
|
||||
return;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
dev->regs[reg] = val;
|
||||
}
|
||||
|
||||
static void
|
||||
cs423x_slam_write(uint16_t addr, uint8_t val, void *priv)
|
||||
cs423x_slam_write(UNUSED(uint16_t addr), uint8_t val, void *priv)
|
||||
{
|
||||
cs423x_t *dev = (cs423x_t *) priv;
|
||||
uint8_t idx;
|
||||
@@ -441,11 +475,17 @@ cs423x_slam_write(uint16_t addr, uint8_t val, void *priv)
|
||||
/* Activate or deactivate the device. */
|
||||
dev->slam_config->activate = val & 0x01;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* Prepare for the next register, unless a two-byte read returns above. */
|
||||
dev->slam_state = CRYSTAL_SLAM_INDEX;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -467,7 +507,7 @@ cs423x_slam_enable(cs423x_t *dev, uint8_t enable)
|
||||
}
|
||||
|
||||
static void
|
||||
cs423x_ctxswitch_write(uint16_t addr, uint8_t val, void *priv)
|
||||
cs423x_ctxswitch_write(uint16_t addr, UNUSED(uint8_t val), void *priv)
|
||||
{
|
||||
cs423x_t *dev = (cs423x_t *) priv;
|
||||
uint8_t ctx = (dev->regs[7] & 0x80);
|
||||
@@ -542,7 +582,9 @@ cs423x_pnp_enable(cs423x_t *dev, uint8_t update_rom, uint8_t update_hwconfig)
|
||||
/* But wait! The TriGem Delhi-III BIOS sends command 0x55, and its behavior doesn't
|
||||
line up with real hardware (still listed in the POST summary and seen by software).
|
||||
Disable the PnP key disabling mechanism until someone figures something out. */
|
||||
// isapnp_enable_card(dev->pnp_card, ((dev->ram_data[0x4002] & 0x20) || !dev->pnp_enable) ? ISAPNP_CARD_NO_KEY : ISAPNP_CARD_ENABLE);
|
||||
#if 0
|
||||
isapnp_enable_card(dev->pnp_card, ((dev->ram_data[0x4002] & 0x20) || !dev->pnp_enable) ? ISAPNP_CARD_NO_KEY : ISAPNP_CARD_ENABLE);
|
||||
#endif
|
||||
if ((dev->ram_data[0x4002] & 0x20) || !dev->pnp_enable)
|
||||
pclog("CS423x: Attempted to disable PnP key\n");
|
||||
}
|
||||
@@ -674,6 +716,9 @@ cs423x_pnp_config_changed(uint8_t ld, isapnp_device_config_t *config, void *priv
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -764,6 +809,9 @@ cs423x_init(const device_t *info)
|
||||
dev->eeprom_data[26] = 0x38;
|
||||
dev->nvr_path = "cs4238b.nvr";
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* Load EEPROM contents from file if present. */
|
||||
@@ -775,6 +823,9 @@ cs423x_init(const device_t *info)
|
||||
dev->gameport = gameport_add(((dev->type == CRYSTAL_CS4235) || (dev->type == CRYSTAL_CS4236B)) ? &gameport_pnp_device : &gameport_pnp_6io_device);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* Initialize I2C bus for the EEPROM. */
|
||||
|
||||
@@ -17,81 +17,90 @@
|
||||
#include <86box/sound.h>
|
||||
#include <86box/snd_emu8k.h>
|
||||
#include <86box/timer.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
#if !defined FILTER_INITIAL && !defined FILTER_MOOG && !defined FILTER_CONSTANT
|
||||
// #define FILTER_INITIAL
|
||||
#if 0
|
||||
#define FILTER_INITIAL
|
||||
#endif
|
||||
# define FILTER_MOOG
|
||||
// #define FILTER_CONSTANT
|
||||
#if 0
|
||||
#define FILTER_CONSTANT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined RESAMPLER_LINEAR && !defined RESAMPLER_CUBIC
|
||||
// #define RESAMPLER_LINEAR
|
||||
#if 0
|
||||
#define RESAMPLER_LINEAR
|
||||
#endif
|
||||
# define RESAMPLER_CUBIC
|
||||
#endif
|
||||
|
||||
// #define EMU8K_DEBUG_REGISTERS
|
||||
#if 0
|
||||
#define EMU8K_DEBUG_REGISTERS
|
||||
#endif
|
||||
|
||||
char *PORT_NAMES[][8] = {
|
||||
/* Data 0 ( 0x620/0x622) */
|
||||
/* Data 0 ( 0x620/0x622) */
|
||||
{
|
||||
"AWE_CPF",
|
||||
"AWE_PTRX",
|
||||
"AWE_CVCF",
|
||||
"AWE_VTFT",
|
||||
"Unk-620-4",
|
||||
"Unk-620-5",
|
||||
"AWE_PSST",
|
||||
"AWE_CSL",
|
||||
},
|
||||
/* Data 1 0xA20 */
|
||||
"AWE_CPF",
|
||||
"AWE_PTRX",
|
||||
"AWE_CVCF",
|
||||
"AWE_VTFT",
|
||||
"Unk-620-4",
|
||||
"Unk-620-5",
|
||||
"AWE_PSST",
|
||||
"AWE_CSL",
|
||||
},
|
||||
/* Data 1 0xA20 */
|
||||
{
|
||||
"AWE_CCCA",
|
||||
0,
|
||||
/*
|
||||
"AWE_HWCF4"
|
||||
"AWE_HWCF5"
|
||||
"AWE_HWCF6"
|
||||
"AWE_HWCF7"
|
||||
"AWE_SMALR"
|
||||
"AWE_SMARR"
|
||||
"AWE_SMALW"
|
||||
"AWE_SMARW"
|
||||
"AWE_SMLD"
|
||||
"AWE_SMRD"
|
||||
"AWE_WC"
|
||||
"AWE_HWCF1"
|
||||
"AWE_HWCF2"
|
||||
"AWE_HWCF3"
|
||||
*/
|
||||
0, //"AWE_INIT1",
|
||||
0, //"AWE_INIT3",
|
||||
"AWE_CCCA",
|
||||
0,
|
||||
/*
|
||||
"AWE_HWCF4"
|
||||
"AWE_HWCF5"
|
||||
"AWE_HWCF6"
|
||||
"AWE_HWCF7"
|
||||
"AWE_SMALR"
|
||||
"AWE_SMARR"
|
||||
"AWE_SMALW"
|
||||
"AWE_SMARW"
|
||||
"AWE_SMLD"
|
||||
"AWE_SMRD"
|
||||
"AWE_WC"
|
||||
"AWE_HWCF1"
|
||||
"AWE_HWCF2"
|
||||
"AWE_HWCF3"
|
||||
*/
|
||||
0, //"AWE_INIT1",
|
||||
0, //"AWE_INIT3",
|
||||
"AWE_ENVVOL",
|
||||
"AWE_DCYSUSV",
|
||||
"AWE_ENVVAL",
|
||||
"AWE_DCYSUS",
|
||||
},
|
||||
/* Data 2 0xA22 */
|
||||
"AWE_DCYSUSV",
|
||||
"AWE_ENVVAL",
|
||||
"AWE_DCYSUS",
|
||||
},
|
||||
/* Data 2 0xA22 */
|
||||
{
|
||||
"AWE_CCCA",
|
||||
0,
|
||||
0, //"AWE_INIT2",
|
||||
0, //"AWE_INIT4",
|
||||
"AWE_CCCA",
|
||||
0,
|
||||
0, //"AWE_INIT2",
|
||||
0, //"AWE_INIT4",
|
||||
"AWE_ATKHLDV",
|
||||
"AWE_LFO1VAL",
|
||||
"AWE_ATKHLD",
|
||||
"AWE_LFO2VAL",
|
||||
},
|
||||
/* Data 3 0xE20 */
|
||||
"AWE_LFO1VAL",
|
||||
"AWE_ATKHLD",
|
||||
"AWE_LFO2VAL",
|
||||
},
|
||||
/* Data 3 0xE20 */
|
||||
{
|
||||
"AWE_IP",
|
||||
"AWE_IFATN",
|
||||
"AWE_PEFE",
|
||||
"AWE_FMMOD",
|
||||
"AWE_TREMFRQ",
|
||||
"AWE_FM2FRQ2",
|
||||
0,
|
||||
0,
|
||||
},
|
||||
"AWE_IP",
|
||||
"AWE_IFATN",
|
||||
"AWE_PEFE",
|
||||
"AWE_FMMOD",
|
||||
"AWE_TREMFRQ",
|
||||
"AWE_FM2FRQ2",
|
||||
0,
|
||||
0,
|
||||
},
|
||||
};
|
||||
|
||||
enum {
|
||||
@@ -143,13 +152,13 @@ static int32_t env_attack_to_samples[128];
|
||||
* In other words, the unit of the table is the 1/21845th of a dB per sample frame, to be added or
|
||||
* substracted to the accumulating value_db of the envelope. */
|
||||
static int32_t env_decay_to_dbs_or_oct[128] = {
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
||||
16, 17, 18, 19, 20, 20, 21, 22, 23, 24, 25, 27, 28, 29, 30, 32,
|
||||
33, 34, 36, 38, 39, 41, 43, 45, 49, 51, 53, 55, 58, 60, 63, 66,
|
||||
69, 72, 75, 78, 82, 85, 89, 93, 97, 102, 106, 111, 116, 121, 126, 132,
|
||||
138, 144, 150, 157, 164, 171, 179, 186, 195, 203, 212, 222, 232, 243, 253, 264,
|
||||
276, 288, 301, 315, 328, 342, 358, 374, 390, 406, 425, 444, 466, 485, 506, 528,
|
||||
553, 580, 602, 634, 660, 689, 721, 755, 780, 820, 849, 897, 932, 970, 1012, 1057,
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
||||
16, 17, 18, 19, 20, 20, 21, 22, 23, 24, 25, 27, 28, 29, 30, 32,
|
||||
33, 34, 36, 38, 39, 41, 43, 45, 49, 51, 53, 55, 58, 60, 63, 66,
|
||||
69, 72, 75, 78, 82, 85, 89, 93, 97, 102, 106, 111, 116, 121, 126, 132,
|
||||
138, 144, 150, 157, 164, 171, 179, 186, 195, 203, 212, 222, 232, 243, 253, 264,
|
||||
276, 288, 301, 315, 328, 342, 358, 374, 390, 406, 425, 444, 466, 485, 506, 528,
|
||||
553, 580, 602, 634, 660, 689, 721, 755, 780, 820, 849, 897, 932, 970, 1012, 1057,
|
||||
1106, 1160, 1219, 1285, 1321, 1399, 1441, 1534, 1585, 1640, 1698, 1829, 1902, 1981, 2068, 2162
|
||||
};
|
||||
|
||||
@@ -158,17 +167,19 @@ static int32_t env_decay_to_dbs_or_oct[128] = {
|
||||
* I tried calculating it using the instructions in awe32p10 from Judge Dredd, but the formula there
|
||||
* is wrong.
|
||||
*
|
||||
*/
|
||||
#if 0
|
||||
static int32_t env_decay_to_millis[128] = {
|
||||
0, 45120, 22614, 15990, 11307, 9508, 7995, 6723, 5653, 5184, 4754, 4359, 3997, 3665, 3361, 3082,
|
||||
2828, 2765, 2648, 2535, 2428, 2325, 2226, 2132, 2042, 1955, 1872, 1793, 1717, 1644, 1574, 1507,
|
||||
1443, 1382, 1324, 1267, 1214, 1162, 1113, 1066, 978, 936, 897, 859, 822, 787, 754, 722,
|
||||
691, 662, 634, 607, 581, 557, 533, 510, 489, 468, 448, 429, 411, 393, 377, 361,
|
||||
345, 331, 317, 303, 290, 278, 266, 255, 244, 234, 224, 214, 205, 196, 188, 180,
|
||||
172, 165, 158, 151, 145, 139, 133, 127, 122, 117, 112, 107, 102, 98, 94, 90,
|
||||
86, 82, 79, 75, 72, 69, 66, 63, 61, 58, 56, 53, 51, 49, 47, 45,
|
||||
43, 41, 39, 37, 36, 34, 33, 31, 30, 29, 28, 26, 25, 24, 23, 22,
|
||||
0, 45120, 22614, 15990, 11307, 9508, 7995, 6723, 5653, 5184, 4754, 4359, 3997, 3665, 3361, 3082,
|
||||
2828, 2765, 2648, 2535, 2428, 2325, 2226, 2132, 2042, 1955, 1872, 1793, 1717, 1644, 1574, 1507,
|
||||
1443, 1382, 1324, 1267, 1214, 1162, 1113, 1066, 978, 936, 897, 859, 822, 787, 754, 722,
|
||||
691, 662, 634, 607, 581, 557, 533, 510, 489, 468, 448, 429, 411, 393, 377, 361,
|
||||
345, 331, 317, 303, 290, 278, 266, 255, 244, 234, 224, 214, 205, 196, 188, 180,
|
||||
172, 165, 158, 151, 145, 139, 133, 127, 122, 117, 112, 107, 102, 98, 94, 90,
|
||||
86, 82, 79, 75, 72, 69, 66, 63, 61, 58, 56, 53, 51, 49, 47, 45,
|
||||
43, 41, 39, 37, 36, 34, 33, 31, 30, 29, 28, 26, 25, 24, 23, 22,
|
||||
};
|
||||
*/
|
||||
#endif
|
||||
|
||||
/* Table represeting the LFO waveform (signed 16bits with 32768 max int. >> 15 to move back to +/-1 range). */
|
||||
static int32_t lfotable[65536];
|
||||
@@ -348,7 +359,9 @@ EMU8K_READ_INTERP_CUBIC(emu8k_t *emu8k, uint32_t int_addr, uint16_t fract)
|
||||
* the card could use two oscillators (usually 31 and 32) where it would
|
||||
* be writing the OPL3 output, and to which, chorus and reverb could be applied to get
|
||||
* those effects for OPL3 sounds.*/
|
||||
// if ((addr & EMU8K_FM_MEM_ADDRESS) == EMU8K_FM_MEM_ADDRESS) {}
|
||||
#if 0
|
||||
if ((addr & EMU8K_FM_MEM_ADDRESS) == EMU8K_FM_MEM_ADDRESS) {}
|
||||
#endif
|
||||
|
||||
/* This is cubic interpolation.
|
||||
* Not the same than 3-point interpolation, but a better approximation than linear
|
||||
@@ -383,9 +396,9 @@ EMU8K_WRITE(emu8k_t *emu8k, uint32_t addr, uint16_t val)
|
||||
}
|
||||
|
||||
uint16_t
|
||||
emu8k_inw(uint16_t addr, void *p)
|
||||
emu8k_inw(uint16_t addr, void *priv)
|
||||
{
|
||||
emu8k_t *emu8k = (emu8k_t *) p;
|
||||
emu8k_t *emu8k = (emu8k_t *) priv;
|
||||
uint16_t ret = 0xffff;
|
||||
|
||||
#ifdef EMU8K_DEBUG_REGISTERS
|
||||
@@ -557,6 +570,9 @@ emu8k_inw(uint16_t addr, void *p)
|
||||
case 7:
|
||||
READ16(addr, emu8k->voice[emu8k->cur_voice].csl);
|
||||
return ret;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -611,6 +627,9 @@ emu8k_inw(uint16_t addr, void *p)
|
||||
| ((emu8k->hwcf3 & 0x08) ? 0x20 : 0) | ((emu8k->hwcf3 & 0x10) ? 0x80 : 0);
|
||||
case 31: /*Configuration Word 3*/
|
||||
return emu8k->hwcf2 & 0x1f;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -631,6 +650,9 @@ emu8k_inw(uint16_t addr, void *p)
|
||||
|
||||
case 7:
|
||||
return emu8k->voice[emu8k->cur_voice].dcysus;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -690,6 +712,9 @@ emu8k_inw(uint16_t addr, void *p)
|
||||
the amount of calls and wait time */
|
||||
case 27: /*Sample Counter ( 44Khz clock) */
|
||||
return emu8k->wc;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -710,6 +735,9 @@ emu8k_inw(uint16_t addr, void *p)
|
||||
|
||||
case 7:
|
||||
return emu8k->voice[emu8k->cur_voice].lfo2val;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -738,6 +766,9 @@ emu8k_inw(uint16_t addr, void *p)
|
||||
|
||||
case 7: /*ID?*/
|
||||
return 0x1c | ((emu8k->id & 0x0002) ? 0xff02 : 0);
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -749,15 +780,18 @@ emu8k_inw(uint16_t addr, void *p)
|
||||
* cubic player has a similar code, where it waits until value & 0x1000 is nonzero, and then waits again until it changes to zero.*/
|
||||
random_helper = (random_helper + 1) & 0x1F;
|
||||
return ((0x80 | random_helper) << 8) | (emu8k->cur_reg << 5) | emu8k->cur_voice;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
emu8k_log("EMU8K READ : Unknown register read: %04X-%02X(%d/%d) \n", addr, (emu8k->cur_reg << 5) | emu8k->cur_voice, emu8k->cur_reg, emu8k->cur_voice);
|
||||
return 0xffff;
|
||||
}
|
||||
|
||||
void
|
||||
emu8k_outw(uint16_t addr, uint16_t val, void *p)
|
||||
emu8k_outw(uint16_t addr, uint16_t val, void *priv)
|
||||
{
|
||||
emu8k_t *emu8k = (emu8k_t *) p;
|
||||
emu8k_t *emu8k = (emu8k_t *) priv;
|
||||
|
||||
/*TODO: I would like to not call this here, but i found it was needed or else cubic player would not finish opening (take a looot more of time than usual).
|
||||
* Basically, being here means that the audio is generated in the emulation thread, instead of the audio thread.*/
|
||||
@@ -879,6 +913,9 @@ emu8k_outw(uint16_t addr, uint16_t val, void *p)
|
||||
/* TODO: Should we update only on MSB update, or this could be used as some sort of hack by applications? */
|
||||
emu8k->voice[emu8k->cur_voice].loop_end.int_address = emu8k->voice[emu8k->cur_voice].csl & EMU8K_MEM_ADDRESS_MASK;
|
||||
return;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -933,6 +970,9 @@ emu8k_outw(uint16_t addr, uint16_t val, void *p)
|
||||
case 31:
|
||||
emu8k->hwcf3 = val;
|
||||
return;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -966,17 +1006,29 @@ emu8k_outw(uint16_t addr, uint16_t val, void *p)
|
||||
case 0x9:
|
||||
emu8k->reverb_engine.reflections[0].feedback = (val & 0xF) / 15.0;
|
||||
break;
|
||||
case 0xB: // emu8k->reverb_engine.reflections[0].feedback_r = (val&0xF)/15.0;
|
||||
case 0xB:
|
||||
#if 0
|
||||
emu8k->reverb_engine.reflections[0].feedback_r = (val&0xF)/15.0;
|
||||
#endif
|
||||
break;
|
||||
case 0x11:
|
||||
emu8k->reverb_engine.reflections[1].feedback = (val & 0xF) / 15.0;
|
||||
break;
|
||||
case 0x13: // emu8k->reverb_engine.reflections[1].feedback_r = (val&0xF)/15.0;
|
||||
case 0x13:
|
||||
#if 0
|
||||
emu8k->reverb_engine.reflections[1].feedback_r = (val&0xF)/15.0;
|
||||
#endif
|
||||
break;
|
||||
case 0x19:
|
||||
emu8k->reverb_engine.reflections[2].feedback = (val & 0xF) / 15.0;
|
||||
break;
|
||||
case 0x1B: // emu8k->reverb_engine.reflections[2].feedback_r = (val&0xF)/15.0;
|
||||
case 0x1B:
|
||||
#if 0
|
||||
emu8k->reverb_engine.reflections[2].feedback_r = (val&0xF)/15.0;
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -998,7 +1050,13 @@ emu8k_outw(uint16_t addr, uint16_t val, void *p)
|
||||
case 1:
|
||||
emu8k->reverb_engine.refl_in_amp = val & 0xFF;
|
||||
break;
|
||||
case 3: // emu8k->reverb_engine.refl_in_amp_r = val&0xFF;
|
||||
case 3:
|
||||
#if 0
|
||||
emu8k->reverb_engine.refl_in_amp_r = val&0xFF;
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1105,6 +1163,9 @@ emu8k_outw(uint16_t addr, uint16_t val, void *p)
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1180,6 +1241,9 @@ emu8k_outw(uint16_t addr, uint16_t val, void *p)
|
||||
EMU8K_WRITE(emu8k, emu8k->smarw, val);
|
||||
emu8k->smarw++;
|
||||
return;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1230,17 +1294,29 @@ emu8k_outw(uint16_t addr, uint16_t val, void *p)
|
||||
case 0x1:
|
||||
emu8k->reverb_engine.reflections[3].feedback = (val & 0xF) / 15.0;
|
||||
break;
|
||||
case 0x3: // emu8k->reverb_engine.reflections[3].feedback_r = (val&0xF)/15.0;
|
||||
case 0x3:
|
||||
#if 0
|
||||
emu8k->reverb_engine.reflections[3].feedback_r = (val&0xF)/15.0;
|
||||
#endif
|
||||
break;
|
||||
case 0x9:
|
||||
emu8k->reverb_engine.reflections[4].feedback = (val & 0xF) / 15.0;
|
||||
break;
|
||||
case 0xb: // emu8k->reverb_engine.reflections[4].feedback_r = (val&0xF)/15.0;
|
||||
case 0xb:
|
||||
#if 0
|
||||
emu8k->reverb_engine.reflections[4].feedback_r = (val&0xF)/15.0;
|
||||
#endif
|
||||
break;
|
||||
case 0x11:
|
||||
emu8k->reverb_engine.reflections[5].feedback = (val & 0xF) / 15.0;
|
||||
break;
|
||||
case 0x13: // emu8k->reverb_engine.reflections[5].feedback_r = (val&0xF)/15.0;
|
||||
case 0x13:
|
||||
#if 0
|
||||
emu8k->reverb_engine.reflections[5].feedback_r = (val&0xF)/15.0;
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1261,6 +1337,9 @@ emu8k_outw(uint16_t addr, uint16_t val, void *p)
|
||||
case 0x1F:
|
||||
emu8k->reverb_engine.link_return_amp = val & 0xFF;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -1346,6 +1425,9 @@ emu8k_outw(uint16_t addr, uint16_t val, void *p)
|
||||
emu8k->voice[emu8k->cur_voice].lfo2_delay_samples = LFOxVAL_TO_EMU_SAMPLES(val);
|
||||
|
||||
return;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1429,6 +1511,9 @@ emu8k_outw(uint16_t addr, uint16_t val, void *p)
|
||||
case 7: /*ID? I believe that this allows applications to know if the emu is in use by another application */
|
||||
emu8k->id = val;
|
||||
return;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1436,30 +1521,33 @@ emu8k_outw(uint16_t addr, uint16_t val, void *p)
|
||||
emu8k->cur_voice = (val & 31);
|
||||
emu8k->cur_reg = ((val >> 5) & 7);
|
||||
return;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
emu8k_log("EMU8K WRITE: Unknown register write: %04X-%02X(%d/%d): %04X \n", addr, (emu8k->cur_reg) << 5 | emu8k->cur_voice,
|
||||
emu8k->cur_reg, emu8k->cur_voice, val);
|
||||
}
|
||||
|
||||
uint8_t
|
||||
emu8k_inb(uint16_t addr, void *p)
|
||||
emu8k_inb(uint16_t addr, void *priv)
|
||||
{
|
||||
/* Reading a single byte is a feature that at least Impulse tracker uses,
|
||||
* but only on detection code and not for odd addresses.*/
|
||||
if (addr & 1)
|
||||
return emu8k_inw(addr & ~1, p) >> 1;
|
||||
return emu8k_inw(addr, p) & 0xff;
|
||||
return emu8k_inw(addr & ~1, priv) >> 1;
|
||||
return emu8k_inw(addr, priv) & 0xff;
|
||||
}
|
||||
|
||||
void
|
||||
emu8k_outb(uint16_t addr, uint8_t val, void *p)
|
||||
emu8k_outb(uint16_t addr, uint8_t val, void *priv)
|
||||
{
|
||||
/* TODO: AWE32 docs says that you cannot write in bytes, but if
|
||||
* an app were to use this implementation, the content of the LS Byte would be lost.*/
|
||||
if (addr & 1)
|
||||
emu8k_outw(addr & ~1, val << 8, p);
|
||||
emu8k_outw(addr & ~1, val << 8, priv);
|
||||
else
|
||||
emu8k_outw(addr, val, p);
|
||||
emu8k_outw(addr, val, priv);
|
||||
}
|
||||
|
||||
/* TODO: This is not a correct emulation, just a workalike implementation. */
|
||||
@@ -1468,7 +1556,9 @@ emu8k_work_chorus(int32_t *inbuf, int32_t *outbuf, emu8k_chorus_eng_t *engine, i
|
||||
{
|
||||
for (int pos = 0; pos < count; pos++) {
|
||||
double lfo_inter1 = chortable[engine->lfo_pos.int_address];
|
||||
// double lfo_inter2 = chortable[(engine->lfo_pos.int_address+1)&0xFFFF];
|
||||
#if 0
|
||||
double lfo_inter2 = chortable[(engine->lfo_pos.int_address+1)&0xFFFF];
|
||||
#endif
|
||||
|
||||
double offset_lfo = lfo_inter1; //= lfo_inter1 + ((lfo_inter2-lfo_inter1)*engine->lfo_pos.fract_address/65536.0);
|
||||
offset_lfo *= engine->lfodepth_multip;
|
||||
@@ -1567,10 +1657,14 @@ emu8k_reverb_tail_work(emu8k_reverb_combfilter_t *comb, emu8k_reverb_combfilter_
|
||||
/* store new value in delayed buffer */
|
||||
comb->reflection[comb->read_pos] = in;
|
||||
|
||||
// output = emu8k_reverb_allpass_work(&allpasses[0],output);
|
||||
#if 0
|
||||
output = emu8k_reverb_allpass_work(&allpasses[0],output);
|
||||
#endif
|
||||
output = emu8k_reverb_diffuser_work(&allpasses[1], output);
|
||||
output = emu8k_reverb_diffuser_work(&allpasses[2], output);
|
||||
// output = emu8k_reverb_allpass_work(&allpasses[3],output);
|
||||
#if 0
|
||||
output = emu8k_reverb_allpass_work(&allpasses[3],output);
|
||||
#endif
|
||||
|
||||
if (++comb->read_pos >= comb->bufsize)
|
||||
comb->read_pos = 0;
|
||||
@@ -1636,7 +1730,7 @@ emu8k_work_reverb(int32_t *inbuf, int32_t *outbuf, emu8k_reverb_eng_t *engine, i
|
||||
}
|
||||
}
|
||||
void
|
||||
emu8k_work_eq(int32_t *inoutbuf, int count)
|
||||
emu8k_work_eq(UNUSED(int32_t *inoutbuf), UNUSED(int count))
|
||||
{
|
||||
// TODO: Work EQ over buf
|
||||
}
|
||||
@@ -1656,9 +1750,11 @@ emu8k_vol_slide(emu8k_slide_t *slide, int32_t target)
|
||||
return slide->last;
|
||||
}
|
||||
|
||||
// int32_t old_pitch[32]={0};
|
||||
// int32_t old_cut[32]={0};
|
||||
// int32_t old_vol[32]={0};
|
||||
#if 0
|
||||
int32_t old_pitch[32] = { 0 };
|
||||
int32_t old_cut[32] = { 0 };
|
||||
int32_t old_vol[32] = { 0 };
|
||||
#endif
|
||||
void
|
||||
emu8k_update(emu8k_t *emu8k)
|
||||
{
|
||||
@@ -1861,6 +1957,9 @@ emu8k_update(emu8k_t *emu8k)
|
||||
case ENV_STOPPED:
|
||||
attenuation = 0x1FFFFF;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
emu8k_envelope_t *modenv = &emu_voice->mod_envelope;
|
||||
@@ -1912,6 +2011,9 @@ emu8k_update(emu8k_t *emu8k)
|
||||
modenv->state = ENV_SUSTAIN;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* run lfos */
|
||||
@@ -2009,11 +2111,13 @@ emu8k_update(emu8k_t *emu8k)
|
||||
emu_voice->ccca = (((uint32_t) emu_voice->ccca_qcontrol) << 24) | emu_voice->addr.int_address;
|
||||
emu_voice->cpf_curr_frac_addr = emu_voice->addr.fract_address;
|
||||
|
||||
// if ( emu_voice->cvcf_curr_volume != old_vol[c]) {
|
||||
// pclog("EMUVOL (%d):%d\n", c, emu_voice->cvcf_curr_volume);
|
||||
// old_vol[c]=emu_voice->cvcf_curr_volume;
|
||||
// }
|
||||
// pclog("EMUFILT :%d\n", emu_voice->cvcf_curr_filt_ctoff);
|
||||
#if 0
|
||||
if (emu_voice->cvcf_curr_volume != old_vol[c]) {
|
||||
pclog("EMUVOL (%d):%d\n", c, emu_voice->cvcf_curr_volume);
|
||||
old_vol[c]=emu_voice->cvcf_curr_volume;
|
||||
}
|
||||
pclog("EMUFILT :%d\n", emu_voice->cvcf_curr_filt_ctoff);
|
||||
#endif
|
||||
}
|
||||
|
||||
buf = &emu8k->buffer[emu8k->pos * 2];
|
||||
@@ -2142,8 +2246,10 @@ emu8k_init(emu8k_t *emu8k, uint16_t emu_addr, int onboard_ram)
|
||||
* Important: Using 65535 as max output value because this is intended to be used with the volume target register! */
|
||||
out = 65535.0;
|
||||
for (c = 0; c < 0x10000; c++) {
|
||||
// double db = -(c*6.0205999/65535.0)*16.0;
|
||||
// out = powf(10.f,db/20.f) * 65536.0;
|
||||
#if 0
|
||||
double db = -(c*6.0205999/65535.0)*16.0;
|
||||
out = powf(10.f,db/20.f) * 65536.0;
|
||||
#endif
|
||||
env_vol_db_to_vol_target[c] = (int32_t) out;
|
||||
/* calculated from the 65536th root of 65536 */
|
||||
out /= 1.00016923970;
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <86box/sound.h>
|
||||
#include <86box/timer.h>
|
||||
#include <86box/snd_ad1848.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
enum {
|
||||
MIDI_INT_RECEIVE = 0x01,
|
||||
@@ -48,28 +49,42 @@ typedef struct gus_t {
|
||||
int reset;
|
||||
|
||||
int global;
|
||||
uint32_t addr, dmaaddr;
|
||||
uint32_t addr;
|
||||
uint32_t dmaaddr;
|
||||
int voice;
|
||||
uint32_t start[32], end[32], cur[32];
|
||||
uint32_t startx[32], endx[32], curx[32];
|
||||
int rstart[32], rend[32];
|
||||
uint32_t start[32];
|
||||
uint32_t end[32];
|
||||
uint32_t cur[32];
|
||||
uint32_t startx[32];
|
||||
uint32_t endx[32];
|
||||
uint32_t curx[32];
|
||||
int rstart[32];
|
||||
int rend[32];
|
||||
int rcur[32];
|
||||
uint16_t freq[32];
|
||||
uint16_t rfreq[32];
|
||||
uint8_t ctrl[32];
|
||||
uint8_t rctrl[32];
|
||||
int curvol[32];
|
||||
int pan_l[32], pan_r[32];
|
||||
int t1on, t2on;
|
||||
int pan_l[32];
|
||||
int pan_r[32];
|
||||
int t1on;
|
||||
int t2on;
|
||||
uint8_t tctrl;
|
||||
uint16_t t1, t2, t1l, t2l;
|
||||
uint8_t irqstatus, irqstatus2;
|
||||
uint16_t t1;
|
||||
uint16_t t2;
|
||||
uint16_t t1l;
|
||||
uint16_t t2l;
|
||||
uint8_t irqstatus;
|
||||
uint8_t irqstatus2;
|
||||
uint8_t adcommand;
|
||||
int waveirqs[32], rampirqs[32];
|
||||
int waveirqs[32];
|
||||
int rampirqs[32];
|
||||
int voices;
|
||||
uint8_t dmactrl;
|
||||
|
||||
int32_t out_l, out_r;
|
||||
int32_t out_l;
|
||||
int32_t out_r;
|
||||
|
||||
int16_t buffer[2][SOUNDBUFLEN];
|
||||
int pos;
|
||||
@@ -82,27 +97,41 @@ typedef struct gus_t {
|
||||
|
||||
int irqnext;
|
||||
|
||||
pc_timer_t timer_1, timer_2;
|
||||
pc_timer_t timer_1;
|
||||
pc_timer_t timer_2;
|
||||
|
||||
int irq, dma, irq_midi;
|
||||
int irq;
|
||||
int dma;
|
||||
int irq_midi;
|
||||
uint16_t base;
|
||||
int latch_enable;
|
||||
|
||||
uint8_t sb_2xa, sb_2xc, sb_2xe;
|
||||
uint8_t sb_2xa;
|
||||
uint8_t sb_2xc;
|
||||
uint8_t sb_2xe;
|
||||
uint8_t sb_ctrl;
|
||||
int sb_nmi;
|
||||
|
||||
uint8_t reg_ctrl;
|
||||
|
||||
uint8_t ad_status, ad_data;
|
||||
uint8_t ad_status;
|
||||
uint8_t ad_data;
|
||||
uint8_t ad_timer_ctrl;
|
||||
|
||||
uint8_t midi_ctrl, midi_status, midi_queue[64], midi_data;
|
||||
int midi_r, midi_w;
|
||||
int uart_in, uart_out, sysex;
|
||||
uint8_t midi_ctrl;
|
||||
uint8_t midi_status;
|
||||
uint8_t midi_queue[64];
|
||||
uint8_t midi_data;
|
||||
int midi_r;
|
||||
int midi_w;
|
||||
int uart_in;
|
||||
int uart_out;
|
||||
int sysex;
|
||||
|
||||
uint8_t gp1, gp2;
|
||||
uint16_t gp1_addr, gp2_addr;
|
||||
uint8_t gp1;
|
||||
uint8_t gp2;
|
||||
uint16_t gp1_addr;
|
||||
uint16_t gp2_addr;
|
||||
|
||||
uint8_t usrr;
|
||||
|
||||
@@ -127,13 +156,12 @@ double vol16bit[4096];
|
||||
void
|
||||
gus_update_int_status(gus_t *gus)
|
||||
{
|
||||
int c;
|
||||
int irq_pending = 0;
|
||||
int midi_irq_pending = 0;
|
||||
|
||||
gus->irqstatus &= ~0x60;
|
||||
gus->irqstatus2 = 0xE0;
|
||||
for (c = 0; c < 32; c++) {
|
||||
for (uint8_t c = 0; c < 32; c++) {
|
||||
if (gus->waveirqs[c]) {
|
||||
gus->irqstatus2 = 0x60 | c;
|
||||
if (gus->rampirqs[c])
|
||||
@@ -199,9 +227,9 @@ gus_midi_update_int_status(gus_t *gus)
|
||||
}
|
||||
|
||||
void
|
||||
writegus(uint16_t addr, uint8_t val, void *p)
|
||||
writegus(uint16_t addr, uint8_t val, void *priv)
|
||||
{
|
||||
gus_t *gus = (gus_t *) p;
|
||||
gus_t *gus = (gus_t *) priv;
|
||||
int c;
|
||||
int d;
|
||||
int old;
|
||||
@@ -299,6 +327,9 @@ writegus(uint16_t addr, uint8_t val, void *p)
|
||||
gus->tctrl = val;
|
||||
gus_update_int_status(gus);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 0x305: /*Global high*/
|
||||
@@ -479,6 +510,9 @@ writegus(uint16_t addr, uint8_t val, void *p)
|
||||
case 0x4c: /*Reset*/
|
||||
gus->reset = val;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 0x307: /*DRAM access*/
|
||||
@@ -566,6 +600,9 @@ writegus(uint16_t addr, uint8_t val, void *p)
|
||||
break;
|
||||
case 6:
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -589,7 +626,7 @@ writegus(uint16_t addr, uint8_t val, void *p)
|
||||
else if (gus->irq != -1)
|
||||
picint(1 << gus->irq);
|
||||
}
|
||||
/*FALLTHROUGH*/
|
||||
[[fallthrough]];
|
||||
case 0x20d:
|
||||
gus->sb_2xc = val;
|
||||
break;
|
||||
@@ -619,13 +656,16 @@ writegus(uint16_t addr, uint8_t val, void *p)
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t
|
||||
readgus(uint16_t addr, void *p)
|
||||
readgus(uint16_t addr, void *priv)
|
||||
{
|
||||
gus_t *gus = (gus_t *) p;
|
||||
gus_t *gus = (gus_t *) priv;
|
||||
uint8_t val = 0xff;
|
||||
uint16_t port;
|
||||
|
||||
@@ -717,6 +757,9 @@ readgus(uint16_t addr, void *p)
|
||||
case 0x0f:
|
||||
val = 0xff;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 0x305: /*Global high*/
|
||||
@@ -777,6 +820,9 @@ readgus(uint16_t addr, void *p)
|
||||
case 0x0f:
|
||||
val = 0xff;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 0x306:
|
||||
@@ -787,7 +833,6 @@ readgus(uint16_t addr, void *p)
|
||||
val = 0xff; /*Pre 3.7 - no mixer*/
|
||||
break;
|
||||
|
||||
break;
|
||||
case 0x307: /*DRAM access*/
|
||||
val = gus->ram[gus->addr];
|
||||
gus->addr &= 0xFFFFF;
|
||||
@@ -813,6 +858,9 @@ readgus(uint16_t addr, void *p)
|
||||
case 4:
|
||||
val = gus->gp2_addr;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -848,14 +896,17 @@ readgus(uint16_t addr, void *p)
|
||||
case 0x20A:
|
||||
val = gus->adcommand;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
void
|
||||
gus_poll_timer_1(void *p)
|
||||
gus_poll_timer_1(void *priv)
|
||||
{
|
||||
gus_t *gus = (gus_t *) p;
|
||||
gus_t *gus = (gus_t *) priv;
|
||||
|
||||
timer_advance_u64(&gus->timer_1, (uint64_t) (TIMER_USEC * 80));
|
||||
if (gus->t1on) {
|
||||
@@ -879,9 +930,9 @@ gus_poll_timer_1(void *p)
|
||||
}
|
||||
|
||||
void
|
||||
gus_poll_timer_2(void *p)
|
||||
gus_poll_timer_2(void *priv)
|
||||
{
|
||||
gus_t *gus = (gus_t *) p;
|
||||
gus_t *gus = (gus_t *) priv;
|
||||
|
||||
timer_advance_u64(&gus->timer_2, (uint64_t) (TIMER_USEC * 320));
|
||||
if (gus->t2on) {
|
||||
@@ -922,9 +973,9 @@ gus_update(gus_t *gus)
|
||||
}
|
||||
|
||||
void
|
||||
gus_poll_wave(void *p)
|
||||
gus_poll_wave(void *priv)
|
||||
{
|
||||
gus_t *gus = (gus_t *) p;
|
||||
gus_t *gus = (gus_t *) priv;
|
||||
uint32_t addr;
|
||||
int16_t v;
|
||||
int32_t vl;
|
||||
@@ -1055,9 +1106,9 @@ gus_poll_wave(void *p)
|
||||
}
|
||||
|
||||
static void
|
||||
gus_get_buffer(int32_t *buffer, int len, void *p)
|
||||
gus_get_buffer(int32_t *buffer, int len, void *priv)
|
||||
{
|
||||
gus_t *gus = (gus_t *) p;
|
||||
gus_t *gus = (gus_t *) priv;
|
||||
|
||||
#if defined(DEV_BRANCH) && defined(USE_GUSMAX)
|
||||
if (gus->max_ctrl)
|
||||
@@ -1121,7 +1172,7 @@ gus_input_sysex(void *p, uint8_t *buffer, uint32_t len, int abort)
|
||||
}
|
||||
|
||||
void *
|
||||
gus_init(const device_t *info)
|
||||
gus_init(UNUSED(const device_t *info))
|
||||
{
|
||||
int c;
|
||||
double out = 1.0;
|
||||
@@ -1180,18 +1231,18 @@ gus_init(const device_t *info)
|
||||
}
|
||||
|
||||
void
|
||||
gus_close(void *p)
|
||||
gus_close(void *priv)
|
||||
{
|
||||
gus_t *gus = (gus_t *) p;
|
||||
gus_t *gus = (gus_t *) priv;
|
||||
|
||||
free(gus->ram);
|
||||
free(gus);
|
||||
}
|
||||
|
||||
void
|
||||
gus_speed_changed(void *p)
|
||||
gus_speed_changed(void *priv)
|
||||
{
|
||||
gus_t *gus = (gus_t *) p;
|
||||
gus_t *gus = (gus_t *) priv;
|
||||
|
||||
if (gus->voices < 14)
|
||||
gus->samp_latch = (uint64_t) (TIMER_USEC * (1000000.0 / 44100.0));
|
||||
|
||||
@@ -11,11 +11,13 @@
|
||||
#include <86box/machine.h>
|
||||
#include <86box/sound.h>
|
||||
#include <86box/timer.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
typedef struct lpt_dac_t {
|
||||
void *lpt;
|
||||
|
||||
uint8_t dac_val_l, dac_val_r;
|
||||
uint8_t dac_val_l;
|
||||
uint8_t dac_val_r;
|
||||
|
||||
int is_stereo;
|
||||
int channel;
|
||||
@@ -34,9 +36,9 @@ dac_update(lpt_dac_t *lpt_dac)
|
||||
}
|
||||
|
||||
static void
|
||||
dac_write_data(uint8_t val, void *p)
|
||||
dac_write_data(uint8_t val, void *priv)
|
||||
{
|
||||
lpt_dac_t *lpt_dac = (lpt_dac_t *) p;
|
||||
lpt_dac_t *lpt_dac = (lpt_dac_t *) priv;
|
||||
|
||||
if (lpt_dac->is_stereo) {
|
||||
if (lpt_dac->channel)
|
||||
@@ -49,24 +51,24 @@ dac_write_data(uint8_t val, void *p)
|
||||
}
|
||||
|
||||
static void
|
||||
dac_write_ctrl(uint8_t val, void *p)
|
||||
dac_write_ctrl(uint8_t val, void *priv)
|
||||
{
|
||||
lpt_dac_t *lpt_dac = (lpt_dac_t *) p;
|
||||
lpt_dac_t *lpt_dac = (lpt_dac_t *) priv;
|
||||
|
||||
if (lpt_dac->is_stereo)
|
||||
lpt_dac->channel = val & 0x01;
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
dac_read_status(void *p)
|
||||
dac_read_status(UNUSED(void *priv))
|
||||
{
|
||||
return 0x0f;
|
||||
}
|
||||
|
||||
static void
|
||||
dac_get_buffer(int32_t *buffer, int len, void *p)
|
||||
dac_get_buffer(int32_t *buffer, int len, void *priv)
|
||||
{
|
||||
lpt_dac_t *lpt_dac = (lpt_dac_t *) p;
|
||||
lpt_dac_t *lpt_dac = (lpt_dac_t *) priv;
|
||||
|
||||
dac_update(lpt_dac);
|
||||
|
||||
@@ -100,9 +102,9 @@ dac_stereo_init(void *lpt)
|
||||
return lpt_dac;
|
||||
}
|
||||
static void
|
||||
dac_close(void *p)
|
||||
dac_close(void *priv)
|
||||
{
|
||||
lpt_dac_t *lpt_dac = (lpt_dac_t *) p;
|
||||
lpt_dac_t *lpt_dac = (lpt_dac_t *) priv;
|
||||
|
||||
free(lpt_dac);
|
||||
}
|
||||
|
||||
@@ -11,15 +11,17 @@
|
||||
#include <86box/machine.h>
|
||||
#include <86box/sound.h>
|
||||
#include <86box/timer.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
typedef struct dss_t {
|
||||
void *lpt;
|
||||
|
||||
uint8_t fifo[16];
|
||||
int read_idx, write_idx;
|
||||
int read_idx;
|
||||
int write_idx;
|
||||
|
||||
uint8_t dac_val,
|
||||
status;
|
||||
uint8_t dac_val;
|
||||
uint8_t status;
|
||||
|
||||
pc_timer_t timer;
|
||||
|
||||
@@ -49,9 +51,9 @@ dss_update_status(dss_t *dss)
|
||||
}
|
||||
|
||||
static void
|
||||
dss_write_data(uint8_t val, void *p)
|
||||
dss_write_data(uint8_t val, void *priv)
|
||||
{
|
||||
dss_t *dss = (dss_t *) p;
|
||||
dss_t *dss = (dss_t *) priv;
|
||||
|
||||
if ((dss->write_idx - dss->read_idx) < 16) {
|
||||
dss->fifo[dss->write_idx & 15] = val;
|
||||
@@ -61,22 +63,23 @@ dss_write_data(uint8_t val, void *p)
|
||||
}
|
||||
|
||||
static void
|
||||
dss_write_ctrl(uint8_t val, void *p)
|
||||
dss_write_ctrl(UNUSED(uint8_t val), UNUSED(void *priv))
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
dss_read_status(void *p)
|
||||
dss_read_status(void *priv)
|
||||
{
|
||||
dss_t *dss = (dss_t *) p;
|
||||
dss_t *dss = (dss_t *) priv;
|
||||
|
||||
return dss->status | 0x0f;
|
||||
}
|
||||
|
||||
static void
|
||||
dss_get_buffer(int32_t *buffer, int len, void *p)
|
||||
dss_get_buffer(int32_t *buffer, int len, void *priv)
|
||||
{
|
||||
dss_t *dss = (dss_t *) p;
|
||||
dss_t *dss = (dss_t *) priv;
|
||||
int16_t val;
|
||||
float fval;
|
||||
|
||||
@@ -84,7 +87,7 @@ dss_get_buffer(int32_t *buffer, int len, void *p)
|
||||
|
||||
for (int c = 0; c < len * 2; c += 2) {
|
||||
fval = dss_iir((float) dss->buffer[c >> 1]);
|
||||
val = (float) fval;
|
||||
val = fval;
|
||||
|
||||
buffer[c] += val;
|
||||
buffer[c + 1] += val;
|
||||
@@ -94,9 +97,9 @@ dss_get_buffer(int32_t *buffer, int len, void *p)
|
||||
}
|
||||
|
||||
static void
|
||||
dss_callback(void *p)
|
||||
dss_callback(void *priv)
|
||||
{
|
||||
dss_t *dss = (dss_t *) p;
|
||||
dss_t *dss = (dss_t *) priv;
|
||||
|
||||
dss_update(dss);
|
||||
|
||||
@@ -123,9 +126,9 @@ dss_init(void *lpt)
|
||||
return dss;
|
||||
}
|
||||
static void
|
||||
dss_close(void *p)
|
||||
dss_close(void *priv)
|
||||
{
|
||||
dss_t *dss = (dss_t *) p;
|
||||
dss_t *dss = (dss_t *) priv;
|
||||
|
||||
free(dss);
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include <86box/timer.h>
|
||||
#include <86box/snd_mpu401.h>
|
||||
#include <86box/sound.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
static uint32_t MPUClockBase[8] = { 48, 72, 96, 120, 144, 168, 192 };
|
||||
static uint8_t cth_data[16] = { 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0 };
|
||||
@@ -52,7 +53,7 @@ int mpu401_standalone_enable = 0;
|
||||
static void MPU401_WriteCommand(mpu_t *mpu, uint8_t val);
|
||||
static void MPU401_IntelligentOut(mpu_t *mpu, uint8_t track);
|
||||
static void MPU401_EOIHandler(void *priv);
|
||||
static void MPU401_EOIHandlerDispatch(void *p);
|
||||
static void MPU401_EOIHandlerDispatch(void *priv);
|
||||
static void MPU401_NotesOff(mpu_t *mpu, int i);
|
||||
|
||||
#ifdef ENABLE_MPU401_LOG
|
||||
@@ -137,7 +138,7 @@ MPU401_RunClock(mpu_t *mpu)
|
||||
}
|
||||
|
||||
static void
|
||||
MPU401_QueueByteEx(mpu_t *mpu, uint8_t data, int irq)
|
||||
MPU401_QueueByteEx(mpu_t *mpu, uint8_t data, UNUSED(int irq))
|
||||
{
|
||||
if (mpu->state.block_ack) {
|
||||
mpu->state.block_ack = 0;
|
||||
@@ -186,7 +187,7 @@ MPU401_IRQPending(mpu_t *mpu)
|
||||
}
|
||||
|
||||
static void
|
||||
MPU401_RecQueueBuffer(mpu_t *mpu, uint8_t *buf, uint32_t len, int block)
|
||||
MPU401_RecQueueBuffer(mpu_t *mpu, uint8_t *buf, uint32_t len, UNUSED(int block))
|
||||
{
|
||||
uint32_t cnt = 0;
|
||||
int pos;
|
||||
@@ -405,6 +406,9 @@ MPU401_WriteCommand(mpu_t *mpu, uint8_t val)
|
||||
mpu->clock.measure_counter = mpu->clock.meas_old;
|
||||
mpu->clock.cth_counter = mpu->clock.cth_old;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch (val & 0xc) { /* Playing */
|
||||
case 0x4: /* Stop */
|
||||
@@ -418,6 +422,9 @@ MPU401_WriteCommand(mpu_t *mpu, uint8_t val)
|
||||
mpu->state.playing = 1;
|
||||
MPU401_StartClock(mpu);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch (val & 0x30) { /* Recording */
|
||||
case 0: /* check if it waited for MIDI RT command */
|
||||
@@ -450,6 +457,9 @@ MPU401_WriteCommand(mpu_t *mpu, uint8_t val)
|
||||
MPU401_StartClock(mpu);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
MPU401_QueueByte(mpu, MSG_MPU_ACK);
|
||||
@@ -679,8 +689,11 @@ MPU401_WriteCommand(mpu_t *mpu, uint8_t val)
|
||||
return;
|
||||
break;
|
||||
|
||||
/* default:
|
||||
mpu401_log("MPU-401:Unhandled command %X",val); */
|
||||
default:
|
||||
#if 0
|
||||
mpu401_log("MPU-401:Unhandled command %X",val);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
MPU401_QueueByte(mpu, MSG_MPU_ACK);
|
||||
@@ -793,7 +806,9 @@ MPU401_WriteData(mpu_t *mpu, uint8_t val)
|
||||
break;
|
||||
|
||||
case 0xf0:
|
||||
/* mpu401_log("MPU-401:Illegal WSD byte\n"); */
|
||||
#if 0
|
||||
mpu401_log("MPU-401:Illegal WSD byte\n");
|
||||
#endif
|
||||
mpu->state.wsd = 0;
|
||||
mpu->state.track = mpu->state.old_track;
|
||||
return;
|
||||
@@ -900,6 +915,9 @@ MPU401_WriteData(mpu_t *mpu, uint8_t val)
|
||||
mpu->state.data_onoff = -1;
|
||||
mpu->state.cond_req = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -944,7 +962,9 @@ MPU401_WriteData(mpu_t *mpu, uint8_t val)
|
||||
if (val == 0xf9)
|
||||
mpu->clock.measure_counter = 0;
|
||||
} else {
|
||||
/* mpu401_log("MPU-401:Illegal message"); */
|
||||
#if 0
|
||||
mpu401_log("MPU-401:Illegal message");
|
||||
#endif
|
||||
mpu->playbuf[mpu->state.track].type = T_OVERFLOW;
|
||||
}
|
||||
mpu->state.data_onoff = -1;
|
||||
@@ -969,6 +989,9 @@ MPU401_WriteData(mpu_t *mpu, uint8_t val)
|
||||
MPU401_EOIHandler(mpu);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -1022,6 +1045,9 @@ MPU401_IntelligentOut(mpu_t *mpu, uint8_t track)
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (retrigger) {
|
||||
midi_raw_out_byte(0x80 | chan);
|
||||
@@ -1130,7 +1156,7 @@ MPU401_EOIHandlerDispatch(void *priv)
|
||||
}
|
||||
|
||||
static void
|
||||
imf_write(uint16_t addr, uint8_t val, void *priv)
|
||||
imf_write(UNUSED(uint16_t addr), UNUSED(uint8_t val), UNUSED(void *priv))
|
||||
{
|
||||
mpu401_log("IMF:Wr %4X,%X\n", addr, val);
|
||||
}
|
||||
@@ -1245,6 +1271,9 @@ mpu401_write(uint16_t addr, uint8_t val, void *priv)
|
||||
MPU401_WriteCommand(mpu, val);
|
||||
mpu401_log("Write Command (0x331) %x\n", val);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1269,6 +1298,9 @@ mpu401_read(uint16_t addr, void *priv)
|
||||
|
||||
mpu401_log("Read Status (0x331) %x\n", ret);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* mpu401_log("MPU401 Read Port %04X, ret %x\n", addr, ret); */
|
||||
@@ -1520,8 +1552,11 @@ MPU401_InputMsg(void *p, uint8_t *msg, uint32_t len)
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((msg[0] >= 0xf0) || (mpu->state.midi_mask & (1 << chan))) {
|
||||
@@ -1617,9 +1652,16 @@ MPU401_InputMsg(void *p, uint8_t *msg, uint32_t len)
|
||||
if (mpu->filter.rt_out)
|
||||
midi_raw_out_rt_byte(msg[0]);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (send_thru && mpu->midi_thru) {
|
||||
@@ -1728,17 +1770,17 @@ mpu401_device_add(void)
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
mpu401_mca_read(int port, void *p)
|
||||
mpu401_mca_read(int port, void *priv)
|
||||
{
|
||||
mpu_t *mpu = (mpu_t *) p;
|
||||
mpu_t *mpu = (mpu_t *) priv;
|
||||
|
||||
return mpu->pos_regs[port & 7];
|
||||
}
|
||||
|
||||
static void
|
||||
mpu401_mca_write(int port, uint8_t val, void *p)
|
||||
mpu401_mca_write(int port, uint8_t val, void *priv)
|
||||
{
|
||||
mpu_t *mpu = (mpu_t *) p;
|
||||
mpu_t *mpu = (mpu_t *) priv;
|
||||
uint16_t addr;
|
||||
|
||||
if (port < 0x102)
|
||||
@@ -1762,7 +1804,7 @@ mpu401_mca_write(int port, uint8_t val, void *p)
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
mpu401_mca_feedb(void *p)
|
||||
mpu401_mca_feedb(UNUSED(void *priv))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -125,9 +125,9 @@ typedef struct chan {
|
||||
uint8_t con;
|
||||
uint8_t alg;
|
||||
uint8_t ksv;
|
||||
uint16_t cha,
|
||||
chb;
|
||||
uint8_t ch_num;
|
||||
uint16_t cha;
|
||||
uint16_t chb;
|
||||
uint8_t ch_num;
|
||||
} chan_t;
|
||||
|
||||
typedef struct wrbuf {
|
||||
@@ -177,12 +177,14 @@ typedef struct chip {
|
||||
|
||||
typedef struct {
|
||||
nuked_t opl;
|
||||
int8_t flags, pad;
|
||||
int8_t flags;
|
||||
int8_t pad;
|
||||
|
||||
uint16_t port;
|
||||
uint8_t status, timer_ctrl;
|
||||
uint16_t timer_count[2],
|
||||
timer_cur_count[2];
|
||||
uint8_t status;
|
||||
uint8_t timer_ctrl;
|
||||
uint16_t timer_count[2];
|
||||
uint16_t timer_cur_count[2];
|
||||
|
||||
pc_timer_t timers[2];
|
||||
|
||||
@@ -543,6 +545,9 @@ env_calc(slot_t *slot)
|
||||
case envelope_gen_num_release:
|
||||
reg_rate = slot->reg_rr;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
slot->pg_reset = reset;
|
||||
@@ -619,6 +624,9 @@ env_calc(slot_t *slot)
|
||||
if (!eg_off && !reset && shift > 0)
|
||||
eg_inc = 1 << (shift - 1);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
slot->eg_rout = (eg_rout + eg_inc) & 0x1ff;
|
||||
|
||||
@@ -810,6 +818,9 @@ channel_setup_alg(chan_t *ch)
|
||||
ch->slots[0]->mod = &ch->slots[0]->fbmod;
|
||||
ch->slots[1]->mod = &ch->dev->zeromod;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -867,6 +878,9 @@ channel_setup_alg(chan_t *ch)
|
||||
ch->out[2] = &ch->slots[1]->out;
|
||||
ch->out[3] = &ch->dev->zeromod;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else
|
||||
switch (ch->alg & 0x01) {
|
||||
@@ -887,6 +901,9 @@ channel_setup_alg(chan_t *ch)
|
||||
ch->out[2] = &ch->dev->zeromod;
|
||||
ch->out[3] = &ch->dev->zeromod;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1128,12 +1145,18 @@ nuked_write_reg(void *priv, uint16_t reg, uint8_t val)
|
||||
case 0x05:
|
||||
dev->newm = val & 0x01;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
else
|
||||
switch (regm & 0x0f) {
|
||||
case 0x08:
|
||||
dev->nts = (val >> 6) & 0x01;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1191,6 +1214,9 @@ nuked_write_reg(void *priv, uint16_t reg, uint8_t val)
|
||||
if (ad_slot[regm & 0x1f] >= 0)
|
||||
slot_write_e0(&dev->slot[18 * high + ad_slot[regm & 0x1f]], val);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1576,6 +1602,9 @@ nuked_drv_write(uint16_t port, uint8_t val, void *priv)
|
||||
nuked_log("Status mask now %02X (val = %02X)\n", (val & ~CTRL_TMR_MASK) & CTRL_TMR_MASK, val);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
dev->port = nuked_write_addr(&dev->opl, port, val) & 0x01ff;
|
||||
|
||||
@@ -29,6 +29,7 @@ extern "C" {
|
||||
#include <86box/snd_opl.h>
|
||||
#include <86box/mem.h>
|
||||
#include <86box/rom.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
// Disable c99-designator to avoid the warnings in *_ymfm_device
|
||||
#ifdef __clang__
|
||||
@@ -50,7 +51,7 @@ enum {
|
||||
|
||||
class YMFMChipBase {
|
||||
public:
|
||||
YMFMChipBase(uint32_t clock, fm_type type, uint32_t samplerate)
|
||||
YMFMChipBase(uint32_t clock, fm_type type, UNUSED(uint32_t samplerate))
|
||||
: m_buf_pos(0)
|
||||
, m_flags(0)
|
||||
, m_type(type)
|
||||
@@ -295,8 +296,8 @@ ymfm_drv_init(const device_t *info)
|
||||
YMFMChipBase *fm;
|
||||
|
||||
switch (info->local) {
|
||||
case FM_YM3812:
|
||||
default:
|
||||
case FM_YM3812:
|
||||
fm = (YMFMChipBase *) new YMFMChip<ymfm::ym3812>(3579545, FM_YM3812, OPL_FREQ);
|
||||
break;
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include <86box/snd_sb.h>
|
||||
#include <86box/mem.h>
|
||||
#include <86box/rom.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
static int optimc_wss_dma[4] = { 0, 0, 1, 3 };
|
||||
static int optimc_wss_irq[8] = { 5, 7, 9, 10, 11, 12, 14, 15 };
|
||||
@@ -48,14 +49,21 @@ enum optimc_local_flags {
|
||||
};
|
||||
|
||||
typedef struct optimc_t {
|
||||
uint8_t type, fm_type;
|
||||
uint8_t type;
|
||||
uint8_t fm_type;
|
||||
|
||||
uint8_t wss_config, reg_enabled;
|
||||
uint8_t wss_config;
|
||||
uint8_t reg_enabled;
|
||||
|
||||
uint16_t cur_addr, cur_wss_addr, cur_mpu401_addr;
|
||||
uint16_t cur_addr;
|
||||
uint16_t cur_wss_addr;
|
||||
uint16_t cur_mpu401_addr;
|
||||
|
||||
int cur_irq, cur_dma;
|
||||
int cur_wss_enabled, cur_wss_irq, cur_wss_dma;
|
||||
int cur_irq;
|
||||
int cur_dma;
|
||||
int cur_wss_enabled;
|
||||
int cur_wss_irq;
|
||||
int cur_wss_dma;
|
||||
int cur_mpu401_irq;
|
||||
int cur_mpu401_enabled;
|
||||
void *gameport;
|
||||
@@ -82,9 +90,9 @@ optimc_filter_opl(void *priv, double *out_l, double *out_r)
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
optimc_wss_read(uint16_t addr, void *priv)
|
||||
optimc_wss_read(UNUSED(uint16_t addr), void *priv)
|
||||
{
|
||||
optimc_t *optimc = (optimc_t *) priv;
|
||||
const optimc_t *optimc = (optimc_t *) priv;
|
||||
|
||||
if (!(optimc->regs[4] & 0x10) && optimc->cur_mode == 0)
|
||||
return 0xFF;
|
||||
@@ -93,7 +101,7 @@ optimc_wss_read(uint16_t addr, void *priv)
|
||||
}
|
||||
|
||||
static void
|
||||
optimc_wss_write(uint16_t addr, uint8_t val, void *priv)
|
||||
optimc_wss_write(UNUSED(uint16_t addr), uint8_t val, void *priv)
|
||||
{
|
||||
optimc_t *optimc = (optimc_t *) priv;
|
||||
|
||||
@@ -105,9 +113,9 @@ optimc_wss_write(uint16_t addr, uint8_t val, void *priv)
|
||||
}
|
||||
|
||||
static void
|
||||
optimc_get_buffer(int32_t *buffer, int len, void *p)
|
||||
optimc_get_buffer(int32_t *buffer, int len, void *priv)
|
||||
{
|
||||
optimc_t *optimc = (optimc_t *) p;
|
||||
optimc_t *optimc = (optimc_t *) priv;
|
||||
|
||||
if (optimc->regs[3] & 0x4)
|
||||
return;
|
||||
@@ -141,9 +149,9 @@ optimc_add_opl(optimc_t *optimc)
|
||||
}
|
||||
|
||||
static void
|
||||
optimc_reg_write(uint16_t addr, uint8_t val, void *p)
|
||||
optimc_reg_write(uint16_t addr, uint8_t val, void *priv)
|
||||
{
|
||||
optimc_t *optimc = (optimc_t *) p;
|
||||
optimc_t *optimc = (optimc_t *) priv;
|
||||
uint16_t idx = addr - 0xF8D;
|
||||
uint8_t old = optimc->regs[idx];
|
||||
static uint8_t reg_enable_phase = 0;
|
||||
@@ -176,6 +184,9 @@ optimc_reg_write(uint16_t addr, uint8_t val, void *p)
|
||||
case 3: /* WSBase = 0x604 */
|
||||
optimc->cur_wss_addr = 0x604;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
io_sethandler(optimc->cur_wss_addr, 0x0004, optimc_wss_read, NULL, NULL, optimc_wss_write, NULL, NULL, optimc);
|
||||
io_sethandler(optimc->cur_wss_addr + 0x0004, 0x0004, ad1848_read, NULL, NULL, ad1848_write, NULL, NULL, &optimc->ad1848);
|
||||
@@ -247,6 +258,9 @@ optimc_reg_write(uint16_t addr, uint8_t val, void *p)
|
||||
case 3:
|
||||
optimc->cur_mpu401_irq = 7;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch ((val >> 5) & 0x3) {
|
||||
case 0:
|
||||
@@ -261,11 +275,17 @@ optimc_reg_write(uint16_t addr, uint8_t val, void *p)
|
||||
case 3:
|
||||
optimc->cur_mpu401_addr = 0x300;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
mpu401_change_addr(optimc->mpu, optimc->cur_mpu401_addr);
|
||||
mpu401_setirq(optimc->mpu, optimc->cur_mpu401_irq);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (optimc->reg_enabled)
|
||||
@@ -291,6 +311,9 @@ optimc_reg_write(uint16_t addr, uint8_t val, void *p)
|
||||
reg_enable_phase = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else
|
||||
reg_enable_phase = 1;
|
||||
@@ -299,9 +322,9 @@ optimc_reg_write(uint16_t addr, uint8_t val, void *p)
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
optimc_reg_read(uint16_t addr, void *p)
|
||||
optimc_reg_read(uint16_t addr, void *priv)
|
||||
{
|
||||
optimc_t *optimc = (optimc_t *) p;
|
||||
optimc_t *optimc = (optimc_t *) priv;
|
||||
uint8_t temp = 0xFF;
|
||||
|
||||
if (optimc->reg_enabled) {
|
||||
@@ -316,6 +339,9 @@ optimc_reg_read(uint16_t addr, void *p)
|
||||
case 2: /* MC3 */
|
||||
temp = (optimc->regs[2] & ~0x3) | 0x2;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
optimc->reg_enabled = 0;
|
||||
}
|
||||
@@ -398,19 +424,19 @@ optimc_init(const device_t *info)
|
||||
}
|
||||
|
||||
static void
|
||||
optimc_close(void *p)
|
||||
optimc_close(void *priv)
|
||||
{
|
||||
optimc_t *optimc = (optimc_t *) p;
|
||||
optimc_t *optimc = (optimc_t *) priv;
|
||||
|
||||
sb_close(optimc->sb);
|
||||
free(optimc->mpu);
|
||||
free(p);
|
||||
free(priv);
|
||||
}
|
||||
|
||||
static void
|
||||
optimc_speed_changed(void *p)
|
||||
optimc_speed_changed(void *priv)
|
||||
{
|
||||
optimc_t *optimc = (optimc_t *) p;
|
||||
optimc_t *optimc = (optimc_t *) priv;
|
||||
|
||||
ad1848_speed_changed(&optimc->ad1848);
|
||||
sb_speed_changed(optimc->sb);
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <86box/snd_opl.h>
|
||||
#include <86box/snd_sb.h>
|
||||
#include <86box/snd_sb_dsp.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
/* Original PAS uses
|
||||
2 x OPL2
|
||||
@@ -97,39 +98,51 @@
|
||||
typedef struct pas16_t {
|
||||
uint16_t base;
|
||||
|
||||
int irq, dma;
|
||||
int irq;
|
||||
int dma;
|
||||
|
||||
uint8_t audiofilt;
|
||||
|
||||
uint8_t audio_mixer;
|
||||
|
||||
uint8_t compat, compat_base;
|
||||
uint8_t compat;
|
||||
uint8_t compat_base;
|
||||
|
||||
uint8_t enhancedscsi;
|
||||
|
||||
uint8_t io_conf_1, io_conf_2, io_conf_3, io_conf_4;
|
||||
uint8_t io_conf_1;
|
||||
uint8_t io_conf_2;
|
||||
uint8_t io_conf_3;
|
||||
uint8_t io_conf_4;
|
||||
|
||||
uint8_t irq_stat, irq_ena;
|
||||
uint8_t irq_stat;
|
||||
uint8_t irq_ena;
|
||||
|
||||
uint8_t pcm_ctrl;
|
||||
uint16_t pcm_dat;
|
||||
|
||||
uint16_t pcm_dat_l, pcm_dat_r;
|
||||
uint16_t pcm_dat_l;
|
||||
uint16_t pcm_dat_r;
|
||||
|
||||
uint8_t sb_irqdma;
|
||||
|
||||
int stereo_lr;
|
||||
|
||||
uint8_t sys_conf_1, sys_conf_2, sys_conf_3, sys_conf_4;
|
||||
uint8_t sys_conf_1;
|
||||
uint8_t sys_conf_2;
|
||||
uint8_t sys_conf_3;
|
||||
uint8_t sys_conf_4;
|
||||
|
||||
struct
|
||||
{
|
||||
struct {
|
||||
uint32_t l[3];
|
||||
int64_t c[3];
|
||||
pc_timer_t timer[3];
|
||||
uint8_t m[3];
|
||||
uint8_t ctrl, ctrls[2];
|
||||
int wp, rm[3], wm[3];
|
||||
uint8_t ctrl;
|
||||
uint8_t ctrls[2];
|
||||
int wp;
|
||||
int rm[3];
|
||||
int wm[3];
|
||||
uint16_t rl[3];
|
||||
int thit[3];
|
||||
int delay[3];
|
||||
@@ -192,9 +205,9 @@ pas16_log(const char *fmt, ...)
|
||||
#endif
|
||||
|
||||
static uint8_t
|
||||
pas16_in(uint16_t port, void *p)
|
||||
pas16_in(uint16_t port, void *priv)
|
||||
{
|
||||
pas16_t *pas16 = (pas16_t *) p;
|
||||
pas16_t *pas16 = (pas16_t *) priv;
|
||||
uint8_t temp = 0xff;
|
||||
switch ((port - pas16->base) + 0x388) {
|
||||
case 0x388:
|
||||
@@ -286,15 +299,18 @@ pas16_in(uint16_t port, void *p)
|
||||
case 0xff8b: /*Master mode read*/
|
||||
temp = 0x20 | 0x10 | 0x01; /*AT bus, XT/AT timing*/
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
pas16_log("pas16_in : port %04X return %02X %04X:%04X\n", port, temp, CS, cpu_state.pc);
|
||||
return temp;
|
||||
}
|
||||
|
||||
static void
|
||||
pas16_out(uint16_t port, uint8_t val, void *p)
|
||||
pas16_out(uint16_t port, uint8_t val, void *priv)
|
||||
{
|
||||
pas16_t *pas16 = (pas16_t *) p;
|
||||
pas16_t *pas16 = (pas16_t *) priv;
|
||||
pas16_log("pas16_out : port %04X val %02X %04X:%04X\n", port, val, CS, cpu_state.pc);
|
||||
switch ((port - pas16->base) + 0x388) {
|
||||
case 0x388:
|
||||
@@ -409,9 +425,9 @@ pas16_out(uint16_t port, uint8_t val, void *p)
|
||||
}
|
||||
|
||||
static void
|
||||
pas16_pit_out(uint16_t port, uint8_t val, void *p)
|
||||
pas16_pit_out(uint16_t port, uint8_t val, void *priv)
|
||||
{
|
||||
pas16_t *pas16 = (pas16_t *) p;
|
||||
pas16_t *pas16 = (pas16_t *) priv;
|
||||
int t;
|
||||
switch (port & 3) {
|
||||
case 3: /*CTRL*/
|
||||
@@ -496,6 +512,9 @@ pas16_pit_out(uint16_t port, uint8_t val, void *p)
|
||||
pas16->pit.l[t] |= val;
|
||||
pas16->pit.wm[t] = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (!pas16->pit.l[t]) {
|
||||
pas16->pit.l[t] |= 0x10000;
|
||||
@@ -504,13 +523,16 @@ pas16_pit_out(uint16_t port, uint8_t val, void *p)
|
||||
timer_set_delay_u64(&pas16->pit.timer[t], pas16->pit.c[t] * PITCONST);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
pas16_pit_in(uint16_t port, void *p)
|
||||
pas16_pit_in(uint16_t port, void *priv)
|
||||
{
|
||||
pas16_t *pas16 = (pas16_t *) p;
|
||||
pas16_t *pas16 = (pas16_t *) priv;
|
||||
uint8_t temp = 0xff;
|
||||
int t = port & 3;
|
||||
switch (port & 3) {
|
||||
@@ -550,11 +572,17 @@ pas16_pit_in(uint16_t port, void *p)
|
||||
else
|
||||
pas16->pit.rm[t] = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 3: /*Control*/
|
||||
temp = pas16->pit.ctrl;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
@@ -566,9 +594,9 @@ pas16_readdma(pas16_t *pas16)
|
||||
}
|
||||
|
||||
static void
|
||||
pas16_pcm_poll(void *p)
|
||||
pas16_pcm_poll(void *priv)
|
||||
{
|
||||
pas16_t *pas16 = (pas16_t *) p;
|
||||
pas16_t *pas16 = (pas16_t *) priv;
|
||||
|
||||
pas16_update(pas16);
|
||||
if (pas16->pit.m[0] & 2) {
|
||||
@@ -633,9 +661,9 @@ pas16_pcm_poll(void *p)
|
||||
}
|
||||
|
||||
static void
|
||||
pas16_out_base(uint16_t port, uint8_t val, void *p)
|
||||
pas16_out_base(UNUSED(uint16_t port), uint8_t val, void *priv)
|
||||
{
|
||||
pas16_t *pas16 = (pas16_t *) p;
|
||||
pas16_t *pas16 = (pas16_t *) priv;
|
||||
|
||||
io_removehandler((pas16->base - 0x388) + 0x0388, 0x0004, pas16_in, NULL, NULL, pas16_out, NULL, NULL, pas16);
|
||||
io_removehandler((pas16->base - 0x388) + 0x0788, 0x0004, pas16_in, NULL, NULL, pas16_out, NULL, NULL, pas16);
|
||||
@@ -696,9 +724,9 @@ pas16_update(pas16_t *pas16)
|
||||
}
|
||||
|
||||
void
|
||||
pas16_get_buffer(int32_t *buffer, int len, void *p)
|
||||
pas16_get_buffer(int32_t *buffer, int len, void *priv)
|
||||
{
|
||||
pas16_t *pas16 = (pas16_t *) p;
|
||||
pas16_t *pas16 = (pas16_t *) priv;
|
||||
|
||||
int32_t *opl_buf = pas16->opl.update(pas16->opl.priv);
|
||||
sb_dsp_update(&pas16->dsp);
|
||||
@@ -715,7 +743,7 @@ pas16_get_buffer(int32_t *buffer, int len, void *p)
|
||||
}
|
||||
|
||||
static void *
|
||||
pas16_init(const device_t *info)
|
||||
pas16_init(UNUSED(const device_t *info))
|
||||
{
|
||||
pas16_t *pas16 = malloc(sizeof(pas16_t));
|
||||
memset(pas16, 0, sizeof(pas16_t));
|
||||
@@ -733,9 +761,9 @@ pas16_init(const device_t *info)
|
||||
}
|
||||
|
||||
static void
|
||||
pas16_close(void *p)
|
||||
pas16_close(void *priv)
|
||||
{
|
||||
pas16_t *pas16 = (pas16_t *) p;
|
||||
pas16_t *pas16 = (pas16_t *) priv;
|
||||
|
||||
free(pas16);
|
||||
}
|
||||
|
||||
@@ -13,15 +13,18 @@
|
||||
#include <86box/sound.h>
|
||||
#include <86box/snd_sn76489.h>
|
||||
#include <86box/timer.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
typedef struct {
|
||||
typedef struct ps1snd_t {
|
||||
sn76489_t sn76489;
|
||||
uint8_t status, ctrl;
|
||||
uint8_t status;
|
||||
uint8_t ctrl;
|
||||
uint64_t timer_latch;
|
||||
pc_timer_t timer_count;
|
||||
int timer_enable;
|
||||
uint8_t fifo[2048];
|
||||
int fifo_read_idx, fifo_write_idx;
|
||||
int fifo_read_idx;
|
||||
int fifo_write_idx;
|
||||
int fifo_threshold;
|
||||
uint8_t dac_val;
|
||||
int16_t buffer[SOUNDBUFLEN];
|
||||
@@ -73,6 +76,10 @@ ps1snd_read(uint16_t port, void *priv)
|
||||
case 6:
|
||||
case 7:
|
||||
ret = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -109,6 +116,9 @@ ps1snd_write(uint16_t port, uint8_t val, void *priv)
|
||||
case 4: /* almost empty */
|
||||
ps1snd->fifo_threshold = val * 4;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,7 +164,7 @@ ps1snd_get_buffer(int32_t *buffer, int len, void *priv)
|
||||
}
|
||||
|
||||
static void *
|
||||
ps1snd_init(const device_t *info)
|
||||
ps1snd_init(UNUSED(const device_t *info))
|
||||
{
|
||||
ps1snd_t *ps1snd = malloc(sizeof(ps1snd_t));
|
||||
memset(ps1snd, 0x00, sizeof(ps1snd_t));
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <86box/sound.h>
|
||||
#include <86box/snd_sn76489.h>
|
||||
#include <86box/timer.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
typedef struct pssj_t {
|
||||
sn76489_t sn76489;
|
||||
@@ -41,9 +42,9 @@ pssj_update_irq(pssj_t *pssj)
|
||||
}
|
||||
|
||||
static void
|
||||
pssj_write(uint16_t port, uint8_t val, void *p)
|
||||
pssj_write(uint16_t port, uint8_t val, void *priv)
|
||||
{
|
||||
pssj_t *pssj = (pssj_t *) p;
|
||||
pssj_t *pssj = (pssj_t *) priv;
|
||||
|
||||
switch (port & 3) {
|
||||
case 0:
|
||||
@@ -67,6 +68,9 @@ pssj_write(uint16_t port, uint8_t val, void *p)
|
||||
case 3: /*Direct DAC*/
|
||||
pssj->dac_val = val;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
@@ -76,12 +80,15 @@ pssj_write(uint16_t port, uint8_t val, void *p)
|
||||
pssj->freq = (pssj->freq & 0x0ff) | ((val & 0xf) << 8);
|
||||
pssj->amplitude = val >> 4;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
static uint8_t
|
||||
pssj_read(uint16_t port, void *p)
|
||||
pssj_read(uint16_t port, void *priv)
|
||||
{
|
||||
pssj_t *pssj = (pssj_t *) p;
|
||||
pssj_t *pssj = (pssj_t *) priv;
|
||||
|
||||
switch (port & 3) {
|
||||
case 0:
|
||||
@@ -96,6 +103,9 @@ pssj_read(uint16_t port, void *p)
|
||||
return 0x80;
|
||||
case 3: /*Direct DAC*/
|
||||
return pssj->dac_val;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
@@ -117,9 +127,9 @@ pssj_update(pssj_t *pssj)
|
||||
}
|
||||
|
||||
static void
|
||||
pssj_callback(void *p)
|
||||
pssj_callback(void *priv)
|
||||
{
|
||||
pssj_t *pssj = (pssj_t *) p;
|
||||
pssj_t *pssj = (pssj_t *) priv;
|
||||
int data;
|
||||
|
||||
pssj_update(pssj);
|
||||
@@ -157,6 +167,9 @@ pssj_callback(void *p)
|
||||
case 0xc0:
|
||||
pssj->dac_val = 0x80;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
pssj->wave_pos = (pssj->wave_pos + 1) & 31;
|
||||
}
|
||||
@@ -165,9 +178,9 @@ pssj_callback(void *p)
|
||||
}
|
||||
|
||||
static void
|
||||
pssj_get_buffer(int32_t *buffer, int len, void *p)
|
||||
pssj_get_buffer(int32_t *buffer, int len, void *priv)
|
||||
{
|
||||
pssj_t *pssj = (pssj_t *) p;
|
||||
pssj_t *pssj = (pssj_t *) priv;
|
||||
|
||||
pssj_update(pssj);
|
||||
|
||||
@@ -178,7 +191,7 @@ pssj_get_buffer(int32_t *buffer, int len, void *p)
|
||||
}
|
||||
|
||||
void *
|
||||
pssj_init(const device_t *info)
|
||||
pssj_init(UNUSED(const device_t *info))
|
||||
{
|
||||
pssj_t *pssj = malloc(sizeof(pssj_t));
|
||||
memset(pssj, 0, sizeof(pssj_t));
|
||||
@@ -193,7 +206,7 @@ pssj_init(const device_t *info)
|
||||
}
|
||||
|
||||
void *
|
||||
pssj_1e0_init(const device_t *info)
|
||||
pssj_1e0_init(UNUSED(const device_t *info))
|
||||
{
|
||||
pssj_t *pssj = malloc(sizeof(pssj_t));
|
||||
memset(pssj, 0, sizeof(pssj_t));
|
||||
@@ -208,7 +221,7 @@ pssj_1e0_init(const device_t *info)
|
||||
}
|
||||
|
||||
void *
|
||||
pssj_isa_init(const device_t *info)
|
||||
pssj_isa_init(UNUSED(const device_t *info))
|
||||
{
|
||||
pssj_t *pssj = malloc(sizeof(pssj_t));
|
||||
memset(pssj, 0, sizeof(pssj_t));
|
||||
@@ -225,9 +238,9 @@ pssj_isa_init(const device_t *info)
|
||||
}
|
||||
|
||||
void
|
||||
pssj_close(void *p)
|
||||
pssj_close(void *priv)
|
||||
{
|
||||
pssj_t *pssj = (pssj_t *) p;
|
||||
pssj_t *pssj = (pssj_t *) priv;
|
||||
|
||||
free(pssj);
|
||||
}
|
||||
|
||||
@@ -20,12 +20,16 @@ psid_t *psid;
|
||||
void *
|
||||
sid_init(void)
|
||||
{
|
||||
// psid_t *psid;
|
||||
#if 0
|
||||
psid_t *psid;
|
||||
#endif
|
||||
sampling_method method = SAMPLE_INTERPOLATE;
|
||||
float cycles_per_sec = 14318180.0 / 16.0;
|
||||
|
||||
psid = new psid_t;
|
||||
// psid = (psid_t *)malloc(sizeof(sound_t));
|
||||
#if 0
|
||||
psid = (psid_t *)malloc(sizeof(sound_t));
|
||||
#endif
|
||||
psid->sid = new SIDFP;
|
||||
|
||||
psid->sid->set_chip_model(MOS8580FP);
|
||||
@@ -42,9 +46,11 @@ sid_init(void)
|
||||
for (uint8_t c = 0; c < 32; c++)
|
||||
psid->sid->write(c, 0);
|
||||
|
||||
if (!psid->sid->set_sampling_parameters((float) cycles_per_sec, method,
|
||||
if (!psid->sid->set_sampling_parameters(cycles_per_sec, method,
|
||||
(float) RESID_FREQ, 0.9 * (float) RESID_FREQ / 2.0)) {
|
||||
// printf("reSID failed!\n");
|
||||
#if 0
|
||||
printf("reSID failed!\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
psid->sid->set_chip_model(MOS6581FP);
|
||||
@@ -58,17 +64,23 @@ sid_init(void)
|
||||
}
|
||||
|
||||
void
|
||||
sid_close(UNUSED(void *p))
|
||||
sid_close(UNUSED(void *priv))
|
||||
{
|
||||
// psid_t *psid = (psid_t *)p;
|
||||
#if 0
|
||||
psid_t *psid = (psid_t *) priv;
|
||||
#endif
|
||||
delete psid->sid;
|
||||
// free(psid);
|
||||
#if 0
|
||||
free(psid);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
sid_reset(UNUSED(void *p))
|
||||
sid_reset(UNUSED(void *priv))
|
||||
{
|
||||
// psid_t *psid = (psid_t *)p;
|
||||
#if 0
|
||||
psid_t *psid = (psid_t *) priv;
|
||||
#endif
|
||||
|
||||
psid->sid->reset();
|
||||
|
||||
@@ -77,18 +89,24 @@ sid_reset(UNUSED(void *p))
|
||||
}
|
||||
|
||||
uint8_t
|
||||
sid_read(uint16_t addr, UNUSED(void *p))
|
||||
sid_read(uint16_t addr, UNUSED(void *priv))
|
||||
{
|
||||
// psid_t *psid = (psid_t *)p;
|
||||
#if 0
|
||||
psid_t *psid = (psid_t *) priv;
|
||||
#endif
|
||||
|
||||
return psid->sid->read(addr & 0x1f);
|
||||
// return 0xFF;
|
||||
#if 0
|
||||
return 0xFF;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
sid_write(uint16_t addr, uint8_t val, UNUSED(void *p))
|
||||
sid_write(uint16_t addr, uint8_t val, UNUSED(void *priv))
|
||||
{
|
||||
// psid_t *psid = (psid_t *)p;
|
||||
#if 0
|
||||
psid_t *psid = (psid_t *) priv;
|
||||
#endif
|
||||
|
||||
psid->sid->write(addr & 0x1f, val);
|
||||
}
|
||||
@@ -105,9 +123,11 @@ fillbuf2(int &count, int16_t *buf, int len)
|
||||
psid->last_sample = *buf;
|
||||
}
|
||||
void
|
||||
sid_fillbuf(int16_t *buf, int len, UNUSED(void *p))
|
||||
sid_fillbuf(int16_t *buf, int len, UNUSED(void *priv))
|
||||
{
|
||||
// psid_t *psid = (psid_t *)p;
|
||||
#if 0
|
||||
psid_t *psid = (psid_t *) priv;
|
||||
#endif
|
||||
int x = CLOCK_DELTA(len);
|
||||
|
||||
fillbuf2(x, buf, len);
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include <86box/sound.h>
|
||||
#include <86box/timer.h>
|
||||
#include <86box/snd_sb.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
/* 0 to 7 -> -14dB to 0dB i 2dB steps. 8 to 15 -> 0 to +14dB in 2dB steps.
|
||||
Note that for positive dB values, this is not amplitude, it is amplitude - 1. */
|
||||
@@ -177,9 +178,9 @@ sb_log(const char *fmt, ...)
|
||||
|
||||
/* SB 1, 1.5, MCV, and 2 do not have a mixer, so signal is hardwired. */
|
||||
static void
|
||||
sb_get_buffer_sb2(int32_t *buffer, int len, void *p)
|
||||
sb_get_buffer_sb2(int32_t *buffer, int len, void *priv)
|
||||
{
|
||||
sb_t *sb = (sb_t *) p;
|
||||
sb_t *sb = (sb_t *) priv;
|
||||
sb_ct1335_mixer_t *mixer = &sb->mixer_sb2;
|
||||
double out_mono = 0.0;
|
||||
double out_l = 0.0;
|
||||
@@ -245,9 +246,9 @@ sb_get_buffer_sb2(int32_t *buffer, int len, void *p)
|
||||
}
|
||||
|
||||
static void
|
||||
sb2_filter_cd_audio(int channel, double *buffer, void *p)
|
||||
sb2_filter_cd_audio(UNUSED(int channel), double *buffer, void *priv)
|
||||
{
|
||||
sb_t *sb = (sb_t *) p;
|
||||
sb_t *sb = (sb_t *) priv;
|
||||
sb_ct1335_mixer_t *mixer = &sb->mixer_sb2;
|
||||
double c;
|
||||
|
||||
@@ -255,15 +256,15 @@ sb2_filter_cd_audio(int channel, double *buffer, void *p)
|
||||
c = ((sb_iir(1, 0, *buffer) / 1.3) * mixer->cd) / 3.0;
|
||||
*buffer = c * mixer->master;
|
||||
} else {
|
||||
c = (((sb_iir(1, 0, ((double) *buffer)) / 1.3) * 65536) / 3.0) / 65536.0;
|
||||
c = (((sb_iir(1, 0, (*buffer)) / 1.3) * 65536) / 3.0) / 65536.0;
|
||||
*buffer = c;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
sb_get_buffer_sbpro(int32_t *buffer, int len, void *p)
|
||||
sb_get_buffer_sbpro(int32_t *buffer, int len, void *priv)
|
||||
{
|
||||
sb_t *sb = (sb_t *) p;
|
||||
sb_t *sb = (sb_t *) priv;
|
||||
sb_ct1345_mixer_t *mixer = &sb->mixer_sbpro;
|
||||
double out_l = 0.0;
|
||||
double out_r = 0.0;
|
||||
@@ -281,7 +282,8 @@ sb_get_buffer_sbpro(int32_t *buffer, int len, void *p)
|
||||
sb_dsp_update(&sb->dsp);
|
||||
|
||||
for (int c = 0; c < len * 2; c += 2) {
|
||||
out_l = 0.0, out_r = 0.0;
|
||||
out_l = 0.0;
|
||||
out_r = 0.0;
|
||||
|
||||
if (sb->opl_enabled) {
|
||||
if (sb->dsp.sb_type == SBPRO) {
|
||||
@@ -327,9 +329,9 @@ sb_get_buffer_sbpro(int32_t *buffer, int len, void *p)
|
||||
}
|
||||
|
||||
void
|
||||
sbpro_filter_cd_audio(int channel, double *buffer, void *p)
|
||||
sbpro_filter_cd_audio(int channel, double *buffer, void *priv)
|
||||
{
|
||||
sb_t *sb = (sb_t *) p;
|
||||
sb_t *sb = (sb_t *) priv;
|
||||
sb_ct1345_mixer_t *mixer = &sb->mixer_sbpro;
|
||||
double c;
|
||||
double cd = channel ? mixer->cd_r : mixer->cd_l;
|
||||
@@ -343,9 +345,9 @@ sbpro_filter_cd_audio(int channel, double *buffer, void *p)
|
||||
}
|
||||
|
||||
static void
|
||||
sb_get_buffer_sb16_awe32(int32_t *buffer, int len, void *p)
|
||||
sb_get_buffer_sb16_awe32(int32_t *buffer, int len, void *priv)
|
||||
{
|
||||
sb_t *sb = (sb_t *) p;
|
||||
sb_t *sb = (sb_t *) priv;
|
||||
sb_ct1745_mixer_t *mixer = &sb->mixer_sb16;
|
||||
int dsp_rec_pos = sb->dsp.record_pos_write;
|
||||
int c_emu8k = 0;
|
||||
@@ -477,9 +479,9 @@ sb_get_buffer_sb16_awe32(int32_t *buffer, int len, void *p)
|
||||
}
|
||||
|
||||
void
|
||||
sb16_awe32_filter_cd_audio(int channel, double *buffer, void *p)
|
||||
sb16_awe32_filter_cd_audio(int channel, double *buffer, void *priv)
|
||||
{
|
||||
sb_t *sb = (sb_t *) p;
|
||||
sb_t *sb = (sb_t *) priv;
|
||||
sb_ct1745_mixer_t *mixer = &sb->mixer_sb16;
|
||||
double c;
|
||||
double cd = channel ? mixer->cd_r : mixer->cd_l /* / 3.0 */;
|
||||
@@ -519,9 +521,9 @@ sb16_awe32_filter_cd_audio(int channel, double *buffer, void *p)
|
||||
}
|
||||
|
||||
void
|
||||
sb_ct1335_mixer_write(uint16_t addr, uint8_t val, void *p)
|
||||
sb_ct1335_mixer_write(uint16_t addr, uint8_t val, void *priv)
|
||||
{
|
||||
sb_t *sb = (sb_t *) p;
|
||||
sb_t *sb = (sb_t *) priv;
|
||||
sb_ct1335_mixer_t *mixer = &sb->mixer_sb2;
|
||||
|
||||
if (!(addr & 1)) {
|
||||
@@ -558,9 +560,9 @@ sb_ct1335_mixer_write(uint16_t addr, uint8_t val, void *p)
|
||||
}
|
||||
|
||||
uint8_t
|
||||
sb_ct1335_mixer_read(uint16_t addr, void *p)
|
||||
sb_ct1335_mixer_read(uint16_t addr, void *priv)
|
||||
{
|
||||
sb_t *sb = (sb_t *) p;
|
||||
sb_t *sb = (sb_t *) priv;
|
||||
sb_ct1335_mixer_t *mixer = &sb->mixer_sb2;
|
||||
|
||||
if (!(addr & 1))
|
||||
@@ -589,9 +591,9 @@ sb_ct1335_mixer_reset(sb_t *sb)
|
||||
}
|
||||
|
||||
void
|
||||
sb_ct1345_mixer_write(uint16_t addr, uint8_t val, void *p)
|
||||
sb_ct1345_mixer_write(uint16_t addr, uint8_t val, void *priv)
|
||||
{
|
||||
sb_t *sb = (sb_t *) p;
|
||||
sb_t *sb = (sb_t *) priv;
|
||||
sb_ct1345_mixer_t *mixer = &sb->mixer_sbpro;
|
||||
|
||||
if (!(addr & 1)) {
|
||||
@@ -685,9 +687,9 @@ sb_ct1345_mixer_write(uint16_t addr, uint8_t val, void *p)
|
||||
}
|
||||
|
||||
uint8_t
|
||||
sb_ct1345_mixer_read(uint16_t addr, void *p)
|
||||
sb_ct1345_mixer_read(uint16_t addr, void *priv)
|
||||
{
|
||||
sb_t *sb = (sb_t *) p;
|
||||
sb_t *sb = (sb_t *) priv;
|
||||
sb_ct1345_mixer_t *mixer = &sb->mixer_sbpro;
|
||||
|
||||
if (!(addr & 1))
|
||||
@@ -727,9 +729,9 @@ sb_ct1345_mixer_reset(sb_t *sb)
|
||||
}
|
||||
|
||||
void
|
||||
sb_ct1745_mixer_write(uint16_t addr, uint8_t val, void *p)
|
||||
sb_ct1745_mixer_write(uint16_t addr, uint8_t val, void *priv)
|
||||
{
|
||||
sb_t *sb = (sb_t *) p;
|
||||
sb_t *sb = (sb_t *) priv;
|
||||
sb_ct1745_mixer_t *mixer = &sb->mixer_sb16;
|
||||
|
||||
if (!(addr & 1))
|
||||
@@ -861,6 +863,9 @@ sb_ct1745_mixer_write(uint16_t addr, uint8_t val, void *p)
|
||||
mpu401_change_addr(sb->mpu, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
mixer->output_selector = mixer->regs[0x3c];
|
||||
@@ -897,9 +902,9 @@ sb_ct1745_mixer_write(uint16_t addr, uint8_t val, void *p)
|
||||
}
|
||||
|
||||
uint8_t
|
||||
sb_ct1745_mixer_read(uint16_t addr, void *p)
|
||||
sb_ct1745_mixer_read(uint16_t addr, void *priv)
|
||||
{
|
||||
sb_t *sb = (sb_t *) p;
|
||||
sb_t *sb = (sb_t *) priv;
|
||||
sb_ct1745_mixer_t *mixer = &sb->mixer_sb16;
|
||||
uint8_t temp;
|
||||
uint8_t ret = 0xff;
|
||||
@@ -974,6 +979,9 @@ sb_ct1745_mixer_read(uint16_t addr, void *p)
|
||||
case 10:
|
||||
ret = 8;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -996,6 +1004,9 @@ sb_ct1745_mixer_read(uint16_t addr, void *p)
|
||||
case 3:
|
||||
ret |= 8;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch (sb->dsp.sb_16_dmanum) {
|
||||
case 5:
|
||||
@@ -1007,6 +1018,9 @@ sb_ct1745_mixer_read(uint16_t addr, void *p)
|
||||
case 7:
|
||||
ret |= 0x80;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1078,9 +1092,9 @@ sb_ct1745_mixer_reset(sb_t *sb)
|
||||
}
|
||||
|
||||
uint8_t
|
||||
sb_mcv_read(int port, void *p)
|
||||
sb_mcv_read(int port, void *priv)
|
||||
{
|
||||
sb_t *sb = (sb_t *) p;
|
||||
sb_t *sb = (sb_t *) priv;
|
||||
|
||||
sb_log("sb_mcv_read: port=%04x\n", port);
|
||||
|
||||
@@ -1088,10 +1102,10 @@ sb_mcv_read(int port, void *p)
|
||||
}
|
||||
|
||||
void
|
||||
sb_mcv_write(int port, uint8_t val, void *p)
|
||||
sb_mcv_write(int port, uint8_t val, void *priv)
|
||||
{
|
||||
uint16_t addr;
|
||||
sb_t *sb = (sb_t *) p;
|
||||
sb_t *sb = (sb_t *) priv;
|
||||
|
||||
if (port < 0x102)
|
||||
return;
|
||||
@@ -1133,17 +1147,17 @@ sb_mcv_write(int port, uint8_t val, void *p)
|
||||
}
|
||||
|
||||
uint8_t
|
||||
sb_mcv_feedb(void *p)
|
||||
sb_mcv_feedb(void *priv)
|
||||
{
|
||||
sb_t *sb = (sb_t *) p;
|
||||
sb_t *sb = (sb_t *) priv;
|
||||
|
||||
return (sb->pos_regs[2] & 1);
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
sb_pro_mcv_read(int port, void *p)
|
||||
sb_pro_mcv_read(int port, void *priv)
|
||||
{
|
||||
sb_t *sb = (sb_t *) p;
|
||||
sb_t *sb = (sb_t *) priv;
|
||||
uint8_t ret = sb->pos_regs[port & 7];
|
||||
|
||||
sb_log("sb_pro_mcv_read: port=%04x ret=%02x\n", port, ret);
|
||||
@@ -1152,10 +1166,10 @@ sb_pro_mcv_read(int port, void *p)
|
||||
}
|
||||
|
||||
static void
|
||||
sb_pro_mcv_write(int port, uint8_t val, void *p)
|
||||
sb_pro_mcv_write(int port, uint8_t val, void *priv)
|
||||
{
|
||||
uint16_t addr;
|
||||
sb_t *sb = (sb_t *) p;
|
||||
sb_t *sb = (sb_t *) priv;
|
||||
|
||||
if (port < 0x102)
|
||||
return;
|
||||
@@ -1212,9 +1226,9 @@ sb_pro_mcv_write(int port, uint8_t val, void *p)
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
sb_16_reply_mca_read(int port, void *p)
|
||||
sb_16_reply_mca_read(int port, void *priv)
|
||||
{
|
||||
sb_t *sb = (sb_t *) p;
|
||||
sb_t *sb = (sb_t *) priv;
|
||||
uint8_t ret = sb->pos_regs[port & 7];
|
||||
|
||||
sb_log("sb_16_reply_mca_read: port=%04x ret=%02x\n", port, ret);
|
||||
@@ -1223,13 +1237,13 @@ sb_16_reply_mca_read(int port, void *p)
|
||||
}
|
||||
|
||||
static void
|
||||
sb_16_reply_mca_write(int port, uint8_t val, void *p)
|
||||
sb_16_reply_mca_write(int port, uint8_t val, void *priv)
|
||||
{
|
||||
uint16_t addr;
|
||||
uint16_t mpu401_addr;
|
||||
int low_dma;
|
||||
int high_dma;
|
||||
sb_t *sb = (sb_t *) p;
|
||||
sb_t *sb = (sb_t *) priv;
|
||||
|
||||
if (port < 0x102)
|
||||
return;
|
||||
@@ -1347,6 +1361,9 @@ sb_16_reply_mca_write(int port, uint8_t val, void *p)
|
||||
case 0x60:
|
||||
sb_dsp_setirq(&sb->dsp, 10);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
low_dma = sb->pos_regs[3] & 3;
|
||||
@@ -1458,6 +1475,9 @@ sb_16_pnp_config_changed(uint8_t ld, isapnp_device_config_t *config, void *priv)
|
||||
|
||||
case 4: /* StereoEnhance (32) */
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1476,6 +1496,9 @@ sb_awe32_pnp_config_changed(uint8_t ld, isapnp_device_config_t *config, void *pr
|
||||
case 3: /* WaveTable */
|
||||
sb_16_pnp_config_changed(ld ^ 1, config, sb);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1493,11 +1516,14 @@ sb_awe64_gold_pnp_config_changed(uint8_t ld, isapnp_device_config_t *config, voi
|
||||
case 1: /* Game */
|
||||
sb_16_pnp_config_changed(3, config, sb);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void *
|
||||
sb_1_init(const device_t *info)
|
||||
sb_1_init(UNUSED(const device_t *info))
|
||||
{
|
||||
/* SB1/2 port mappings, 210h to 260h in 10h steps
|
||||
2x0 to 2x3 -> CMS chip
|
||||
@@ -1545,7 +1571,7 @@ sb_1_init(const device_t *info)
|
||||
}
|
||||
|
||||
void *
|
||||
sb_15_init(const device_t *info)
|
||||
sb_15_init(UNUSED(const device_t *info))
|
||||
{
|
||||
/* SB1/2 port mappings, 210h to 260h in 10h steps
|
||||
2x0 to 2x3 -> CMS chip
|
||||
@@ -1595,7 +1621,7 @@ sb_15_init(const device_t *info)
|
||||
}
|
||||
|
||||
void *
|
||||
sb_mcv_init(const device_t *info)
|
||||
sb_mcv_init(UNUSED(const device_t *info))
|
||||
{
|
||||
/* SB1/2 port mappings, 210h to 260h in 10h steps
|
||||
2x6, 2xA, 2xC, 2xE -> DSP chip
|
||||
@@ -1628,7 +1654,7 @@ sb_mcv_init(const device_t *info)
|
||||
}
|
||||
|
||||
void *
|
||||
sb_2_init(const device_t *info)
|
||||
sb_2_init(UNUSED(const device_t *info))
|
||||
{
|
||||
/* SB2 port mappings, 220h or 240h.
|
||||
2x0 to 2x3 -> CMS chip
|
||||
@@ -1724,7 +1750,7 @@ sb_pro_v1_opl_write(uint16_t port, uint8_t val, void *priv)
|
||||
}
|
||||
|
||||
static void *
|
||||
sb_pro_v1_init(const device_t *info)
|
||||
sb_pro_v1_init(UNUSED(const device_t *info))
|
||||
{
|
||||
/* SB Pro port mappings, 220h or 240h.
|
||||
2x0 to 2x3 -> FM chip, Left and Right (9*2 voices)
|
||||
@@ -1784,7 +1810,7 @@ sb_pro_v1_init(const device_t *info)
|
||||
}
|
||||
|
||||
static void *
|
||||
sb_pro_v2_init(const device_t *info)
|
||||
sb_pro_v2_init(UNUSED(const device_t *info))
|
||||
{
|
||||
/* SB Pro 2 port mappings, 220h or 240h.
|
||||
2x0 to 2x3 -> FM chip (18 voices)
|
||||
@@ -1836,7 +1862,7 @@ sb_pro_v2_init(const device_t *info)
|
||||
}
|
||||
|
||||
static void *
|
||||
sb_pro_mcv_init(const device_t *info)
|
||||
sb_pro_mcv_init(UNUSED(const device_t *info))
|
||||
{
|
||||
/* SB Pro MCV port mappings, 220h or 240h.
|
||||
2x0 to 2x3 -> FM chip, Left and Right (18 voices)
|
||||
@@ -1868,7 +1894,7 @@ sb_pro_mcv_init(const device_t *info)
|
||||
}
|
||||
|
||||
static void *
|
||||
sb_pro_compat_init(const device_t *info)
|
||||
sb_pro_compat_init(UNUSED(const device_t *info))
|
||||
{
|
||||
sb_t *sb = malloc(sizeof(sb_t));
|
||||
memset(sb, 0, sizeof(sb_t));
|
||||
@@ -1890,7 +1916,7 @@ sb_pro_compat_init(const device_t *info)
|
||||
}
|
||||
|
||||
static void *
|
||||
sb_16_init(const device_t *info)
|
||||
sb_16_init(UNUSED(const device_t *info))
|
||||
{
|
||||
sb_t *sb = malloc(sizeof(sb_t));
|
||||
uint16_t addr = device_get_config_hex16("base");
|
||||
@@ -1946,7 +1972,7 @@ sb_16_init(const device_t *info)
|
||||
}
|
||||
|
||||
static void *
|
||||
sb_16_reply_mca_init(const device_t *info)
|
||||
sb_16_reply_mca_init(UNUSED(const device_t *info))
|
||||
{
|
||||
sb_t *sb = malloc(sizeof(sb_t));
|
||||
memset(sb, 0x00, sizeof(sb_t));
|
||||
@@ -1981,7 +2007,7 @@ sb_16_reply_mca_init(const device_t *info)
|
||||
}
|
||||
|
||||
static void *
|
||||
sb_16_pnp_init(const device_t *info)
|
||||
sb_16_pnp_init(UNUSED(const device_t *info))
|
||||
{
|
||||
sb_t *sb = malloc(sizeof(sb_t));
|
||||
memset(sb, 0x00, sizeof(sb_t));
|
||||
@@ -2083,7 +2109,7 @@ sb_awe64_gold_available(void)
|
||||
}
|
||||
|
||||
static void *
|
||||
sb_awe32_init(const device_t *info)
|
||||
sb_awe32_init(UNUSED(const device_t *info))
|
||||
{
|
||||
sb_t *sb = malloc(sizeof(sb_t));
|
||||
uint16_t addr = device_get_config_hex16("base");
|
||||
@@ -2194,6 +2220,9 @@ sb_awe32_pnp_init(const device_t *info)
|
||||
case 4:
|
||||
pnp_rom_file = "roms/sound/CT4540 PnP.BIN";
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
uint8_t *pnp_rom = NULL;
|
||||
@@ -2220,6 +2249,9 @@ sb_awe32_pnp_init(const device_t *info)
|
||||
case 4:
|
||||
isapnp_add_card(pnp_rom, sizeof(sb->pnp_rom), sb_awe64_gold_pnp_config_changed, NULL, NULL, NULL, sb);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
sb_dsp_setaddr(&sb->dsp, 0);
|
||||
@@ -2238,18 +2270,18 @@ sb_awe32_pnp_init(const device_t *info)
|
||||
}
|
||||
|
||||
void
|
||||
sb_close(void *p)
|
||||
sb_close(void *priv)
|
||||
{
|
||||
sb_t *sb = (sb_t *) p;
|
||||
sb_t *sb = (sb_t *) priv;
|
||||
sb_dsp_close(&sb->dsp);
|
||||
|
||||
free(sb);
|
||||
}
|
||||
|
||||
static void
|
||||
sb_awe32_close(void *p)
|
||||
sb_awe32_close(void *priv)
|
||||
{
|
||||
sb_t *sb = (sb_t *) p;
|
||||
sb_t *sb = (sb_t *) priv;
|
||||
|
||||
emu8k_close(&sb->emu8k);
|
||||
|
||||
@@ -2257,9 +2289,9 @@ sb_awe32_close(void *p)
|
||||
}
|
||||
|
||||
void
|
||||
sb_speed_changed(void *p)
|
||||
sb_speed_changed(void *priv)
|
||||
{
|
||||
sb_t *sb = (sb_t *) p;
|
||||
sb_t *sb = (sb_t *) priv;
|
||||
|
||||
sb_dsp_speed_changed(&sb->dsp);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <86box/sound.h>
|
||||
#include <86box/timer.h>
|
||||
#include <86box/snd_sb.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
#define ADPCM_4 1
|
||||
#define ADPCM_26 2
|
||||
@@ -33,8 +34,8 @@
|
||||
/*The recording safety margin is intended for uneven "len" calls to the get_buffer mixer calls on sound_sb*/
|
||||
#define SB_DSP_REC_SAFEFTY_MARGIN 4096
|
||||
|
||||
void pollsb(void *p);
|
||||
void sb_poll_i(void *p);
|
||||
void pollsb(void *priv);
|
||||
void sb_poll_i(void *priv);
|
||||
|
||||
static int sbe2dat[4][9] = {
|
||||
{0x01, -0x02, -0x04, 0x08, -0x10, 0x20, 0x40, -0x80, -106},
|
||||
@@ -205,8 +206,8 @@ sb_update_status(sb_dsp_t *dsp, int bit, int set)
|
||||
int masked = 0;
|
||||
|
||||
switch (bit) {
|
||||
case 0:
|
||||
default:
|
||||
case 0:
|
||||
dsp->sb_irq8 = set;
|
||||
masked = dsp->sb_irqm8;
|
||||
break;
|
||||
@@ -595,7 +596,7 @@ sb_exec_command(sb_dsp_t *dsp)
|
||||
case 0x75: /* 4-bit ADPCM output with reference */
|
||||
dsp->sbref = dsp->dma_readb(dsp->dma_priv);
|
||||
dsp->sbstep = 0;
|
||||
/* Fall through */
|
||||
[[fallthrough]];
|
||||
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 = dsp->dma_readb(dsp->dma_priv);
|
||||
@@ -917,6 +918,9 @@ sb_exec_command(sb_dsp_t *dsp)
|
||||
* 0FCh DSP Auxiliary Status SB16
|
||||
* 0FDh DSP Command Status SB16
|
||||
*/
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* Update 8051 ram with the last DSP command.
|
||||
@@ -1046,6 +1050,9 @@ sb_read(uint16_t a, void *priv)
|
||||
sb_dsp_log("SB 16-bit ACK read 0xFF\n");
|
||||
ret = 0xff;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -1192,9 +1199,9 @@ sb_dsp_dma_attach(sb_dsp_t *dsp,
|
||||
}
|
||||
|
||||
void
|
||||
pollsb(void *p)
|
||||
pollsb(void *priv)
|
||||
{
|
||||
sb_dsp_t *dsp = (sb_dsp_t *) p;
|
||||
sb_dsp_t *dsp = (sb_dsp_t *) priv;
|
||||
int tempi;
|
||||
int ref;
|
||||
int data[2];
|
||||
@@ -1378,6 +1385,9 @@ pollsb(void *p)
|
||||
} else
|
||||
dsp->sbdatl = dsp->sbdatr = dsp->sbdat;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (dsp->sb_8_length < 0) {
|
||||
@@ -1426,6 +1436,9 @@ pollsb(void *p)
|
||||
dsp->sbdatr = data[1];
|
||||
dsp->sb_16_length -= 2;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (dsp->sb_16_length < 0) {
|
||||
@@ -1451,9 +1464,9 @@ pollsb(void *p)
|
||||
}
|
||||
|
||||
void
|
||||
sb_poll_i(void *p)
|
||||
sb_poll_i(void *priv)
|
||||
{
|
||||
sb_dsp_t *dsp = (sb_dsp_t *) p;
|
||||
sb_dsp_t *dsp = (sb_dsp_t *) priv;
|
||||
int processed = 0;
|
||||
|
||||
timer_advance_u64(&dsp->input_timer, dsp->sblatchi);
|
||||
@@ -1486,6 +1499,9 @@ sb_poll_i(void *p)
|
||||
dsp->record_pos_read += 2;
|
||||
dsp->record_pos_read &= 0xFFFF;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (dsp->sb_8_length < 0) {
|
||||
@@ -1531,6 +1547,9 @@ sb_poll_i(void *p)
|
||||
dsp->record_pos_read += 2;
|
||||
dsp->record_pos_read &= 0xFFFF;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (dsp->sb_16_length < 0) {
|
||||
@@ -1565,6 +1584,7 @@ sb_dsp_update(sb_dsp_t *dsp)
|
||||
}
|
||||
|
||||
void
|
||||
sb_dsp_close(sb_dsp_t *dsp)
|
||||
sb_dsp_close(UNUSED(sb_dsp_t *dsp))
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <86box/io.h>
|
||||
#include <86box/sound.h>
|
||||
#include <86box/snd_sn76489.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
int sn76489_mute;
|
||||
|
||||
@@ -33,7 +34,7 @@ sn76489_update(sn76489_t *sn76489)
|
||||
result += (int16_t) (volslog[sn76489->vol[c]] * 127);
|
||||
|
||||
sn76489->count[c] -= (256 * sn76489->psgconst);
|
||||
while ((int) sn76489->count[c] < 0) {
|
||||
while (sn76489->count[c] < 0) {
|
||||
sn76489->count[c] += sn76489->latch[c];
|
||||
sn76489->stat[c] = -sn76489->stat[c];
|
||||
}
|
||||
@@ -41,7 +42,7 @@ sn76489_update(sn76489_t *sn76489)
|
||||
result += (((sn76489->shift & 1) ^ 1) * 127 * volslog[sn76489->vol[0]] * 2);
|
||||
|
||||
sn76489->count[0] -= (512 * sn76489->psgconst);
|
||||
while ((int) sn76489->count[0] < 0 && sn76489->latch[0]) {
|
||||
while (sn76489->count[0] < 0 && sn76489->latch[0]) {
|
||||
sn76489->count[0] += (sn76489->latch[0] * 4);
|
||||
if (!(sn76489->noise & 4)) {
|
||||
if (sn76489->shift & 1)
|
||||
@@ -59,9 +60,9 @@ sn76489_update(sn76489_t *sn76489)
|
||||
}
|
||||
|
||||
void
|
||||
sn76489_get_buffer(int32_t *buffer, int len, void *p)
|
||||
sn76489_get_buffer(int32_t *buffer, int len, void *priv)
|
||||
{
|
||||
sn76489_t *sn76489 = (sn76489_t *) p;
|
||||
sn76489_t *sn76489 = (sn76489_t *) priv;
|
||||
|
||||
sn76489_update(sn76489);
|
||||
|
||||
@@ -74,9 +75,9 @@ sn76489_get_buffer(int32_t *buffer, int len, void *p)
|
||||
}
|
||||
|
||||
void
|
||||
sn76489_write(uint16_t addr, uint8_t data, void *p)
|
||||
sn76489_write(UNUSED(uint16_t addr), uint8_t data, void *priv)
|
||||
{
|
||||
sn76489_t *sn76489 = (sn76489_t *) p;
|
||||
sn76489_t *sn76489 = (sn76489_t *) priv;
|
||||
int freq;
|
||||
|
||||
sn76489_update(sn76489);
|
||||
@@ -140,6 +141,9 @@ sn76489_write(uint16_t addr, uint8_t data, void *p)
|
||||
data &= 0xf;
|
||||
sn76489->vol[0] = 0xf - data;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if ((sn76489->firstdat & 0x70) == 0x60 && (sn76489->type == SN76496)) {
|
||||
@@ -197,7 +201,7 @@ sn76489_init(sn76489_t *sn76489, uint16_t base, uint16_t size, int type, int fre
|
||||
}
|
||||
|
||||
void *
|
||||
sn76489_device_init(const device_t *info)
|
||||
sn76489_device_init(UNUSED(const device_t *info))
|
||||
{
|
||||
sn76489_t *sn76489 = malloc(sizeof(sn76489_t));
|
||||
memset(sn76489, 0, sizeof(sn76489_t));
|
||||
@@ -208,7 +212,7 @@ sn76489_device_init(const device_t *info)
|
||||
}
|
||||
|
||||
void *
|
||||
ncr8496_device_init(const device_t *info)
|
||||
ncr8496_device_init(UNUSED(const device_t *info))
|
||||
{
|
||||
sn76489_t *sn76489 = malloc(sizeof(sn76489_t));
|
||||
memset(sn76489, 0, sizeof(sn76489_t));
|
||||
@@ -219,7 +223,7 @@ ncr8496_device_init(const device_t *info)
|
||||
}
|
||||
|
||||
void *
|
||||
tndy_device_init(const device_t *info)
|
||||
tndy_device_init(UNUSED(const device_t *info))
|
||||
{
|
||||
sn76489_t *sn76489 = malloc(sizeof(sn76489_t));
|
||||
memset(sn76489, 0, sizeof(sn76489_t));
|
||||
@@ -232,9 +236,9 @@ tndy_device_init(const device_t *info)
|
||||
}
|
||||
|
||||
void
|
||||
sn76489_device_close(void *p)
|
||||
sn76489_device_close(void *priv)
|
||||
{
|
||||
sn76489_t *sn76489 = (sn76489_t *) p;
|
||||
sn76489_t *sn76489 = (sn76489_t *) priv;
|
||||
|
||||
free(sn76489);
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <86box/pit.h>
|
||||
#include <86box/snd_speaker.h>
|
||||
#include <86box/sound.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
int speaker_mute = 0;
|
||||
int speaker_gated = 0;
|
||||
@@ -85,7 +86,7 @@ speaker_update(void)
|
||||
}
|
||||
|
||||
void
|
||||
speaker_get_buffer(int32_t *buffer, int len, void *p)
|
||||
speaker_get_buffer(int32_t *buffer, int len, UNUSED(void *priv))
|
||||
{
|
||||
int32_t val;
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <86box/io.h>
|
||||
#include <86box/snd_resid.h>
|
||||
#include <86box/sound.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
typedef struct ssi2001_t {
|
||||
void *psid;
|
||||
@@ -31,9 +32,9 @@ ssi2001_update(ssi2001_t *ssi2001)
|
||||
}
|
||||
|
||||
static void
|
||||
ssi2001_get_buffer(int32_t *buffer, int len, void *p)
|
||||
ssi2001_get_buffer(int32_t *buffer, int len, void *priv)
|
||||
{
|
||||
ssi2001_t *ssi2001 = (ssi2001_t *) p;
|
||||
ssi2001_t *ssi2001 = (ssi2001_t *) priv;
|
||||
|
||||
ssi2001_update(ssi2001);
|
||||
|
||||
@@ -44,26 +45,26 @@ ssi2001_get_buffer(int32_t *buffer, int len, void *p)
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
ssi2001_read(uint16_t addr, void *p)
|
||||
ssi2001_read(uint16_t addr, void *priv)
|
||||
{
|
||||
ssi2001_t *ssi2001 = (ssi2001_t *) p;
|
||||
ssi2001_t *ssi2001 = (ssi2001_t *) priv;
|
||||
|
||||
ssi2001_update(ssi2001);
|
||||
|
||||
return sid_read(addr, p);
|
||||
return sid_read(addr, priv);
|
||||
}
|
||||
|
||||
static void
|
||||
ssi2001_write(uint16_t addr, uint8_t val, void *p)
|
||||
ssi2001_write(uint16_t addr, uint8_t val, void *priv)
|
||||
{
|
||||
ssi2001_t *ssi2001 = (ssi2001_t *) p;
|
||||
ssi2001_t *ssi2001 = (ssi2001_t *) priv;
|
||||
|
||||
ssi2001_update(ssi2001);
|
||||
sid_write(addr, val, p);
|
||||
sid_write(addr, val, priv);
|
||||
}
|
||||
|
||||
void *
|
||||
ssi2001_init(const device_t *info)
|
||||
ssi2001_init(UNUSED(const device_t *info))
|
||||
{
|
||||
ssi2001_t *ssi2001 = malloc(sizeof(ssi2001_t));
|
||||
memset(ssi2001, 0, sizeof(ssi2001_t));
|
||||
@@ -80,9 +81,9 @@ ssi2001_init(const device_t *info)
|
||||
}
|
||||
|
||||
void
|
||||
ssi2001_close(void *p)
|
||||
ssi2001_close(void *priv)
|
||||
{
|
||||
ssi2001_t *ssi2001 = (ssi2001_t *) p;
|
||||
ssi2001_t *ssi2001 = (ssi2001_t *) priv;
|
||||
|
||||
sid_close(ssi2001->psid);
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <86box/timer.h>
|
||||
#include <86box/snd_ad1848.h>
|
||||
#include <86box/snd_opl.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
/* 530, 11, 3 - 530=23
|
||||
* 530, 11, 1 - 530=22
|
||||
@@ -59,14 +60,14 @@ typedef struct wss_t {
|
||||
} wss_t;
|
||||
|
||||
uint8_t
|
||||
wss_read(uint16_t addr, void *priv)
|
||||
wss_read(UNUSED(uint16_t addr), void *priv)
|
||||
{
|
||||
wss_t *wss = (wss_t *) priv;
|
||||
return 4 | (wss->config & 0x40);
|
||||
}
|
||||
|
||||
void
|
||||
wss_write(uint16_t addr, uint8_t val, void *priv)
|
||||
wss_write(UNUSED(uint16_t addr), uint8_t val, void *priv)
|
||||
{
|
||||
wss_t *wss = (wss_t *) priv;
|
||||
|
||||
@@ -97,7 +98,7 @@ wss_get_buffer(int32_t *buffer, int len, void *priv)
|
||||
}
|
||||
|
||||
void *
|
||||
wss_init(const device_t *info)
|
||||
wss_init(UNUSED(const device_t *info))
|
||||
{
|
||||
wss_t *wss = malloc(sizeof(wss_t));
|
||||
memset(wss, 0, sizeof(wss_t));
|
||||
@@ -196,7 +197,7 @@ ncr_audio_mca_feedb(void *priv)
|
||||
}
|
||||
|
||||
void *
|
||||
ncr_audio_init(const device_t *info)
|
||||
ncr_audio_init(UNUSED(const device_t *info))
|
||||
{
|
||||
wss_t *wss = malloc(sizeof(wss_t));
|
||||
memset(wss, 0, sizeof(wss_t));
|
||||
|
||||
@@ -5,12 +5,13 @@
|
||||
|
||||
#include <86box/86box.h>
|
||||
#include <86box/snd_ym7128.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
static int attenuation[32];
|
||||
static int tap_position[32];
|
||||
|
||||
void
|
||||
ym7128_init(ym7128_t *ym7128)
|
||||
ym7128_init(UNUSED(ym7128_t *ym7128))
|
||||
{
|
||||
int c;
|
||||
double out = 65536.0;
|
||||
@@ -97,6 +98,9 @@ ym7128_write(ym7128_t *ym7128, uint8_t val)
|
||||
case 0x1e:
|
||||
ym7128->t[ym7128->reg_sel - 0x16] = tap_position[ym7128->dat & 0x1f];
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
ym7128->regs[ym7128->reg_sel] = ym7128->dat;
|
||||
}
|
||||
@@ -137,8 +141,8 @@ ym7128_apply(ym7128_t *ym7128, int16_t *buffer, int len)
|
||||
samp_l = (samp_l * ym7128->vl * 2) >> 16;
|
||||
samp_r = (samp_r * ym7128->vr * 2) >> 16;
|
||||
|
||||
buffer[c] += ((int32_t) samp_l + (int32_t) ym7128->prev_l) / 2;
|
||||
buffer[c + 1] += ((int32_t) samp_r + (int32_t) ym7128->prev_r) / 2;
|
||||
buffer[c] += (samp_l + (int32_t) ym7128->prev_l) / 2;
|
||||
buffer[c + 1] += (samp_r + (int32_t) ym7128->prev_r) / 2;
|
||||
buffer[c + 2] += samp_l;
|
||||
buffer[c + 3] += samp_r;
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ typedef struct {
|
||||
} SOUND_CARD;
|
||||
|
||||
typedef struct {
|
||||
void (*get_buffer)(int32_t *buffer, int len, void *p);
|
||||
void (*get_buffer)(int32_t *buffer, int len, void *priv);
|
||||
void *priv;
|
||||
} sound_handler_t;
|
||||
|
||||
@@ -76,7 +76,7 @@ static int cd_buf_update = CD_BUFLEN / SOUNDBUFLEN;
|
||||
static volatile int cdaudioon = 0;
|
||||
static int cd_thread_enable = 0;
|
||||
|
||||
static void (*filter_cd_audio)(int channel, double *buffer, void *p) = NULL;
|
||||
static void (*filter_cd_audio)(int channel, double *buffer, void *priv) = NULL;
|
||||
static void *filter_cd_audio_p = NULL;
|
||||
|
||||
static const device_t sound_none_device = {
|
||||
@@ -208,7 +208,7 @@ sound_card_get_from_internal_name(const char *s)
|
||||
int c = 0;
|
||||
|
||||
while (sound_cards[c].device != NULL) {
|
||||
if (!strcmp((char *) sound_cards[c].device->internal_name, s))
|
||||
if (!strcmp(sound_cards[c].device->internal_name, s))
|
||||
return c;
|
||||
c++;
|
||||
}
|
||||
@@ -246,7 +246,7 @@ sound_cd_clean_buffers(void)
|
||||
}
|
||||
|
||||
static void
|
||||
sound_cd_thread(void *param)
|
||||
sound_cd_thread(UNUSED(void *param))
|
||||
{
|
||||
uint32_t lba;
|
||||
int r;
|
||||
@@ -425,24 +425,24 @@ sound_init(void)
|
||||
}
|
||||
|
||||
void
|
||||
sound_add_handler(void (*get_buffer)(int32_t *buffer, int len, void *p), void *p)
|
||||
sound_add_handler(void (*get_buffer)(int32_t *buffer, int len, void *priv), void *priv)
|
||||
{
|
||||
sound_handlers[sound_handlers_num].get_buffer = get_buffer;
|
||||
sound_handlers[sound_handlers_num].priv = p;
|
||||
sound_handlers[sound_handlers_num].priv = priv;
|
||||
sound_handlers_num++;
|
||||
}
|
||||
|
||||
void
|
||||
sound_set_cd_audio_filter(void (*filter)(int channel, double *buffer, void *p), void *p)
|
||||
sound_set_cd_audio_filter(void (*filter)(int channel, double *buffer, void *priv), void *priv)
|
||||
{
|
||||
if ((filter_cd_audio == NULL) || (filter == NULL)) {
|
||||
filter_cd_audio = filter;
|
||||
filter_cd_audio_p = p;
|
||||
filter_cd_audio_p = priv;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
sound_poll(void *priv)
|
||||
sound_poll(UNUSED(void *priv))
|
||||
{
|
||||
timer_advance_u64(&sound_poll_timer, sound_poll_latch);
|
||||
|
||||
@@ -459,7 +459,7 @@ sound_poll(void *priv)
|
||||
|
||||
for (c = 0; c < SOUNDBUFLEN * 2; c++) {
|
||||
if (sound_is_float)
|
||||
outbuffer_ex[c] = ((float) outbuffer[c]) / 32768.0;
|
||||
outbuffer_ex[c] = ((float) outbuffer[c]) / (float) 32768.0;
|
||||
else {
|
||||
if (outbuffer[c] > 32767)
|
||||
outbuffer[c] = 32767;
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <86box/midi.h>
|
||||
#include <86box/plat_dynld.h>
|
||||
#include <86box/sound.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
#if defined(_WIN32) && !defined(USE_FAUDIO)
|
||||
static void *xaudio2_handle = NULL;
|
||||
@@ -57,32 +58,38 @@ static IXAudio2SourceVoice *srcvoicecd = NULL;
|
||||
#define BUFLEN SOUNDBUFLEN
|
||||
|
||||
static void WINAPI
|
||||
OnVoiceProcessingPassStart(IXAudio2VoiceCallback *callback, uint32_t bytesRequired)
|
||||
OnVoiceProcessingPassStart(UNUSED(IXAudio2VoiceCallback *callback), UNUSED(uint32_t bytesRequired))
|
||||
{
|
||||
//
|
||||
}
|
||||
static void WINAPI
|
||||
OnVoiceProcessingPassEnd(IXAudio2VoiceCallback *callback)
|
||||
OnVoiceProcessingPassEnd(UNUSED(IXAudio2VoiceCallback *callback))
|
||||
{
|
||||
//
|
||||
}
|
||||
static void WINAPI
|
||||
OnStreamEnd(IXAudio2VoiceCallback *callback)
|
||||
OnStreamEnd(UNUSED(IXAudio2VoiceCallback *callback))
|
||||
{
|
||||
//
|
||||
}
|
||||
static void WINAPI
|
||||
OnBufferStart(IXAudio2VoiceCallback *callback, void *pBufferContext)
|
||||
OnBufferStart(UNUSED(IXAudio2VoiceCallback *callback), UNUSED(void *pBufferContext))
|
||||
{
|
||||
//
|
||||
}
|
||||
static void WINAPI
|
||||
OnLoopEnd(IXAudio2VoiceCallback *callback, void *pBufferContext)
|
||||
OnLoopEnd(UNUSED(IXAudio2VoiceCallback *callback), UNUSED(void *pBufferContext))
|
||||
{
|
||||
//
|
||||
}
|
||||
static void WINAPI
|
||||
OnVoiceError(IXAudio2VoiceCallback *callback, void *pBufferContext, HRESULT error)
|
||||
OnVoiceError(UNUSED(IXAudio2VoiceCallback *callback), UNUSED(void *pBufferContext), UNUSED(HRESULT error))
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
static void WINAPI
|
||||
OnBufferEnd(IXAudio2VoiceCallback *callback, void *pBufferContext)
|
||||
OnBufferEnd(UNUSED(IXAudio2VoiceCallback *callback), UNUSED(void *pBufferContext))
|
||||
{
|
||||
free(pBufferContext);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user