|
|
1.1 root 1: /*
2: Hatari
3:
4: Reset emulation state
5: */
6:
7: #include "main.h"
8: #include "cart.h"
9: #include "decode.h"
10: #include "fdc.h"
11: #include "floppy.h"
12: #include "gemdos.h"
13: #include "ikbd.h"
14: #include "int.h"
15: #include "m68000.h"
16: #include "misc.h"
17: #include "mfp.h"
18: #include "psg.h"
19: #include "reset.h"
20: #include "screen.h"
21: #include "sound.h"
22: #include "stMemory.h"
23: #include "tos.h"
24: #include "video.h"
25:
1.1.1.2 root 26:
27: /*-----------------------------------------------------------------------*/
1.1 root 28: /*
29: Cold reset ST (reset memory, all registers and reboot)
30: */
31: void Reset_Cold(void)
32: {
33: Reset_ST(TRUE);
34: }
35:
1.1.1.2 root 36:
37: /*-----------------------------------------------------------------------*/
1.1 root 38: /*
39: Warm reset ST (reset registers, leave in same state and reboot)
40: */
41: void Reset_Warm(void)
42: {
43: Reset_ST(FALSE);
44: }
45:
1.1.1.2 root 46:
47: /*-----------------------------------------------------------------------*/
1.1 root 48: /*
49: Reset ST emulator states, chips, interrupts and registers
50: */
51: void Reset_ST(BOOL bCold)
52: {
53: if (bCold) {
1.1.1.2 root 54: STMemory_Clear(0x00000000,0x00400000); /* Clear First 4Mb */
55: STMemory_Clear(0x00e00000,0x00ffffff); /* Clear Upper memory */
56: STMemory_WriteLong(4,0x00fc0020); /* Set reset vector */
57: STMemory_WriteLong(0,0x0000f000); /* And reset stack pointer */
58:
59: Floppy_GetBootDrive(); /* Find which device to boot from(A: or C:) */
60: Cart_LoadImage(); /* Load program into cartridge memory. Used for gemdos loading */
61: TOS_LoadImage(); /* Load TOS, writes into cartridge memory */
1.1 root 62: }
1.1.1.2 root 63: Int_Reset(); /* Reset interrupts */
64: MFP_Reset(); /* Setup MFP chip */
65: Video_Reset(); /* Reset video */
1.1 root 66: if (bCold) {
1.1.1.3 ! root 67: GemDOS_Reset(); /* Reset GEMDOS emulation */
1.1.1.2 root 68: FDC_Reset(); /* Reset FDC */
1.1 root 69: }
1.1.1.2 root 70: PSG_Reset(); /* Reset PSG */
71: Sound_Reset(); /* Reset Sound */
72: IKBD_Reset(bCold); /* Keyboard */
73: Screen_Reset(); /* Reset screen */
74: M68000_Reset(bCold); /* Reset CPU */
1.1 root 75:
1.1.1.2 root 76: /* And VBL interrupt, MUST always be one interrupt ready to trigger */
1.1 root 77: Int_AddAbsoluteInterrupt(CYCLES_ENDLINE,INTERRUPT_VIDEO_ENDLINE);
78: Int_AddAbsoluteInterrupt(CYCLES_HBL,INTERRUPT_VIDEO_HBL);
79: Int_AddAbsoluteInterrupt(CYCLES_PER_FRAME,INTERRUPT_VIDEO_VBL);
1.1.1.2 root 80: /* And keyboard check for debugger */
1.1 root 81: #ifdef USE_DEBUGGER
82: Int_AddAbsoluteInterrupt(CYCLES_DEBUGGER,INTERRUPT_DEBUGGER);
83: #endif
84: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.