comparison m68k_to_x86.c @ 208:3457dc6fd558

Tweaks to make blastem compatible with m68k-tester
author Mike Pavone <pavone@retrodev.com>
date Sat, 26 Jan 2013 01:33:32 -0800
parents c82f65a87a53
children 922b59c09259
comparison
equal deleted inserted replaced
207:c82f65a87a53 208:3457dc6fd558
1 #include "gen_x86.h" 1 #include "gen_x86.h"
2 #include "m68k_to_x86.h" 2 #include "m68k_to_x86.h"
3 #include "68kinst.h"
3 #include "mem.h" 4 #include "mem.h"
4 #include <stdio.h> 5 #include <stdio.h>
5 #include <stddef.h> 6 #include <stddef.h>
6 #include <stdlib.h> 7 #include <stdlib.h>
7 #include <string.h> 8 #include <string.h>
2802 } else if(inst->op == M68K_SCC) { 2803 } else if(inst->op == M68K_SCC) {
2803 return translate_m68k_scc(dst, inst, opts); 2804 return translate_m68k_scc(dst, inst, opts);
2804 } else if(inst->op == M68K_MOVEP) { 2805 } else if(inst->op == M68K_MOVEP) {
2805 return translate_m68k_movep(dst, inst, opts); 2806 return translate_m68k_movep(dst, inst, opts);
2806 } else if(inst->op == M68K_INVALID) { 2807 } else if(inst->op == M68K_INVALID) {
2808 if (inst->src.params.immed == 0x7100) {
2809 return retn(dst);
2810 }
2807 dst = mov_ir(dst, inst->address, SCRATCH1, SZ_D); 2811 dst = mov_ir(dst, inst->address, SCRATCH1, SZ_D);
2808 return call(dst, (uint8_t *)m68k_invalid); 2812 return call(dst, (uint8_t *)m68k_invalid);
2809 } else if(inst->op == M68K_CMP) { 2813 } else if(inst->op == M68K_CMP) {
2810 return translate_m68k_cmp(dst, inst, opts); 2814 return translate_m68k_cmp(dst, inst, opts);
2811 } 2815 }
2960 } 2964 }
2961 } 2965 }
2962 break; 2966 break;
2963 case M68K_ASL: 2967 case M68K_ASL:
2964 case M68K_LSL: 2968 case M68K_LSL:
2965 //TODO: Check overflow flag behavior
2966 dst = translate_shift(dst, inst, &src_op, &dst_op, opts, shl_ir, shl_irdisp8, shl_clr, shl_clrdisp8, shr_ir, shr_irdisp8); 2969 dst = translate_shift(dst, inst, &src_op, &dst_op, opts, shl_ir, shl_irdisp8, shl_clr, shl_clrdisp8, shr_ir, shr_irdisp8);
2967 break; 2970 break;
2968 case M68K_ASR: 2971 case M68K_ASR:
2969 dst = translate_shift(dst, inst, &src_op, &dst_op, opts, sar_ir, sar_irdisp8, sar_clr, sar_clrdisp8, NULL, NULL); 2972 dst = translate_shift(dst, inst, &src_op, &dst_op, opts, sar_ir, sar_irdisp8, sar_clr, sar_clrdisp8, NULL, NULL);
2970 break; 2973 break;
3862 if (existing) { 3865 if (existing) {
3863 dst = jmp(dst, existing); 3866 dst = jmp(dst, existing);
3864 break; 3867 break;
3865 } 3868 }
3866 next = m68k_decode(encoded, &instbuf, address); 3869 next = m68k_decode(encoded, &instbuf, address);
3870 if (instbuf.op == M68K_INVALID) {
3871 instbuf.src.params.immed = *encoded;
3872 }
3867 uint16_t m68k_size = (next-encoded)*2; 3873 uint16_t m68k_size = (next-encoded)*2;
3868 address += m68k_size; 3874 address += m68k_size;
3869 encoded = next; 3875 encoded = next;
3870 //m68k_disasm(&instbuf, disbuf); 3876 //m68k_disasm(&instbuf, disbuf);
3871 //printf("%X: %s\n", instbuf.address, disbuf); 3877 //printf("%X: %s\n", instbuf.address, disbuf);