mirror of
https://github.com/MiSTer-devel/InputTest_MiSTer.git
synced 2026-05-24 03:03:36 +00:00
Add wiring for paddles and spinners
This commit is contained in:
32
InputTest.sv
32
InputTest.sv
@@ -225,6 +225,18 @@ wire [15:0] joystick_analog_2;
|
||||
wire [15:0] joystick_analog_3;
|
||||
wire [15:0] joystick_analog_4;
|
||||
wire [15:0] joystick_analog_5;
|
||||
wire [7:0] paddle_0;
|
||||
wire [7:0] paddle_1;
|
||||
wire [7:0] paddle_2;
|
||||
wire [7:0] paddle_3;
|
||||
wire [7:0] paddle_4;
|
||||
wire [7:0] paddle_5;
|
||||
wire [8:0] spinner_0;
|
||||
wire [8:0] spinner_1;
|
||||
wire [8:0] spinner_2;
|
||||
wire [8:0] spinner_3;
|
||||
wire [8:0] spinner_4;
|
||||
wire [8:0] spinner_5;
|
||||
|
||||
wire [21:0] gamma_bus;
|
||||
|
||||
@@ -261,7 +273,21 @@ hps_io #(.CONF_STR(CONF_STR)) hps_io
|
||||
.joystick_analog_2(joystick_analog_2),
|
||||
.joystick_analog_3(joystick_analog_3),
|
||||
.joystick_analog_4(joystick_analog_4),
|
||||
.joystick_analog_5(joystick_analog_5)
|
||||
.joystick_analog_5(joystick_analog_5),
|
||||
|
||||
.paddle_0(paddle_0),
|
||||
.paddle_1(paddle_1),
|
||||
.paddle_2(paddle_2),
|
||||
.paddle_3(paddle_3),
|
||||
.paddle_4(paddle_4),
|
||||
.paddle_5(paddle_5),
|
||||
|
||||
.spinner_0(spinner_0),
|
||||
.spinner_1(spinner_1),
|
||||
.spinner_2(spinner_2),
|
||||
.spinner_3(spinner_3),
|
||||
.spinner_4(spinner_4),
|
||||
.spinner_5(spinner_5)
|
||||
);
|
||||
|
||||
|
||||
@@ -329,7 +355,9 @@ system system(
|
||||
.dn_wr(ioctl_wr),
|
||||
.dn_index(ioctl_index),
|
||||
.joystick({joystick_5,joystick_4,joystick_3,joystick_2,joystick_1,joystick_0}),
|
||||
.analog({joystick_analog_5,joystick_analog_4,joystick_analog_3,joystick_analog_2,joystick_analog_1,joystick_analog_0})
|
||||
.analog({joystick_analog_5,joystick_analog_4,joystick_analog_3,joystick_analog_2,joystick_analog_1,joystick_analog_0}),
|
||||
.paddle({paddle_5,paddle_4,paddle_3,paddle_2,paddle_1,paddle_0}),
|
||||
.spinner({spinner_5,spinner_4,spinner_3,spinner_2,spinner_1,spinner_0})
|
||||
);
|
||||
|
||||
endmodule
|
||||
|
||||
File diff suppressed because one or more lines are too long
24
rtl/system.v
24
rtl/system.v
@@ -8,12 +8,18 @@ module system (
|
||||
input [7:0] dn_data,
|
||||
input [7:0] dn_index,
|
||||
|
||||
// 6 joysticks, 32 buttons each
|
||||
// 6 devices, 32 buttons each
|
||||
input [191:0] joystick,
|
||||
|
||||
// 6 joysticks, 16 bits each - -127..+127, Y: [15:8], X: [7:0]
|
||||
// 6 devices, 16 bits each - -127..+127, Y: [15:8], X: [7:0]
|
||||
input [95:0] analog,
|
||||
|
||||
// 6 devices, 8 bits each - paddle 0..255
|
||||
input [47:0] paddle,
|
||||
|
||||
// 6 devices, 9 bits eachspinner [7:0] -128..+127, [8] - toggle with every update
|
||||
input [53:0] spinner,
|
||||
|
||||
output VGA_HS,
|
||||
output VGA_VS,
|
||||
output [7:0] VGA_R,
|
||||
@@ -109,12 +115,10 @@ wire [7:0] colram_data_out;
|
||||
|
||||
// Hardware inputs
|
||||
wire [7:0] in0_data_out = {VGA_HS, VGA_VS, 6'b101000};
|
||||
|
||||
wire [7:0] joystick_bit = cpu_addr[7:0];
|
||||
wire [7:0] joystick_data_out = joystick[joystick_bit +: 8];
|
||||
|
||||
wire [6:0] analog_bit = cpu_addr[6:0];
|
||||
wire [7:0] analog_data_out = analog[analog_bit +: 8];
|
||||
wire [7:0] joystick_data_out = joystick[cpu_addr[7:0] +: 8];
|
||||
wire [7:0] analog_data_out = analog[cpu_addr[6:0] +: 8];
|
||||
wire [7:0] paddle_data_out = paddle[cpu_addr[5:0] +: 8];
|
||||
wire [7:0] spinner_data_out = spinner[cpu_addr[5:0] +: 8];
|
||||
|
||||
// CPU address decodes
|
||||
wire pgrom_cs = cpu_addr[15:14] == 2'b00;
|
||||
@@ -125,6 +129,8 @@ wire wkram_cs = cpu_addr[15:14] == 2'b11;
|
||||
wire in0_cs = cpu_addr == 16'h6000;
|
||||
wire joystick_cs = cpu_addr[15:8] == 8'b01110000;
|
||||
wire analog_cs = cpu_addr[15:8] == 8'b01110001;
|
||||
wire paddle_cs = cpu_addr[15:8] == 8'b01110010;
|
||||
wire spinner_cs = cpu_addr[15:8] == 8'b01110011;
|
||||
|
||||
always @(posedge clk_sys) begin
|
||||
// if(pgrom_cs) $display("%x pgrom o %x", cpu_addr, pgrom_data_out);
|
||||
@@ -145,6 +151,8 @@ assign cpu_din = pgrom_cs ? pgrom_data_out :
|
||||
in0_cs ? in0_data_out :
|
||||
joystick_cs ? joystick_data_out :
|
||||
analog_cs ? analog_data_out :
|
||||
paddle_cs ? paddle_data_out :
|
||||
spinner_cs ? spinner_data_out :
|
||||
8'b00000000;
|
||||
|
||||
// Rom upload write enables
|
||||
|
||||
@@ -131,6 +131,10 @@ void main()
|
||||
write_string(str2, 0xFF, 28, y + j);
|
||||
m <<= 1;
|
||||
}
|
||||
|
||||
|
||||
// ADD THE PADDLES AND SPINNERS HERE
|
||||
|
||||
}
|
||||
hsync_last = hsync;
|
||||
vsync_last = vsync;
|
||||
|
||||
@@ -29,6 +29,20 @@ module top(
|
||||
input [15:0] joystick_analog_4,
|
||||
input [15:0] joystick_analog_5,
|
||||
|
||||
input [7:0] paddle_0,
|
||||
input [7:0] paddle_1,
|
||||
input [7:0] paddle_2,
|
||||
input [7:0] paddle_3,
|
||||
input [7:0] paddle_4,
|
||||
input [7:0] paddle_5,
|
||||
|
||||
input [8:0] spinner_0,
|
||||
input [8:0] spinner_1,
|
||||
input [8:0] spinner_2,
|
||||
input [8:0] spinner_3,
|
||||
input [8:0] spinner_4,
|
||||
input [8:0] spinner_5,
|
||||
|
||||
output [7:0] VGA_R/*verilator public_flat*/,
|
||||
output [7:0] VGA_G/*verilator public_flat*/,
|
||||
output [7:0] VGA_B/*verilator public_flat*/,
|
||||
@@ -63,7 +77,9 @@ system system(
|
||||
.dn_index(ioctl_index),
|
||||
|
||||
.joystick({joystick_5,joystick_4,joystick_3,joystick_2,joystick_1,joystick_0}),
|
||||
.analog({joystick_analog_5,joystick_analog_4,joystick_analog_3,joystick_analog_2,joystick_analog_1,joystick_analog_0})
|
||||
.analog({joystick_analog_5,joystick_analog_4,joystick_analog_3,joystick_analog_2,joystick_analog_1,joystick_analog_0}),
|
||||
.paddle({paddle_5,paddle_4,paddle_3,paddle_2,paddle_1,paddle_0}),
|
||||
.spinner({spinner_5,spinner_4,spinner_3,spinner_2,spinner_1,spinner_0})
|
||||
);
|
||||
|
||||
endmodule
|
||||
|
||||
Reference in New Issue
Block a user