|
|
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"
1.1.1.3 ! root 18: #include "sysReg.h"
1.1 root 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: int pendingInterrupts = 0;
30:
31:
32: /**
33: * Reset custom chips
34: */
35: void customreset(void)
36: {
37: pendingInterrupts = 0;
38:
39: /* In case the 6301 was executing a custom program from its RAM */
40: /* we must turn it back to the 'normal' mode. */
41: // IKBD_Reset_ExeMode ();
42:
43: /* Reseting the GLUE video chip should also set freq/res register to 0 */
44: Video_Reset_Glue ();
45: }
46:
47:
48: /**
1.1.1.3 ! root 49: * Return interrupt number (1 - 7), 0 means no interrupt.
1.1 root 50: * Note that the interrupt stays pending if it can't be executed yet
51: * due to the interrupt level field in the SR.
52: */
53: int intlev(void)
54: {
1.1.1.3 ! root 55: /* Poll interrupt level from interrupt status and mask registers
! 56: * --> see sysReg.c
! 57: */
! 58: return get_interrupt_level();
1.1 root 59: }
60:
61: /**
62: * Initialize 680x0 emulation
63: */
64: int Init680x0(void)
65: {
66: currprefs.cpu_level = changed_prefs.cpu_level = ConfigureParams.System.nCpuLevel;
67:
68: switch (currprefs.cpu_level) {
69: case 0 : currprefs.cpu_model = 68000; break;
70: case 1 : currprefs.cpu_model = 68010; break;
71: case 2 : currprefs.cpu_model = 68020; break;
72: case 3 : currprefs.cpu_model = 68030; break;
73: case 4 : currprefs.cpu_model = 68040; break;
74: case 5 : currprefs.cpu_model = 68060; break;
75: default: fprintf (stderr, "Init680x0() : Error, cpu_level unknown\n");
76: }
1.1.1.3 ! root 77:
! 78: currprefs.fpu_model = changed_prefs.fpu_model = ConfigureParams.System.n_FPUType;
! 79: switch (currprefs.fpu_model) {
! 80: case 68881: currprefs.fpu_revision = 0x1f; break;
! 81: case 68882: currprefs.fpu_revision = 0x20; break;
! 82: case 68040:
! 83: if (ConfigureParams.System.bTurbo)
! 84: currprefs.fpu_revision = 0x41;
! 85: else
! 86: currprefs.fpu_revision = 0x40;
! 87: break;
! 88: default: fprintf (stderr, "Init680x0() : Error, fpu_model unknown\n");
! 89: }
1.1 root 90:
91: currprefs.cpu_compatible = changed_prefs.cpu_compatible = ConfigureParams.System.bCompatibleCpu;
92: currprefs.address_space_24 = changed_prefs.address_space_24 = ConfigureParams.System.bAddressSpace24;
93: currprefs.cpu_cycle_exact = changed_prefs.cpu_cycle_exact = ConfigureParams.System.bCycleExactCpu;
94: currprefs.fpu_strict = changed_prefs.fpu_strict = ConfigureParams.System.bCompatibleFPU;
1.1.1.3 ! root 95: currprefs.mmu_model = changed_prefs.mmu_model = ConfigureParams.System.bMMU?changed_prefs.cpu_model:0;
! 96:
1.1.1.2 root 97: write_log("Init680x0() called\n");
1.1 root 98:
99: init_m68k();
100:
101: return true;
102: }
103:
104:
105: /**
106: * Deinitialize 680x0 emulation
107: */
108: void Exit680x0(void)
109: {
110: memory_uninit();
111:
112: free(table68k);
113: table68k = NULL;
114: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.