Implement ESS identification mixer register

This commit is contained in:
Cacodemon345
2024-03-04 02:00:07 +06:00
committed by Kagamiin~
parent 68f6779b2f
commit dfa0ec6be8
2 changed files with 22 additions and 2 deletions

View File

@@ -76,6 +76,9 @@ typedef struct ess_mixer_t {
uint8_t index;
uint8_t regs[256];
uint8_t ess_id_str[4];
uint8_t ess_id_str_pos : 2;
} ess_mixer_t;
typedef struct ess_t {
@@ -128,6 +131,8 @@ ess_mixer_write(uint16_t addr, uint8_t val, void *priv)
if (!(addr & 1)) {
mixer->index = val;
mixer->regs[0x01] = val;
if (val == 0x40)
mixer->ess_id_str_pos = 0;
} else {
if (mixer->index == 0) {
/* Reset */
@@ -218,8 +223,8 @@ ess_mixer_write(uint16_t addr, uint8_t val, void *priv)
uint8_t
ess_mixer_read(uint16_t addr, void *priv)
{
const ess_t *ess = (ess_t *) priv;
const ess_mixer_t *mixer = &ess->mixer_sbpro;
ess_t *ess = (ess_t *) priv;
ess_mixer_t *mixer = &ess->mixer_sbpro;
if (!(addr & 1))
return mixer->index;
@@ -242,6 +247,11 @@ ess_mixer_read(uint16_t addr, void *priv)
case 0x38:
return mixer->regs[mixer->index];
case 0x40:
{
return mixer->ess_id_str[mixer->ess_id_str_pos++];
}
default:
//sb_log("ess: Unknown register READ: %02X\t%02X\n", mixer->index, mixer->regs[mixer->index]);
break;
@@ -391,6 +401,13 @@ ess_1688_init(UNUSED(const device_t *info))
if (device_get_config_int("receive_input"))
midi_in_handler(1, sb_dsp_input_msg, sb_dsp_input_sysex, &ess->dsp);
{
ess->mixer_sbpro.ess_id_str[0] = 0x16;
ess->mixer_sbpro.ess_id_str[1] = 0x88;
ess->mixer_sbpro.ess_id_str[2] = (addr >> 8) & 0xff;
ess->mixer_sbpro.ess_id_str[3] = addr & 0xff;
}
return ess;
}

View File

@@ -900,6 +900,9 @@ sb_exec_command(sb_dsp_t *dsp)
case 0x10: /* 8-bit direct mode */
sb_dsp_update(dsp);
dsp->sbdat = dsp->sbdatl = dsp->sbdatr = (dsp->sb_data[0] ^ 0x80) << 8;
// FIXME: What does the ESS AudioDrive do to its filter/sample rate divider registers when emulating this Sound Blaster command?
ESSreg(0xA1) = 128 - (397700 / 22050);
ESSreg(0xA2) = 256 - (7160000 / (82 * ((4 * 22050) / 10)));
break;
case 0x14: /* 8-bit single cycle DMA output */
sb_start_dma(dsp, 1, 0, 0, dsp->sb_data[0] + (dsp->sb_data[1] << 8));