changeset 244:df8a36bf5e1d

Implement cycle limit in Z80 core.
author Mike Pavone <pavone@retrodev.com>
date Sun, 28 Apr 2013 18:53:43 -0700
parents 2f069a0b487e
children ea3899e3e7ec
files transz80.c z80_to_x86.h
diffstat 2 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/transz80.c	Sun Apr 28 14:32:45 2013 -0700
+++ b/transz80.c	Sun Apr 28 18:53:43 2013 -0700
@@ -22,10 +22,13 @@
 	init_z80_context(&context, &opts);
 	//cartridge ROM
 	context.mem_pointers[0] = z80_ram;
-	context.target_cycle = 0x7FFFFFFF;
+	context.sync_cycle = context.target_cycle = 0x7FFFFFFF;
 	//work RAM
 	context.mem_pointers[1] = context.mem_pointers[2] = NULL;
 	z80_reset(&context);
-	z80_run(&context);
+	for(;;)
+	{
+		z80_run(&context);
+	}
 	return 0;
 }
--- a/z80_to_x86.h	Sun Apr 28 14:32:45 2013 -0700
+++ b/z80_to_x86.h	Sun Apr 28 18:53:43 2013 -0700
@@ -37,6 +37,11 @@
 	uint8_t *         mem_pointers[ZNUM_MEM_AREAS];
 	uint8_t           iff1;
 	uint8_t           iff2;
+	uint16_t          scratch1;
+	uint16_t          scratch2;
+	void *            extra_pc;
+	uint32_t          sync_cycle;
+	uint32_t          int_cycle;
 	native_map_slot * static_code_map;
 	native_map_slot * banked_code_map;
 	void *            options;