diff ztestrun.c @ 1748:48a43dff4dc0

Added init functions to z80_util.c so new Z80 core is closer to a drop in replacement for the old one
author Michael Pavone <pavone@retrodev.com>
date Thu, 07 Feb 2019 09:43:25 -0800
parents 9ab64ef5cba0
children 0a26f3657295
line wrap: on
line diff
--- a/ztestrun.c	Wed Feb 06 09:13:24 2019 -0800
+++ b/ztestrun.c	Thu Feb 07 09:43:25 2019 -0800
@@ -96,15 +96,9 @@
 		exit(1);
 	}
 	fclose(f);
+	init_z80_opts(&opts, z80_map, 2, port_map, 1, 1, 0xFF);
+	context = init_z80_context(&opts);
 #ifdef NEW_CORE
-	memset(&opts, 0, sizeof(opts));
-	opts.gen.memmap = z80_map;
-	opts.gen.memmap_chunks = 2;
-	opts.gen.address_mask = 0xFFFF;
-	opts.gen.max_address = 0xFFFF;
-	opts.gen.clock_divider = 1;
-	context = calloc(1, sizeof(z80_context));
-	context->opts = &opts;
 	z80_execute(context, 1000);
 	printf("A: %X\nB: %X\nC: %X\nD: %X\nE: %X\nHL: %X\nIX: %X\nIY: %X\nSP: %X\n\nIM: %d, IFF1: %d, IFF2: %d\n",
 		context->main[7], context->main[0], context->main[1],
@@ -124,8 +118,6 @@
 		context->alt[2], context->alt[3],
 		(context->alt[4] << 8) | context->alt[5]);
 #else
-	init_z80_opts(&opts, z80_map, 2, port_map, 1, 1, 0xFF);
-	context = init_z80_context(&opts);
 	//Z80 RAM
 	context->mem_pointers[0] = z80_ram;
 	if (retranslate) {