From f034861757f2327f853a50ee4e8494d47326bdc9 Mon Sep 17 00:00:00 2001 From: Squid Date: Tue, 21 Feb 2017 11:28:49 +0000 Subject: [PATCH] Fix missing OSD on RGB 15khz. Fix dull colours on RGB 15khz --- cores/bbc/fpga/mist/bbc_mist_top.v | 6 ++++-- cores/bbc/fpga/mist/osd.v | 18 ++++++++++++++---- 2 files changed, 18 insertions(+), 6 deletions(-) mode change 100644 => 100755 cores/bbc/fpga/mist/bbc_mist_top.v mode change 100644 => 100755 cores/bbc/fpga/mist/osd.v diff --git a/cores/bbc/fpga/mist/bbc_mist_top.v b/cores/bbc/fpga/mist/bbc_mist_top.v old mode 100644 new mode 100755 index a3fd38a..823352c --- a/cores/bbc/fpga/mist/bbc_mist_top.v +++ b/cores/bbc/fpga/mist/bbc_mist_top.v @@ -109,7 +109,7 @@ clockgen CLOCKS( // without scan doubler only half the pixel clock is used reg clk_12m; -always @(clk_24m) +always @(posedge clk_24m) clk_12m <= !clk_12m; wire clk_osd = scandoubler_disable?clk_12m:clk_24m; @@ -133,7 +133,9 @@ osd #(0,0,4) OSD ( .green_out ( VGA_G ), .blue_out ( VGA_B ), .hs_out ( v_hs ), - .vs_out ( v_vs ) + .vs_out ( v_vs ), + + .tv15khz ( scandoubler_disable ) ); wire v_hs, v_vs; diff --git a/cores/bbc/fpga/mist/osd.v b/cores/bbc/fpga/mist/osd.v old mode 100644 new mode 100755 index 4f0f650..f851698 --- a/cores/bbc/fpga/mist/osd.v +++ b/cores/bbc/fpga/mist/osd.v @@ -45,7 +45,9 @@ module osd ( output [5:0] green_out, output [5:0] blue_out, output hs_out, - output vs_out + output vs_out, + + input tv15khz ); parameter OSD_X_OFFSET = 10'd0; @@ -194,9 +196,17 @@ always @(posedge pclk) osd_byte <= osd_buffer[{osd_vcnt[6:4], osd_hcnt}]; wire [2:0] osd_color = OSD_COLOR; -assign red_out = !osd_de? {3{red_in}} : {osd_pixel, osd_pixel, osd_color[2], {red_in, red_in[1]} }; -assign green_out = !osd_de? {3{green_in}} : {osd_pixel, osd_pixel, osd_color[1], {green_in, green_in[1]} }; -assign blue_out = !osd_de? {3{blue_in}} : {osd_pixel, osd_pixel, osd_color[0], {blue_in, blue_in[1]} }; + +// RGB 15khz output is different to fix dull colours, VGA not affected. +// BBC only uses one bit per colour but video engine uses a 2-bit vector, MSB is only used. +// BBC has a fixed palette of 8 colours. +wire [5:0] r_in = tv15khz? {5{red_in[0]}} : {3{red_in}}; +wire [5:0] g_in = tv15khz? {5{green_in[0]}} : {3{green_in}}; +wire [5:0] b_in = tv15khz? {5{blue_in[0]}} : {3{blue_in}}; + +assign red_out = !osd_de? r_in : {osd_pixel, osd_pixel, osd_color[2], {red_in, red_in[1]} }; +assign green_out = !osd_de? g_in : {osd_pixel, osd_pixel, osd_color[1], {green_in, green_in[1]} }; +assign blue_out = !osd_de? b_in : {osd_pixel, osd_pixel, osd_color[0], {blue_in, blue_in[1]} }; assign hs_out = hs_in; assign vs_out = vs_in;