ESS register read function

This commit is contained in:
Cacodemon345
2024-03-02 17:48:21 +06:00
committed by Kagamiin~
parent 3f7fbc7467
commit eda528d98c

View File

@@ -587,7 +587,8 @@ sb_dsp_setdma16_translate(sb_dsp_t *dsp, int translate)
/* TODO: Investigate ESS cards' filtering on real hardware as well.
(DOSBox-X did it purely off some laptop's ESS chip, which isn't a good look.) */
static void sb_ess_update_filter_freq(sb_dsp_t *dsp) {
static void sb_ess_update_filter_freq(sb_dsp_t *dsp)
{
if (dsp->sb_freq >= 22050)
ESSreg(0xA1) = 256 - (795500UL / dsp->sb_freq);
else
@@ -597,6 +598,27 @@ static void sb_ess_update_filter_freq(sb_dsp_t *dsp) {
ESSreg(0xA2) = 256 - (7160000 / (freq * 82));
}
static unsigned int sb_ess_get_dma_len(sb_dsp_t *dsp)
{
unsigned int r;
r = (unsigned int)ESSreg(0xA5) << 8U;
r |= (unsigned int)ESSreg(0xA4);
/* the 16-bit counter is a "two's complement" of the DMA count because it counts UP to 0 and triggers IRQ on overflow */
return 0x10000U-r;
}
static uint8_t sb_ess_read_reg(sb_dsp_t *dsp, uint8_t reg)
{
switch (reg) {
default:
return ESSreg(reg);
}
return 0xFF;
}
void
sb_exec_command(sb_dsp_t *dsp)
{