Merge pull request #1867 from jriwanek-forks/patch-misc

default RAM and SB16 8051 RAM emulation
This commit is contained in:
Miran Grča
2021-11-24 00:32:54 +01:00
committed by GitHub
3 changed files with 256 additions and 243 deletions

View File

@@ -833,8 +833,7 @@ load_machine(void)
p = (char *)config_get_string(cat, "fpu_type", "none"); p = (char *)config_get_string(cat, "fpu_type", "none");
fpu_type = fpu_get_type(cpu_f, cpu, p); fpu_type = fpu_get_type(cpu_f, cpu, p);
mem_size = config_get_int(cat, "mem_size", 4096); mem_size = config_get_int(cat, "mem_size", 64);
#if 0 #if 0
if (mem_size < (((machines[machine].flags & MACHINE_AT) && if (mem_size < (((machines[machine].flags & MACHINE_AT) &&
(machines[machine].ram_granularity < 128)) ? machines[machine].min_ram*1024 : machines[machine].min_ram)) (machines[machine].ram_granularity < 128)) ? machines[machine].min_ram*1024 : machines[machine].min_ram))
@@ -2060,7 +2059,7 @@ config_load(void)
/* Unmute the CD audio on the first CD-ROM drive. */ /* Unmute the CD audio on the first CD-ROM drive. */
cdrom[0].sound_on = 1; cdrom[0].sound_on = 1;
mem_size = 640; mem_size = 64;
isartc_type = 0; isartc_type = 0;
for (i = 0; i < ISAMEM_MAX; i++) for (i = 0; i < ISAMEM_MAX; i++)
isamem_type[i] = 0; isamem_type[i] = 0;

View File

@@ -66,6 +66,7 @@ typedef struct sb_dsp_t
int sb_irqm8, sb_irqm16, sb_irqm401; int sb_irqm8, sb_irqm16, sb_irqm401;
uint8_t sb_asp_regs[256]; uint8_t sb_asp_regs[256];
uint8_t sb_8051_ram[256];
int sbenable, sb_enable_i; 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_dsp_log("Trigger IRQ\n");
sb_irq(dsp, 0); sb_irq(dsp, 0);
break; break;
case 0xE7: case 0xFA: /* ???? */ case 0xE7: /* ???? */
break; break;
case 0x07: case 0xFF: /* No, that's not how you program auto-init DMA */ case 0x07: case 0xFF: /* No, that's not how you program auto-init DMA */
break; break;
@@ -808,15 +808,15 @@ sb_exec_command(sb_dsp_t *dsp)
break; break;
case 0xF9: case 0xF9:
if (dsp->sb_type >= SB16) { if (dsp->sb_type >= SB16) {
if (dsp->sb_data[0] == 0x0e) sb_add_data(dsp, dsp->sb_8051_ram[dsp->sb_data[0]]);
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);
} }
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: case 0x04: case 0x05:
break; break;
@@ -847,6 +847,12 @@ sb_exec_command(sb_dsp_t *dsp)
* 0FDh DSP Command Status SB16 * 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. */ a set frequency command is sent. */
recalc_sb16_filter(0, 3200*2); recalc_sb16_filter(0, 3200*2);
recalc_sb16_filter(1, 44100); 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); 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); sb_dsp_update(dsp);
switch (dsp->sb_16_format) { switch (dsp->sb_16_format) {