Beispiel #1
0
/**
 * Reset custom chips
 */
void customreset(void)
{
	pendingInterrupts = 0;

	/* In case the 6301 was executing a custom program from its RAM */
	/* we must turn it back to the 'normal' mode. */
	IKBD_Reset_ExeMode ();

	/* Reseting the GLUE video chip should also set freq/res register to 0 */
	Video_Reset_Glue ();

	/* Reset the YM2149 (stop any sound) */
	PSG_Reset ();
}
Beispiel #2
0
void PSG_Init(unsigned int clock, unsigned int rate)
{
    int i, j;
    double out;

#if PSG_DEBUG_LEVEL > 0
    if (psg_debug_file == NULL)
    {
        psg_debug_file = fopen("psg.log", "w");
        fprintf(psg_debug_file, "PSG logging :\n\n");
    }
#endif

    for(i = 1; i < 1024; i++)
    {
        // Step calculation

        out = (double) (clock) / (double) (i << 4);        // out = frequency
        out /= (double) (rate);
        out *= 65536.0;

        PSG_Step_Table[i] = (unsigned int) out;
    }

    PSG_Step_Table[0] = PSG_Step_Table[1];

    for(i = 0; i < 3; i++)
    {
        out = (double) (clock) / (double) (1 << (9 + i));
        out /= (double) (rate);
        out *= 65536.0;

        PSG_Noise_Step_Table[i] = (unsigned int) out;
    }

    PSG_Noise_Step_Table[3] = 0;

    out = (double) MAX_OUTPUT / 3.0;

    for (i = 0; i < 15; i++)
    {
        PSG_Volume_Table[i] = (unsigned int) out;
        out /= 1.258925412;        // = 10 ^ (2/20) = 2dB
    }

    PSG_Volume_Table[15] = 0;

    PSG_Reset();
}
Beispiel #3
0
/**
 * Reset custom chips
 * In case the RESET instruction is called, we must reset all the peripherals
 * connected to the CPU's reset pin.
 */
void customreset(void)
{
	pendingInterrupts = 0;

	/* Reset the IKBD */
	IKBD_Reset ( false );

	/* Reseting the GLUE video chip should also set freq/res register to 0 */
	Video_Reset_Glue ();

        /* Reset the YM2149 (stop any sound) */
        PSG_Reset ();

	/* Reset the MFP */
	MFP_Reset ();

	/* Reset the FDC */
	FDC_Reset ( false );
}
Beispiel #4
0
/**
 * Reset ST emulator states, chips, interrupts and registers.
 * Return zero or negative TOS image load error code.
 */
static int Reset_ST(bool bCold)
{
	if (bCold)
	{
		int ret;

		Floppy_GetBootDrive();      /* Find which device to boot from (A: or C:) */

		ret = TOS_LoadImage();      /* Load TOS, writes into cartridge memory */
		if (ret)
			return ret;               /* If we can not load a TOS image, return now! */

		Cart_ResetImage();          /* Load cartridge program into ROM memory. */
		Cart_Patch();
	}
	CycInt_Reset();               /* Reset interrupts */
	MFP_Reset();                  /* Setup MFP chip */
	Video_Reset();                /* Reset video */
	VDI_Reset();                  /* Reset internal VDI variables */
	NvRam_Reset();                /* reset NvRAM (video) settings */

	GemDOS_Reset();               /* Reset GEMDOS emulation */
	if (bCold)
	{
		FDC_Reset( bCold );	/* Reset FDC */
	}
	Floppy_Reset();			/* Reset Floppy */

	if (ConfigureParams.System.nMachineType == MACHINE_FALCON
	    || ConfigureParams.System.nMachineType == MACHINE_TT)
	{
		Ncr5380_Reset();
	}

	if (ConfigureParams.System.nMachineType == MACHINE_FALCON)
	{
		DSP_Reset();                  /* Reset the DSP */
		Crossbar_Reset(bCold);        /* Reset Crossbar sound */
	}
	else
		DmaSnd_Reset(bCold);          /* Reset DMA sound */

	PSG_Reset();                  /* Reset PSG */
	Sound_Reset();                /* Reset Sound */
	ACIA_Reset( ACIA_Array );     /* ACIA */
	IKBD_Reset(bCold);            /* Keyboard (after ACIA) */
	if (ConfigureParams.System.nMachineType == MACHINE_FALCON && !bUseVDIRes)
		VIDEL_reset();
	else
		Screen_Reset();               /* Reset screen */
	M68000_Reset(bCold);          /* Reset CPU */

	DebugCpu_SetDebugging();      /* Re-set debugging flag if needed */
	DebugDsp_SetDebugging();

	Midi_Reset();

#if defined(__linux__)
        nf_scsidrv_reset();
#endif

	/* Start HBL, Timer B and VBL interrupts with a 0 cycle delay */
	Video_StartInterrupts( 0 );

	return 0;
}