Update sys. HV-Integer scale. Vertical crop.

This commit is contained in:
sorgelig
2021-03-02 20:11:28 +08:00
parent 17fc907348
commit 2c2b476975
11 changed files with 559 additions and 180 deletions

View File

@ -39,8 +39,9 @@ module emu
output CE_PIXEL,
//Video aspect ratio for HDMI. Most retro systems have ratio 4:3.
output [11:0] VIDEO_ARX,
output [11:0] VIDEO_ARY,
//if VIDEO_ARX[12] or VIDEO_ARY[12] is set then [11:0] contains scaled size instead of aspect ratio.
output [12:0] VIDEO_ARX,
output [12:0] VIDEO_ARY,
output [7:0] VGA_R,
output [7:0] VGA_G,
@ -51,6 +52,9 @@ module emu
output VGA_F1,
output [1:0] VGA_SL,
output VGA_SCALER, // Force VGA scaler
input [11:0] HDMI_WIDTH,
input [11:0] HDMI_HEIGHT,
`ifdef USE_FB
// Use framebuffer in DDRAM (USE_FB=1 in qsf)
@ -181,9 +185,23 @@ assign BUTTONS = 0;
assign VGA_SCALER= 0;
wire [1:0] ar = status[33:32];
wire vcrop_en = status[34];
reg en270p;
always @(posedge CLK_VIDEO) begin
en270p <= ((HDMI_WIDTH == 1920) && (HDMI_HEIGHT == 1080) && !forced_scandoubler && !scale);
end
assign VIDEO_ARX = (!ar) ? 12'd4 : (ar - 1'd1);
assign VIDEO_ARY = (!ar) ? 12'd3 : 12'd0;
wire vga_de;
video_freak video_freak
(
.*,
.VGA_DE_IN(vga_de),
.ARX((!ar) ? 12'd4 : (ar - 1'd1)),
.ARY((!ar) ? 12'd3 : 12'd0),
.CROP_SIZE((en270p & vcrop_en) ? 10'd270 : 10'd0),
.CROP_OFF(0),
.SCALE(status[36:35])
);
`include "build_id.v"
localparam CONF_STR = {
@ -193,6 +211,9 @@ localparam CONF_STR = {
"o01,Aspect ratio,Original,Full Screen,[ARC1],[ARC2];",
"O12,Scandoubler Fx,None,HQ2x,CRT 25%,CRT 50%;",
"-;",
"d0o2,Vertical Crop,Disabled,270p(5x);",
"o34,Scale,Normal,V-Integer,Narrower HV-Integer,Wider HV-Integer;",
"-;",
"O34,Stereo mix,None,25%,50%,100%;",
"OST,General Sound,512KB,1MB,2MB;",
"-;",
@ -231,13 +252,12 @@ assign CMOSCfg[27:25]= status[27:25] + 1'd1;
//////////////////// CLOCKS ///////////////////
wire clk_sys;
wire clk_vid;
pll pll
(
.refclk(CLK_50M),
.outclk_0(clk_sys),
.outclk_1(clk_vid)
.outclk_1(CLK_VIDEO)
);
reg ce_28m;
@ -297,6 +317,7 @@ hps_io #(.STRLEN($size(CONF_STR)>>3)) hps_io
.buttons(buttons),
.status(status),
.status_menumask({en270p}),
.forced_scandoubler(forced_scandoubler),
.gamma_bus(gamma_bus),
@ -425,15 +446,13 @@ assign AUDIO_S = 1;
assign AUDIO_MIX = status[4:3];
reg ce_pix;
always @(posedge clk_vid) begin
always @(posedge CLK_VIDEO) begin
reg old_ce;
old_ce <= ce_vid;
ce_pix <= ~old_ce & ce_vid;
end
assign CLK_VIDEO = clk_vid;
reg VSync, HSync;
always @(posedge CLK_VIDEO) begin
HSync <= HS;
@ -447,12 +466,9 @@ assign VGA_SL = {scale == 3, scale == 2};
video_mixer #(.GAMMA(1)) video_mixer
(
.*,
.ce_pix_out(CE_PIXEL),
.scanlines(0),
.scandoubler(scale || forced_scandoubler),
.hq2x(scale==1),
.mono(0)
.VGA_DE(vga_de)
);