|
|
1.1 root 1: /*
2: Hatari
3:
1.1.1.4 root 4: This file is distributed under the GNU Public License, version 2 or at
5: your option any later version. Read the file gpl.txt for details.
6:
7: Reset emulation state.
1.1 root 8: */
1.1.1.10! root 9: const char Reset_rcsid[] = "Hatari $Id: reset.c,v 1.27 2008/03/13 23:17:27 thothy Exp $";
1.1 root 10:
11: #include "main.h"
1.1.1.10! root 12: #include "configuration.h"
1.1 root 13: #include "cart.h"
1.1.1.8 root 14: #include "dmaSnd.h"
1.1 root 15: #include "fdc.h"
16: #include "floppy.h"
17: #include "gemdos.h"
18: #include "ikbd.h"
19: #include "int.h"
20: #include "m68000.h"
21: #include "misc.h"
22: #include "mfp.h"
23: #include "psg.h"
24: #include "reset.h"
25: #include "screen.h"
26: #include "sound.h"
27: #include "stMemory.h"
28: #include "tos.h"
1.1.1.10! root 29: #include "vdi.h"
1.1 root 30: #include "video.h"
1.1.1.10! root 31: #include "falcon/videl.h"
1.1 root 32:
1.1.1.2 root 33:
34: /*-----------------------------------------------------------------------*/
1.1.1.10! root 35: /**
! 36: * Reset ST emulator states, chips, interrupts and registers.
! 37: * Return zero or negative TOS image load error code.
! 38: */
! 39: static int Reset_ST(BOOL bCold)
1.1 root 40: {
1.1.1.10! root 41: if (bCold)
! 42: {
! 43: int ret;
! 44:
! 45: Floppy_GetBootDrive(); /* Find which device to boot from (A: or C:) */
! 46:
! 47: ret = TOS_LoadImage(); /* Load TOS, writes into cartridge memory */
! 48: if (ret)
! 49: return ret; /* If we can not load a TOS image, return now! */
! 50:
! 51: Cart_ResetImage(); /* Load cartridge program into ROM memory. */
! 52: }
! 53: Int_Reset(); /* Reset interrupts */
! 54: MFP_Reset(); /* Setup MFP chip */
! 55: Video_Reset(); /* Reset video */
! 56:
! 57: GemDOS_Reset(); /* Reset GEMDOS emulation */
! 58: if (bCold)
! 59: {
! 60: FDC_Reset(); /* Reset FDC */
! 61: }
! 62:
! 63: DmaSnd_Reset(bCold); /* Reset DMA sound */
! 64: PSG_Reset(); /* Reset PSG */
! 65: Sound_Reset(); /* Reset Sound */
! 66: IKBD_Reset(bCold); /* Keyboard */
! 67: if (ConfigureParams.System.nMachineType == MACHINE_FALCON && !bUseVDIRes)
! 68: VIDEL_reset();
! 69: else
! 70: Screen_Reset(); /* Reset screen */
! 71: M68000_Reset(bCold); /* Reset CPU */
! 72:
! 73: /* Start HBL and VBL interrupts */
! 74: Video_StartInterrupts();
1.1.1.7 root 75:
1.1.1.10! root 76: return 0;
1.1 root 77: }
78:
1.1.1.2 root 79:
80: /*-----------------------------------------------------------------------*/
1.1.1.10! root 81: /**
! 82: * Cold reset ST (reset memory, all registers and reboot)
! 83: */
! 84: int Reset_Cold(void)
1.1 root 85: {
1.1.1.10! root 86: Main_WarpMouse(sdlscrn->w/2, sdlscrn->h/2); /* Set mouse pointer to the middle of the screen */
! 87:
! 88: return Reset_ST(TRUE);
1.1 root 89: }
90:
1.1.1.2 root 91:
92: /*-----------------------------------------------------------------------*/
1.1.1.10! root 93: /**
! 94: * Warm reset ST (reset registers, leave in same state and reboot)
! 95: */
! 96: int Reset_Warm(void)
1.1 root 97: {
1.1.1.10! root 98: return Reset_ST(FALSE);
1.1 root 99: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.