constant asize : integer := 14;\r
constant HSCAN : integer := 256;\r
constant VSCAN : integer := 240;\r
-constant HSCAN_NEXT_START : integer := 383;\r
+constant HSCAN_NEXT_START : integer := 382;\r
constant VSCAN_NEXT_START : integer := 262;\r
constant HSCAN_SPR_MAX : integer := 321;\r
constant HSCAN_OAM_EVA_START : integer := 64;\r
---bg prefetch x pos is 16 + scroll cycle ahead of current pos.\r
prf_x <= nes_x + ppu_scroll_x + "000010000" \r
when nes_x < conv_std_logic_vector(HSCAN, X_SIZE) else\r
- nes_x + ppu_scroll_x + "010000001"; -- +16 -399\r
+ nes_x + ppu_scroll_x + "010000010"; -- -382\r
\r
prf_y <= nes_y + ppu_scroll_y\r
when nes_x < conv_std_logic_vector(HSCAN, X_SIZE) and\r
d_print("nes_y: " & conv_hex16(conv_integer(nes_y)));\r
\r
----fetch next tile byte.\r
- if (prf_x (2 downto 0) = "010") then\r
+ if (nes_x (2 downto 0) = "010") then\r
nt_we_n <= '0';\r
else\r
nt_we_n <= '1';\r
end if;\r
\r
----fetch attr table byte.\r
- if (prf_x (4 downto 0) = "00100") then\r
+ if (nes_x (4 downto 0) = "00100") then\r
attr_we_n <= '0';\r
else\r
attr_we_n <= '1';\r
end if;\r
- if (prf_x (4 downto 0) = "10000") then\r
+ if (nes_x (4 downto 0) = "10000") then\r
disp_attr_we_n <= '0';\r
else\r
disp_attr_we_n <= '1';\r
end if;\r
---attribute is shifted every 16 bit.\r
- if (prf_x (3 downto 0) = "0000") then\r
+ if (nes_x (3 downto 0) = "0000") then\r
attr_ce_n <= '0';\r
else\r
attr_ce_n <= '1';\r
end if;\r
\r
----fetch pattern table low byte.\r
- if (prf_x (2 downto 0) = "110") then\r
+ if (nes_x (2 downto 0) = "110") then\r
ptn_l_we_n <= '0';\r
else\r
ptn_l_we_n <= '1';\r
end if;\r
\r
----fetch pattern table high byte.\r
- if (prf_x (2 downto 0) = "000") then\r
+ if (nes_x (2 downto 0) = "000") then\r
ptn_h_we_n <= '0';\r
else\r
ptn_h_we_n <= '1';\r
)) then\r
\r
----fetch next tile byte.\r
- if (prf_x (2 downto 0) = "001") then\r
+ if (nes_x (2 downto 0) = "001") then\r
--vram addr is incremented every 8 cycle.\r
--name table at 0x2000\r
vram_addr(9 downto 0) \r
vram_addr(asize - 1 downto 10) <= "10" & ppu_ctrl(PPUBNA downto 0) \r
+ ("000" & prf_x(dsize));\r
----fetch attr table byte.\r
- elsif (prf_x (2 downto 0) = "011") then\r
+ elsif (nes_x (2 downto 0) = "011") then\r
--attr table at 0x23c0\r
vram_addr(dsize - 1 downto 0) <= "11000000" +\r
("00" & prf_y(7 downto 5) & prf_x(7 downto 5));\r
ppu_ctrl(PPUBNA downto 0) & "11"\r
+ ("000" & prf_x(dsize) & "00");\r
----fetch pattern table low byte.\r
- elsif (prf_x (2 downto 0) = "101") then\r
+ elsif (nes_x (2 downto 0) = "101") then\r
--vram addr is incremented every 8 cycle.\r
vram_addr <= "0" & ppu_ctrl(PPUBPA) & \r
disp_nt(dsize - 1 downto 0) \r
& "0" & prf_y(2 downto 0);\r
----fetch pattern table high byte.\r
- elsif (prf_x (2 downto 0) = "111") then\r
+ elsif (nes_x (2 downto 0) = "111") then\r
--vram addr is incremented every 8 cycle.\r
vram_addr <= "0" & ppu_ctrl(PPUBPA) & \r
disp_nt(dsize - 1 downto 0) \r