Project

General

Profile

« Previous | Next » 

Revision 428

Added by markw almost 10 years ago

digital stick support for 5200

View differences:

common/a8core/atari5200core_simplesdram.vhd
-- JOYSTICK
JOY1_X : IN signed(7 downto 0);
JOY1_Y : IN signed(7 downto 0);
JOY1_BUTTON : IN std_logic;
JOY2_X : IN signed(7 downto 0);
JOY2_Y : IN signed(7 downto 0);
JOY2_BUTTON : IN std_logic;
JOY1_N : IN std_logic_vector(4 downto 0); -- FRLDU, 0=pressed
JOY2_N : IN std_logic_vector(4 downto 0); -- FRLDU, 0=pressed
-- Pokey keyboard matrix
-- Standard component available to connect this to PS2
KEYBOARD_RESPONSE : IN STD_LOGIC_VECTOR(1 DOWNTO 0);
......
BEGIN
-- triggers
TRIG(0) <= JOY1_BUTTON;
TRIG(1) <= JOY2_BUTTON;
TRIG(0) <= JOY1_N(4);
TRIG(1) <= JOY2_N(4);
-- pots
pot0 : entity work.pot_from_signed
......
ENABLED => CONSOL_OUT(2),
POT_RESET => POT_RESET,
POS => JOY1_X,
FORCE_LOW => NOT(JOY1_N(2)),
FORCE_HIGH => NOT(JOY1_N(3)),
POT_HIGH => POT_IN(0)
);
pot1 : entity work.pot_from_signed
......
ENABLED => CONSOL_OUT(2),
POT_RESET => POT_RESET,
POS => JOY1_Y,
FORCE_LOW => NOT(JOY1_N(0)),
FORCE_HIGH => NOT(JOY1_N(1)),
POT_HIGH => POT_IN(1)
);
pot2 : entity work.pot_from_signed
......
ENABLED => CONSOL_OUT(2),
POT_RESET => POT_RESET,
POS => JOY2_X,
FORCE_LOW => NOT(JOY2_N(2)),
FORCE_HIGH => NOT(JOY2_N(3)),
POT_HIGH => POT_IN(2)
);
pot3 : entity work.pot_from_signed
......
ENABLED => CONSOL_OUT(2),
POT_RESET => POT_RESET,
POS => JOY2_Y,
FORCE_LOW => NOT(JOY2_N(0)),
FORCE_HIGH => NOT(JOY2_N(1)),
POT_HIGH => POT_IN(3)
);
POT_IN(7 downto 4) <= (others=>'0');
common/a8core/pot_from_signed.vhdl
line_length : integer := 114;
min_lines : integer := 0;
max_lines : integer := 227;
reverse : integer := 0
reverse : integer := 0;
force_to : signed(7 downto 0) := to_signed(100,8)
);
PORT
(
......
ENABLED : IN STD_LOGIC;
POT_RESET : IN STD_LOGIC;
POS : IN SIGNED(7 downto 0);
FORCE_LOW : IN STD_LOGIC:='0';
FORCE_HIGH : IN STD_LOGIC:='0';
POT_HIGH : OUT STD_LOGIC
);
END pot_from_signed;
......
end if;
end process;
process(count_reg,pot_reset,count_enable,pot_out_next,enabled,pos)
process(count_reg,pot_reset,count_enable,pot_out_next,enabled,pos,force_low,force_high)
variable pos2 : signed(7 downto 0);
begin
pos2 := pos;
if (abs(pos2) < 16 and force_low='1') then
pos2 := -force_to;
end if;
if (abs(pos2) < 16 and force_high='1') then
pos2 := force_to;
end if;
count_next <= count_reg;
if (pot_reset ='1' or enabled = '0') then
if (reverse = 1) then
count_next <= std_logic_vector(to_unsigned(-to_integer(pos)+127+(line_length*min_lines/count_cycles),10));
count_next <= std_logic_vector(to_unsigned(-to_integer(pos2)+127+(line_length*min_lines/count_cycles),10));
else
count_next <= std_logic_vector(to_unsigned(to_integer(pos)+128+(line_length*min_lines/count_cycles),10));
count_next <= std_logic_vector(to_unsigned(to_integer(pos2)+128+(line_length*min_lines/count_cycles),10));
end if;
end if;

Also available in: Unified diff