From 0b5a8dd3470fd91b01d2115136352610fa510579 Mon Sep 17 00:00:00 2001 From: Sebastien Delestaing Date: Sat, 24 Sep 2016 18:09:57 +0200 Subject: [PATCH] [NES]Disconnect keyboard when OSD is visible --- cores/nes/mist/NES_mist.v | 10 +++++++--- cores/nes/mist/osd.v | 6 ++++-- cores/nes/src/video.v | 8 ++++++-- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/cores/nes/mist/NES_mist.v b/cores/nes/mist/NES_mist.v index 1cffc7b..49b8971 100644 --- a/cores/nes/mist/NES_mist.v +++ b/cores/nes/mist/NES_mist.v @@ -221,9 +221,9 @@ end wire strt = (start_cnt != 0); wire sel = (select_cnt != 0); -wire [7:0] nes_joy_A = reset_nes ? 8'd0 : { joyB[0], joyB[1], joyB[2], joyB[3], +wire [7:0] nes_joy_A = (reset_nes || osd_visible) ? 8'd0 : { joyB[0], joyB[1], joyB[2], joyB[3], joyB[7] | strt, joyB[6] | sel, joyB[5], joyB[4] } | kbd_joy0; -wire [7:0] nes_joy_B = reset_nes ? 8'd0 : { joyA[0], joyA[1], joyA[2], joyA[3], +wire [7:0] nes_joy_B = (reset_nes || osd_visible) ? 8'd0 : { joyA[0], joyA[1], joyA[2], joyA[3], joyA[7], joyA[6], joyA[5], joyA[4] } | kbd_joy1; wire clock_locked; @@ -326,6 +326,8 @@ wire [7:0] nes_joy_B = reset_nes ? 8'd0 : { joyA[0], joyA[1], joyA[2], joyA[3], assign LED = downloading ? 0 : loader_fail ? led_blink[12] : 1; + wire osd_visible; + wire reset_nes = (init_reset || buttons[1] || arm_reset || reset_osd || download_reset || loader_fail); wire run_nes = (nes_ce == 3); // keep running even when reset, so that the reset can actually do its job! @@ -433,7 +435,9 @@ video video ( .VGA_VS(VGA_VS), .VGA_R(VGA_R), .VGA_G(VGA_G), - .VGA_B(VGA_B) + .VGA_B(VGA_B), + + .osd_visible(osd_visible) ); assign AUDIO_R = audio; diff --git a/cores/nes/mist/osd.v b/cores/nes/mist/osd.v index 6e3fc29..59234e8 100644 --- a/cores/nes/mist/osd.v +++ b/cores/nes/mist/osd.v @@ -21,7 +21,10 @@ module osd ( // VGA signals going to video connector output [5:0] red_out, output [5:0] green_out, - output [5:0] blue_out + output [5:0] blue_out, + + output reg osd_enable + ); parameter OSD_X_OFFSET = 10'd0; @@ -41,7 +44,6 @@ reg [7:0] sbuf; reg [7:0] cmd; reg [4:0] cnt; reg [10:0] bcnt; -reg osd_enable; reg [7:0] osd_buffer [2047:0]; // the OSD buffer itself diff --git a/cores/nes/src/video.v b/cores/nes/src/video.v index b4119a1..9fe2451 100644 --- a/cores/nes/src/video.v +++ b/cores/nes/src/video.v @@ -19,7 +19,9 @@ module video( output VGA_VS, output [5:0] VGA_R, output [5:0] VGA_G, - output [5:0] VGA_B + output [5:0] VGA_B, + + output osd_visible ); reg clk2 = 1'b0; @@ -41,7 +43,9 @@ osd #(10'd0, 10'd0, 3'd4) osd ( .red_out(VGA_R), .green_out(VGA_G), - .blue_out(VGA_B) + .blue_out(VGA_B), + + .osd_enable(osd_visible) ); // NES Palette -> RGB555 conversion