|
|
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 "video.h"
18: #include "sysReg.h"
19:
20: #include "sysdeps.h"
21: #include "maccess.h"
22: #include "memory.h"
23: #include "newcpu.h"
24: #include "hatari-glue.h"
25:
26:
27: struct uae_prefs currprefs, changed_prefs;
28:
29:
30:
31: /**
32: * Return interrupt number (1 - 7), 0 means no interrupt.
33: * Note that the interrupt stays pending if it can't be executed yet
34: * due to the interrupt level field in the SR.
35: */
36: int intlev(void) {
37: /* Poll interrupt level from interrupt status and mask registers
38: * --> see sysReg.c
39: */
40: return get_interrupt_level();
41: }
42:
43: /**
44: * Initialize 680x0 emulation
45: */
46: int Init680x0(void) {
47: currprefs.cpu_level = changed_prefs.cpu_level = ConfigureParams.System.nCpuLevel;
48:
49: switch (currprefs.cpu_level) {
50: case 3 : currprefs.cpu_model = 68030; break;
51: case 4 : currprefs.cpu_model = 68040; break;
52: default: fprintf (stderr, "Init680x0() : Error, cpu_level not supported (%i)\n",currprefs.cpu_model);
53: }
54:
55: currprefs.fpu_model = changed_prefs.fpu_model = ConfigureParams.System.n_FPUType;
56: switch (currprefs.fpu_model) {
57: case 68881: currprefs.fpu_revision = 0x1f; break;
58: case 68882: currprefs.fpu_revision = 0x20; break;
59: case 68040:
60: if (ConfigureParams.System.bTurbo)
61: currprefs.fpu_revision = 0x41;
62: else
63: currprefs.fpu_revision = 0x40;
64: break;
65: default: fprintf (stderr, "Init680x0() : Error, fpu_model unknown\n");
66: }
67:
68: currprefs.cpu_compatible = changed_prefs.cpu_compatible = ConfigureParams.System.bCompatibleCpu;
69: currprefs.fpu_strict = changed_prefs.fpu_strict = ConfigureParams.System.bCompatibleFPU;
70: currprefs.mmu_model = changed_prefs.mmu_model = ConfigureParams.System.bMMU?changed_prefs.cpu_model:0;
71:
72: write_log("Init680x0() called\n");
73:
74: init_m68k();
75:
76: return true;
77: }
78:
79:
80: /**
81: * Deinitialize 680x0 emulation
82: */
83: void Exit680x0(void)
84: {
85: memory_uninit();
86:
87: free(table68k);
88: table68k = NULL;
89: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.