- flag set bug fixed.
set_nz;
output_d_bus;
+ elsif instruction = conv_std_logic_vector(16#2a#, dsize) then
+ --rol acc.
+ sel <= ALU_ROL;
+ d1 <= acc_out;
+ set_nz;
+ carry_out <= c;
+ output_d_bus;
+
elsif instruction = conv_std_logic_vector(16#4a#, dsize) then
--lsr acc.
sel <= ALU_LSR;
if instruction (7 downto 5) = "000" then
d_print("asl");
+
elsif instruction (7 downto 5) = "001" then
d_print("rol");
+ sel <= ALU_ROL;
+ set_nz;
+ carry_out <= c;
+
elsif instruction (7 downto 5) = "010" then
d_print("lsr");
+
elsif instruction (7 downto 5) = "011" then
--d_print("ror");
sel <= ALU_ROR;
carry_out <= res(dsize);
elsif sel = ALU_ROL then
- ----
+ res(dsize - 1 downto 1) := d1(dsize - 2 downto 0);
+ res(0) := carry_in;
+
+ d_out <= res(dsize - 1 downto 0);
+ set_n(res(dsize - 1 downto 0));
+ set_z(res(dsize - 1 downto 0));
+ carry_out <= d1(7);
+
elsif sel = ALU_ROR then
res(dsize - 1) := carry_in;
res(dsize - 2 downto 0) := d1(dsize - 1 downto 1);
procedure set_nz_from_bus is
begin
--status register n/z bit update.
- stat_dec_oe_n <= '1';
- status_reg <= "10000010";
stat_bus_nz_n <= '0';
end procedure;
-procedure set_nzc_from_bus is
+procedure set_zc_from_alu is
begin
- --status register n,z,c bit update.
+ --status register n/z bit update.
+ stat_alu_we_n <= '0';
stat_dec_oe_n <= '1';
- status_reg <= "10000011";
- stat_bus_nz_n <= '0';
+ status_reg <= "00000011";
end procedure;
procedure set_nz_from_alu is
arith_en_n <= '0';
back_oe(acc_cmd, '0');
front_we(acc_cmd, '0');
- set_nzc_from_bus;
+ set_zc_from_alu;
single_inst;
elsif instruction = conv_std_logic_vector(16#ea#, dsize) then
elsif instruction = conv_std_logic_vector(16#2a#, dsize) then
--rol acc
d_print("rol");
+ arith_en_n <= '0';
+ back_oe(acc_cmd, '0');
+ front_we(acc_cmd, '0');
+ set_nzc_from_alu;
+ single_inst;
elsif instruction = conv_std_logic_vector(16#38#, dsize) then
d_print("sec");
elsif instruction = conv_std_logic_vector(16#66#, dsize) then
--zp
d_print("ror");
- a4_zp;
- if exec_cycle = T4 then
- set_nzc_from_bus;
- end if;
+-- a4_zp;
+-- if exec_cycle = T4 then
+-- set_nzc_from_alu;
+-- end if;
elsif instruction = conv_std_logic_vector(16#76#, dsize) then
--zp, x
--nes ppu instance
ppu_inst : ppu
port map (ppu_clk, ppu_ce_n, rst_n, r_nw, addr(2 downto 0), d_io,
- nmi_n2, rd_n, wr_n, ale, vram_ad, vram_a,
+ nmi_n, rd_n, wr_n, ale, vram_ad, vram_a,
vga_clk, h_sync_n, v_sync_n, r, g, b);
ppu_addr_decoder : v_address_decoder generic map (size14, data_size)
dummy_vga_disp : vga_device
port map (vga_clk, rst_n, h_sync_n, v_sync_n, r, g, b);
- nmi_p: process
- constant powerup_time : time := 5000 ns;
- constant reset_time : time := 10 us;
- begin
- wait for powerup_time;
- nmi_n <= '1';
- wait for reset_time;
- wait for 46 us;
- nmi_n <= '0';
-
- wait;
- end process;
+-- nmi_p: process
+-- constant powerup_time : time := 5000 ns;
+-- constant reset_time : time := 10 us;
+-- begin
+-- wait for powerup_time;
+-- nmi_n <= '1';
+-- wait for reset_time;
+-- wait for 46 us;
+-- nmi_n <= '0';
+--
+-- wait;
+-- end process;
end rtl;