--- hatari/src/uae-cpu/hatari-glue.c 2019/04/09 08:47:23 1.1.1.14 +++ hatari/src/uae-cpu/hatari-glue.c 2019/04/09 08:50:33 1.1.1.17 @@ -12,20 +12,23 @@ const char HatariGlue_fileid[] = "Hatari #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 "main.h" +#include "configuration.h" +#include "cycInt.h" +#include "tos.h" +#include "gemdos.h" +#include "cart.h" +#include "vdi.h" +#include "stMemory.h" +#include "ikbd.h" +#include "screen.h" +#include "video.h" +#include "psg.h" #include "sysdeps.h" #include "maccess.h" #include "memory.h" +#include "m68000.h" #include "newcpu.h" #include "hatari-glue.h" @@ -48,6 +51,9 @@ void customreset(void) /* Reseting the GLUE video chip should also set freq/res register to 0 */ Video_Reset_Glue (); + + /* Reset the YM2149 (stop any sound) */ + PSG_Reset (); } @@ -170,11 +176,22 @@ unsigned long OpCode_GemDos(uae_u32 opco */ unsigned long OpCode_VDI(uae_u32 opcode) { - VDI_Complete(); + Uint32 pc = M68000_GetPC(); - /* Set PC back to where originated from to continue instruction decoding */ - m68k_setpc(VDI_OldPC); + /* this is valid only after VDI trap, called from cartridge code */ + if (VDI_OldPC && pc >= 0xfa0000 && pc < 0xfc0000) + { + VDI_Complete(); + /* Set PC back to where originated from to continue instruction decoding */ + m68k_setpc(VDI_OldPC); + VDI_OldPC = 0; + } + else + { + /* illegal instruction */ + op_illg(opcode); + } fill_prefetch_0(); return 4; }