Mercurial > repos > blastem
diff m68k_core.c @ 979:771875b5f519
Fix order of writes for move.l with a predec destination
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 24 Apr 2016 00:22:38 -0700 |
parents | 6011409ded0d |
children | 902c53d9c16f |
line wrap: on
line diff
--- a/m68k_core.c Sat Apr 23 18:14:01 2016 -0700 +++ b/m68k_core.c Sun Apr 24 00:22:38 2016 -0700 @@ -71,7 +71,7 @@ } } -void m68k_write_size(m68k_options *opts, uint8_t size) +void m68k_write_size(m68k_options *opts, uint8_t size, uint8_t lowfirst) { switch (size) { @@ -82,30 +82,22 @@ call(&opts->gen.code, opts->write_16); break; case OPSIZE_LONG: - call(&opts->gen.code, opts->write_32_highfirst); + if (lowfirst) { + call(&opts->gen.code, opts->write_32_lowfirst); + } else { + call(&opts->gen.code, opts->write_32_highfirst); + } break; } } void m68k_save_result(m68kinst * inst, m68k_options * opts) { - code_info *code = &opts->gen.code; if (inst->dst.addr_mode != MODE_REG && inst->dst.addr_mode != MODE_AREG && inst->dst.addr_mode != MODE_UNUSED) { if (inst->dst.addr_mode == MODE_AREG_PREDEC && inst->src.addr_mode == MODE_AREG_PREDEC && inst->op != M68K_MOVE) { areg_to_native(opts, inst->dst.params.regs.pri, opts->gen.scratch2); } - switch (inst->extra.size) - { - case OPSIZE_BYTE: - call(code, opts->write_8); - break; - case OPSIZE_WORD: - call(code, opts->write_16); - break; - case OPSIZE_LONG: - call(code, opts->write_32_lowfirst); - break; - } + m68k_write_size(opts, inst->extra.size, 1); } }