Mercurial > repos > blastem
comparison blastem.c @ 279:6be6056735a9
Fix native address lookup in bannked memory area
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 03 May 2013 20:18:28 -0700 |
parents | eec7072189a1 |
children | 9ee64039ddeb |
comparison
equal
deleted
inserted
replaced
278:9578e5dea147 | 279:6be6056735a9 |
---|---|
131 uint8_t need_reset = 0; | 131 uint8_t need_reset = 0; |
132 uint8_t busreq = 0; | 132 uint8_t busreq = 0; |
133 uint8_t busack = 0; | 133 uint8_t busack = 0; |
134 uint32_t busack_cycle = CYCLE_NEVER; | 134 uint32_t busack_cycle = CYCLE_NEVER; |
135 uint8_t new_busack = 0; | 135 uint8_t new_busack = 0; |
136 //#define DO_DEBUG_PRINT | 136 #define DO_DEBUG_PRINT |
137 #ifdef DO_DEBUG_PRINT | 137 #ifdef DO_DEBUG_PRINT |
138 #define dprintf printf | 138 #define dprintf printf |
139 #define dputs puts | 139 #define dputs puts |
140 #else | 140 #else |
141 #define dprintf | 141 #define dprintf |
348 /*if (pad->input[GAMEPAD_TH0] || pad->input[GAMEPAD_TH1]) { | 348 /*if (pad->input[GAMEPAD_TH0] || pad->input[GAMEPAD_TH1]) { |
349 printf ("value: %X\n", context->value); | 349 printf ("value: %X\n", context->value); |
350 }*/ | 350 }*/ |
351 } | 351 } |
352 | 352 |
353 uint32_t zram_counter = 0; | |
354 | |
353 m68k_context * io_write(uint32_t location, m68k_context * context, uint8_t value) | 355 m68k_context * io_write(uint32_t location, m68k_context * context, uint8_t value) |
354 { | 356 { |
355 if (location < 0x10000) { | 357 if (location < 0x10000) { |
356 if (busack_cycle > context->current_cycle) { | 358 if (busack_cycle > context->current_cycle) { |
357 busack = new_busack; | 359 busack = new_busack; |
399 new_busack = 0; | 401 new_busack = 0; |
400 } | 402 } |
401 } else { | 403 } else { |
402 if (busreq) { | 404 if (busreq) { |
403 dputs("releasing z80 bus"); | 405 dputs("releasing z80 bus"); |
406 char fname[20]; | |
407 sprintf(fname, "zram-%d", zram_counter++); | |
408 FILE * f = fopen(fname, "wb"); | |
409 fwrite(z80_ram, 1, sizeof(z80_ram), f); | |
410 fclose(f); | |
404 z80_context * z_context = context->next_cpu; | 411 z80_context * z_context = context->next_cpu; |
405 //TODO: Add necessary delay between release of busreq and resumption of execution | 412 //TODO: Add necessary delay between release of busreq and resumption of execution |
406 z_context->current_cycle = (context->current_cycle * MCLKS_PER_68K) / MCLKS_PER_Z80; | 413 z_context->current_cycle = (context->current_cycle * MCLKS_PER_68K) / MCLKS_PER_Z80; |
407 } | 414 } |
408 busreq = 0; | 415 busreq = 0; |
483 new_busack = 0; | 490 new_busack = 0; |
484 } | 491 } |
485 } else { | 492 } else { |
486 if (busreq) { | 493 if (busreq) { |
487 dprintf("releasing Z80 bus @ %d\n", (context->current_cycle * MCLKS_PER_68K) / MCLKS_PER_Z80); | 494 dprintf("releasing Z80 bus @ %d\n", (context->current_cycle * MCLKS_PER_68K) / MCLKS_PER_Z80); |
495 char fname[20]; | |
496 sprintf(fname, "zram-%d", zram_counter++); | |
497 FILE * f = fopen(fname, "wb"); | |
498 fwrite(z80_ram, 1, sizeof(z80_ram), f); | |
499 fclose(f); | |
488 z80_context * z_context = context->next_cpu; | 500 z80_context * z_context = context->next_cpu; |
489 //TODO: Add necessary delay between release of busreq and resumption of execution | 501 //TODO: Add necessary delay between release of busreq and resumption of execution |
490 z_context->current_cycle = (context->current_cycle * MCLKS_PER_68K) / MCLKS_PER_Z80; | 502 z_context->current_cycle = (context->current_cycle * MCLKS_PER_68K) / MCLKS_PER_Z80; |
491 } | 503 } |
492 busreq = 0; | 504 busreq = 0; |