OSDN Git Service

scrolling ok, but now scroll happens only 8 pix each... strange!
authorastoria-d <astoria-d@mail.goo.ne.jp>
Sat, 27 Aug 2016 17:57:38 +0000 (02:57 +0900)
committerastoria-d <astoria-d@mail.goo.ne.jp>
Sat, 27 Aug 2016 17:57:38 +0000 (02:57 +0900)
de1_nes/ppu/vga_ppu.vhd
de1_nes/simulation/modelsim/de1_nes_run_msim_rtl_vhdl.do
doc/mos6502-ppu.xlsx

index 924734e..7695f3a 100644 (file)
@@ -164,7 +164,7 @@ constant dsize        : integer := 8;
 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
@@ -929,7 +929,7 @@ begin
     ---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
@@ -995,39 +995,39 @@ begin
                     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
@@ -1070,7 +1070,7 @@ begin
                         )) 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
@@ -1079,7 +1079,7 @@ begin
                             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
@@ -1087,13 +1087,13 @@ begin
                                     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
index 9df75aa..75f5496 100644 (file)
@@ -91,6 +91,7 @@ add wave -divider ppu
 \r
 #add wave  -radix hex  sim:/testbench_motones_sim/sim_board/ppu_inst/*\r
 #add wave  -radix hex  sim:/testbench_motones_sim/sim_board/ppu_inst/vga_render_inst/*\r
+add wave  -label prf_x -radix decimal sim:/testbench_motones_sim/sim_board/ppu_inst/vga_render_inst/prf_x\r
 \r
 #add wave -radix hex sim:/testbench_motones_sim/sim_board/vram_latch/*\r
 #add wave -label v_addr_ppu -radix hex sim:/testbench_motones_sim/sim_board/v_addr_ppu\r
index e03fe9b..53ce470 100644 (file)
Binary files a/doc/mos6502-ppu.xlsx and b/doc/mos6502-ppu.xlsx differ