comparison 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
comparison
equal deleted inserted replaced
978:34b811ea1e7c 979:771875b5f519
69 call(&opts->gen.code, opts->read_32); 69 call(&opts->gen.code, opts->read_32);
70 break; 70 break;
71 } 71 }
72 } 72 }
73 73
74 void m68k_write_size(m68k_options *opts, uint8_t size) 74 void m68k_write_size(m68k_options *opts, uint8_t size, uint8_t lowfirst)
75 { 75 {
76 switch (size) 76 switch (size)
77 { 77 {
78 case OPSIZE_BYTE: 78 case OPSIZE_BYTE:
79 call(&opts->gen.code, opts->write_8); 79 call(&opts->gen.code, opts->write_8);
80 break; 80 break;
81 case OPSIZE_WORD: 81 case OPSIZE_WORD:
82 call(&opts->gen.code, opts->write_16); 82 call(&opts->gen.code, opts->write_16);
83 break; 83 break;
84 case OPSIZE_LONG: 84 case OPSIZE_LONG:
85 call(&opts->gen.code, opts->write_32_highfirst); 85 if (lowfirst) {
86 call(&opts->gen.code, opts->write_32_lowfirst);
87 } else {
88 call(&opts->gen.code, opts->write_32_highfirst);
89 }
86 break; 90 break;
87 } 91 }
88 } 92 }
89 93
90 void m68k_save_result(m68kinst * inst, m68k_options * opts) 94 void m68k_save_result(m68kinst * inst, m68k_options * opts)
91 { 95 {
92 code_info *code = &opts->gen.code;
93 if (inst->dst.addr_mode != MODE_REG && inst->dst.addr_mode != MODE_AREG && inst->dst.addr_mode != MODE_UNUSED) { 96 if (inst->dst.addr_mode != MODE_REG && inst->dst.addr_mode != MODE_AREG && inst->dst.addr_mode != MODE_UNUSED) {
94 if (inst->dst.addr_mode == MODE_AREG_PREDEC && inst->src.addr_mode == MODE_AREG_PREDEC && inst->op != M68K_MOVE) { 97 if (inst->dst.addr_mode == MODE_AREG_PREDEC && inst->src.addr_mode == MODE_AREG_PREDEC && inst->op != M68K_MOVE) {
95 areg_to_native(opts, inst->dst.params.regs.pri, opts->gen.scratch2); 98 areg_to_native(opts, inst->dst.params.regs.pri, opts->gen.scratch2);
96 } 99 }
97 switch (inst->extra.size) 100 m68k_write_size(opts, inst->extra.size, 1);
98 {
99 case OPSIZE_BYTE:
100 call(code, opts->write_8);
101 break;
102 case OPSIZE_WORD:
103 call(code, opts->write_16);
104 break;
105 case OPSIZE_LONG:
106 call(code, opts->write_32_lowfirst);
107 break;
108 }
109 } 101 }
110 } 102 }
111 103
112 void translate_m68k_lea_pea(m68k_options * opts, m68kinst * inst) 104 void translate_m68k_lea_pea(m68k_options * opts, m68kinst * inst)
113 { 105 {