Mercurial > repos > blastem
changeset 1998:0740d90812ee
Enter debugger when a VDP data port read would cause a CPU lockup
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 28 Jun 2020 22:53:52 -0700 |
parents | e08c489d5602 |
children | 7a6835c02db0 |
files | genesis.c vdp.c |
diffstat | 2 files changed, 15 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/genesis.c Sun Jun 28 21:31:09 2020 -0700 +++ b/genesis.c Sun Jun 28 22:53:52 2020 -0700 @@ -266,7 +266,7 @@ } context->target_cycle = context->int_cycle < context->sync_cycle ? context->int_cycle : context->sync_cycle; - if (context->should_return) { + if (context->should_return || gen->header.enter_debugger) { context->target_cycle = context->current_cycle; } else if (context->target_cycle < context->current_cycle) { //Changes to SR can result in an interrupt cycle that's in the past
--- a/vdp.c Sun Jun 28 21:31:09 2020 -0700 +++ b/vdp.c Sun Jun 28 22:53:52 2020 -0700 @@ -3953,6 +3953,20 @@ } if (context->cd & 1) { warning("Read from VDP data port while writes are configured, CPU is now frozen. VDP Address: %X, CD: %X\n", context->address, context->cd); + context->system->enter_debugger = 1; + return context->prefetch; + } + switch (context->cd) + { + case VRAM_READ: + case VSRAM_READ: + case CRAM_READ: + case VRAM_READ8: + break; + default: + warning("Read from VDP data port with invalid source, CPU is now frozen. VDP Address: %X, CD: %X\n", context->address, context->cd); + context->system->enter_debugger = 1; + return context->prefetch; } while (!(context->flags & FLAG_READ_FETCHED)) { vdp_run_context_full(context, context->cycles + ((context->regs[REG_MODE_4] & BIT_H40) ? 16 : 20));