mirror of
https://gitlab.os-k.eu/os-k-team/kvisc.git
synced 2023-08-25 14:05:46 +02:00
dump
This commit is contained in:
parent
b8d29210fb
commit
16a46dd8e7
@ -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;
|
||||
|
31
vm/pc/dump.c
31
vm/pc/dump.c
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user