diff --git a/as/k-as.py b/as/k-as.py index 882c9ae..b286956 100755 --- a/as/k-as.py +++ b/as/k-as.py @@ -674,8 +674,8 @@ special_syms = { def gentext(): instrs.seek(0) - print(instrs.read()) - instrs.seek(0) + # print(instrs.read()) + # instrs.seek(0) text_start = 0x100000 data_start = text_start + ptext diff --git a/ka/main.k b/ka/main.k index 3ab7a19..b44b2a7 100644 --- a/ka/main.k +++ b/ka/main.k @@ -26,7 +26,7 @@ main: mov rsi, 0x10 mov rdi, 8 - lea rbi, b[rsi + rdi + 1] + lea rbi, b[rdi + rsi * 2 + 1] leave ret diff --git a/vm/pc/decd.c b/vm/pc/decd.c index fa7aacc..4996072 100644 --- a/vm/pc/decd.c +++ b/vm/pc/decd.c @@ -239,7 +239,7 @@ void extract_param(ctx_t *ctx, acc_t *p, uchar fmt) p->imm2 = 0; } - p->addr = R(p->reg1) + R(p->reg2) * p->imm1 + (long)p->imm2; + p->addr = R(p->reg1) + R(p->reg2) * p->imm1 + p->imm2; break; diff --git a/vm/pc/dump.c b/vm/pc/dump.c index d6ac475..c6b3407 100644 --- a/vm/pc/dump.c +++ b/vm/pc/dump.c @@ -43,21 +43,21 @@ static void dump_acc(ctx_t *ctx, acc_t *p) else if (mfmt == AM_RRI) { if (p->reg1 && p->reg2) - log("%s+%s+%lX]", ctx->r[p->reg1].name, - ctx->r[p->reg2].name, p->imm2); + log("%s+%s+%hd]", ctx->r[p->reg1].name, + ctx->r[p->reg2].name, p->imm2); - else log("%s+%lX]", ctx->r[p->reg1 ? p->reg1 : p->reg2].name, p->imm2); + else log("%s+%d]", ctx->r[p->reg1 ? p->reg1 : p->reg2].name, p->imm2); } else if (mfmt == AM_RRII) { if (p->reg1) - log("%s+%s*0x%x+0x%x]", + log("%s+%s*%u+%hd]", ctx->r[p->reg1].name, ctx->r[p->reg2].name, p->imm1, p->imm2); else - log("%s*0x%x+0x%x]", + log("%s*%u+%hd]", ctx->r[p->reg2].name, p->imm1, p->imm2); } @@ -80,7 +80,7 @@ void dump_instr( if (cond) { - log("c"); + log("."); if (cond & (1 << 4)) {