comparison m68k_core_x86.c @ 834:65f9041b5f17

Implemented nbcd
author Michael Pavone <pavone@retrodev.com>
date Wed, 21 Oct 2015 23:31:17 -0700
parents 841e44c5af83
children f2cd380adebe
comparison
equal deleted inserted replaced
833:841e44c5af83 834:65f9041b5f17
1371 } 1371 }
1372 1372
1373 void translate_m68k_abcd_sbcd(m68k_options *opts, m68kinst *inst, host_ea *src_op, host_ea *dst_op) 1373 void translate_m68k_abcd_sbcd(m68k_options *opts, m68kinst *inst, host_ea *src_op, host_ea *dst_op)
1374 { 1374 {
1375 code_info *code = &opts->gen.code; 1375 code_info *code = &opts->gen.code;
1376 if (src_op->base != opts->gen.scratch2) { 1376 if (inst->op == M68K_NBCD) {
1377 if (src_op->mode == MODE_REG_DIRECT) { 1377 if (dst_op->base != opts->gen.scratch2) {
1378 mov_rr(code, src_op->base, opts->gen.scratch2, SZ_B); 1378 if (dst_op->mode == MODE_REG_DIRECT) {
1379 } else { 1379 mov_rr(code, dst_op->base, opts->gen.scratch2, SZ_B);
1380 mov_rdispr(code, src_op->base, src_op->disp, opts->gen.scratch2, SZ_B); 1380 } else {
1381 } 1381 mov_rdispr(code, dst_op->base, dst_op->disp, opts->gen.scratch2, SZ_B);
1382 } 1382 }
1383 if (dst_op->base != opts->gen.scratch1) { 1383 }
1384 if (dst_op->mode == MODE_REG_DIRECT) { 1384 xor_rr(code, opts->gen.scratch1, opts->gen.scratch1, SZ_B);
1385 mov_rr(code, dst_op->base, opts->gen.scratch1, SZ_B); 1385 } else {
1386 } else { 1386 if (src_op->base != opts->gen.scratch2) {
1387 mov_rdispr(code, dst_op->base, dst_op->disp, opts->gen.scratch1, SZ_B); 1387 if (src_op->mode == MODE_REG_DIRECT) {
1388 mov_rr(code, src_op->base, opts->gen.scratch2, SZ_B);
1389 } else {
1390 mov_rdispr(code, src_op->base, src_op->disp, opts->gen.scratch2, SZ_B);
1391 }
1392 }
1393 if (dst_op->base != opts->gen.scratch1) {
1394 if (dst_op->mode == MODE_REG_DIRECT) {
1395 mov_rr(code, dst_op->base, opts->gen.scratch1, SZ_B);
1396 } else {
1397 mov_rdispr(code, dst_op->base, dst_op->disp, opts->gen.scratch1, SZ_B);
1398 }
1388 } 1399 }
1389 } 1400 }
1390 uint8_t other_reg; 1401 uint8_t other_reg;
1391 //WARNING: This may need adjustment if register assignments change 1402 //WARNING: This may need adjustment if register assignments change
1392 if (opts->gen.scratch2 > RBX) { 1403 if (opts->gen.scratch2 > RBX) {