diff genesis.c @ 1130:8f14767661fa

Remove memory map assumptions from Z80 core and move a little bit of logic to the generic backend.c so it can be shared between CPU cores
author Michael Pavone <pavone@retrodev.com>
date Wed, 28 Dec 2016 20:39:27 -0800
parents 928a65750345
children 9fc680b35dbb
line wrap: on
line diff
--- a/genesis.c	Wed Dec 28 12:28:52 2016 -0800
+++ b/genesis.c	Wed Dec 28 20:39:27 2016 -0800
@@ -925,15 +925,16 @@
 	gen->psg = malloc(sizeof(psg_context));
 	psg_init(gen->psg, render_sample_rate(), gen->master_clock, MCLKS_PER_PSG, render_audio_buffer(), lowpass_cutoff);
 
-	gen->z80 = calloc(1, sizeof(z80_context));
 	gen->zram = calloc(1, Z80_RAM_BYTES);
 	z80_map[0].buffer = gen->zram = calloc(1, Z80_RAM_BYTES);
 #ifndef NO_Z80
 	z80_options *z_opts = malloc(sizeof(z80_options));
 	init_z80_opts(z_opts, z80_map, 5, NULL, 0, MCLKS_PER_Z80, 0xFFFF);
-	init_z80_context(gen->z80, z_opts);
+	gen->z80 = init_z80_context(z_opts);
 	gen->z80->next_int_pulse = z80_next_int_pulse;
 	z80_assert_reset(gen->z80, 0);
+#else
+	gen->z80 = calloc(1, sizeof(z80_context));
 #endif
 
 	gen->z80->system = gen;