comparison trans.c @ 1990:57ae42c3ab45

Fix 68k test harness target, add cycle count to output and add a cycle limit
author Michael Pavone <pavone@retrodev.com>
date Fri, 12 Jun 2020 23:54:22 -0700
parents 0c1491818f4b
children 7d4df6b74263
comparison
equal deleted inserted replaced
1989:0d87116630c7 1990:57ae42c3ab45
24 } 24 }
25 25
26 #ifndef NEW_CORE 26 #ifndef NEW_CORE
27 m68k_context * sync_components(m68k_context * context, uint32_t address) 27 m68k_context * sync_components(m68k_context * context, uint32_t address)
28 { 28 {
29 if (context->current_cycle > 0x80000000) { 29 if (context->current_cycle >= context->target_cycle) {
30 context->current_cycle -= 0x80000000; 30 puts("hit cycle limit");
31 exit(0);
31 } 32 }
32 if (context->status & M68K_STATUS_TRACE || context->trace_pending) { 33 if (context->status & M68K_STATUS_TRACE || context->trace_pending) {
33 context->target_cycle = context->current_cycle; 34 context->target_cycle = context->current_cycle;
34 } 35 }
35 return context; 36 return context;
37 #endif 38 #endif
38 39
39 m68k_context *reset_handler(m68k_context *context) 40 m68k_context *reset_handler(m68k_context *context)
40 { 41 {
41 m68k_print_regs(context); 42 m68k_print_regs(context);
43 printf("cycles: %d\n", context->current_cycle);
42 exit(0); 44 exit(0);
43 //unreachable 45 //unreachable
44 return context; 46 return context;
45 } 47 }
46 48
78 memset(memmap[1].buffer, 0, 64 * 1024); 80 memset(memmap[1].buffer, 0, 64 * 1024);
79 init_m68k_opts(&opts, memmap, 2, 1); 81 init_m68k_opts(&opts, memmap, 2, 1);
80 m68k_context * context = init_68k_context(&opts, reset_handler); 82 m68k_context * context = init_68k_context(&opts, reset_handler);
81 context->mem_pointers[0] = memmap[0].buffer; 83 context->mem_pointers[0] = memmap[0].buffer;
82 context->mem_pointers[1] = memmap[1].buffer; 84 context->mem_pointers[1] = memmap[1].buffer;
85 context->current_cycle = 40;
83 #ifndef NEW_CORE 86 #ifndef NEW_CORE
84 context->target_cycle = context->sync_cycle = 0x80000000; 87 context->target_cycle = context->sync_cycle = 8000;
85 #endif 88 #endif
86 m68k_reset(context); 89 m68k_reset(context);
87 #ifdef NEW_CORE 90 #ifdef NEW_CORE
88 for (;;) 91 m68k_execute(context, 8000);
89 { 92 puts("hit cycle limit");
90 m68k_execute(context, 0x80000000);
91 context->cycles = 0;
92 }
93 #endif 93 #endif
94 return 0; 94 return 0;
95 } 95 }
96 96