Project

General

Profile

« Previous | Next » 

Revision 154

Added by markw about 11 years ago

keyboard must match for 2 cycles and joystick must match for 2 cycles (2 loops of state machine). This seems to pretty much prevent false keypresses. Of course cannot type when stick moved...

View differences:

chameleon/chameleon_c64_joykeyb.vhd
signal cnt : unsigned(3 downto 0) := (others => '0');
signal col : integer range 0 to 7 := 0;
signal keys_reg : unsigned(63 downto 0) := (others => '1');
signal last_keys_reg : unsigned(63 downto 0) := (others => '1');
signal approved_keys_reg : unsigned(63 downto 0) := (others => '1');
signal joystick1_reg : unsigned(4 downto 0);
signal joystick1_prev_reg : unsigned(4 downto 0);
......
if enable_4player then
state <= READ_JOY34;
end if;
if ((joystick1_reg and d(4 downto 0) and joystick1_prev_reg and joystick2_prev_reg) = "11111") then
last_keys_reg <= keys_reg;
if ((joystick1_reg and d(4 downto 0) and joystick1_prev_reg and joystick2_prev_reg) = "11111" and last_keys_reg = keys_reg) then
approved_keys_reg <= keys_reg;
end if;
joystick2_prev_reg <= d(4 downto 0);

Also available in: Unified diff