Mercurial > repos > blastem
comparison vdp.c @ 2508:caf92f1b7b76
Fix behavior of rendering when all planes are disabled via VDP test register (Thanks vladikcomper!)
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 27 Aug 2024 20:50:31 -0700 |
parents | 593a4f308335 |
children | 1102372feaee |
comparison
equal
deleted
inserted
replaced
2507:aa888682faa0 | 2508:caf92f1b7b76 |
---|---|
1581 } | 1581 } |
1582 } | 1582 } |
1583 | 1583 |
1584 static void render_testreg(vdp_context *context, int32_t col, uint8_t *dst, uint8_t *debug_dst, uint8_t *buf_a, int plane_a_off, int plane_a_mask, int plane_b_off, uint8_t output_disabled, uint8_t test_layer) | 1584 static void render_testreg(vdp_context *context, int32_t col, uint8_t *dst, uint8_t *debug_dst, uint8_t *buf_a, int plane_a_off, int plane_a_mask, int plane_b_off, uint8_t output_disabled, uint8_t test_layer) |
1585 { | 1585 { |
1586 uint8_t pixel; | |
1586 if (output_disabled) { | 1587 if (output_disabled) { |
1587 switch (test_layer) | 1588 switch (test_layer) |
1588 { | 1589 { |
1589 case 0: | 1590 case 0: |
1591 pixel = context->regs[REG_BG_COLOR] & 0x3F; | |
1590 for (int i = 0; i < 16; i++) | 1592 for (int i = 0; i < 16; i++) |
1591 { | 1593 { |
1592 *(dst++) = 0x3F; //TODO: confirm this on hardware | 1594 *(dst++) = pixel; //TODO: confirm this on hardware |
1593 *(debug_dst++) = DBG_SRC_BG; | 1595 *(debug_dst++) = DBG_SRC_BG; |
1594 } | 1596 } |
1595 break; | 1597 break; |
1596 case 1: { | 1598 case 1: { |
1597 uint8_t *sprite_buf = context->linebuf + col * 8; | 1599 uint8_t *sprite_buf = context->linebuf + col * 8; |
1620 } else { | 1622 } else { |
1621 int start = 0; | 1623 int start = 0; |
1622 uint8_t *sprite_buf = context->linebuf + col * 8; | 1624 uint8_t *sprite_buf = context->linebuf + col * 8; |
1623 if (!col && (context->regs[REG_MODE_1] & BIT_COL0_MASK)) { | 1625 if (!col && (context->regs[REG_MODE_1] & BIT_COL0_MASK)) { |
1624 //TODO: Confirm how test register interacts with column 0 blanking | 1626 //TODO: Confirm how test register interacts with column 0 blanking |
1625 uint8_t pixel = 0x3F; | 1627 pixel = 0x3F; |
1626 uint8_t src = DBG_SRC_BG; | 1628 uint8_t src = DBG_SRC_BG; |
1627 for (int i = 0; i < 8; ++i) | 1629 for (int i = 0; i < 8; ++i) |
1628 { | 1630 { |
1629 switch (test_layer) | 1631 switch (test_layer) |
1630 { | 1632 { |
1660 { | 1662 { |
1661 uint8_t sprite, plane_a, plane_b; | 1663 uint8_t sprite, plane_a, plane_b; |
1662 plane_a = buf_a[plane_a_off & plane_a_mask]; | 1664 plane_a = buf_a[plane_a_off & plane_a_mask]; |
1663 plane_b = context->tmp_buf_b[plane_b_off & SCROLL_BUFFER_MASK]; | 1665 plane_b = context->tmp_buf_b[plane_b_off & SCROLL_BUFFER_MASK]; |
1664 sprite = *sprite_buf; | 1666 sprite = *sprite_buf; |
1665 uint8_t pixel = composite_normal(context, debug_dst, sprite, plane_a, plane_b, 0x3F) & 0x3F; | 1667 pixel = composite_normal(context, debug_dst, sprite, plane_a, plane_b, 0x3F) & 0x3F; |
1666 switch (test_layer) | 1668 switch (test_layer) |
1667 { | 1669 { |
1668 case 1: | 1670 case 1: |
1669 pixel &= sprite; | 1671 pixel &= sprite; |
1670 if (pixel) { | 1672 if (pixel) { |
1742 } else { | 1744 } else { |
1743 pixel.index &= 0x3F; | 1745 pixel.index &= 0x3F; |
1744 } | 1746 } |
1745 switch (test_layer) | 1747 switch (test_layer) |
1746 { | 1748 { |
1749 case 0: | |
1750 if (output_disabled) { | |
1751 pixel.index &= context->regs[REG_BG_COLOR]; | |
1752 *debug_dst = DBG_SRC_BG; | |
1753 } | |
1754 break; | |
1747 case 1: | 1755 case 1: |
1748 pixel.index &= sprite; | 1756 pixel.index &= sprite; |
1749 if (pixel.index) { | 1757 if (pixel.index) { |
1750 *debug_dst = DBG_SRC_S; | 1758 *debug_dst = DBG_SRC_S; |
1751 } | 1759 } |