--- hatari/src/uae-cpu/hatari-glue.c 2019/04/01 07:13:11 1.1.1.10 +++ hatari/src/uae-cpu/hatari-glue.c 2019/04/01 07:15:36 1.1.1.13 @@ -7,18 +7,21 @@ This file contains some code to glue the UAE CPU core to the rest of the emulator and Hatari's "illegal" opcodes. */ -const char HatariGlue_rcsid[] = "Hatari $Id: hatari-glue.c,v 1.1.1.10 2019/04/01 07:13:11 root Exp $"; +const char HatariGlue_fileid[] = "Hatari hatari-glue.c : " __DATE__ " " __TIME__; #include #include "../includes/main.h" +#include "../includes/configuration.h" #include "../includes/int.h" #include "../includes/tos.h" #include "../includes/gemdos.h" #include "../includes/cart.h" #include "../includes/vdi.h" #include "../includes/stMemory.h" +#include "../includes/ikbd.h" +#include "../includes/video.h" #include "sysdeps.h" #include "maccess.h" @@ -32,10 +35,7 @@ const char HatariGlue_rcsid[] = "Hatari #endif -int illegal_mem = TRUE; -int address_space_24 = TRUE; -int cpu_level = 0; /* 68000 (default) */ -int cpu_compatible = FALSE; +struct uae_prefs currprefs, changed_prefs; int pendingInterrupts = 0; @@ -44,6 +44,13 @@ int pendingInterrupts = 0; void customreset(void) { pendingInterrupts = 0; + + /* In case the 6301 was executing a custom program from its RAM */ + /* we must turn it back to the 'normal' mode. */ + IKBD_Reset_ExeMode (); + + /* Reseting the GLUE video chip should also set freq/res register to 0 */ + Video_Reset_Glue (); } @@ -75,7 +82,9 @@ int intlev(void) /* Initialize 680x0 emulation */ int Init680x0(void) { - /* Note: memory_init() is now done in tos.c */ + currprefs.cpu_level = changed_prefs.cpu_level = ConfigureParams.System.nCpuLevel; + currprefs.cpu_compatible = changed_prefs.cpu_compatible = ConfigureParams.System.bCompatibleCpu; + currprefs.address_space_24 = changed_prefs.address_space_24 = TRUE; init_m68k(); return TRUE; @@ -92,24 +101,16 @@ void Exit680x0(void) } -/* Reset and start 680x0 emulation */ -void Start680x0(void) -{ - m68k_reset(); - m68k_go(TRUE); -} - - /* Check if the CPU type has been changed */ -void check_prefs_changed_cpu(int new_level, int new_compatible) +void check_prefs_changed_cpu(void) { - if(cpu_level!=new_level || cpu_compatible!=new_compatible) + if (currprefs.cpu_level != changed_prefs.cpu_level + || currprefs.cpu_compatible != changed_prefs.cpu_compatible) { - cpu_level = new_level; - cpu_compatible = new_compatible; + currprefs.cpu_level = changed_prefs.cpu_level; + currprefs.cpu_compatible = changed_prefs.cpu_compatible; set_special(SPCFLAG_MODE_CHANGE); - if (table68k) - build_cpufunctbl (); + build_cpufunctbl (); } } @@ -132,11 +133,10 @@ unsigned long OpCode_SysInit(uae_u32 opc /* Init on boot - see cart.c */ GemDOS_Boot(); - /* We use this to get pointer to Line-A structure details - * (to fix for extended VDI res) */ - LineABase = regs.regs[0]; /* D0 */ - FontBase = regs.regs[9]; /* A1 */ - VDI_LineA(); + /* Update LineA for extended VDI res + * D0: LineA base, A1: Font base + */ + VDI_LineA(regs.regs[0], regs.regs[9]); } m68k_incpc(2);