#include "../sound/sound.h"
-extern unsigned char formatted_bram[8*0x10];
+extern unsigned char formatted_bram[4*0x10];
int PicoInitMCD(void)
int PicoResetMCD(int hard)
{
- memset(Pico_mcd->prg_ram, 0, sizeof(Pico_mcd->prg_ram));
- memset(Pico_mcd->word_ram, 0, sizeof(Pico_mcd->word_ram));
- memset(Pico_mcd->pcm_ram, 0, sizeof(Pico_mcd->pcm_ram));
+ memset(Pico_mcd->prg_ram, 0, sizeof(Pico_mcd->prg_ram));
+ memset(Pico_mcd->word_ram2M, 0, sizeof(Pico_mcd->word_ram2M));
+ memset(Pico_mcd->pcm_ram, 0, sizeof(Pico_mcd->pcm_ram));
if (hard) {
+ int fmt_size = sizeof(formatted_bram);
memset(Pico_mcd->bram, 0, sizeof(Pico_mcd->bram));
- memcpy(Pico_mcd->bram + sizeof(Pico_mcd->bram) - 8*0x10, formatted_bram, 8*0x10);
+ memcpy(Pico_mcd->bram + sizeof(Pico_mcd->bram) - fmt_size, formatted_bram, fmt_size);
}
memset(Pico_mcd->s68k_regs, 0, sizeof(Pico_mcd->s68k_regs));
memset(&Pico_mcd->pcm, 0, sizeof(Pico_mcd->pcm));
gfx_cd_update();
}
-// to be called on 224 or line_sample scanlines only
-static __inline void getSamples(int y)
-{
- if(y == 224) {
- //dprintf("sta%i: %i [%i]", (emustatus & 2), emustatus, y);
- if(emustatus & 2)
- sound_render(PsndLen/2, PsndLen-PsndLen/2);
- else sound_render(0, PsndLen);
- if (emustatus&1) emustatus|=2; else emustatus&=~2;
- if (PicoWriteSound) PicoWriteSound();
- // clear sound buffer
- sound_clear();
- //memset(PsndOut, 0, (PicoOpt & 8) ? (PsndLen<<2) : (PsndLen<<1));
- }
- else if(emustatus & 3) {
- emustatus|= 2;
- emustatus&=~1;
- sound_render(0, PsndLen/2);
- }
-}
-
static int PicoFrameHintsMCD(void)
{
sound_timers_and_dac(y);
// get samples from sound chips
- if(y == 32 && PsndOut)
- emustatus &= ~1;
- else if((y == 224 || y == line_sample) && PsndOut)
- getSamples(y);
+ if (y == 224 && PsndOut) {
+ int len = sound_render(0, PsndLen);
+ if (PicoWriteSound) PicoWriteSound(len);
+ // clear sound buffer
+ sound_clear();
+ }
// Run scanline:
//dprintf("m68k starting exec @ %06x", SekPc);