From 0f42aa719da7ba1e3fa6d093f3ea8cda2c25b3f9 Mon Sep 17 00:00:00 2001 From: Michael Snyder Date: Fri, 18 Jul 2003 00:08:23 +0000 Subject: [PATCH] 2003-07-17 Michael Snyder * compile.c (decode): IMM16 is always zero-extended. --- sim/h8300/ChangeLog | 4 ++++ sim/h8300/compile.c | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/sim/h8300/ChangeLog b/sim/h8300/ChangeLog index 2112ad9..77cb912 100644 --- a/sim/h8300/ChangeLog +++ b/sim/h8300/ChangeLog @@ -1,3 +1,7 @@ +2003-07-17 Michael Snyder + + * compile.c (decode): IMM16 is always zero-extended. + 2003-06-24 Michael Snyder * sim-main.h (SIM_WIFSTOPPED, SIM_WSTOPSIG): Define. diff --git a/sim/h8300/compile.c b/sim/h8300/compile.c index 7635655..3819fdd 100644 --- a/sim/h8300/compile.c +++ b/sim/h8300/compile.c @@ -818,7 +818,9 @@ decode (SIM_DESC sd, int addr, unsigned char *data, decoded_inst *dst) (looking_for & SIZE) == L_16U) { cst[opnum] = (data[len / 2] << 8) + data[len / 2 + 1]; - if ((looking_for & SIZE) != L_16U) + /* Immediates are always unsigned. */ + if ((looking_for & SIZE) != L_16U && + (looking_for & MODE) != IMM) cst[opnum] = (short) cst[opnum]; /* Sign extend. */ } else if (looking_for & ABSJMP) -- 2.7.4