Mercurial > repos > blastem
comparison vdp.c @ 722:8f5339961903
Restore the other 2 debug display modes
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 21 May 2015 00:55:46 -0700 |
parents | 15d9359fd771 |
children | 2174f92c5f9b |
comparison
equal
deleted
inserted
replaced
721:20be7d01e312 | 722:8f5339961903 |
---|---|
792 if (col) | 792 if (col) |
793 { | 793 { |
794 col-=2; | 794 col-=2; |
795 dst = context->framebuf; | 795 dst = context->framebuf; |
796 dst += line * 320 + col * 8; | 796 dst += line * 320 + col * 8; |
797 sprite_buf = context->linebuf + col * 8; | 797 if (context->debug < 2) { |
798 uint8_t a_src, src; | 798 sprite_buf = context->linebuf + col * 8; |
799 if (context->flags & FLAG_WINDOW) { | 799 uint8_t a_src, src; |
800 plane_a_off = context->buf_a_off; | 800 if (context->flags & FLAG_WINDOW) { |
801 a_src = DBG_SRC_W; | 801 plane_a_off = context->buf_a_off; |
802 } else { | 802 a_src = DBG_SRC_W; |
803 plane_a_off = context->buf_a_off - (context->hscroll_a & 0xF); | 803 } else { |
804 a_src = DBG_SRC_A; | 804 plane_a_off = context->buf_a_off - (context->hscroll_a & 0xF); |
805 } | 805 a_src = DBG_SRC_A; |
806 plane_b_off = context->buf_b_off - (context->hscroll_b & 0xF); | 806 } |
807 //printf("A | tmp_buf offset: %d\n", 8 - (context->hscroll_a & 0x7)); | 807 plane_b_off = context->buf_b_off - (context->hscroll_b & 0xF); |
808 | 808 //printf("A | tmp_buf offset: %d\n", 8 - (context->hscroll_a & 0x7)); |
809 if (context->regs[REG_MODE_4] & BIT_HILIGHT) { | 809 |
810 for (int i = 0; i < 16; ++plane_a_off, ++plane_b_off, ++sprite_buf, ++i) { | 810 if (context->regs[REG_MODE_4] & BIT_HILIGHT) { |
811 uint8_t pixel; | 811 for (int i = 0; i < 16; ++plane_a_off, ++plane_b_off, ++sprite_buf, ++i) { |
812 plane_a = context->tmp_buf_a + (plane_a_off & SCROLL_BUFFER_MASK); | 812 uint8_t pixel; |
813 plane_b = context->tmp_buf_b + (plane_b_off & SCROLL_BUFFER_MASK); | 813 plane_a = context->tmp_buf_a + (plane_a_off & SCROLL_BUFFER_MASK); |
814 uint32_t * colors = context->colors; | 814 plane_b = context->tmp_buf_b + (plane_b_off & SCROLL_BUFFER_MASK); |
815 src = 0; | 815 uint32_t * colors = context->colors; |
816 pixel = context->regs[REG_BG_COLOR]; | 816 src = 0; |
817 src = DBG_SRC_BG; | 817 pixel = context->regs[REG_BG_COLOR]; |
818 if (*plane_b & 0xF) { | 818 src = DBG_SRC_BG; |
819 pixel = *plane_b; | 819 if (*plane_b & 0xF) { |
820 src = DBG_SRC_B; | 820 pixel = *plane_b; |
821 } | 821 src = DBG_SRC_B; |
822 if (*plane_a & 0xF && (*plane_a & BUF_BIT_PRIORITY) >= (pixel & BUF_BIT_PRIORITY)) { | 822 } |
823 pixel = *plane_a; | 823 if (*plane_a & 0xF && (*plane_a & BUF_BIT_PRIORITY) >= (pixel & BUF_BIT_PRIORITY)) { |
824 src = DBG_SRC_A; | 824 pixel = *plane_a; |
825 } | 825 src = DBG_SRC_A; |
826 if (*sprite_buf & 0xF) { | 826 } |
827 uint8_t sprite_color = *sprite_buf & 0x3F; | 827 if (*sprite_buf & 0xF) { |
828 if (sprite_color == 0x3E) { | 828 uint8_t sprite_color = *sprite_buf & 0x3F; |
829 colors += CRAM_SIZE*2; | 829 if (sprite_color == 0x3E) { |
830 src |= DBG_HILIGHT; | 830 colors += CRAM_SIZE*2; |
831 } else if (sprite_color == 0x3F) { | 831 src |= DBG_HILIGHT; |
832 } else if (sprite_color == 0x3F) { | |
833 colors += CRAM_SIZE; | |
834 src |= DBG_SHADOW; | |
835 } else if ((*sprite_buf & BUF_BIT_PRIORITY) >= (pixel & BUF_BIT_PRIORITY)) { | |
836 pixel = *sprite_buf; | |
837 src = DBG_SRC_S; | |
838 if ((pixel & 0xF) == 0xE) { | |
839 src |= DBG_SHADOW; | |
840 colors += CRAM_SIZE; | |
841 } | |
842 | |
843 } | |
844 } else if (!((*plane_a | *plane_b) & BUF_BIT_PRIORITY)) { | |
832 colors += CRAM_SIZE; | 845 colors += CRAM_SIZE; |
833 src |= DBG_SHADOW; | 846 src |= DBG_SHADOW; |
834 } else if ((*sprite_buf & BUF_BIT_PRIORITY) >= (pixel & BUF_BIT_PRIORITY)) { | 847 } |
848 pixel &= 0x3F; | |
849 uint32_t outpixel; | |
850 if (context->debug) { | |
851 outpixel = context->debugcolors[src]; | |
852 } else { | |
853 outpixel = colors[pixel]; | |
854 } | |
855 *(dst++) = outpixel; | |
856 //*dst = (context->cram[pixel & 0x3F] & 0xEEE) | ((pixel & BUF_BIT_PRIORITY) ? FBUF_BIT_PRIORITY : 0) | src; | |
857 } | |
858 } else { | |
859 for (int i = 0; i < 16; ++plane_a_off, ++plane_b_off, ++sprite_buf, ++i) { | |
860 plane_a = context->tmp_buf_a + (plane_a_off & SCROLL_BUFFER_MASK); | |
861 plane_b = context->tmp_buf_b + (plane_b_off & SCROLL_BUFFER_MASK); | |
862 uint8_t pixel = context->regs[REG_BG_COLOR]; | |
863 src = DBG_SRC_BG; | |
864 if (*plane_b & 0xF) { | |
865 pixel = *plane_b; | |
866 src = DBG_SRC_B; | |
867 } | |
868 if (*plane_a & 0xF && (*plane_a & BUF_BIT_PRIORITY) >= (pixel & BUF_BIT_PRIORITY)) { | |
869 pixel = *plane_a; | |
870 src = DBG_SRC_A; | |
871 } | |
872 if (*sprite_buf & 0xF && (*sprite_buf & BUF_BIT_PRIORITY) >= (pixel & BUF_BIT_PRIORITY)) { | |
835 pixel = *sprite_buf; | 873 pixel = *sprite_buf; |
836 src = DBG_SRC_S; | 874 src = DBG_SRC_S; |
837 if ((pixel & 0xF) == 0xE) { | |
838 src |= DBG_SHADOW; | |
839 colors += CRAM_SIZE; | |
840 } | |
841 | |
842 } | 875 } |
843 } else if (!((*plane_a | *plane_b) & BUF_BIT_PRIORITY)) { | 876 uint32_t outpixel; |
844 colors += CRAM_SIZE; | 877 if (context->debug) { |
845 src |= DBG_SHADOW; | 878 outpixel = context->debugcolors[src]; |
846 } | 879 } else { |
847 pixel &= 0x3F; | 880 outpixel = context->colors[pixel & 0x3F]; |
848 uint32_t outpixel; | 881 } |
849 if (context->debug) { | 882 *(dst++) = outpixel; |
850 outpixel = context->debugcolors[src]; | 883 } |
851 } else { | 884 } |
852 outpixel = colors[pixel]; | 885 } else if (context->debug == 2) { |
853 } | 886 if (col < 32) { |
854 *(dst++) = outpixel; | 887 *(dst++) = context->colors[col * 2]; |
855 //*dst = (context->cram[pixel & 0x3F] & 0xEEE) | ((pixel & BUF_BIT_PRIORITY) ? FBUF_BIT_PRIORITY : 0) | src; | 888 *(dst++) = context->colors[col * 2]; |
856 } | 889 *(dst++) = context->colors[col * 2]; |
857 } else { | 890 *(dst++) = context->colors[col * 2]; |
858 for (int i = 0; i < 16; ++plane_a_off, ++plane_b_off, ++sprite_buf, ++i) { | 891 *(dst++) = context->colors[col * 2 + 1]; |
859 plane_a = context->tmp_buf_a + (plane_a_off & SCROLL_BUFFER_MASK); | 892 *(dst++) = context->colors[col * 2 + 1]; |
860 plane_b = context->tmp_buf_b + (plane_b_off & SCROLL_BUFFER_MASK); | 893 *(dst++) = context->colors[col * 2 + 1]; |
861 uint8_t pixel = context->regs[REG_BG_COLOR]; | 894 *(dst++) = context->colors[col * 2 + 1]; |
862 src = DBG_SRC_BG; | 895 *(dst++) = context->colors[col * 2 + 2]; |
863 if (*plane_b & 0xF) { | 896 *(dst++) = context->colors[col * 2 + 2]; |
864 pixel = *plane_b; | 897 *(dst++) = context->colors[col * 2 + 2]; |
865 src = DBG_SRC_B; | 898 *(dst++) = context->colors[col * 2 + 2]; |
866 } | 899 *(dst++) = context->colors[col * 2 + 3]; |
867 if (*plane_a & 0xF && (*plane_a & BUF_BIT_PRIORITY) >= (pixel & BUF_BIT_PRIORITY)) { | 900 *(dst++) = context->colors[col * 2 + 3]; |
868 pixel = *plane_a; | 901 *(dst++) = context->colors[col * 2 + 3]; |
869 src = DBG_SRC_A; | 902 *(dst++) = context->colors[col * 2 + 3]; |
870 } | 903 } else if (col == 32 || line >= 192) { |
871 if (*sprite_buf & 0xF && (*sprite_buf & BUF_BIT_PRIORITY) >= (pixel & BUF_BIT_PRIORITY)) { | 904 for (int32_t i = 0; i < 16; i ++) { |
872 pixel = *sprite_buf; | 905 *(dst++) = 0; |
873 src = DBG_SRC_S; | 906 } |
874 } | 907 } else { |
875 uint32_t outpixel; | 908 for (int32_t i = 0; i < 16; i ++) { |
876 if (context->debug) { | 909 *(dst++) = context->colors[line / 3 + (col - 34) * 0x20]; |
877 outpixel = context->debugcolors[src]; | 910 } |
878 } else { | 911 } |
879 outpixel = context->colors[pixel & 0x3F]; | 912 } else { |
880 } | 913 uint32_t cell = (line / 8) * (context->regs[REG_MODE_4] & BIT_H40 ? 40 : 32) + col; |
881 *(dst++) = outpixel; | 914 uint32_t address = cell * 32 + (line % 8) * 4; |
915 for (int32_t i = 0; i < 4; i ++) { | |
916 *(dst++) = context->colors[(context->debug_pal << 4) | (context->vdpmem[address] >> 4)]; | |
917 *(dst++) = context->colors[(context->debug_pal << 4) | (context->vdpmem[address] & 0xF)]; | |
918 address++; | |
919 } | |
920 cell++; | |
921 address = cell * 32 + (line % 8) * 4; | |
922 for (int32_t i = 0; i < 4; i ++) { | |
923 *(dst++) = context->colors[(context->debug_pal << 4) | (context->vdpmem[address] >> 4)]; | |
924 *(dst++) = context->colors[(context->debug_pal << 4) | (context->vdpmem[address] & 0xF)]; | |
925 address++; | |
882 } | 926 } |
883 } | 927 } |
884 } | 928 } |
885 context->buf_a_off = (context->buf_a_off + SCROLL_BUFFER_DRAW) & SCROLL_BUFFER_MASK; | 929 context->buf_a_off = (context->buf_a_off + SCROLL_BUFFER_DRAW) & SCROLL_BUFFER_MASK; |
886 context->buf_b_off = (context->buf_b_off + SCROLL_BUFFER_DRAW) & SCROLL_BUFFER_MASK; | 930 context->buf_b_off = (context->buf_b_off + SCROLL_BUFFER_DRAW) & SCROLL_BUFFER_MASK; |