changeset 565:9324f721efa6

Add a separate flag/define for disabling the Z80 at compile time to ease refactoring
author Michael Pavone <pavone@retrodev.com>
date Sat, 01 Mar 2014 17:11:06 -0800
parents 316facea756d
children 624dd5106060
files Makefile blastem.c debug.c gdb_remote.c
diffstat 4 files changed, 14 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Sat Mar 01 17:07:33 2014 -0800
+++ b/Makefile	Sat Mar 01 17:11:06 2014 -0800
@@ -33,6 +33,7 @@
 ifeq ($(CPU),i686)
 M68KOBJS+= runtime_32.o
 TRANSOBJS+= gen_x86.o
+NOZ80:=1
 endif
 endif
 
@@ -44,13 +45,18 @@
 
 ifeq ($(CPU),x86_64)
 CFLAGS+=-DX86_64
-MAINOBJS+= $(Z80OBJS)
 else
 ifeq ($(CPU),i686)
 CFLAGS+=-DX86_32
 endif
 endif
 
+ifdef NOZ80
+CFLAGS+=-DNO_Z80
+else
+MAINOBJS+= $(Z80OBJS)
+endif
+
 
 all : dis zdis stateview vgmplay blastem
 
--- a/blastem.c	Sat Mar 01 17:07:33 2014 -0800
+++ b/blastem.c	Sat Mar 01 17:11:06 2014 -0800
@@ -182,7 +182,7 @@
 
 void sync_z80(z80_context * z_context, uint32_t mclks)
 {
-#ifdef X86_64
+#ifndef NO_Z80
 	if (z80_enabled && !reset && !busreq) {
 		genesis_context * gen = z_context->system;
 		z_context->sync_cycle = mclks / MCLKS_PER_Z80;
@@ -472,7 +472,7 @@
 			location &= 0x7FFF;
 			if (location < 0x4000) {
 				z80_ram[location & 0x1FFF] = value;
-#ifdef X86_64
+#ifndef NO_Z80
 				z80_handle_code_write(location & 0x1FFF, gen->z80);
 #endif
 			} else if (location < 0x6000) {
@@ -991,7 +991,7 @@
 			insert_breakpoint(&context, pc, debugger);
 		}
 		adjust_int_cycle(gen->m68k, gen->vdp);
-#ifdef X86_64
+#ifndef NO_Z80
 		gen->z80->native_pc =  z80_get_native_address_trans(gen->z80, gen->z80->pc);
 #endif
 		start_68k_context(&context, pc);
@@ -1238,7 +1238,7 @@
 
 	z80_context z_context;
 	x86_z80_options z_opts;
-#ifdef X86_64
+#ifndef NO_Z80
 	init_x86_z80_opts(&z_opts);
 	init_z80_context(&z_context, &z_opts);
 #endif
--- a/debug.c	Sat Mar 01 17:07:33 2014 -0800
+++ b/debug.c	Sat Mar 01 17:11:06 2014 -0800
@@ -82,7 +82,7 @@
 	}
 }
 
-#ifdef X86_64
+#ifndef NO_Z80
 
 void zdebugger_print(z80_context * context, char format_char, char * param)
 {
@@ -705,7 +705,7 @@
 				}
 				break;
 			}
-#ifdef X86_64
+#ifndef NO_Z80
 			case 'z': {
 				genesis_context * gen = context->system;
 				//Z80 debug commands
--- a/gdb_remote.c	Sat Mar 01 17:07:33 2014 -0800
+++ b/gdb_remote.c	Sat Mar 01 17:11:06 2014 -0800
@@ -145,7 +145,7 @@
 	} else if (address >= 0xA00000 && address < 0xA04000) {
 		z80_ram[address & 0x1FFF] = value;
 		genesis_context * gen = context->system;
-#ifdef X86_64
+#ifndef NO_Z80
 		z80_handle_code_write(address & 0x1FFF, gen->z80);
 #endif
 		return;