comparison m68k_core_x86.c @ 792:724bbec47f86

Use a new fatal_error function instead of calling fprintf and exit for fatal errors. This new function more gracefully handles the case in which BlastEm was not started from a terminal or disconnected from ther terminal (Windows).
author Michael Pavone <pavone@retrodev.com>
date Sat, 25 Jul 2015 18:22:07 -0700
parents 483f7e7926a6
children 841e44c5af83
comparison
equal deleted inserted replaced
791:60686f8d5e48 792:724bbec47f86
7 #include "m68k_core.h" 7 #include "m68k_core.h"
8 #include "m68k_internal.h" 8 #include "m68k_internal.h"
9 #include "68kinst.h" 9 #include "68kinst.h"
10 #include "mem.h" 10 #include "mem.h"
11 #include "backend.h" 11 #include "backend.h"
12 #include "util.h"
12 #include <stdio.h> 13 #include <stdio.h>
13 #include <stddef.h> 14 #include <stddef.h>
14 #include <stdlib.h> 15 #include <stdlib.h>
15 #include <string.h> 16 #include <string.h>
16 17
505 ea->disp |= 0xFFFF0000; 506 ea->disp |= 0xFFFF0000;
506 } 507 }
507 return; 508 return;
508 default: 509 default:
509 m68k_disasm(inst, disasm_buf); 510 m68k_disasm(inst, disasm_buf);
510 printf("%X: %s\naddress mode %d not implemented (%s)\n", inst->address, disasm_buf, op->addr_mode, dst ? "dst" : "src"); 511 fatal_error("%X: %s\naddress mode %d not implemented (%s)\n", inst->address, disasm_buf, op->addr_mode, dst ? "dst" : "src");
511 exit(1);
512 } 512 }
513 if (!dst && inst->dst.addr_mode == MODE_AREG && inst->extra.size == OPSIZE_WORD) { 513 if (!dst && inst->dst.addr_mode == MODE_AREG && inst->extra.size == OPSIZE_WORD) {
514 if (ea->mode == MODE_REG_DIRECT) { 514 if (ea->mode == MODE_REG_DIRECT) {
515 movsx_rr(code, ea->base, opts->gen.scratch1, SZ_W, SZ_D); 515 movsx_rr(code, ea->base, opts->gen.scratch1, SZ_W, SZ_D);
516 } else { 516 } else {
682 } 682 }
683 mov_ir(code, inst->dst.params.immed, opts->gen.scratch2, SZ_D); 683 mov_ir(code, inst->dst.params.immed, opts->gen.scratch2, SZ_D);
684 break; 684 break;
685 default: 685 default:
686 m68k_disasm(inst, disasm_buf); 686 m68k_disasm(inst, disasm_buf);
687 printf("%X: %s\naddress mode %d not implemented (move dst)\n", inst->address, disasm_buf, inst->dst.addr_mode); 687 fatal_error("%X: %s\naddress mode %d not implemented (move dst)\n", inst->address, disasm_buf, inst->dst.addr_mode);
688 exit(1);
689 } 688 }
690 689
691 if (inst->dst.addr_mode != MODE_AREG) { 690 if (inst->dst.addr_mode != MODE_AREG) {
692 cmp_ir(code, 0, flags_reg, inst->extra.size); 691 cmp_ir(code, 0, flags_reg, inst->extra.size);
693 update_flags(opts, N|Z|V0|C0); 692 update_flags(opts, N|Z|V0|C0);