diff --git a/Console_MiST/GCE - Vectrex_MiST/rtl/keyboard.v b/Console_MiST/GCE - Vectrex_MiST/rtl/keyboard.v deleted file mode 100644 index afa04144..00000000 --- a/Console_MiST/GCE - Vectrex_MiST/rtl/keyboard.v +++ /dev/null @@ -1,92 +0,0 @@ - - -module keyboard -( - input clk, - input reset, - input ps2_kbd_clk, - input ps2_kbd_data, - - output reg[15:0] joystick -); - -reg [11:0] shift_reg = 12'hFFF; -wire[11:0] kdata = {ps2_kbd_data,shift_reg[11:1]}; -wire [7:0] kcode = kdata[9:2]; -reg release_btn = 0; - -reg [7:0] code; -reg input_strobe = 0; - -always @(negedge clk) begin - reg old_reset = 0; - - old_reset <= reset; - - if(~old_reset & reset)begin - joystick <= 0; - end - - if(input_strobe) begin - case(code) - 'h16: joystick[4] <= ~release_btn; // 1 - 'h1E: joystick[5] <= ~release_btn; // 2 - 'h26: joystick[6] <= ~release_btn; // 3 - 'h25: joystick[7] <= ~release_btn; // 4 - - 'h1D: joystick[11] <= ~release_btn; // W - 'h1B: joystick[10] <= ~release_btn; // S - 'h1C: joystick[9] <= ~release_btn; // A - 'h23: joystick[8] <= ~release_btn; // D - - 'h77: joystick[12] <= ~release_btn; // NUM - 'h4A: joystick[13] <= ~release_btn; // / - 'h7C: joystick[14] <= ~release_btn; // * - 'h7B: joystick[15] <= ~release_btn; // - - - 'h75: joystick[3] <= ~release_btn; // arrow up - 'h72: joystick[2] <= ~release_btn; // arrow down - 'h6B: joystick[1] <= ~release_btn; // arrow left - 'h74: joystick[0] <= ~release_btn; // arrow right - - - - endcase - end -end - -always @(posedge clk) begin - reg [3:0] prev_clk = 0; - reg old_reset = 0; - reg action = 0; - - old_reset <= reset; - input_strobe <= 0; - - if(~old_reset & reset)begin - prev_clk <= 0; - shift_reg <= 12'hFFF; - end else begin - prev_clk <= {ps2_kbd_clk,prev_clk[3:1]}; - if(prev_clk == 1) begin - if (kdata[11] & ^kdata[10:2] & ~kdata[1] & kdata[0]) begin - shift_reg <= 12'hFFF; - if (kcode == 8'he0) ; - // Extended key code follows - else if (kcode == 8'hf0) - // Release code follows - action <= 1; - else begin - // Cancel extended/release flags for next time - action <= 0; - release_btn <= action; - code <= kcode; - input_strobe <= 1; - end - end else begin - shift_reg <= kdata; - end - end - end -end -endmodule diff --git a/Console_MiST/GCE - Vectrex_MiST/rtl/vectrex_mist.sv b/Console_MiST/GCE - Vectrex_MiST/rtl/vectrex_mist.sv index 5c5590ac..a1afb743 100644 --- a/Console_MiST/GCE - Vectrex_MiST/rtl/vectrex_mist.sv +++ b/Console_MiST/GCE - Vectrex_MiST/rtl/vectrex_mist.sv @@ -37,6 +37,8 @@ wire [1:0] switches; wire [15:0] kbjoy; wire [7:0] joystick_0; wire [7:0] joystick_1; +wire [15:0] joy_ana_0; +wire [15:0] joy_ana_1; wire ypbpr; wire ps2_kbd_clk, ps2_kbd_data; wire [7:0] pot_x_1, pot_x_2; @@ -61,25 +63,6 @@ assign LED = !ioctl_downl; wire clk_24, clk_12; wire pll_locked; -always @(clk_24)begin - pot_x_1 = 8'h00; - pot_y_1 = 8'h00; - pot_x_2 = 8'h00; - pot_y_2 = 8'h00; - // - if (joystick_0[1] | kbjoy[1]) pot_x_2 = 8'h80; - if (joystick_0[0] | kbjoy[0]) pot_x_2 = 8'h7F; - - if (joystick_0[3] | kbjoy[3]) pot_y_2 = 8'h7F; - if (joystick_0[2] | kbjoy[2]) pot_y_2 = 8'h80; - //Player2 - if (joystick_1[1] | kbjoy[9]) pot_x_1 = 8'h80; - if (joystick_1[0] | kbjoy[8]) pot_x_1 = 8'h7F; - - if (joystick_1[3] | kbjoy[11]) pot_y_1 = 8'h7F; - if (joystick_1[2] | kbjoy[10]) pot_y_1 = 8'h80; -end - pll pll ( .inclk0 ( CLOCK_27 ), .areset ( 0 ), @@ -113,6 +96,11 @@ always @(posedge clk_24) begin end end +assign pot_x_1 = status[4] ? joy_ana_1[15:8] : joy_ana_0[15:8]; +assign pot_x_2 = status[4] ? joy_ana_0[15:8] : joy_ana_1[15:8]; +assign pot_y_1 = status[4] ? ~joy_ana_1[ 7:0] : ~joy_ana_0[ 7:0]; +assign pot_y_2 = status[4] ? ~joy_ana_0[ 7:0] : ~joy_ana_1[ 7:0]; + vectrex vectrex ( .clock_24 ( clk_24 ), .clock_12 ( clk_12 ), @@ -131,28 +119,21 @@ vectrex vectrex ( .cart_addr ( cart_addr ), .cart_do ( cart_do ), .cart_rd ( cart_rd ), - .btn11 ( joystick_0[4] | kbjoy[4] | status[4] ? joystick_1[4] : 1'b0), - .btn12 ( joystick_0[5] | kbjoy[5] | status[4] ? joystick_1[5] : 1'b0), - .btn13 ( joystick_0[6] | kbjoy[6] | status[4] ? joystick_1[6] : 1'b0), - .btn14 ( joystick_0[7] | kbjoy[7] | status[4] ? joystick_1[7] : 1'b0), - .pot_x_1 ( pot_x_1 ), - .pot_y_1 ( pot_y_1 ), - .btn21 ( kbjoy[12] | ~status[4] ? joystick_1[4] : 1'b0), - .btn22 ( kbjoy[13] | ~status[4] ? joystick_1[5] : 1'b0), - .btn23 ( kbjoy[14] | ~status[4] ? joystick_1[6] : 1'b0), - .btn24 ( kbjoy[15] | ~status[4] ? joystick_1[7] : 1'b0), - .pot_x_2 ( pot_x_2 ), - .pot_y_2 ( pot_y_2 ), + .btn11 ( status[4] ? joystick_1[4] : joystick_0[4]), + .btn12 ( status[4] ? joystick_1[5] : joystick_0[5]), + .btn13 ( status[4] ? joystick_1[6] : joystick_0[6]), + .btn14 ( status[4] ? joystick_1[7] : joystick_0[7]), + .pot_x_1 ( pot_x_1 ), + .pot_y_1 ( pot_y_1 ), + .btn21 ( status[4] ? joystick_0[4] : joystick_1[4]), + .btn22 ( status[4] ? joystick_0[5] : joystick_1[5]), + .btn23 ( status[4] ? joystick_0[6] : joystick_1[6]), + .btn24 ( status[4] ? joystick_0[7] : joystick_1[7]), + .pot_x_2 ( pot_x_2 ), + .pot_y_2 ( pot_y_2 ), .leds ( ), .dbg_cpu_addr ( ) ); - - // .pot_x_1(joya_0[7:0] ? joya_0[7:0] : {joystick_0[1], {7{joystick_0[0]}}}), - //.pot_y_1(joya_0[15:8] ? ~joya_0[15:8] : {joystick_0[2], {7{joystick_0[3]}}}), - - // .pot_x_2(joya_1[7:0] ? joya_1[7:0] : {joystick_1[1], {7{joystick_1[0]}}}), - //.pot_y_2(joya_1[15:8] ? ~joya_1[15:8] : {joystick_1[2], {7{joystick_1[3]}}}) - dac dac ( .clk_i ( clk_24 ), @@ -229,6 +210,8 @@ mist_io #(.STRLEN(($size(CONF_STR)>>3))) mist_io ( .ps2_kbd_data ( ps2_kbd_data ), .joystick_0 ( joystick_0 ), .joystick_1 ( joystick_1 ), + .joystick_analog_0( joy_ana_0 ), + .joystick_analog_1( joy_ana_1 ), .status ( status ), .ioctl_download( ioctl_downl ), .ioctl_index ( ioctl_index ), @@ -237,13 +220,4 @@ mist_io #(.STRLEN(($size(CONF_STR)>>3))) mist_io ( .ioctl_dout ( ioctl_dout ) ); -keyboard keyboard ( - .clk ( clk_24 ), - .reset ( 0 ), - .ps2_kbd_clk ( ps2_kbd_clk ), - .ps2_kbd_data ( ps2_kbd_data ), - .joystick ( kbjoy ) - ); - - endmodule \ No newline at end of file diff --git a/Console_MiST/GCE - Vectrex_MiST/vectrex_MiST.qsf b/Console_MiST/GCE - Vectrex_MiST/vectrex_MiST.qsf index 35c008ca..dc8b461c 100644 --- a/Console_MiST/GCE - Vectrex_MiST/vectrex_MiST.qsf +++ b/Console_MiST/GCE - Vectrex_MiST/vectrex_MiST.qsf @@ -209,7 +209,6 @@ set_global_assignment -name VHDL_FILE rtl/gen_ram.vhd set_global_assignment -name VHDL_FILE rtl/cpu09l_128a.vhd set_global_assignment -name VHDL_FILE rtl/dac.vhd set_global_assignment -name SYSTEMVERILOG_FILE rtl/hq2x.sv -set_global_assignment -name VERILOG_FILE rtl/keyboard.v set_global_assignment -name VERILOG_FILE rtl/mist_io.v set_global_assignment -name VERILOG_FILE rtl/pll.v set_global_assignment -name VERILOG_FILE rtl/mc6809is.v