changeset 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 0d87116630c7
children 7d4df6b74263
files Makefile trans.c
diffstat 2 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Wed Jun 10 19:08:41 2020 -0700
+++ b/Makefile	Fri Jun 12 23:54:22 2020 -0700
@@ -297,7 +297,7 @@
 	ar rcs libemu68k.a $(M68KOBJS) $(TRANSOBJS)
 
 trans : trans.o serialize.o $(M68KOBJS) $(TRANSOBJS) util.o
-	$(CC) -o trans trans.o $(M68KOBJS) $(TRANSOBJS) util.o $(OPT)
+	$(CC) -o $@ $^ $(OPT)
 
 transz80 : transz80.o $(Z80OBJS) $(TRANSOBJS)
 	$(CC) -o transz80 transz80.o $(Z80OBJS) $(TRANSOBJS)
--- a/trans.c	Wed Jun 10 19:08:41 2020 -0700
+++ b/trans.c	Fri Jun 12 23:54:22 2020 -0700
@@ -26,8 +26,9 @@
 #ifndef NEW_CORE
 m68k_context * sync_components(m68k_context * context, uint32_t address)
 {
-	if (context->current_cycle > 0x80000000) {
-		context->current_cycle -= 0x80000000;
+	if (context->current_cycle >= context->target_cycle) {
+		puts("hit cycle limit");
+		exit(0);
 	}
 	if (context->status & M68K_STATUS_TRACE || context->trace_pending) {
 		context->target_cycle = context->current_cycle;
@@ -39,6 +40,7 @@
 m68k_context *reset_handler(m68k_context *context)
 {
 	m68k_print_regs(context);
+	printf("cycles: %d\n", context->current_cycle);
 	exit(0);
 	//unreachable
 	return context;
@@ -80,16 +82,14 @@
 	m68k_context * context = init_68k_context(&opts, reset_handler);
 	context->mem_pointers[0] = memmap[0].buffer;
 	context->mem_pointers[1] = memmap[1].buffer;
+	context->current_cycle = 40;
 #ifndef NEW_CORE
-	context->target_cycle = context->sync_cycle = 0x80000000;
+	context->target_cycle = context->sync_cycle = 8000;
 #endif
 	m68k_reset(context);
 #ifdef NEW_CORE
-	for (;;)
-	{
-		m68k_execute(context, 0x80000000);
-		context->cycles = 0;
-	}
+	m68k_execute(context, 8000);
+	puts("hit cycle limit");
 #endif
 	return 0;
 }