--- hatari/src/uae-cpu/hatari-glue.c 2019/04/09 08:48:48 1.1.1.15 +++ hatari/src/uae-cpu/hatari-glue.c 2019/04/09 08:50:33 1.1.1.17 @@ -21,11 +21,14 @@ const char HatariGlue_fileid[] = "Hatari #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; }