Mercurial > repos > blastem
comparison blastem.c @ 280:9ee64039ddeb
Fix bank register update
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 03 May 2013 21:09:48 -0700 |
parents | 6be6056735a9 |
children | a8ee7934a1f8 |
comparison
equal
deleted
inserted
replaced
279:6be6056735a9 | 280:9ee64039ddeb |
---|---|
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 |
401 new_busack = 0; | 401 new_busack = 0; |
402 } | 402 } |
403 } else { | 403 } else { |
404 if (busreq) { | 404 if (busreq) { |
405 dputs("releasing z80 bus"); | 405 dputs("releasing z80 bus"); |
406 #ifdef DO_DEBUG_PRINT | |
406 char fname[20]; | 407 char fname[20]; |
407 sprintf(fname, "zram-%d", zram_counter++); | 408 sprintf(fname, "zram-%d", zram_counter++); |
408 FILE * f = fopen(fname, "wb"); | 409 FILE * f = fopen(fname, "wb"); |
409 fwrite(z80_ram, 1, sizeof(z80_ram), f); | 410 fwrite(z80_ram, 1, sizeof(z80_ram), f); |
410 fclose(f); | 411 fclose(f); |
412 #endif | |
411 z80_context * z_context = context->next_cpu; | 413 z80_context * z_context = context->next_cpu; |
412 //TODO: Add necessary delay between release of busreq and resumption of execution | 414 //TODO: Add necessary delay between release of busreq and resumption of execution |
413 z_context->current_cycle = (context->current_cycle * MCLKS_PER_68K) / MCLKS_PER_Z80; | 415 z_context->current_cycle = (context->current_cycle * MCLKS_PER_68K) / MCLKS_PER_Z80; |
414 } | 416 } |
415 busreq = 0; | 417 busreq = 0; |
490 new_busack = 0; | 492 new_busack = 0; |
491 } | 493 } |
492 } else { | 494 } else { |
493 if (busreq) { | 495 if (busreq) { |
494 dprintf("releasing Z80 bus @ %d\n", (context->current_cycle * MCLKS_PER_68K) / MCLKS_PER_Z80); | 496 dprintf("releasing Z80 bus @ %d\n", (context->current_cycle * MCLKS_PER_68K) / MCLKS_PER_Z80); |
497 #ifdef DO_DEBUG_PRINT | |
495 char fname[20]; | 498 char fname[20]; |
496 sprintf(fname, "zram-%d", zram_counter++); | 499 sprintf(fname, "zram-%d", zram_counter++); |
497 FILE * f = fopen(fname, "wb"); | 500 FILE * f = fopen(fname, "wb"); |
498 fwrite(z80_ram, 1, sizeof(z80_ram), f); | 501 fwrite(z80_ram, 1, sizeof(z80_ram), f); |
499 fclose(f); | 502 fclose(f); |
503 #endif | |
500 z80_context * z_context = context->next_cpu; | 504 z80_context * z_context = context->next_cpu; |
501 //TODO: Add necessary delay between release of busreq and resumption of execution | 505 //TODO: Add necessary delay between release of busreq and resumption of execution |
502 z_context->current_cycle = (context->current_cycle * MCLKS_PER_68K) / MCLKS_PER_Z80; | 506 z_context->current_cycle = (context->current_cycle * MCLKS_PER_68K) / MCLKS_PER_Z80; |
503 } | 507 } |
504 busreq = 0; | 508 busreq = 0; |