示例#1
0
文件: cpu.cpp 项目: dezro/snes9x
void S9xSoftReset (void)
{
    S9xResetSaveTimer (FALSE);

	if (Settings.BS)
		S9xResetBSX();
    if (Settings.SuperFX)
        S9xResetSuperFX ();
#ifdef ZSNES_FX
    WinterGold = Settings.WinterGold;
#endif
    ZeroMemory (Memory.FillRAM, 0x8000);
    memset (Memory.VRAM, 0x00, 0x10000);
 //   memset (Memory.RAM, 0x55, 0x20000);

	if(Settings.SPC7110)
		S9xSpc7110Reset();
    S9xSoftResetCPU ();
    S9xSoftResetPPU ();
    S9xResetSRTC ();
    if (Settings.SDD1)
        S9xResetSDD1 ();

    S9xResetDMA ();
    S9xResetAPU ();
    S9xResetDSP1 ();
	if(Settings.OBC1)
		ResetOBC1();
    S9xSA1Init ();
    if (Settings.C4)
        S9xInitC4 ();
    S9xInitCheatData ();

//    Settings.Paused = FALSE;
}
示例#2
0
void S9xSoftReset(void)
{
   if (Settings.SuperFX)
      S9xResetSuperFX();

   memset(Memory.FillRAM, 0, 0x8000);
   memset(Memory.VRAM, 0x00, 0x10000);
   //   memset (Memory.RAM, 0x55, 0x20000);

   if (Settings.SPC7110)
      S9xSpc7110Reset();
   S9xResetCPU();
   S9xSoftResetPPU();
   S9xResetSRTC();
   if (Settings.SDD1)
      S9xResetSDD1();

   S9xResetDMA();
   S9xResetAPU();
   S9xResetDSP1();
   if (Settings.OBC1)
      ResetOBC1();
   S9xSA1Init();
   if (Settings.C4)
      S9xInitC4();

#ifdef WANT_CHEATS
   S9xInitCheatData();
#endif

}
示例#3
0
//int msgBoxLines(char* msg,int delay);
void S9xReset (void)
{
	//	msgBoxLines("S9xReset called",80);	
	MyCounter_Init();
	S9xResumeSoundProcess();
	S9xSuspendSoundProcess();
#ifdef _BSX_151_
	if (Settings.BS)//add azz 080517
		S9xResetBSX();
#endif

    if (Settings.SuperFX)
        S9xResetSuperFX ();

#ifdef ZSNES_FX
    WinterGold = Settings.WinterGold;
#endif
    ZeroMemory (ROM_GLOBAL, 0x8000);
    memset (VRAM, 0x00, 0x10000);
    memset (RAM, 0x55, 0x20000);

	if (Settings.SPC7110)
		S9xResetSPC7110();
    S9xResetCPU ();
    S9xResetPPU ();
	if (Settings.SRTC)
		S9xResetSRTC ();
    if (Settings.SDD1)
        S9xResetSDD1 ();

    S9xResetDMA ();
    S9xResetAPU ();
    S9xResetDSP1 ();
    S9xSA1Init ();
    if (Settings.C4)
        S9xInitC4 ();
    S9xInitCheatData ();

    Settings.Paused = FALSE;
    
        //Init CPU Map & co
    CPUPack.CPU.Memory_Map=(uint8*)Map;
    CPUPack.CPU.Memory_WriteMap=(uint8*)Memory.WriteMap;
    CPUPack.CPU.Memory_MemorySpeed=(uint8*)Memory.MemorySpeed;
    CPUPack.CPU.Memory_BlockIsRAM=(uint8*)Memory.BlockIsRAM;
//    CPUPack.CPU.Memory_SRAM=SRAM;
    CPUPack.CPU.Memory_BWRAM=BWRAM;
    CPUPack.CPU.Memory_SRAMMask=Memory.SRAMMask;
	
/*    __asm 
    {
    	LDR 	R0, = CPU
  	    ADD		R0,R0,R10
  		STR	 	R9,[R0,#124]
  		STR	 	R10,[R0,#128]
    } 
	*/
}
示例#4
0
static void SPCPlayDefrost(void)
{
	uint16	savedswitch;
	short   i;

	savedswitch = so.stereo_switch;

	S9xResetAPU();
    S9xSetSoundMute(true);

	memcpy(&APU,          StoredAPU,          sizeof(SAPU));
	memcpy(&APURegisters, StoredAPURegisters, sizeof(SAPURegisters));
	memcpy(&SoundData,    StoredSoundData,    sizeof(SSoundData));
	memcpy(IAPU.RAM,      StoredIAPURAM,      0x10000);

	if (!mbxFinished)
	{
		for (i = 0; i < 4; i++)
			APU.OutPorts[i] = IAPU.RAM[0xf4 + i];

		for (i = 0; i < 3; i++)
		{
			if (IAPU.RAM[0xfa + i] == 0)
				APU.TimerTarget[i] = 0x100;
			else
				APU.TimerTarget[i] = IAPU.RAM[0xfa + i];
		}

		S9xSetAPUControl(IAPU.RAM[0xf1] & 0xcf);   // Don't reset I/O ports
	}

	S9xSetSoundMute(false);

	IAPU.PC = IAPU.RAM + APURegisters.PC;
	S9xAPUUnpackStatus();

	if (APUCheckDirectPage())
	    IAPU.DirectPage = IAPU.RAM + 0x100;
	else
	    IAPU.DirectPage = IAPU.RAM;

	IAPU.APUExecuting = true;

	IAPU.NextAPUTimerPos = oldNextAPUTimerPos;
	IAPU.APUTimerCounter = oldAPUTimerCounter;
	CPU.Cycles           = oldCPUCycles;

	S9xFixSoundAfterSnapshotLoad(SNAPSHOT_VERSION);

	so.stereo_switch = savedswitch;
}
示例#5
0
文件: cpu.cpp 项目: loveemu/snsf9x
void S9xReset (void)
{
#ifdef SNSF9X_REMOVED
	S9xResetSaveTimer(FALSE);
	S9xResetLogger();
#endif

	memset(Memory.RAM, 0x55, 0x20000);
	memset(Memory.VRAM, 0x00, 0x10000);
	ZeroMemory(Memory.FillRAM, 0x8000);

#ifdef SNSF9X_REMOVED
	if (Settings.BS)
		S9xResetBSX();
#endif

	S9xResetCPU();
	S9xResetPPU();
	S9xResetDMA();
	S9xResetAPU();

#ifdef SNSF9X_REMOVED
	if (Settings.DSP)
		S9xResetDSP();
	if (Settings.SuperFX)
		S9xResetSuperFX();
#endif
#ifndef SNSF9X_REMOVED_SA1
	if (Settings.SA1)
		S9xSA1Init();
#endif
#ifndef SNSF9X_REMOVED_SDD1
	if (Settings.SDD1)
		S9xResetSDD1();
#endif
#ifdef SNSF9X_REMOVED
	if (Settings.SPC7110)
		S9xResetSPC7110();
	if (Settings.C4)
		S9xInitC4();
	if (Settings.OBC1)
		S9xResetOBC1();
	if (Settings.SRTC)
		S9xResetSRTC();

	S9xInitCheatData();
#endif
}
示例#6
0
void S9xReset (void)
{
#ifdef SUPER_FX
    if (Settings.SuperFX)
        S9xResetSuperFX ();
#endif

    ZeroMemory (Memory.FillRAM, 0x8000);
    memset (Memory.VRAM, 0x00, 0x10000);
    memset (Memory.RAM, 0x55, 0x20000);

/*	if(Settings.SPC7110)
		S9xSpc7110Reset();*/
    S9xResetCPU ();
    S9xResetPPU ();
    S9xResetSRTC ();
    if (Settings.SDD1)
        S9xResetSDD1 ();

    S9xResetDMA ();
    S9xResetAPU ();
    S9xResetDSP1 ();
#ifdef USE_SA1
    S9xSA1Init ();
#endif

	if (Settings.C4)
		S9xInitC4 ();

	S9xResetSound(1);

    Settings.Paused = FALSE;
    
       //Init CPU Map & co
    CPU.Memory_Map=(uint8*)&(Memory.Map);
    CPU.Memory_WriteMap=(uint8*)&(Memory.WriteMap);
    CPU.Memory_MemorySpeed=Memory.MemorySpeed;
    CPU.Memory_BlockIsRAM=(uint8*)&(Memory.BlockIsRAM);
    CPU.Memory_SRAM=Memory.SRAM;
    CPU.Memory_BWRAM=Memory.BWRAM;
//    CPU.Memory_SRAMMask=Memory.SRAMMask;
	
}
示例#7
0
//extern uint8 *C4Ram;
END_EXTERN_C
#endif

void S9xReset (void)
{

    if (Settings.SuperFX)
        S9xResetSuperFX ();

#ifdef ZSNES_FX
    WinterGold = Settings.WinterGold;
#endif

    ZeroMemory (Memory.FillRAM, 0x8000);
    memset (Memory.VRAM, 0x00, 0x10000);
    memset (Memory.RAM, 0x55, 0x20000);

    S9xResetCPU ();
    S9xResetPPU ();

//S9xResetSRTC ();

    if (Settings.SDD1)
        S9xResetSDD1 ();

    S9xResetDMA ();
    S9xResetAPU ();
    S9xResetDSP1 ();

    S9xSA1Init ();

    if (Settings.C4)
        S9xInitC4 ();

#ifdef CHEATS
    S9xInitCheatData ();
    S9xApplyCheats ();
#endif

	if(Settings.OBC1)
		ResetOBC1();
    Settings.Paused = FALSE;
}
示例#8
0
/* Load SPC file [CLEANUP]
   ---------------------------------------------------------------- */
int SPC_load (const char *fname, SPC_ID666 * id)
{
    FILE *fp;
    char temp[64];

    if (id) {
        memset(id, 0, sizeof(*id));
    }

    fp = fopen (fname, "rb");
    if (!fp)
        return FALSE;

    read_id666(fp, id);

    IAPU.OneCycle = ONE_APU_CYCLE; /* VP : moved this before call to S9xResetAPU !! */

    S9xInitAPU();
    S9xResetAPU();

    fseek(fp, 0x25, SEEK_SET);
    fread(&BackupAPURegisters.PC, 1, 2, fp);
    fread(&BackupAPURegisters.YA.B.A, 1, 1, fp);
    fread(&BackupAPURegisters.X, 1, 1, fp);
    fread(&BackupAPURegisters.YA.B.Y, 1, 1, fp);
    fread(&BackupAPURegisters.P, 1, 1, fp);
    fread(&BackupAPURegisters.S, 1, 1, fp);

    fseek(fp, 0x100, SEEK_SET);
    fread(BackupAPURAM, 1, 0x10000, fp);
    fread(BackupDSPRAM, 1, 128, fp);
    fread(temp, 1, 64, fp);
    fread(BackupAPUExtraRAM, 1, 64, fp);

    fclose(fp);

    RestoreSPC();

    return TRUE;
}
示例#9
0
void S9xReset (void)
{
	S9xResetSaveTimer(FALSE);
	S9xResetLogger();

	memset(Memory.RAM, 0x55, 0x20000);
	memset(Memory.VRAM, 0x00, 0x10000);
	memset(Memory.FillRAM, 0, 0x8000);

	if (Settings.BS)
		S9xResetBSX();

	S9xResetCPU();
	S9xResetPPU();
	S9xResetDMA();
	S9xResetAPU();
    S9xResetMSU();

	if (Settings.DSP)
		S9xResetDSP();
	if (Settings.SuperFX)
		S9xResetSuperFX();
	if (Settings.SA1)
		S9xSA1Init();
	if (Settings.SDD1)
		S9xResetSDD1();
	if (Settings.SPC7110)
		S9xResetSPC7110();
	if (Settings.C4)
		S9xInitC4();
	if (Settings.OBC1)
		S9xResetOBC1();
	if (Settings.SRTC)
		S9xResetSRTC();
	if (Settings.MSU1)
		S9xMSU1Init();

	S9xInitCheatData();
}
示例#10
0
int SPC_loadFP(FILE *fp)
{
    char temp[64];
	unsigned char a, b;

    S9xInitAPU();

    if (!fp)
        return FALSE;
  
    S9xResetAPU();

    fseek(fp, 0x25, SEEK_SET);
   
	fread(&a, 1, 1, fp);
	fread(&b, 1, 1, fp);
	BackupAPURegisters.PC = (b << 8) | a;
//	fread(&BackupAPURegisters.PC, 1, 2, fp);
	
    fread(&BackupAPURegisters.YA.B.A, 1, 1, fp);
    fread(&BackupAPURegisters.X, 1, 1, fp);
    fread(&BackupAPURegisters.YA.B.Y, 1, 1, fp);
    fread(&BackupAPURegisters.P, 1, 1, fp);
    fread(&BackupAPURegisters.S, 1, 1, fp);

    fseek(fp, 0x100, SEEK_SET);
    fread(BackupAPURAM, 1, 0x10000, fp);
    fread(BackupDSPRAM, 1, 128, fp);
    fread(temp, 1, 64, fp);
    fread(BackupAPUExtraRAM, 1, 64, fp);

    RestoreSPC();
    IAPU.OneCycle = ONE_APU_CYCLE;

    return TRUE;
}