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->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;
break;

View File

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