|
|
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.7 ! root 9: char Reset_rcsid[] = "Hatari $Id: reset.c,v 1.9 2004/12/03 20:42:45 thothy Exp $";
1.1 root 10:
11: #include "main.h"
12: #include "cart.h"
13: #include "fdc.h"
14: #include "floppy.h"
15: #include "gemdos.h"
16: #include "ikbd.h"
17: #include "int.h"
18: #include "m68000.h"
19: #include "misc.h"
20: #include "mfp.h"
21: #include "psg.h"
22: #include "reset.h"
23: #include "screen.h"
24: #include "sound.h"
25: #include "stMemory.h"
26: #include "tos.h"
27: #include "video.h"
28:
1.1.1.2 root 29:
30: /*-----------------------------------------------------------------------*/
1.1 root 31: /*
32: Cold reset ST (reset memory, all registers and reboot)
33: */
1.1.1.4 root 34: int Reset_Cold(void)
1.1 root 35: {
1.1.1.7 ! root 36: Main_WarpMouse(sdlscrn->w/2, sdlscrn->h/2); /* Set mouse pointer to the middle of the screen */
! 37:
1.1.1.4 root 38: return Reset_ST(TRUE);
1.1 root 39: }
40:
1.1.1.2 root 41:
42: /*-----------------------------------------------------------------------*/
1.1 root 43: /*
44: Warm reset ST (reset registers, leave in same state and reboot)
45: */
1.1.1.4 root 46: int Reset_Warm(void)
1.1 root 47: {
1.1.1.4 root 48: return Reset_ST(FALSE);
1.1 root 49: }
50:
1.1.1.2 root 51:
52: /*-----------------------------------------------------------------------*/
1.1 root 53: /*
54: Reset ST emulator states, chips, interrupts and registers
55: */
1.1.1.4 root 56: int Reset_ST(BOOL bCold)
1.1 root 57: {
1.1.1.4 root 58: if (bCold)
59: {
60: int ret;
61:
62: STMemory_Clear(0x00000000, 0x00400000); /* Clear First 4Mb */
63: STMemory_Clear(0x00e00000, 0x00ffffff); /* Clear Upper memory */
64: STMemory_WriteLong(4, 0x00fc0000); /* Set reset vector */
65: STMemory_WriteLong(0, 0x0000f000); /* And reset stack pointer */
1.1.1.2 root 66:
67: Floppy_GetBootDrive(); /* Find which device to boot from(A: or C:) */
68: Cart_LoadImage(); /* Load program into cartridge memory. Used for gemdos loading */
1.1.1.4 root 69:
70: ret = TOS_LoadImage(); /* Load TOS, writes into cartridge memory */
71: if(ret)
72: {
73: return ret; /* If we can not load a TOS image, return now! */
74: }
1.1 root 75: }
1.1.1.2 root 76: Int_Reset(); /* Reset interrupts */
77: MFP_Reset(); /* Setup MFP chip */
78: Video_Reset(); /* Reset video */
1.1.1.4 root 79:
1.1.1.5 root 80: GemDOS_Reset(); /* Reset GEMDOS emulation */
1.1.1.4 root 81: if (bCold)
82: {
1.1.1.2 root 83: FDC_Reset(); /* Reset FDC */
1.1 root 84: }
1.1.1.4 root 85:
1.1.1.2 root 86: PSG_Reset(); /* Reset PSG */
87: Sound_Reset(); /* Reset Sound */
88: IKBD_Reset(bCold); /* Keyboard */
89: Screen_Reset(); /* Reset screen */
90: M68000_Reset(bCold); /* Reset CPU */
1.1 root 91:
1.1.1.2 root 92: /* And VBL interrupt, MUST always be one interrupt ready to trigger */
1.1.1.4 root 93: Int_AddAbsoluteInterrupt(CYCLES_ENDLINE, INTERRUPT_VIDEO_ENDLINE);
94: Int_AddAbsoluteInterrupt(CYCLES_HBL, INTERRUPT_VIDEO_HBL);
95: Int_AddAbsoluteInterrupt(CYCLES_PER_FRAME, INTERRUPT_VIDEO_VBL);
96:
97: return 0;
1.1 root 98: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.