SB16 8051 RAM

Ported from PCBox
This commit is contained in:
Jasmine Iwanek
2021-11-23 17:53:03 -05:00
parent 9c9fa70961
commit 306308f2bd
2 changed files with 254 additions and 240 deletions

View File

@@ -66,6 +66,7 @@ typedef struct sb_dsp_t
int sb_irqm8, sb_irqm16, sb_irqm401;
uint8_t sb_asp_regs[256];
uint8_t sb_8051_ram[256];
int sbenable, sb_enable_i;

View File

@@ -763,7 +763,7 @@ sb_exec_command(sb_dsp_t *dsp)
sb_dsp_log("Trigger IRQ\n");
sb_irq(dsp, 0);
break;
case 0xE7: case 0xFA: /* ???? */
case 0xE7: /* ???? */
break;
case 0x07: case 0xFF: /* No, that's not how you program auto-init DMA */
break;
@@ -808,15 +808,15 @@ sb_exec_command(sb_dsp_t *dsp)
break;
case 0xF9:
if (dsp->sb_type >= SB16) {
if (dsp->sb_data[0] == 0x0e)
sb_add_data(dsp, 0xff);
else if (dsp->sb_data[0] == 0x0f)
sb_add_data(dsp, 0x07);
else if (dsp->sb_data[0] == 0x37)
sb_add_data(dsp, 0x38);
else
sb_add_data(dsp, 0x00);
sb_add_data(dsp, dsp->sb_8051_ram[dsp->sb_data[0]]);
}
break;
case 0xFA:
if(dsp->sb_type >= SB16)
{
dsp->sb_8051_ram[dsp->sb_data[0]] = dsp->sb_data[1];
}
break;
case 0x04: case 0x05:
break;
@@ -847,6 +847,12 @@ sb_exec_command(sb_dsp_t *dsp)
* 0FDh DSP Command Status SB16
*/
}
if(dsp->sb_type >= SB16)
{
//Update 8051 ram with the last DSP command.
//See https://github.com/joncampbell123/dosbox-x/issues/1044
dsp->sb_8051_ram[0x30] = dsp->sb_command;
}
}
@@ -1059,6 +1065,12 @@ sb_dsp_init(sb_dsp_t *dsp, int type, int subtype, void *parent)
a set frequency command is sent. */
recalc_sb16_filter(0, 3200*2);
recalc_sb16_filter(1, 44100);
// Initialize SB16 8051 RAM
memset(dsp->sb_8051_ram, 0, 256);
dsp->sb_8051_ram[0x0e] = 0xff;
dsp->sb_8051_ram[0x0f] = 0x07;
dsp->sb_8051_ram[0x37] = 0x38;
}
@@ -1282,7 +1294,8 @@ pollsb(void *p)
}
sb_irq(dsp, 1);
}
} if (dsp->sb_16_enable && !dsp->sb_16_pause && (dsp->sb_pausetime < 0LL) && dsp->sb_16_output) {
}
if (dsp->sb_16_enable && !dsp->sb_16_pause && (dsp->sb_pausetime < 0LL) && dsp->sb_16_output) {
sb_dsp_update(dsp);
switch (dsp->sb_16_format) {