Mercurial > repos > blastem
comparison blastem.c @ 271:969ee17471c5
Protect debug prints for busreq/reset regs with appropriate macros
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 02 May 2013 22:21:41 -0700 |
parents | 6c2d7e003a55 |
children | eec7072189a1 |
comparison
equal
deleted
inserted
replaced
270:df5bf4c113dc | 271:969ee17471c5 |
---|---|
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 | 136 |
137 #ifdef DO_DEBUG_PRINT | 137 #ifdef DO_DEBUG_PRINT |
138 #define dprintf printf | 138 #define dprintf printf |
139 #define dputs puts | |
139 #else | 140 #else |
140 #define dprintf | 141 #define dprintf |
142 #define dputs | |
141 #endif | 143 #endif |
142 | 144 |
143 void sync_z80(z80_context * z_context, uint32_t mclks) | 145 void sync_z80(z80_context * z_context, uint32_t mclks) |
144 { | 146 { |
145 if (z80_enabled && !reset && !busreq) { | 147 if (z80_enabled && !reset && !busreq) { |
388 if (busack_cycle > context->current_cycle) { | 390 if (busack_cycle > context->current_cycle) { |
389 busack = new_busack; | 391 busack = new_busack; |
390 busack_cycle = CYCLE_NEVER; | 392 busack_cycle = CYCLE_NEVER; |
391 } | 393 } |
392 if (value & 1) { | 394 if (value & 1) { |
393 puts("bus requesting Z80"); | 395 dputs("bus requesting Z80"); |
394 busreq = 1; | 396 busreq = 1; |
395 if(!reset) { | 397 if(!reset) { |
396 busack_cycle = context->current_cycle + Z80_ACK_DELAY; | 398 busack_cycle = context->current_cycle + Z80_ACK_DELAY; |
397 new_busack = 0; | 399 new_busack = 0; |
398 } | 400 } |
399 } else { | 401 } else { |
400 if (busreq) { | 402 if (busreq) { |
401 puts("releasing z80 bus"); | 403 dputs("releasing z80 bus"); |
402 z80_context * z_context = context->next_cpu; | 404 z80_context * z_context = context->next_cpu; |
403 //TODO: Add necessary delay between release of busreq and resumption of execution | 405 //TODO: Add necessary delay between release of busreq and resumption of execution |
404 z_context->current_cycle = (context->current_cycle * MCLKS_PER_68K) / MCLKS_PER_Z80; | 406 z_context->current_cycle = (context->current_cycle * MCLKS_PER_68K) / MCLKS_PER_Z80; |
405 } | 407 } |
406 busreq = 0; | 408 busreq = 0; |
472 if (busack_cycle > context->current_cycle) { | 474 if (busack_cycle > context->current_cycle) { |
473 busack = new_busack; | 475 busack = new_busack; |
474 busack_cycle = CYCLE_NEVER; | 476 busack_cycle = CYCLE_NEVER; |
475 } | 477 } |
476 if (value & 0x100) { | 478 if (value & 0x100) { |
477 printf("bus requesting Z80 @ %d\n", (context->current_cycle * MCLKS_PER_68K) / MCLKS_PER_Z80); | 479 dprintf("bus requesting Z80 @ %d\n", (context->current_cycle * MCLKS_PER_68K) / MCLKS_PER_Z80); |
478 busreq = 1; | 480 busreq = 1; |
479 if(!reset) { | 481 if(!reset) { |
480 busack_cycle = context->current_cycle + Z80_ACK_DELAY; | 482 busack_cycle = context->current_cycle + Z80_ACK_DELAY; |
481 new_busack = 0; | 483 new_busack = 0; |
482 } | 484 } |
483 } else { | 485 } else { |
484 if (busreq) { | 486 if (busreq) { |
485 printf("releasing Z80 bus @ %d\n", (context->current_cycle * MCLKS_PER_68K) / MCLKS_PER_Z80); | 487 dprintf("releasing Z80 bus @ %d\n", (context->current_cycle * MCLKS_PER_68K) / MCLKS_PER_Z80); |
486 z80_context * z_context = context->next_cpu; | 488 z80_context * z_context = context->next_cpu; |
487 //TODO: Add necessary delay between release of busreq and resumption of execution | 489 //TODO: Add necessary delay between release of busreq and resumption of execution |
488 z_context->current_cycle = (context->current_cycle * MCLKS_PER_68K) / MCLKS_PER_Z80; | 490 z_context->current_cycle = (context->current_cycle * MCLKS_PER_68K) / MCLKS_PER_Z80; |
489 } | 491 } |
490 busreq = 0; | 492 busreq = 0; |