From bdc268034dad3fc297d7ee74dad2e4c222916ade Mon Sep 17 00:00:00 2001 From: Eugene Lozovoy Date: Mon, 16 Sep 2024 22:43:01 +0300 Subject: [PATCH] add sinclair and cursor joystick options --- TSConf.sv | 13 +- rtl/periph/keyboard.v | 300 ++++++++++++++++++++++++++++++++++++++++ rtl/periph/keyboard.vhd | 170 ----------------------- rtl/tsconf.v | 15 +- 4 files changed, 321 insertions(+), 177 deletions(-) create mode 100644 rtl/periph/keyboard.v delete mode 100644 rtl/periph/keyboard.vhd diff --git a/TSConf.sv b/TSConf.sv index 6eb3d24..d1600dd 100644 --- a/TSConf.sv +++ b/TSConf.sv @@ -69,6 +69,8 @@ assign UART_TX = 1'b1; `include "build_id.v" localparam CONF_STR = { "TSConf;;", + "O78,Joystick 1,Kempston,Sinclair 1,Sinclair 2,Cursor;", + "O9A,Joystick 2,Kempston,Sinclair 1,Sinclair 2,Cursor;", "O12,Scandoubler Fx,None,CRT 25%,CRT 50%,CRT 75%;", "O4,Vsync,49 Hz,60 Hz;", "O5,VDAC1,ON,OFF;", @@ -80,6 +82,8 @@ localparam CONF_STR = { }; wire st_reset = status[0]; +wire [1:0] st_joystick1 = status[8:7]; +wire [1:0] st_joystick2 = status[10:9]; wire [1:0] st_scanlines = status[2:1]; wire st_60hz = ~status[4]; wire st_vdac = ~status[5]; @@ -121,8 +125,8 @@ end ////////////////// MIST ARM I/O /////////////////// -wire [7:0] joystick_0; -wire [7:0] joystick_1; +wire [31:0] joystick_0; +wire [31:0] joystick_1; wire [1:0] buttons; wire [1:0] switches; @@ -333,10 +337,13 @@ tsconf tsconf .CFG_60HZ(st_60hz), .CFG_SCANDOUBLER(1'b0), .CFG_VDAC(st_vdac), + .CFG_JOYSTICK1(st_joystick1), + .CFG_JOYSTICK2(st_joystick2), .PS2_KEY({key_strobe,key_pressed,key_extended,key_code}), .PS2_MOUSE(ps2_mouse), - .JOYSTICK(joystick_0 | joystick_1), + .JOYSTICK1({joystick_0[9:8], joystick_0[5:0]}), + .JOYSTICK2({joystick_1[9:8], joystick_1[5:0]}), .loader_act(ioctl_download), .loader_addr(ioctl_addr[15:0]), diff --git a/rtl/periph/keyboard.v b/rtl/periph/keyboard.v new file mode 100644 index 0000000..b7b9656 --- /dev/null +++ b/rtl/periph/keyboard.v @@ -0,0 +1,300 @@ +module keyboard +( + input clk, + input reset, + input [7:0] a, + output [4:0] keyb, + output reg key_reset, + output reg [7:0] scancode, + input [10:0] ps2_key, + input [1:0] cfg_joystick1, + input [1:0] cfg_joystick2, + input [7:0] joystick1, + input [7:0] joystick2 +); + +reg [4:0] keys [7:0]; + +wire [4:0] row0 = a[0]? 5'b11111 : keys[0]; +wire [4:0] row1 = a[1]? 5'b11111 : keys[1]; +wire [4:0] row2 = a[2]? 5'b11111 : keys[2]; +wire [4:0] row3 = a[3]? 5'b11111 : keys[3]; +wire [4:0] row4 = a[4]? 5'b11111 : keys[4]; +wire [4:0] row5 = a[5]? 5'b11111 : keys[5]; +wire [4:0] row6 = a[6]? 5'b11111 : keys[6]; +wire [4:0] row7 = a[7]? 5'b11111 : keys[7]; +assign keyb = row0 & row1 & row2 & row3 & row4 & row5 & row6 & row7; + + +wire [15:0] joys = {joystick2, joystick1}; +reg [15:0] joys_r = 0; +reg joys_ch = 0; +reg [3:0] joys_chn; + +reg strobe = 0; +reg press; +reg [8:0] code; + +reg flg = 0; +always @(posedge clk) + flg <= ps2_key[10]; + + +always @(posedge clk) begin + strobe <= 1'b0; + + if (joys[15] != joys_r[15]) {joys_ch, joys_chn} <= {1'b1, 4'd15}; + if (joys[14] != joys_r[14]) {joys_ch, joys_chn} <= {1'b1, 4'd14}; + if (joys[13] != joys_r[13]) {joys_ch, joys_chn} <= {1'b1, 4'd13}; + if (joys[12] != joys_r[12]) {joys_ch, joys_chn} <= {1'b1, 4'd12}; + if (joys[11] != joys_r[11]) {joys_ch, joys_chn} <= {1'b1, 4'd11}; + if (joys[10] != joys_r[10]) {joys_ch, joys_chn} <= {1'b1, 4'd10}; + if (joys[9] != joys_r[9]) {joys_ch, joys_chn} <= {1'b1, 4'd9}; + if (joys[8] != joys_r[8]) {joys_ch, joys_chn} <= {1'b1, 4'd8}; + if (joys[7] != joys_r[7]) {joys_ch, joys_chn} <= {1'b1, 4'd7}; + if (joys[6] != joys_r[6]) {joys_ch, joys_chn} <= {1'b1, 4'd6}; + if (joys[5] != joys_r[5]) {joys_ch, joys_chn} <= {1'b1, 4'd5}; + if (joys[4] != joys_r[4]) {joys_ch, joys_chn} <= {1'b1, 4'd4}; + if (joys[3] != joys_r[3]) {joys_ch, joys_chn} <= {1'b1, 4'd3}; + if (joys[2] != joys_r[2]) {joys_ch, joys_chn} <= {1'b1, 4'd2}; + if (joys[1] != joys_r[1]) {joys_ch, joys_chn} <= {1'b1, 4'd1}; + if (joys[0] != joys_r[0]) {joys_ch, joys_chn} <= {1'b1, 4'd0}; + + if (ps2_key[10] && !flg) begin + {strobe, press, code} <= ps2_key; + end + else if (joys_ch) begin + joys_ch <= 1'b0; + joys_r[joys_chn] <= joys[joys_chn]; + case (cfg_joystick1) + 2'b01: begin // Sinclair 1 + case (joys_chn) + 0: {strobe, press, code} <= {1'b1, joys[0 ], 9'h3d}; // Right | 7 + 1: {strobe, press, code} <= {1'b1, joys[1 ], 9'h36}; // Left | 6 + 2: {strobe, press, code} <= {1'b1, joys[2 ], 9'h3e}; // Down | 8 + 3: {strobe, press, code} <= {1'b1, joys[3 ], 9'h46}; // Up | 9 + 4: {strobe, press, code} <= {1'b1, joys[4 ], 9'h45}; // Fire 1 | 0 + 5: {strobe, press, code} <= {1'b1, joys[5 ], 9'h3a}; // Fire 2 | m + 6: {strobe, press, code} <= {1'b1, joys[6 ], 9'h31}; // Fire 3 | n + 7: {strobe, press, code} <= {1'b1, joys[7 ], 9'h32}; // Fire 4 | b + endcase + end + 2'b10: begin // Sinclair 2 + case (joys_chn) + 0: {strobe, press, code} <= {1'b1, joys[0 ], 9'h1e}; // Right | 2 + 1: {strobe, press, code} <= {1'b1, joys[1 ], 9'h16}; // Left | 1 + 2: {strobe, press, code} <= {1'b1, joys[2 ], 9'h26}; // Down | 3 + 3: {strobe, press, code} <= {1'b1, joys[3 ], 9'h25}; // Up | 4 + 4: {strobe, press, code} <= {1'b1, joys[4 ], 9'h2e}; // Fire 1 | 5 + 5: {strobe, press, code} <= {1'b1, joys[5 ], 9'h1a}; // Fire 2 | z + 6: {strobe, press, code} <= {1'b1, joys[6 ], 9'h22}; // Fire 3 | x + 7: {strobe, press, code} <= {1'b1, joys[7 ], 9'h21}; // Fire 4 | c + endcase + end + 2'b11: begin // Cursor + case (joys_chn) + 0: {strobe, press, code} <= {1'b1, joys[0 ], 9'h74}; // Right | Right + 1: {strobe, press, code} <= {1'b1, joys[1 ], 9'h6b}; // Left | Left + 2: {strobe, press, code} <= {1'b1, joys[2 ], 9'h72}; // Down | Down + 3: {strobe, press, code} <= {1'b1, joys[3 ], 9'h75}; // Up | Up + 4: {strobe, press, code} <= {1'b1, joys[4 ], 9'h5a}; // Fire 1 | Enter + 5: {strobe, press, code} <= {1'b1, joys[5 ], 9'h0d}; // Fire 2 | Tab + 6: {strobe, press, code} <= {1'b1, joys[6 ], 9'h29}; // Fire 3 | Space + 7: {strobe, press, code} <= {1'b1, joys[7 ], 9'h76}; // Fire 4 | Esc + endcase + end + endcase + case (cfg_joystick2) + 2'b01: begin // Sinclair 1 + case (joys_chn) + 8: {strobe, press, code} <= {1'b1, joys[8 ], 9'h3d}; // Right | 7 + 9: {strobe, press, code} <= {1'b1, joys[9 ], 9'h36}; // Left | 6 + 10: {strobe, press, code} <= {1'b1, joys[10], 9'h3e}; // Down | 8 + 11: {strobe, press, code} <= {1'b1, joys[11], 9'h46}; // Up | 9 + 12: {strobe, press, code} <= {1'b1, joys[12], 9'h45}; // Fire 1 | 0 + 13: {strobe, press, code} <= {1'b1, joys[13], 9'h3a}; // Fire 2 | m + 14: {strobe, press, code} <= {1'b1, joys[14], 9'h31}; // Fire 3 | n + 15: {strobe, press, code} <= {1'b1, joys[15], 9'h32}; // Fire 4 | b + endcase + end + 2'b10: begin // Sinclair 2 + case (joys_chn) + 8: {strobe, press, code} <= {1'b1, joys[8 ], 9'h1e}; // Right | 2 + 9: {strobe, press, code} <= {1'b1, joys[9 ], 9'h16}; // Left | 1 + 10: {strobe, press, code} <= {1'b1, joys[10], 9'h26}; // Down | 3 + 11: {strobe, press, code} <= {1'b1, joys[11], 9'h25}; // Up | 4 + 12: {strobe, press, code} <= {1'b1, joys[12], 9'h2e}; // Fire 1 | 5 + 13: {strobe, press, code} <= {1'b1, joys[13], 9'h1a}; // Fire 2 | z + 14: {strobe, press, code} <= {1'b1, joys[14], 9'h22}; // Fire 3 | x + 15: {strobe, press, code} <= {1'b1, joys[15], 9'h21}; // Fire 4 | c + endcase + end + 2'b11: begin // Cursor + case (joys_chn) + 8: {strobe, press, code} <= {1'b1, joys[8 ], 9'h74}; // Right | Right + 9: {strobe, press, code} <= {1'b1, joys[9 ], 9'h6b}; // Left | Left + 10: {strobe, press, code} <= {1'b1, joys[10], 9'h72}; // Down | Down + 11: {strobe, press, code} <= {1'b1, joys[11], 9'h75}; // Up | Up + 12: {strobe, press, code} <= {1'b1, joys[12], 9'h5a}; // Fire 1 | Enter + 13: {strobe, press, code} <= {1'b1, joys[13], 9'h0d}; // Fire 2 | Tab + 14: {strobe, press, code} <= {1'b1, joys[14], 9'h29}; // Fire 3 | Space + 15: {strobe, press, code} <= {1'b1, joys[15], 9'h76}; // Fire 4 | Esc + endcase + end + endcase + end +end + + +always @(posedge clk or posedge reset) begin + if (reset) begin + keys[0] <= 5'b11111; + keys[1] <= 5'b11111; + keys[2] <= 5'b11111; + keys[3] <= 5'b11111; + keys[4] <= 5'b11111; + keys[5] <= 5'b11111; + keys[6] <= 5'b11111; + keys[7] <= 5'b11111; + key_reset <= 0; + scancode <= 0; + end + else begin + if (strobe) begin + if (press) + scancode <= code[7:0]; + else + scancode <= 8'hFF; + case (code[7:0]) + 8'h12: keys[0][0] <= ~press; // Left shift (CAPS SHIFT) + 8'h59: keys[0][0] <= ~press; // Right shift (CAPS SHIFT) + 8'h1a: keys[0][1] <= ~press; // Z + 8'h22: keys[0][2] <= ~press; // X + 8'h21: keys[0][3] <= ~press; // C + 8'h2a: keys[0][4] <= ~press; // V + + 8'h1c: keys[1][0] <= ~press; // A + 8'h1b: keys[1][1] <= ~press; // S + 8'h23: keys[1][2] <= ~press; // D + 8'h2b: keys[1][3] <= ~press; // F + 8'h34: keys[1][4] <= ~press; // G + + 8'h15: keys[2][0] <= ~press; // Q + 8'h1d: keys[2][1] <= ~press; // W + 8'h24: keys[2][2] <= ~press; // E + 8'h2d: keys[2][3] <= ~press; // R + 8'h2c: keys[2][4] <= ~press; // T + + 8'h16: keys[3][0] <= ~press; // 1 + 8'h1e: keys[3][1] <= ~press; // 2 + 8'h26: keys[3][2] <= ~press; // 3 + 8'h25: keys[3][3] <= ~press; // 4 + 8'h2e: keys[3][4] <= ~press; // 5 + + 8'h45: keys[4][0] <= ~press; // 0 + 8'h46: keys[4][1] <= ~press; // 9 + 8'h3e: keys[4][2] <= ~press; // 8 + 8'h3d: keys[4][3] <= ~press; // 7 + 8'h36: keys[4][4] <= ~press; // 6 + + 8'h4d: keys[5][0] <= ~press; // P + 8'h44: keys[5][1] <= ~press; // O + 8'h43: keys[5][2] <= ~press; // I + 8'h3c: keys[5][3] <= ~press; // U + 8'h35: keys[5][4] <= ~press; // Y + + 8'h5a: keys[6][0] <= ~press; // ENTER + 8'h4b: keys[6][1] <= ~press; // L + 8'h42: keys[6][2] <= ~press; // K + 8'h3b: keys[6][3] <= ~press; // J + 8'h33: keys[6][4] <= ~press; // H + + 8'h29: keys[7][0] <= ~press; // SPACE + 8'h14: keys[7][1] <= ~press; // CTRL (Symbol Shift) + 8'h3a: keys[7][2] <= ~press; // M + 8'h31: keys[7][3] <= ~press; // N + 8'h32: keys[7][4] <= ~press; // B + + // Cursor keys + 8'h6b: begin + keys[0][0] <= ~press; // Left (CAPS 5) + keys[3][4] <= ~press; + end + 8'h72: begin + keys[0][0] <= ~press; // Down (CAPS 6) + keys[4][4] <= ~press; + end + 8'h75: begin + keys[0][0] <= ~press; // Up (CAPS 7) + keys[4][3] <= ~press; + end + 8'h74: begin + keys[0][0] <= ~press; // Right (CAPS 8) + keys[4][2] <= ~press; + end + + // Other special keys sent to the ULA as key combinations + 8'h66: begin + keys[0][0] <= ~press; // Backspace (CAPS 0) + keys[4][0] <= ~press; + end + 8'h58: begin + keys[0][0] <= ~press; // Caps lock (CAPS 2) + keys[3][1] <= ~press; + end + 8'h0d: begin + keys[0][0] <= ~press; // Tab (CAPS SPACE) + keys[7][0] <= ~press; + end + 8'h49: begin + keys[7][2] <= ~press; // . + keys[7][1] <= ~press; + end + 8'h4e: begin + keys[6][3] <= ~press; // - + keys[7][1] <= ~press; + end + 8'h0e: begin + keys[3][0] <= ~press; // ` (EDIT) + keys[0][0] <= ~press; + end + 8'h41: begin + keys[7][3] <= ~press; // , + keys[7][1] <= ~press; + end + 8'h4c: begin + keys[5][1] <= ~press; // ; + keys[7][1] <= ~press; + end + 8'h52: begin + keys[5][0] <= ~press; // " + keys[7][1] <= ~press; + end + 8'h5d: begin + keys[0][1] <= ~press; // : + keys[7][1] <= ~press; + end + 8'h55: begin + keys[6][1] <= ~press; // = + keys[7][1] <= ~press; + end + 8'h54: begin + keys[4][2] <= ~press; // ( + keys[7][1] <= ~press; + end + 8'h5b: begin + keys[4][1] <= ~press; // ) + keys[7][1] <= ~press; + end + 8'h4a: begin + keys[0][3] <= ~press; // ? + keys[7][1] <= ~press; + end + + 8'h78: key_reset <= press; + endcase + end + end +end + +endmodule diff --git a/rtl/periph/keyboard.vhd b/rtl/periph/keyboard.vhd deleted file mode 100644 index 5054c73..0000000 --- a/rtl/periph/keyboard.vhd +++ /dev/null @@ -1,170 +0,0 @@ --------------------------------------------------------------------[28.07.2014] --- KEYBOARD CONTROLLER USB HID scancode to Spectrum matrix conversion -------------------------------------------------------------------------------- --- V0.1 05.10.2011 первая версия --- V0.2 16.03.2014 измененмия в key_f (активная клавиша теперь устанавливается в '1') --- V1.0 24.07.2014 доработан под USB HID Keyboard --- V1.1 28.07.2014 добавлены спец клавиши --- WXEDA 10.03.2015 добавлен контроллер ps/2 - -library IEEE; -use IEEE.STD_LOGIC_1164.ALL; -use IEEE.NUMERIC_STD.ALL; - -entity keyboard is -port ( - CLK : in std_logic; - RESET : in std_logic; - A : in std_logic_vector(7 downto 0); - KEYB : out std_logic_vector(4 downto 0); - KEY_RESET: out std_logic; - SCANCODE : out std_logic_vector(7 downto 0); - PS2_KEY : in std_logic_vector(10 downto 0) -); -end keyboard; - -architecture rtl of keyboard is - --- Internal signals -type key_matrix is array (7 downto 0) of std_logic_vector(4 downto 0); -signal keys : key_matrix; -signal row0, row1, row2, row3, row4, row5, row6, row7 : std_logic_vector(4 downto 0); -signal flg : std_logic; - -begin - - -- Output addressed row to ULA - row0 <= keys(0) when A(0) = '0' else (others => '1'); - row1 <= keys(1) when A(1) = '0' else (others => '1'); - row2 <= keys(2) when A(2) = '0' else (others => '1'); - row3 <= keys(3) when A(3) = '0' else (others => '1'); - row4 <= keys(4) when A(4) = '0' else (others => '1'); - row5 <= keys(5) when A(5) = '0' else (others => '1'); - row6 <= keys(6) when A(6) = '0' else (others => '1'); - row7 <= keys(7) when A(7) = '0' else (others => '1'); - KEYB <= row0 and row1 and row2 and row3 and row4 and row5 and row6 and row7; - - process (CLK) begin - if rising_edge(CLK) then - flg <= ps2_key(10); - - if RESET = '1' then - keys(0) <= (others => '1'); - keys(1) <= (others => '1'); - keys(2) <= (others => '1'); - keys(3) <= (others => '1'); - keys(4) <= (others => '1'); - keys(5) <= (others => '1'); - keys(6) <= (others => '1'); - keys(7) <= (others => '1'); - KEY_RESET <= '0'; - SCANCODE <= (others => '0'); - else - if flg /= ps2_key(10) then - if (ps2_key(9) = '1') then - SCANCODE <= ps2_key(7 downto 0); - else - SCANCODE <= (others => '1'); - end if; - - case ps2_key(7 downto 0) is - when X"12" => keys(0)(0) <= not ps2_key(9); -- Left shift (CAPS SHIFT) - when X"59" => keys(0)(0) <= not ps2_key(9); -- Right shift (CAPS SHIFT) - when X"1a" => keys(0)(1) <= not ps2_key(9); -- Z - when X"22" => keys(0)(2) <= not ps2_key(9); -- X - when X"21" => keys(0)(3) <= not ps2_key(9); -- C - when X"2a" => keys(0)(4) <= not ps2_key(9); -- V - - when X"1c" => keys(1)(0) <= not ps2_key(9); -- A - when X"1b" => keys(1)(1) <= not ps2_key(9); -- S - when X"23" => keys(1)(2) <= not ps2_key(9); -- D - when X"2b" => keys(1)(3) <= not ps2_key(9); -- F - when X"34" => keys(1)(4) <= not ps2_key(9); -- G - - when X"15" => keys(2)(0) <= not ps2_key(9); -- Q - when X"1d" => keys(2)(1) <= not ps2_key(9); -- W - when X"24" => keys(2)(2) <= not ps2_key(9); -- E - when X"2d" => keys(2)(3) <= not ps2_key(9); -- R - when X"2c" => keys(2)(4) <= not ps2_key(9); -- T - - when X"16" => keys(3)(0) <= not ps2_key(9); -- 1 - when X"1e" => keys(3)(1) <= not ps2_key(9); -- 2 - when X"26" => keys(3)(2) <= not ps2_key(9); -- 3 - when X"25" => keys(3)(3) <= not ps2_key(9); -- 4 - when X"2e" => keys(3)(4) <= not ps2_key(9); -- 5 - - when X"45" => keys(4)(0) <= not ps2_key(9); -- 0 - when X"46" => keys(4)(1) <= not ps2_key(9); -- 9 - when X"3e" => keys(4)(2) <= not ps2_key(9); -- 8 - when X"3d" => keys(4)(3) <= not ps2_key(9); -- 7 - when X"36" => keys(4)(4) <= not ps2_key(9); -- 6 - - when X"4d" => keys(5)(0) <= not ps2_key(9); -- P - when X"44" => keys(5)(1) <= not ps2_key(9); -- O - when X"43" => keys(5)(2) <= not ps2_key(9); -- I - when X"3c" => keys(5)(3) <= not ps2_key(9); -- U - when X"35" => keys(5)(4) <= not ps2_key(9); -- Y - - when X"5a" => keys(6)(0) <= not ps2_key(9); -- ENTER - when X"4b" => keys(6)(1) <= not ps2_key(9); -- L - when X"42" => keys(6)(2) <= not ps2_key(9); -- K - when X"3b" => keys(6)(3) <= not ps2_key(9); -- J - when X"33" => keys(6)(4) <= not ps2_key(9); -- H - - when X"29" => keys(7)(0) <= not ps2_key(9); -- SPACE - when X"14" => keys(7)(1) <= not ps2_key(9); -- CTRL (Symbol Shift) - when X"3a" => keys(7)(2) <= not ps2_key(9); -- M - when X"31" => keys(7)(3) <= not ps2_key(9); -- N - when X"32" => keys(7)(4) <= not ps2_key(9); -- B - - -- Cursor keys - when X"6b" => keys(0)(0) <= not ps2_key(9); -- Left (CAPS 5) - keys(3)(4) <= not ps2_key(9); - when X"72" => keys(0)(0) <= not ps2_key(9); -- Down (CAPS 6) - keys(4)(4) <= not ps2_key(9); - when X"75" => keys(0)(0) <= not ps2_key(9); -- Up (CAPS 7) - keys(4)(3) <= not ps2_key(9); - when X"74" => keys(0)(0) <= not ps2_key(9); -- Right (CAPS 8) - keys(4)(2) <= not ps2_key(9); - - -- Other special keys sent to the ULA as key combinations - when X"66" => keys(0)(0) <= not ps2_key(9); -- Backspace (CAPS 0) - keys(4)(0) <= not ps2_key(9); - when X"58" => keys(0)(0) <= not ps2_key(9); -- Caps lock (CAPS 2) - keys(3)(1) <= not ps2_key(9); - when X"0d" => keys(0)(0) <= not ps2_key(9); -- Tab (CAPS SPACE) - keys(7)(0) <= not ps2_key(9); - when X"49" => keys(7)(2) <= not ps2_key(9); -- . - keys(7)(1) <= not ps2_key(9); - when X"4e" => keys(6)(3) <= not ps2_key(9); -- - - keys(7)(1) <= not ps2_key(9); - when X"0e" => keys(3)(0) <= not ps2_key(9); -- ` (EDIT) - keys(0)(0) <= not ps2_key(9); - when X"41" => keys(7)(3) <= not ps2_key(9); -- , - keys(7)(1) <= not ps2_key(9); - when X"4c" => keys(5)(1) <= not ps2_key(9); -- ; - keys(7)(1) <= not ps2_key(9); - when X"52" => keys(5)(0) <= not ps2_key(9); -- " - keys(7)(1) <= not ps2_key(9); - when X"5d" => keys(0)(1) <= not ps2_key(9); -- : - keys(7)(1) <= not ps2_key(9); - when X"55" => keys(6)(1) <= not ps2_key(9); -- = - keys(7)(1) <= not ps2_key(9); - when X"54" => keys(4)(2) <= not ps2_key(9); -- ( - keys(7)(1) <= not ps2_key(9); - when X"5b" => keys(4)(1) <= not ps2_key(9); -- ) - keys(7)(1) <= not ps2_key(9); - when X"4a" => keys(0)(3) <= not ps2_key(9); -- ? - keys(7)(1) <= not ps2_key(9); - -------------------------------------------- - - when X"78" => KEY_RESET <= ps2_key(9); -- F11 - - when others => null; - end case; - end if; - end if; - end if; - end process; - -end architecture; diff --git a/rtl/tsconf.v b/rtl/tsconf.v index 8171160..42e4ade 100644 --- a/rtl/tsconf.v +++ b/rtl/tsconf.v @@ -51,11 +51,14 @@ module tsconf input CFG_60HZ, input CFG_SCANDOUBLER, input CFG_VDAC, + input [2:1] CFG_JOYSTICK1, + input [2:1] CFG_JOYSTICK2, // User input input [10:0] PS2_KEY, input [24:0] PS2_MOUSE, - input [7:0] JOYSTICK, + input [7:0] JOYSTICK1, + input [7:0] JOYSTICK2, input loader_act, input [15:0] loader_addr, @@ -765,7 +768,7 @@ module tsconf .dmawpdev(dmawpdev), .keys_in(kbd_port_data), .mus_in(mus_port_data), - .kj_in(JOYSTICK), + .kj_in((!CFG_JOYSTICK1? JOYSTICK1 : 0) | (!CFG_JOYSTICK2? JOYSTICK2 : 0)), .tape_read(TAPE_IN), .beeper_wr(beeper_wr), .covox_wr(covox_wr), @@ -926,9 +929,13 @@ module tsconf .reset(COLD_RESET | WARM_RESET), .a(a[15:8]), .keyb(kbd_port_data), - .KEY_RESET(key_reset), + .key_reset(key_reset), .scancode(key_scancode), - .ps2_key(PS2_KEY) + .ps2_key(PS2_KEY), + .cfg_joystick1(CFG_JOYSTICK1), + .cfg_joystick2(CFG_JOYSTICK2), + .joystick1(JOYSTICK1), + .joystick2(JOYSTICK2) );