This commit is contained in:
julianb0 2019-07-02 20:57:40 +02:00
parent b8d29210fb
commit 16a46dd8e7
No known key found for this signature in database
GPG Key ID: 9C7ACF0C053FB8A1
2 changed files with 22 additions and 12 deletions

View File

@ -135,7 +135,8 @@ void extract_param(ctx_t *ctx, acc_t *p, uchar fmt)
p->imm2 = 0; p->imm2 = 0;
} }
p->addr = R(p->reg1) + R(p->reg2) * p->imm1 p->addr = R(p->reg1) + R(p->reg2)
* (long)(short)p->imm1
+ (long)(short)p->imm2; + (long)(short)p->imm2;
break; break;

View File

@ -3,6 +3,8 @@
#include <pc/arch.h> #include <pc/arch.h>
#define ABS(x) ((short)(x) < 0 ? -x : x)
char *cond_suffixes[] = char *cond_suffixes[] =
{ {
"-", "-",
@ -115,24 +117,31 @@ void dump_acc(ctx_t *ctx, acc_t *p)
else if (mfmt == AM_RRI) else if (mfmt == AM_RRI)
{ {
if (p->reg1 && p->reg2) if (p->reg1 && p->reg2)
trace("%s+%s+%hd]", ctx->r[p->reg1].name, trace("%s+%s%c%hd]",
ctx->r[p->reg2].name, p->imm2); ctx->r[p->reg1].name,
ctx->r[p->reg2].name,
else trace("%s+%hd]", ((short)p->imm2 < 0 ? '-' : '+'),
ctx->r[p->reg1 ? p->reg1 : p->reg2].name, p->imm2); ABS(p->imm2));
else trace("%s%c%hd]",
ctx->r[p->reg1 ? p->reg1 : p->reg2].name,
((short)p->imm2 < 0 ? '-' : '+'),
ABS(p->imm2));
} }
else if (mfmt == AM_RRII) else if (mfmt == AM_RRII)
{ {
if (p->reg1) if (p->reg1)
trace("%s+%s*%u+%hd]", trace("%s+%s*%hd%c%hd]",
ctx->r[p->reg1].name, ctx->r[p->reg1].name,
ctx->r[p->reg2].name, ctx->r[p->reg2].name, p->imm1,
p->imm1, p->imm2); ((short)p->imm2 < 0 ? '-' : '+'),
ABS(p->imm2));
else else
trace("%s*%u+%hd]", trace("%s*%hd%c%hd]",
ctx->r[p->reg2].name, ctx->r[p->reg2].name, p->imm1,
p->imm1, p->imm2); ((short)p->imm2 < 0 ? '-' : '+'),
ABS(p->imm2));
} }
} }
} }