|
|
1.1 root 1: /*
2: Hatari - hatari-glue.c
3:
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: This file contains some code to glue the UAE CPU core to the rest of the
8: emulator and Hatari's "illegal" opcodes.
9: */
10: const char HatariGlue_fileid[] = "Hatari hatari-glue.c : " __DATE__ " " __TIME__;
11:
12:
13: #include <stdio.h>
14:
15: #include "main.h"
16: #include "configuration.h"
17: #include "cycInt.h"
18: #include "cart.h"
19: #include "nextMemory.h"
1.1.1.2 ! root 20: #include "screen.h"
1.1 root 21: #include "video.h"
22:
23: #include "sysdeps.h"
24: #include "maccess.h"
25: #include "memory.h"
26: #include "newcpu.h"
27: #include "hatari-glue.h"
28:
29:
30: struct uae_prefs currprefs, changed_prefs;
31:
32: int pendingInterrupts = 0;
33:
34:
35: /**
36: * Reset custom chips
37: */
38: void customreset(void)
39: {
40: pendingInterrupts = 0;
41:
42: /* Reseting the GLUE video chip should also set freq/res register to 0 */
43: Video_Reset_Glue ();
44: }
45:
46:
47: /**
48: * Return interrupt number (1 - 7), -1 means no interrupt.
49: * Note that the interrupt stays pending if it can't be executed yet
50: * due to the interrupt level field in the SR.
51: */
52: int intlev(void)
53: {
54: /* There are only VBL and HBL autovector interrupts in the ST... */
55: assert((pendingInterrupts & ~((1<<4)|(1<<2))) == 0);
56:
57: if (pendingInterrupts & (1 << 4)) /* VBL interrupt? */
58: {
59: if (regs.intmask < 4)
60: pendingInterrupts &= ~(1 << 4);
61: return 4;
62: }
63: else if (pendingInterrupts & (1 << 2)) /* HBL interrupt? */
64: {
65: if (regs.intmask < 2)
66: pendingInterrupts &= ~(1 << 2);
67: return 2;
68: }
69:
70: return -1;
71: }
72:
73:
74: /**
75: * Initialize 680x0 emulation
76: */
77: int Init680x0(void)
78: {
79: currprefs.cpu_level = changed_prefs.cpu_level = ConfigureParams.System.nCpuLevel;
80: currprefs.cpu_compatible = changed_prefs.cpu_compatible = ConfigureParams.System.bCompatibleCpu;
81: currprefs.address_space_24 = changed_prefs.address_space_24 = false;
82:
83: init_m68k();
84:
85: return true;
86: }
87:
88:
89: /**
90: * Deinitialize 680x0 emulation
91: */
92: void Exit680x0(void)
93: {
94: memory_uninit();
95:
96: free(table68k);
97: table68k = NULL;
98: }
99:
100:
101: /**
102: * Check if the CPU type has been changed
103: */
104: void check_prefs_changed_cpu(void)
105: {
106: if (currprefs.cpu_level != changed_prefs.cpu_level
107: || currprefs.cpu_compatible != changed_prefs.cpu_compatible)
108: {
109: currprefs.cpu_level = changed_prefs.cpu_level;
110: currprefs.cpu_compatible = changed_prefs.cpu_compatible;
111: set_special(SPCFLAG_MODE_CHANGE);
112: build_cpufunctbl ();
113: }
114: }
115:
116:
117:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.