When running the Megarace demo install.exe, eventually sound starts to play, which seems to be pure noise. Anyone can see if there's an error in my sound blaster emulation? Or is it simply an error in the 80386 emulation?
- updateSoundBlaster updates timing and rendering.
- inSoundBlaster/outSoundBlaster handle I/O to the sound blaster.
- SoundBlaster_readDMA8/SoundBlaster_writeDMA8 handle input/output from DMA.
- SoundBlaster_DREQ handles DREQ updating.
- SoundBlaster_DACK/SoundBlaster_TC handles DACK and TC from the DMA controller.
- StartPendingSoundBlasterIRQ handles IRQ from the Sound Blaster being acnowledged by the PIC.
- SoundBlaster_SoundGenerator renders from the double buffer to the real renderer.
Anyone can see what's going wrong with the MegaRace installer playback? Or is there a fault in the CPU that must be causing this?
1 if (SOUNDBLASTER.ADPCM_format) //Format specified? Use ADPCM! 2 { 3 if (SOUNDBLASTER.ADPCM_reference) //We're the reference byte? 4 { 5 SOUNDBLASTER.ADPCM_reference = 0; //No reference anymore! 6 SOUNDBLASTER.ADPCM_currentreference = data; 7 SOUNDBLASTER.ADPCM_stepsize = MIN_ADAPTIVE_STEP_SIZE; //Initialise the step size! 8 writefifobuffer(SOUNDBLASTER.DSPoutdata, data); //Send the current sample for rendering! 9 } 10 else //Data based on the reference? 11 { 12 switch (SOUNDBLASTER.ADPCM_format) //What format? 13 { 14 case ADPCM_FORMAT_2BIT: //Dosbox DSP_DMA_2 15 writefifobuffer(SOUNDBLASTER.DSPoutdata, decode_ADPCM_2_sample((data >> 6) & 0x3, &SOUNDBLASTER.ADPCM_currentreference, &SOUNDBLASTER.ADPCM_stepsize)); //Send the partial sample for rendering! 16 writefifobuffer(SOUNDBLASTER.DSPoutdata, decode_ADPCM_2_sample((data >> 4) & 0x3, &SOUNDBLASTER.ADPCM_currentreference, &SOUNDBLASTER.ADPCM_stepsize)); //Send the partial sample for rendering! 17 writefifobuffer(SOUNDBLASTER.DSPoutdata, decode_ADPCM_2_sample((data >> 2) & 0x3, &SOUNDBLASTER.ADPCM_currentreference, &SOUNDBLASTER.ADPCM_stepsize)); //Send the partial sample for rendering! 18 writefifobuffer(SOUNDBLASTER.DSPoutdata, decode_ADPCM_2_sample((data >> 0) & 0x3, &SOUNDBLASTER.ADPCM_currentreference, &SOUNDBLASTER.ADPCM_stepsize)); //Send the partial sample for rendering! 19 break; 20 case ADPCM_FORMAT_26BIT: //Dosbox DSP_DMA_3 21 writefifobuffer(SOUNDBLASTER.DSPoutdata, decode_ADPCM_3_sample((data >> 5) & 0x7, &SOUNDBLASTER.ADPCM_currentreference, &SOUNDBLASTER.ADPCM_stepsize)); //Send the partial sample for rendering! 22 writefifobuffer(SOUNDBLASTER.DSPoutdata, decode_ADPCM_3_sample((data >> 2) & 0x7, &SOUNDBLASTER.ADPCM_currentreference, &SOUNDBLASTER.ADPCM_stepsize)); //Send the partial sample for rendering! 23 writefifobuffer(SOUNDBLASTER.DSPoutdata, decode_ADPCM_3_sample((data & 3) << 0x1, &SOUNDBLASTER.ADPCM_currentreference, &SOUNDBLASTER.ADPCM_stepsize)); //Send the partial sample for rendering! 24 break; 25 case ADPCM_FORMAT_4BIT: //Dosbox DSP_DMA_4 26 writefifobuffer(SOUNDBLASTER.DSPoutdata, decode_ADPCM_4_sample((data >> 4) & 0xF, &SOUNDBLASTER.ADPCM_currentreference, &SOUNDBLASTER.ADPCM_stepsize)); //Send the partial sample for rendering! 27 writefifobuffer(SOUNDBLASTER.DSPoutdata, decode_ADPCM_4_sample(data & 0xF, &SOUNDBLASTER.ADPCM_currentreference, &SOUNDBLASTER.ADPCM_stepsize)); //Send the partial sample for rendering! 28 break; 29 default: //Unknown format? 30 //Ignore output! 31 writefifobuffer(SOUNDBLASTER.DSPoutdata, 0x80); //Send the empty sample for rendering! 32 break; 33 } 34 } 35 } 36 else //Normal 8-bit sample? 37 { 38 writefifobuffer(SOUNDBLASTER.DSPoutdata, data); //Send the current sample for rendering! 39 } 40 if (--SOUNDBLASTER.dataleft==0) //One data used! Finished? Give IRQ! 41 { 42 SoundBlaster_IRQ8(); //Raise the 8-bit IRQ! 43 if (SOUNDBLASTER.AutoInit) //Autoinit enabled? 44 { 45 SoundBlaster_DetectDMALength((byte)SOUNDBLASTER.command, SOUNDBLASTER.AutoInitBlockSize); //Reload the length of the DMA transfer to play back, in bytes! 46 } 47 } 48 SOUNDBLASTER.DREQ |= 2; //Wait for the next sample to be played, according to the sample rate!
Setting DREQ bit 2(the final line) makes it wait for the samples to be rendered before reasserting DREQ(which depends on the amount of samples in the buffer).
With the latest bugfixes(ModR/M address size vs Operand size, protected mode privilege checks only on segment register loads and MOV to/from CR/DR/TR registers being fixed), Megarace(only himem.sys loaded) starts, switches to graphics mode and finally returns to MS-DOS complaining that there's not enough memory. In a system with 6MB RAM installed!
Anyone knows why this hapoens? Jepael? Dosbox developers?
With the latest bugfixes(ModR/M address size vs Operand size, protected mode privilege checks only on segment register loads and MOV to/from CR/DR/TR registers being fixed), Megarace(only himem.sys loaded) starts, switches to graphics mode and finally returns to MS-DOS complaining that there's not enough memory. In a system with 6MB RAM installed!
Anyone knows why this hapoens? Jepael? Dosbox developers?
I am pretty sure they mean base memory (<640k) and not high/up/xms/ems. The game's requirement is only 2Mb of memory, so 6 is enough.
mem /p shows(after a big list of memory locations up to address 0317A0 size 06E450 -- Free --):
1654336 bytes total conventional memory 2654336 bytes available to MS-DOS 3547664 largest executable program size 4 52097152 bytes total EMS memory 62097152 bytes free EMS memory
No emm386 is loaded.
After reinstallation and reboot:
1654336 bytes total conventional memory 2654336 bytes available to MS-DOS 3549008 largest executable program size 4 55636096 total contiguous extended memory 60 bytes available contiguous extended memory 75570560 bytes available XMS memory 864Kb High Memory Area available
Edit: Whoops, the first one was during XT emulation(with Inboard 386 CPU). The second one is AT with 80386 CPU.
Loading EMM386 after HIMEM.SYS crashes(force shutdown) the emulator because of an #UD.
Edit: Now retrying with the following MS-DOS 5.0a CONFIG.SYS: