--- hatari/src/uae-cpu/hatari-glue.c 2019/04/09 08:49:40 1.1.1.16 +++ hatari/src/uae-cpu/hatari-glue.c 2019/04/09 08:50:33 1.1.1.17 @@ -23,10 +23,12 @@ const char HatariGlue_fileid[] = "Hatari #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" @@ -49,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 (); } @@ -171,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; }