addr <= conv_std_logic_vector(ad, 16);\r
d_io <= conv_std_logic_vector(dt, 8);\r
end;\r
+\r
procedure io_brk is\r
begin\r
addr <= (others => 'Z');\r
r_nw <= 'Z';\r
end;\r
\r
+procedure io_read (ad: in integer) is\r
+begin\r
+ r_nw <= '1';\r
+ addr <= conv_std_logic_vector(ad, 16);\r
+ d_io <= (others => 'Z');\r
+end;\r
+\r
begin\r
if (rst_n = '0') then\r
\r
dma_step_cnt := dma_step_cnt + 1;\r
\r
elsif (global_step_cnt = 5) then\r
- --step4 = scroll test.\r
+ --step4 = scroll test and ppu reg read test.\r
if (scl_step_cnt = 0) then\r
--x scroll pos=123\r
io_out(16#2005#, 11);\r
--y scroll pos=100\r
io_out(16#2005#, 0);\r
\r
+ elsif (scl_step_cnt = 2 * cpu_io_multi) then\r
+ --read status reg.\r
+ io_read(16#2002#);\r
+\r
+ elsif (scl_step_cnt = 3 * cpu_io_multi) then\r
+ --read vram nt0.\r
+ io_out(16#2006#, 16#20#);\r
+\r
+ elsif (scl_step_cnt = 4 * cpu_io_multi) then\r
+ io_out(16#2006#, 16#03#);\r
+\r
+ elsif (scl_step_cnt = 5 * cpu_io_multi) then\r
+ io_read(16#2007#);\r
+\r
+ elsif (scl_step_cnt = 6 * cpu_io_multi) then\r
+ --pattern tbl.\r
+ io_out(16#2006#, 16#04#);\r
+\r
+ elsif (scl_step_cnt = 7 * cpu_io_multi) then\r
+ io_out(16#2006#, 16#d1#);\r
+\r
+ elsif (scl_step_cnt = 8 * cpu_io_multi) then\r
+ io_read(16#2007#);\r
+\r
+ elsif (scl_step_cnt = 9 * cpu_io_multi) then\r
+ --attr tbl.\r
+ io_out(16#2006#, 16#23#);\r
+\r
+ elsif (scl_step_cnt = 10 * cpu_io_multi) then\r
+ io_out(16#2006#, 16#c0#);\r
+\r
+ elsif (scl_step_cnt = 11 * cpu_io_multi) then\r
+ --set attr first.\r
+ io_out(16#2006#, 16#5a#);\r
+\r
+ elsif (scl_step_cnt = 12 * cpu_io_multi) then\r
+ io_out(16#2006#, 16#23#);\r
+\r
+ elsif (scl_step_cnt = 13 * cpu_io_multi) then\r
+ io_out(16#2006#, 16#c0#);\r
+\r
+ elsif (scl_step_cnt = 14 * cpu_io_multi) then\r
+ io_read(16#2007#);\r
+\r
+ elsif (scl_step_cnt = 15 * cpu_io_multi) then\r
+ --read palette tbl.\r
+ io_out(16#2006#, 16#3f#);\r
+\r
+ elsif (scl_step_cnt = 16 * cpu_io_multi) then\r
+ io_out(16#2006#, 16#10#);\r
+\r
+ elsif (scl_step_cnt = 17 * cpu_io_multi) then\r
+ io_read(16#2007#);\r
+\r
else\r
io_brk;\r
- if (scl_step_cnt > 1 * cpu_io_multi) then\r
+ if (scl_step_cnt > 17 * cpu_io_multi) then\r
global_step_cnt := global_step_cnt + 1;\r
end if;\r
end if;\r