From 1c9074ad5bbade02fa7b31056d97c39b32478f6a Mon Sep 17 00:00:00 2001 From: Mike Pavone Date: Fri, 3 May 2013 20:18:28 -0700 Subject: Fix native address lookup in bannked memory area --- blastem.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'blastem.c') diff --git a/blastem.c b/blastem.c index 05ef5ae..371fe22 100644 --- a/blastem.c +++ b/blastem.c @@ -133,7 +133,7 @@ uint8_t busreq = 0; uint8_t busack = 0; uint32_t busack_cycle = CYCLE_NEVER; uint8_t new_busack = 0; -//#define DO_DEBUG_PRINT +#define DO_DEBUG_PRINT #ifdef DO_DEBUG_PRINT #define dprintf printf #define dputs puts @@ -350,6 +350,8 @@ void io_data_read(io_port * pad, m68k_context * context) }*/ } +uint32_t zram_counter = 0; + m68k_context * io_write(uint32_t location, m68k_context * context, uint8_t value) { if (location < 0x10000) { @@ -401,6 +403,11 @@ m68k_context * io_write(uint32_t location, m68k_context * context, uint8_t value } else { if (busreq) { dputs("releasing z80 bus"); + char fname[20]; + sprintf(fname, "zram-%d", zram_counter++); + FILE * f = fopen(fname, "wb"); + fwrite(z80_ram, 1, sizeof(z80_ram), f); + fclose(f); z80_context * z_context = context->next_cpu; //TODO: Add necessary delay between release of busreq and resumption of execution z_context->current_cycle = (context->current_cycle * MCLKS_PER_68K) / MCLKS_PER_Z80; @@ -485,6 +492,11 @@ m68k_context * io_write_w(uint32_t location, m68k_context * context, uint16_t va } else { if (busreq) { dprintf("releasing Z80 bus @ %d\n", (context->current_cycle * MCLKS_PER_68K) / MCLKS_PER_Z80); + char fname[20]; + sprintf(fname, "zram-%d", zram_counter++); + FILE * f = fopen(fname, "wb"); + fwrite(z80_ram, 1, sizeof(z80_ram), f); + fclose(f); z80_context * z_context = context->next_cpu; //TODO: Add necessary delay between release of busreq and resumption of execution z_context->current_cycle = (context->current_cycle * MCLKS_PER_68K) / MCLKS_PER_Z80; -- cgit v1.2.3