comparison trans.c @ 2053:3414a4423de1 segacd

Merge from default
author Michael Pavone <pavone@retrodev.com>
date Sat, 15 Jan 2022 13:15:21 -0800
parents 7d4df6b74263
children 638eb2d25696 339eff5dc350
comparison
equal deleted inserted replaced
1692:5dacaef602a7 2053:3414a4423de1
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 >= context->target_cycle) {
25 context->current_cycle -= 0x80000000; 30 puts("hit cycle limit");
31 exit(0);
26 } 32 }
27 if (context->status & M68K_STATUS_TRACE || context->trace_pending) { 33 if (context->status & M68K_STATUS_TRACE || context->trace_pending) {
28 context->target_cycle = context->current_cycle; 34 context->target_cycle = context->current_cycle;
29 } 35 }
30 return context; 36 return context;
31 } 37 }
38 #endif
32 39
33 m68k_context *reset_handler(m68k_context *context) 40 m68k_context *reset_handler(m68k_context *context)
34 { 41 {
35 m68k_print_regs(context); 42 m68k_print_regs(context);
43 #ifdef NEW_CORE
44 printf("cycles: %d\n", context->cycles);
45 #else
46 printf("cycles: %d\n", context->current_cycle);
47 #endif
36 exit(0); 48 exit(0);
37 //unreachable 49 //unreachable
38 return context; 50 return context;
39 } 51 }
40 52
72 memset(memmap[1].buffer, 0, 64 * 1024); 84 memset(memmap[1].buffer, 0, 64 * 1024);
73 init_m68k_opts(&opts, memmap, 2, 1); 85 init_m68k_opts(&opts, memmap, 2, 1);
74 m68k_context * context = init_68k_context(&opts, reset_handler); 86 m68k_context * context = init_68k_context(&opts, reset_handler);
75 context->mem_pointers[0] = memmap[0].buffer; 87 context->mem_pointers[0] = memmap[0].buffer;
76 context->mem_pointers[1] = memmap[1].buffer; 88 context->mem_pointers[1] = memmap[1].buffer;
77 context->target_cycle = context->sync_cycle = 0x80000000; 89 #ifdef NEW_CORE
78 uint32_t address; 90 context->cycles = 40;
79 address = filebuf[2] << 16 | filebuf[3]; 91 #else
80 translate_m68k_stream(address, context); 92 context->current_cycle = 40;
93 context->target_cycle = context->sync_cycle = 8000;
94 #endif
81 m68k_reset(context); 95 m68k_reset(context);
96 #ifdef NEW_CORE
97 m68k_execute(context, 8000);
98 puts("hit cycle limit");
99 #endif
82 return 0; 100 return 0;
83 } 101 }
84 102