Mercurial > repos > blastem
changeset 1322:b1423d432c0e
Initial stab at implementing the output disable/layer selection bits of the VDP test register
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 18 Apr 2017 19:27:10 -0700 |
parents | 0849e9356bfe |
children | c9dc2603b087 |
files | vdp.c vdp.h |
diffstat | 2 files changed, 49 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/vdp.c Mon Apr 17 23:58:21 2017 -0700 +++ b/vdp.c Tue Apr 18 19:27:10 2017 -0700 @@ -1254,6 +1254,8 @@ } plane_b_off = context->buf_b_off - (context->hscroll_b & 0xF); //printf("A | tmp_buf offset: %d\n", 8 - (context->hscroll_a & 0x7)); + uint8_t output_disabled = (context->test_port & TEST_BIT_DISABLE) != 0; + uint8_t test_layer = context->test_port >> 7 & 3; if (context->regs[REG_MODE_4] & BIT_HILIGHT) { for (int i = 0; i < 16; ++plane_a_off, ++plane_b_off, ++sprite_buf, ++i) { @@ -1287,6 +1289,9 @@ } } } + if (output_disabled) { + pixel = 0x3F; + } if (!intensity) { src |= DBG_SHADOW; colors += CRAM_SIZE; @@ -1294,6 +1299,20 @@ src |= DBG_HILIGHT; colors += CRAM_SIZE*2; } + //TODO: Verify how test register stuff interacts with shadow/highlight + //TODO: Simulate CRAM corruption from bus fight + switch (test_layer) + { + case 1: + pixel &= *sprite_buf; + break; + case 2: + pixel &= *plane_a; + break; + case 3: + pixel &= *plane_b; + break; + } uint32_t outpixel; if (context->debug) { @@ -1309,17 +1328,34 @@ plane_b = context->tmp_buf_b + (plane_b_off & SCROLL_BUFFER_MASK); uint8_t pixel = context->regs[REG_BG_COLOR]; src = DBG_SRC_BG; - if (*plane_b & 0xF) { - pixel = *plane_b; - src = DBG_SRC_B; + if (output_disabled) { + pixel = 0x3F; + } else { + if (*plane_b & 0xF) { + pixel = *plane_b; + src = DBG_SRC_B; + } + if (*plane_a & 0xF && (*plane_a & BUF_BIT_PRIORITY) >= (pixel & BUF_BIT_PRIORITY)) { + pixel = *plane_a; + src = a_src; + } + if (*sprite_buf & 0xF && (*sprite_buf & BUF_BIT_PRIORITY) >= (pixel & BUF_BIT_PRIORITY)) { + pixel = *sprite_buf; + src = DBG_SRC_S; + } } - if (*plane_a & 0xF && (*plane_a & BUF_BIT_PRIORITY) >= (pixel & BUF_BIT_PRIORITY)) { - pixel = *plane_a; - src = a_src; - } - if (*sprite_buf & 0xF && (*sprite_buf & BUF_BIT_PRIORITY) >= (pixel & BUF_BIT_PRIORITY)) { - pixel = *sprite_buf; - src = DBG_SRC_S; + //TODO: Simulate CRAM corruption from bus fight + switch (test_layer) + { + case 1: + pixel &= *sprite_buf; + break; + case 2: + pixel &= *plane_a; + break; + case 3: + pixel &= *plane_b; + break; } uint32_t outpixel; if (context->debug) {