Skip to content

Commit

Permalink
Merge pull request #75 from nikitalita/fix-nes-controllers
Browse files Browse the repository at this point in the history
Fix NES controllers
  • Loading branch information
nand2mario authored May 23, 2024
2 parents e4e9c5c + 5a2c8fa commit 705d9c1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/controller_snes.v
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,14 @@ always @(posedge clk) begin
bits <= bits + 1;
if (bits == 4'd15) begin // scan complete
state <= 3;
buttons <= buttons_buf[11:0];
// check if buttons_buf[15:12] are 0; if not, this is an NES controller
if (buttons_buf[15:12] != 4'b0000) begin
// NES controller
buttons <= {0, 0, 0, 0, buttons_buf[7:0]};
end else begin
// SNES controller
buttons <= buttons_buf[11:0];
end
end else
state <= 1;
end
Expand Down

0 comments on commit 705d9c1

Please sign in to comment.