Ejemplo n.º 1
0
void c64::reset()
{
    m_scheduler.reset();

    //cpu.reset();
    cia1.reset();
    cia2.reset();
    vic.reset();
    sidBank.reset();
    colorRAMBank.reset();
    mmu.reset();

    std::for_each(extraSidBanks.begin(), extraSidBanks.end(), resetSID());

    irqCount = 0;
    oldBAState = true;
}
Ejemplo n.º 2
0
Player_SID::Player_SID(ScummEngine *scumm, Audio::Mixer *mixer) {
	/*
	 * clear memory
	 */

	resID_song = 0;
	statusBits1A = 0;
	statusBits1B = 0;
	busyChannelBits = 0;
	SIDReg23 = 0;
	SIDReg23Stuff = 0;
	SIDReg24 = 0;
	bgSoundResID = 0;
	freeChannelCount = 0;
	usedChannelBits = 0;
	var481A = 0;
	songChannelBits = 0;
	//var5163 = 0;
	SIDReg24_HiNibble = 0;
	chansWithLowerPrioCount = 0;
	minChanPrio = 0;
	minChanPrioIndex = 0;

	_music = NULL;
	songFileOrChanBufData = NULL;
	actSongFileData = NULL;

	initializing = false;
	_soundInQueue = false;
	isVoiceChannel = false;
	isMusicPlaying = false;
	swapVarLoaded = false;
	bgSoundActive = false;
	filterUsed = false;
	pulseWidthSwapped = false;
	swapPrepared = false;
	filterSwapped = false;
	keepSwapVars = false;
	actFilterHasLowerPrio = false;

	ZEROMEM(chanFileData);
	ZEROMEM(chanDataOffset);
	ZEROMEM(songPosPtr);
	ZEROMEM(freqReg);
	ZEROMEM(vec6);
	ZEROMEM(songFileOrChanBufOffset);
	ZEROMEM(freqDelta);
	ZEROMEM(freqDeltaCounter);
	ZEROMEM(swapSongPosPtr);
	ZEROMEM(swapVec5);
	ZEROMEM(swapVec8);
	ZEROMEM(swapVec10);
	ZEROMEM(swapFreqReg);
	ZEROMEM(swapVec11);
	ZEROMEM(vec20);
	ZEROMEM(swapVec20);
	ZEROMEM(resStatus);
	ZEROMEM(attackReg);
	ZEROMEM(sustainReg);
	ZEROMEM(phaseBit);
	ZEROMEM(releasePhase);
	ZEROMEM(_soundQueue);
	ZEROMEM(channelMap);
	ZEROMEM(songPosUpdateCounter);
	ZEROMEM(chanPrio);
	ZEROMEM(waveCtrlReg);
	ZEROMEM(swapAttack);
	ZEROMEM(swapSustain);
	ZEROMEM(swapSongPrio);
	ZEROMEM(swapVec479C);
	ZEROMEM(swapVec19);
	ZEROMEM(swapSongPosUpdateCounter);
	ZEROMEM(swapWaveCtrlReg);
	ZEROMEM(stepTbl);

	/*
	 * initialize data
	 */

	const uint8 chanBuffer_const[3][45] = {
		{
			0x00,0x00,0x00,0x00,0x7f,0x01,0x19,0x00,
			0x00,0x00,0x2d,0x00,0x00,0x00,0x00,0x00,
			0x00,0x00,0xf0,0x40,0x10,0x04,0x00,0x00,
			0x00,0x04,0x27,0x03,0xff,0xff,0x01,0x00,
			0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
			0x00,0x00,0x00,0x00,0x00
		},
		{
			0x00,0x00,0x00,0x00,0x7f,0x01,0x19,0x00,
			0x00,0x00,0x2d,0x00,0x00,0x00,0x00,0x00,
			0x00,0x00,0xf0,0x20,0x10,0x04,0x00,0x00,
			0x00,0x04,0x27,0x03,0xff,0xff,0x02,0x00,
			0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
			0x00,0x00,0x00,0x00,0x00
		},
		{
			0x00,0x00,0x00,0x00,0x7f,0x01,0x19,0x00,
			0x00,0x00,0x2d,0x00,0x00,0x00,0x00,0x00,
			0x00,0x00,0xf0,0x20,0x10,0x04,0x00,0x00,
			0x00,0x04,0x27,0x03,0xff,0xff,0x02,0x00,
			0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
			0x00,0x00,0x00,0x00,0x00
		}
	};
	memcpy(chanBuffer, chanBuffer_const, sizeof(chanBuffer_const));

	for (int i = 0; i < 7; ++i) {
		_soundQueue[i] = -1;
	};

	_music_timer = 0;

	_mixer = mixer;
	_sampleRate = _mixer->getOutputRate();
	_vm = scumm;

	// sound speed is slightly different on NTSC and PAL machines
	// as the SID clock depends on the frame rate.
	// ScummVM does not distinguish between NTSC and PAL targets
	// so we use the NTSC timing here as the music was composed for
	// NTSC systems (music on PAL systems is slower).
	_videoSystem = NTSC;
	_cpuCyclesLeft = 0;

	initSID();
	resetSID();

	_mixer->playStream(Audio::Mixer::kPlainSoundType, &_soundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
}