comparison trans.c @ 1838:0c1491818f4b

WIP new 68K core using CPU DSL
author Michael Pavone <pavone@retrodev.com>
date Thu, 18 Apr 2019 19:47:50 -0700
parents 5b90d7669eee
children 374a5ae694e8 57ae42c3ab45
comparison
equal deleted inserted replaced
1837:f6ee0df6bb48 1838:0c1491818f4b
2 Copyright 2013 Michael Pavone 2 Copyright 2013 Michael Pavone
3 This file is part of BlastEm. 3 This file is part of BlastEm.
4 BlastEm is free software distributed under the terms of the GNU General Public License version 3 or greater. See COPYING for full license text. 4 BlastEm is free software distributed under the terms of the GNU General Public License version 3 or greater. See COPYING for full license text.
5 */ 5 */
6 #include "68kinst.h" 6 #include "68kinst.h"
7 #ifdef NEW_CORE
8 #include "m68k.h"
9 #else
7 #include "m68k_core.h" 10 #include "m68k_core.h"
11 #endif
8 #include "mem.h" 12 #include "mem.h"
9 #include <stdio.h> 13 #include <stdio.h>
10 #include <stdlib.h> 14 #include <stdlib.h>
11 #include <string.h> 15 #include <string.h>
12 16
17 21
18 void render_infobox(char * title, char * buf) 22 void render_infobox(char * title, char * buf)
19 { 23 {
20 } 24 }
21 25
26 #ifndef NEW_CORE
22 m68k_context * sync_components(m68k_context * context, uint32_t address) 27 m68k_context * sync_components(m68k_context * context, uint32_t address)
23 { 28 {
24 if (context->current_cycle > 0x80000000) { 29 if (context->current_cycle > 0x80000000) {
25 context->current_cycle -= 0x80000000; 30 context->current_cycle -= 0x80000000;
26 } 31 }
27 if (context->status & M68K_STATUS_TRACE || context->trace_pending) { 32 if (context->status & M68K_STATUS_TRACE || context->trace_pending) {
28 context->target_cycle = context->current_cycle; 33 context->target_cycle = context->current_cycle;
29 } 34 }
30 return context; 35 return context;
31 } 36 }
37 #endif
32 38
33 m68k_context *reset_handler(m68k_context *context) 39 m68k_context *reset_handler(m68k_context *context)
34 { 40 {
35 m68k_print_regs(context); 41 m68k_print_regs(context);
36 exit(0); 42 exit(0);
72 memset(memmap[1].buffer, 0, 64 * 1024); 78 memset(memmap[1].buffer, 0, 64 * 1024);
73 init_m68k_opts(&opts, memmap, 2, 1); 79 init_m68k_opts(&opts, memmap, 2, 1);
74 m68k_context * context = init_68k_context(&opts, reset_handler); 80 m68k_context * context = init_68k_context(&opts, reset_handler);
75 context->mem_pointers[0] = memmap[0].buffer; 81 context->mem_pointers[0] = memmap[0].buffer;
76 context->mem_pointers[1] = memmap[1].buffer; 82 context->mem_pointers[1] = memmap[1].buffer;
83 #ifndef NEW_CORE
77 context->target_cycle = context->sync_cycle = 0x80000000; 84 context->target_cycle = context->sync_cycle = 0x80000000;
78 uint32_t address; 85 #endif
79 address = filebuf[2] << 16 | filebuf[3];
80 translate_m68k_stream(address, context);
81 m68k_reset(context); 86 m68k_reset(context);
87 #ifdef NEW_CORE
88 for (;;)
89 {
90 m68k_execute(context, 0x80000000);
91 context->cycles = 0;
92 }
93 #endif
82 return 0; 94 return 0;
83 } 95 }
84 96