From 4a016f2b4b82cdc3b1fb9b5c143ff473ed66becc Mon Sep 17 00:00:00 2001 From: Sjoerd van der Berg Date: Sun, 11 Jan 2004 12:31:12 +0000 Subject: [PATCH] Set and use the global direction flag variable Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@1563 --- src/cpu/core_full/load.h | 2 ++ src/cpu/core_full/string.h | 2 +- src/cpu/core_normal/prefix_none.h | 2 ++ src/cpu/core_normal/string.h | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/cpu/core_full/load.h b/src/cpu/core_full/load.h index 8bcf8744..ab38c4d5 100644 --- a/src/cpu/core_full/load.h +++ b/src/cpu/core_full/load.h @@ -404,9 +404,11 @@ l_M_Ed: goto nextopcode; case D_CLD: SETFLAGBIT(DF,false); + cpu.direction=1; goto nextopcode; case D_STD: SETFLAGBIT(DF,true); + cpu.direction=-1; goto nextopcode; case D_WAIT: case D_NOP: diff --git a/src/cpu/core_full/string.h b/src/cpu/core_full/string.h index 95ce58f6..ea4e5e91 100644 --- a/src/cpu/core_full/string.h +++ b/src/cpu/core_full/string.h @@ -34,7 +34,7 @@ count_left=0; } } - add_index=GETFLAG(DF) ? -1 : 1; + add_index=cpu.direction; if (count) switch (inst.code.op) { case R_OUTSB: for (;count>0;count--) { diff --git a/src/cpu/core_normal/prefix_none.h b/src/cpu/core_normal/prefix_none.h index 7d9fc2be..99df7d44 100644 --- a/src/cpu/core_normal/prefix_none.h +++ b/src/cpu/core_normal/prefix_none.h @@ -1064,9 +1064,11 @@ break; CASE_B(0xfc) /* CLD */ SETFLAGBIT(DF,false); + cpu.direction=1; break; CASE_B(0xfd) /* STD */ SETFLAGBIT(DF,true); + cpu.direction=-1; break; CASE_B(0xfe) /* GRP4 Eb */ { diff --git a/src/cpu/core_normal/string.h b/src/cpu/core_normal/string.h index 00d70c0c..c2f3013e 100644 --- a/src/cpu/core_normal/string.h +++ b/src/cpu/core_normal/string.h @@ -46,7 +46,7 @@ static void DoString(STRING_OP type) { count_left=0; } } - add_index=GETFLAG(DF) ? -1 : 1; + add_index=cpu.direction; if (count) switch (type) { case R_OUTSB: for (;count>0;count--) {