1
0
mirror of https://github.com/mist-devel/mist-board.git synced 2026-02-06 08:04:41 +00:00

C64: [VIC2] Fix sprite priority by vpelletier

If a lower-index background-priority (1) sprite's opaque pixel intersects
with a higher-index foreground-priority (0) sprite's opaque pixel, and the
screen bitmap has a foreground color at that same position, then the
screen bitmap's foreground color is visible.
This is counter-intuitive, as higher-index sprite's pixel alone would mask
the bitmap color, and adding another sprite top of it makes the bitmap
visible again, but this is how the VICII works.
This commit is contained in:
Gyorgy Szombathelyi
2020-03-17 20:48:14 +01:00
parent 84958b72b8
commit 2aab723f24

View File

@@ -1087,16 +1087,22 @@ calcBitmap: process(clk)
muxColor := "00";
muxSprite := (others => '-');
for i in 7 downto 0 loop
if (MPRIO(i) = '0') or (pixelBgFlag = '0') then
if MC(i) = '1' then
if MCurrentPixel(i) /= "00" then
if MC(i) = '1' then
if MCurrentPixel(i) /= "00" then
if (MPRIO(i) = '0') or (pixelBgFlag = '0') then
muxColor := MCurrentPixel(i);
muxSprite := to_unsigned(i, 3);
else
muxColor := "00";
end if;
elsif MCurrentPixel(i)(1) = '1' then
muxColor := "10";
muxSprite := to_unsigned(i, 3);
end if;
elsif MCurrentPixel(i)(1) = '1' then
if (MPRIO(i) = '0') or (pixelBgFlag = '0') then
muxColor := "10";
else
muxColor := "00";
end if;
muxSprite := to_unsigned(i, 3);
end if;
end loop;