diff 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
line wrap: on
line diff
--- a/trans.c	Sun May 10 00:16:00 2020 -0700
+++ b/trans.c	Thu Aug 05 09:29:33 2021 -0700
@@ -4,7 +4,11 @@
  BlastEm is free software distributed under the terms of the GNU General Public License version 3 or greater. See COPYING for full license text.
 */
 #include "68kinst.h"
+#ifdef NEW_CORE
+#include "m68k.h"
+#else
 #include "m68k_core.h"
+#endif
 #include "mem.h"
 #include <stdio.h>
 #include <stdlib.h>
@@ -19,6 +23,7 @@
 {
 }
 
+#ifndef NEW_CORE
 uint64_t total_cycles;
 
 m68k_context * sync_components(m68k_context * context, uint32_t address)
@@ -32,12 +37,17 @@
 	}
 	return context;
 }
+#endif
 
 m68k_context *reset_handler(m68k_context *context)
 {
 	m68k_print_regs(context);
+#ifdef NEW_CORE
+	printf("cycles: %d\n", context->cycles);
+#else
 	total_cycles += context->current_cycle;
 	printf("%ld cycles\n", total_cycles);
+#endif
 	exit(0);
 	//unreachable
 	return context;
@@ -75,16 +85,21 @@
 	memmap[1].flags = MMAP_READ | MMAP_WRITE | MMAP_CODE;
 	memmap[1].buffer = malloc(64 * 1024);
 	memset(memmap[1].buffer, 0, 64 * 1024);
-	init_m68k_opts(&opts, memmap, 2, 7);
+	init_m68k_opts(&opts, memmap, 2, 1);
 	m68k_context * context = init_68k_context(&opts, reset_handler);
 	context->mem_pointers[0] = memmap[0].buffer;
 	context->mem_pointers[1] = memmap[1].buffer;
-	context->target_cycle = context->sync_cycle = 0x80000000;
-	/*
-	uint32_t address;
-	address = filebuf[2] << 16 | filebuf[3];
-	translate_m68k_stream(address, context);*/
+#ifdef NEW_CORE
+	context->cycles = 40;
+#else
+	context->current_cycle = 40;
+	context->target_cycle = context->sync_cycle = 8000;
+#endif
 	m68k_reset(context);
+#ifdef NEW_CORE
+	m68k_execute(context, 8000);
+	puts("hit cycle limit");
+#endif
 	return 0;
 }