From e91fbebe3d5560373a3e069a66dbe2eed5850a57 Mon Sep 17 00:00:00 2001 From: "Howard M. Harte" Date: Sat, 5 Nov 2022 19:55:40 -0700 Subject: [PATCH] AltairZ80: i86: Don't clear segment override on REPE/REPNE MASM generates REP CS:MOVSW as: REP CS: MOVSW The Seattle Computer Products 8086 assembler allows the segment override as a discrete opcode. This means that: CS: REP MOVSW is also possible, and in fact used in the SCP Monitor v1.6. The i86 emulator was clearing the override flags when REPE/REPNE, is encountered, which causes the segment override to be lost. Verifying the behavior of a real 80286 processor in an IBM PC/AT (5170) using MS-DOS 6.22 DEBUG shows that both instruction sequences yield the desired segment override. --- AltairZ80/i86_ops.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/AltairZ80/i86_ops.c b/AltairZ80/i86_ops.c index de2b8fab..f652b237 100644 --- a/AltairZ80/i86_ops.c +++ b/AltairZ80/i86_ops.c @@ -4321,14 +4321,12 @@ static void i86op_lock(PC_ENV *m) static void i86op_repne(PC_ENV *m) { m->sysmode |= SYSMODE_PREFIX_REPNE; - DECODE_CLEAR_SEGOVR(m); } /*opcode=0xf3*/ static void i86op_repe(PC_ENV *m) { m->sysmode |= SYSMODE_PREFIX_REPE; - DECODE_CLEAR_SEGOVR(m); } /*opcode=0xf4*/