|
|
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.13! root 9: const char Reset_fileid[] = "Hatari reset.c : " __DATE__ " " __TIME__;
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"
1.1.1.12 root 22: #include "midi.h"
1.1 root 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: */
1.1.1.11 root 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:
1.1.1.12 root 73: Midi_Reset();
74:
1.1.1.13! root 75: /* Start HBL, Timer B and VBL interrupts with a 0 cycle delay */
! 76: Video_StartInterrupts( 0 );
1.1.1.7 root 77:
1.1.1.10 root 78: return 0;
1.1 root 79: }
80:
1.1.1.2 root 81:
82: /*-----------------------------------------------------------------------*/
1.1.1.10 root 83: /**
84: * Cold reset ST (reset memory, all registers and reboot)
85: */
86: int Reset_Cold(void)
1.1 root 87: {
1.1.1.10 root 88: Main_WarpMouse(sdlscrn->w/2, sdlscrn->h/2); /* Set mouse pointer to the middle of the screen */
89:
1.1.1.13! root 90: return Reset_ST(true);
1.1 root 91: }
92:
1.1.1.2 root 93:
94: /*-----------------------------------------------------------------------*/
1.1.1.10 root 95: /**
96: * Warm reset ST (reset registers, leave in same state and reboot)
97: */
98: int Reset_Warm(void)
1.1 root 99: {
1.1.1.13! root 100: return Reset_ST(false);
1.1 root 101: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.