Mercurial > repos > blastem
comparison trans.c @ 2041:638eb2d25696 mame_interp
Merge from default
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 05 Aug 2021 09:29:33 -0700 |
parents | 374a5ae694e8 7d4df6b74263 |
children |
comparison
equal
deleted
inserted
replaced
1984:0d5f88e53dca | 2041:638eb2d25696 |
---|---|
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 uint64_t total_cycles; | 27 uint64_t total_cycles; |
23 | 28 |
24 m68k_context * sync_components(m68k_context * context, uint32_t address) | 29 m68k_context * sync_components(m68k_context * context, uint32_t address) |
25 { | 30 { |
26 if (context->current_cycle > 0x80000000) { | 31 if (context->current_cycle > 0x80000000) { |
30 if (context->status & M68K_STATUS_TRACE || context->trace_pending) { | 35 if (context->status & M68K_STATUS_TRACE || context->trace_pending) { |
31 context->target_cycle = context->current_cycle; | 36 context->target_cycle = context->current_cycle; |
32 } | 37 } |
33 return context; | 38 return context; |
34 } | 39 } |
40 #endif | |
35 | 41 |
36 m68k_context *reset_handler(m68k_context *context) | 42 m68k_context *reset_handler(m68k_context *context) |
37 { | 43 { |
38 m68k_print_regs(context); | 44 m68k_print_regs(context); |
45 #ifdef NEW_CORE | |
46 printf("cycles: %d\n", context->cycles); | |
47 #else | |
39 total_cycles += context->current_cycle; | 48 total_cycles += context->current_cycle; |
40 printf("%ld cycles\n", total_cycles); | 49 printf("%ld cycles\n", total_cycles); |
50 #endif | |
41 exit(0); | 51 exit(0); |
42 //unreachable | 52 //unreachable |
43 return context; | 53 return context; |
44 } | 54 } |
45 | 55 |
73 memmap[1].end = 0x1000000; | 83 memmap[1].end = 0x1000000; |
74 memmap[1].mask = 0xFFFF; | 84 memmap[1].mask = 0xFFFF; |
75 memmap[1].flags = MMAP_READ | MMAP_WRITE | MMAP_CODE; | 85 memmap[1].flags = MMAP_READ | MMAP_WRITE | MMAP_CODE; |
76 memmap[1].buffer = malloc(64 * 1024); | 86 memmap[1].buffer = malloc(64 * 1024); |
77 memset(memmap[1].buffer, 0, 64 * 1024); | 87 memset(memmap[1].buffer, 0, 64 * 1024); |
78 init_m68k_opts(&opts, memmap, 2, 7); | 88 init_m68k_opts(&opts, memmap, 2, 1); |
79 m68k_context * context = init_68k_context(&opts, reset_handler); | 89 m68k_context * context = init_68k_context(&opts, reset_handler); |
80 context->mem_pointers[0] = memmap[0].buffer; | 90 context->mem_pointers[0] = memmap[0].buffer; |
81 context->mem_pointers[1] = memmap[1].buffer; | 91 context->mem_pointers[1] = memmap[1].buffer; |
82 context->target_cycle = context->sync_cycle = 0x80000000; | 92 #ifdef NEW_CORE |
83 /* | 93 context->cycles = 40; |
84 uint32_t address; | 94 #else |
85 address = filebuf[2] << 16 | filebuf[3]; | 95 context->current_cycle = 40; |
86 translate_m68k_stream(address, context);*/ | 96 context->target_cycle = context->sync_cycle = 8000; |
97 #endif | |
87 m68k_reset(context); | 98 m68k_reset(context); |
99 #ifdef NEW_CORE | |
100 m68k_execute(context, 8000); | |
101 puts("hit cycle limit"); | |
102 #endif | |
88 return 0; | 103 return 0; |
89 } | 104 } |
90 | 105 |