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