# HG changeset patch # User Michael Pavone # Date 1669187261 28800 # Node ID e6bad7bd8751af360ebe194bfcb3bbf3b2fbeb90 # Parent 0d1d5dccdd28da7c43648d08c99010a29b0bbd0b# Parent 31fc1186ffbb2b4332a0c3de16258482ec3eea9f merge diff -r 0d1d5dccdd28 -r e6bad7bd8751 m68k_core.c --- a/m68k_core.c Tue Nov 22 17:57:02 2022 -0800 +++ b/m68k_core.c Tue Nov 22 23:07:41 2022 -0800 @@ -1037,14 +1037,18 @@ memmap_chunk const *chunk = find_map_chunk(address, &opts->gen, 0, NULL); if (!chunk) { code_ptr start = code->cur; - defer_translation(&opts->gen, address, opts->retrans_stub); + translate_out_of_bounds(opts, address); code_ptr after = code->cur; map_native_address(context, address, start, 2, after-start); break; } if (!(chunk->flags & MMAP_READ)) { code_ptr start = code->cur; - defer_translation(&opts->gen, address, opts->retrans_stub); + if (chunk->flags & MMAP_CODE) { + defer_translation(&opts->gen, address, opts->retrans_stub); + } else { + translate_out_of_bounds(opts, address); + } code_ptr after = code->cur; map_native_address(context, address, start, 2, after-start); break; diff -r 0d1d5dccdd28 -r e6bad7bd8751 vdp.c --- a/vdp.c Tue Nov 22 17:57:02 2022 -0800 +++ b/vdp.c Tue Nov 22 23:07:41 2022 -0800 @@ -117,6 +117,7 @@ context->state = ACTIVE; } else if (context->vcounter == 0x1FF) { context->state = PREPARING; + memset(context->compositebuf, 0, sizeof(context->compositebuf)); } } } else { @@ -137,6 +138,7 @@ } else if (context->vcounter == 0x1FF) { context->state = PREPARING; + memset(context->compositebuf, 0, sizeof(context->compositebuf)); } } } @@ -190,7 +192,7 @@ } if (!static_table_init_done) { - + for (uint16_t mode4_addr = 0; mode4_addr < 0x4000; mode4_addr++) { uint16_t mode5_addr = mode4_addr & 0x3DFD; @@ -2351,7 +2353,9 @@ } else {\ *(dst++) = context->colors[(*(src++) & 0xC0) | bgindex];\ }\ - if (slot != (BG_START_SLOT + LINEBUF_SIZE/2)) {\ + if (slot == (BG_START_SLOT + LINEBUF_SIZE/2)) {\ + context->done_composite = NULL;\ + } else {\ if ((*src & 0x3F) | test_layer) {\ *(dst++) = context->colors[*(src++)];\ } else {\ @@ -2368,7 +2372,9 @@ } else {\ *(dst++) = context->colors[(*(src++) & 0xC0) | bgindex];\ }\ - if (slot != (BG_START_SLOT + (256+HORIZ_BORDER)/2)) {\ + if (slot == (BG_START_SLOT + (256+HORIZ_BORDER)/2)) {\ + context->done_composite = NULL;\ + } else {\ if ((*src & 0x3F) | test_layer) {\ *(dst++) = context->colors[*(src++)];\ } else {\ @@ -3526,7 +3532,7 @@ } uint32_t *dst; uint8_t *debug_dst; - if (context->output && context->hslot >= BG_START_SLOT && context->hslot < bg_end_slot) { + if (context->output && context->hslot >= BG_START_SLOT && context->hslot <= bg_end_slot) { dst = context->output + 2 * (context->hslot - BG_START_SLOT); debug_dst = context->layer_debug_buf + 2 * (context->hslot - BG_START_SLOT); } else { @@ -3541,9 +3547,6 @@ if (context->hslot == BG_START_SLOT && context->output) { dst = context->output + (context->hslot - BG_START_SLOT) * 2; debug_dst = context->layer_debug_buf + 2 * (context->hslot - BG_START_SLOT); - } else if (context->hslot == bg_end_slot) { - advance_output_line(context); - dst = NULL; } //this will need some tweaking to properly interact with 128K mode, //but this should be good enough for now @@ -3621,22 +3624,7 @@ *(dst++) = bg_color; *(debug_dst++) = DBG_SRC_BG; } - if (context->done_composite) { - uint8_t pixel = context->compositebuf[dst-context->output]; - if (!(pixel & 0x3F | test_layer)) { - pixel = pixel & 0xC0 | bg_index; - } - *(dst++) = context->colors[pixel]; - if ((dst - context->output) == (context->done_composite - context->compositebuf)) { - context->done_composite = NULL; - memset(context->compositebuf, 0, sizeof(context->compositebuf)); - } - } else { - *(dst++) = bg_color; - *(debug_dst++) = DBG_SRC_BG; - } - - if (context->hslot == (bg_end_slot-1)) { + if (context->hslot != bg_end_slot) { if (context->done_composite) { uint8_t pixel = context->compositebuf[dst-context->output]; if (!(pixel & 0x3F | test_layer)) { @@ -3653,6 +3641,10 @@ } } } + if (context->hslot == bg_end_slot) { + advance_output_line(context); + dst = NULL; + } if (!is_refresh(context, context->hslot)) { external_slot(context); @@ -3679,6 +3671,7 @@ vdp_advance_line(context); if (context->vcounter == active_line) { context->state = PREPARING; + memset(context->compositebuf, 0, sizeof(context->compositebuf)); return; } }