gnusim8085-devel team mailing list archive
-
gnusim8085-devel team
-
Mailing list archive
-
Message #00199
[Bug 579320] Re: CMP flags not working like SUB with signed numbers
- Log -----------------------------------------------------------------
commit 5d0aafb931d03d7487accdb0d2d331e105a8d68b
Author: Aanjhan Ranganathan <aanjhan@xxxxxxxxx>
Date: Fri Sep 24 23:16:30 2010 +0200
Fixes bug LP: #579320. See change log file for details.
diff --git a/ChangeLog b/ChangeLog
index 7681e26..6c5783b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2010-09-24 Aanjhan Ranganathan <aanjhan@xxxxxxxxxxxxx>
+ * src/8085-instructions.c: CMP instruction should not check and
+ set S, P and AC flags as there is no result that is computed. It
+ affects only C and Z flags. Hence removed most code in that
+ function. Fixes bug LP: #579320.
+
* src/8085-instructions.c: Fixed the long standing DAA
bug. Followed http://www.ray.masmcode.com/BCDdaa.html plus had to
ensure the addition operation on the accumulator must be done
diff --git a/src/8085-instructions.c b/src/8085-instructions.c
index 4c5c042..157e0ad 100644
--- a/src/8085-instructions.c
+++ b/src/8085-instructions.c
@@ -502,19 +502,16 @@ _eef_inst_func_xra (eef_addr_t opnd_addr, gchar sec)
static gint
_eef_inst_func_cmp_i (eef_addr_t opnd_addr, eef_data_t data)
{
- _eef_find_and_set_flags (sys.reg.a);
-
- sys.flag.s = (sys.reg.a < data);
-
- _eef_flag_check_and_set_aux_c (sys.reg.a, data, '-');
+ /* Since this is just comparison, there is no "result"
+ that affects the S, P and AC flags is present. Hence
+ no need to check and set flags */
if (sys.reg.a < data)
- sys.flag.c = 1, sys.flag.z = 0;
+ sys.flag.c = 1, sys.flag.z = 0;
else if (sys.reg.a > data)
- sys.flag.c = 0, sys.flag.z = 0;
+ sys.flag.c = 0, sys.flag.z = 0;
else
- sys.flag.c = 0, sys.flag.z = 1;
-
+ sys.flag.c = 0, sys.flag.z = 1;
return 0;
}
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 5 +++++
src/8085-instructions.c | 15 ++++++---------
2 files changed, 11 insertions(+), 9 deletions(-)
** Changed in: gnusim8085
Status: New => Fix Committed
** Changed in: gnusim8085
Assignee: Aanjhan Ranganathan (aanjhan) => Onkar Shinde (onkarshinde)
--
CMP flags not working like SUB with signed numbers
https://bugs.launchpad.net/bugs/579320
You received this bug notification because you are a member of
GNUSim8085 developers, which is subscribed to gnusim8085.
Status in gnusim8085: Fix Committed
Bug description:
MVI A,001h
MVI B,0FEh
CMP B
SUB B
flags after CMP not the same as SUB.