This commit is contained in:
julianb0 2019-06-08 09:36:28 +02:00
parent 10beb59a31
commit c667bd23fc
No known key found for this signature in database
GPG Key ID: DDF8325C95299A62
2 changed files with 7 additions and 31 deletions

View File

@ -34,7 +34,7 @@ void decode(ctx_t *ctx)
acc_t p1 = { 0 }; acc_t p1 = { 0 };
acc_t p2 = { 0 }; acc_t p2 = { 0 };
bool rep = 0 bool rep = 0;
uint cond = 0; uint cond = 0;
bool lock, nomore; bool lock, nomore;
@ -228,7 +228,7 @@ void extract_param(ctx_t *ctx, acc_t *p, uchar fmt)
imm2 = ctx->get(ctx); imm2 = ctx->get(ctx);
} }
p->addr = R(reg1) + R(reg2) * imm1 + imm2; p->addr = R(reg1) + R(reg2) * imm1 + (long)imm2;
break; break;
@ -248,6 +248,8 @@ static bool eval_cond(ctx_t *ctx, uint cond)
switch (cond) switch (cond)
{ {
case CD_NONE: ok = 1; break;
case CD_C: ok = flg&CF; break; case CD_C: ok = flg&CF; break;
case CD_O: ok = flg&OF; break; case CD_O: ok = flg&OF; break;
case CD_Z: ok = flg&ZF; break; case CD_Z: ok = flg&ZF; break;
@ -358,10 +360,7 @@ void exec_instr(
// Debugging // Debugging
dump_instr(ctx, in, p1, p2, lock, rep, cond, pc); dump_instr(ctx, in, p1, p2, lock, rep, cond, pc);
if (rep && !cond)
cond = CD_CXZ;
do_rep: do_rep:
if (!eval_cond(ctx, cond)) if (!eval_cond(ctx, cond))
@ -384,11 +383,9 @@ do_rep:
} }
} }
if (rep) if (rep && rcx > 0)
{ {
if (cond == CD_CXZ) rcx--;
rcx--;
goto do_rep; goto do_rep;
} }
} }

View File

@ -93,24 +93,3 @@ void extract_param(ctx_t *ctx,
acc_t *p, acc_t *p,
uchar fmt); uchar fmt);