From a845a73f0a491f975116c5889a923a92bffce4a9 Mon Sep 17 00:00:00 2001 From: Allofich <19624336+Allofich@users.noreply.github.com> Date: Thu, 4 Nov 2021 12:54:32 +0900 Subject: [PATCH] Make 8086 treat 0x60-0x6F as 0x70-0x7F Also try to speed up emulation by only running checks in these opcodes for relevant cputypes. --- src/cpu/core_normal/prefix_none.h | 103 ++++++++++++++---- vs2015/log.txt | 171 ------------------------------ 2 files changed, 85 insertions(+), 189 deletions(-) delete mode 100644 vs2015/log.txt diff --git a/src/cpu/core_normal/prefix_none.h b/src/cpu/core_normal/prefix_none.h index 2ffff240d..feb788a17 100644 --- a/src/cpu/core_normal/prefix_none.h +++ b/src/cpu/core_normal/prefix_none.h @@ -233,7 +233,9 @@ CASE_W(0x5f) /* POP DI */ reg_di=Pop_16();break; CASE_W(0x60) /* PUSHA */ - if (CPU_ArchitectureType CPU_ARCHTYPE_286 { if ((reg_flags & FLAG_VM) || (!cpu.pmode)) goto illegal_opcode; GetRMrw; @@ -291,52 +306,104 @@ } } break; +#endif CASE_B(0x64) /* SEG FS: */ - if (CPU_ArchitectureType= CPU_ARCHTYPE_386 + DO_PREFIX_SEG(fs);break; +#endif + CASE_B(0x65) /* SEG GS: */ +#if CPU_CORE == CPU_ARCHTYPE_8086 + JumpCond16_b(TFLG_NZ); break; +#endif +#if CPU_CORE == CPU_ARCHTYPE_286 + goto illegal_opcode; +#endif +#if CPU_CORE >= CPU_ARCHTYPE_386 + DO_PREFIX_SEG(gs);break; +#endif + CASE_B(0x66) /* Operand Size Prefix (386+) */ +#if CPU_CORE == CPU_ARCHTYPE_8086 + JumpCond16_b(TFLG_BE); break; +#endif +#if CPU_CORE == CPU_ARCHTYPE_286 + goto illegal_opcode; +#endif +#if CPU_CORE >= CPU_ARCHTYPE_386 core.opcode_index=(cpu.code.big^0x1u)*0x200u; goto restart_opcode; #endif -#if CPU_CORE >= CPU_ARCHTYPE_386 CASE_B(0x67) /* Address Size Prefix (386+) */ +#if CPU_CORE == CPU_ARCHTYPE_8086 + JumpCond16_b(TFLG_NBE); break; +#endif +#if CPU_CORE == CPU_ARCHTYPE_286 + goto illegal_opcode; +#endif +#if CPU_CORE >= CPU_ARCHTYPE_386 DO_PREFIX_ADDR(); #endif CASE_W(0x68) /* PUSH Iw */ - if (CPU_ArchitectureType