comparison backend_x86.c @ 756:e1dc98f7ed9f

Preserve scratch2 when using it as a temporary in memory read functions. This fixes a bunch of issues with the Z80 core and possibly some issues with the 68K core as well
author Michael Pavone <pavone@retrodev.com>
date Sat, 27 Jun 2015 13:18:55 -0700
parents 59b499f6b24f
children 656b1fded67f
comparison
equal deleted inserted replaced
755:7306b3967c51 756:e1dc98f7ed9f
169 mov_ir(code, (intptr_t)memmap[chunk].buffer, opts->scratch1, SZ_PTR); 169 mov_ir(code, (intptr_t)memmap[chunk].buffer, opts->scratch1, SZ_PTR);
170 add_rr(code, opts->scratch1, opts->scratch2, SZ_PTR); 170 add_rr(code, opts->scratch1, opts->scratch2, SZ_PTR);
171 pop_r(code, opts->scratch1); 171 pop_r(code, opts->scratch1);
172 mov_rrind(code, opts->scratch1, opts->scratch2, tmp_size); 172 mov_rrind(code, opts->scratch1, opts->scratch2, tmp_size);
173 } else { 173 } else {
174 push_r(code, opts->scratch2);
174 mov_ir(code, (intptr_t)memmap[chunk].buffer, opts->scratch2, SZ_PTR); 175 mov_ir(code, (intptr_t)memmap[chunk].buffer, opts->scratch2, SZ_PTR);
175 mov_rindexr(code, opts->scratch2, opts->scratch1, 1, opts->scratch1, tmp_size); 176 mov_rindexr(code, opts->scratch2, opts->scratch1, 1, opts->scratch1, tmp_size);
177 pop_r(code, opts->scratch2);
176 } 178 }
177 } 179 }
178 if (size != tmp_size && !is_write) { 180 if (size != tmp_size && !is_write) {
179 if (memmap[chunk].flags & MMAP_ONLY_EVEN) { 181 if (memmap[chunk].flags & MMAP_ONLY_EVEN) {
180 shl_ir(code, 8, opts->scratch1, SZ_W); 182 shl_ir(code, 8, opts->scratch1, SZ_W);