Files
Arcade-Dcon_MiSTer/sys/scanlines.v
rmonc79 3ad6536176 Initial commit: DCon MiSTer core v1.0
D-Con (Success, 1992) — FPGA core for the MiSTer FPGA platform
(Terasic DE10-Nano). Reimplements the original Seibu hardware in
SystemVerilog from MAME (seibu/dcon.cpp, seibu/seibu_crtc.cpp),
hardware documentation, main 68000 ROM disassembly and observation
of real PCB behavior.

Hardware emulated:
- M68000 main CPU @ 10 MHz (FX68K cycle-accurate)
- Z80 sound CPU @ 4 MHz (T80s) with audio-rate multicycle SDC
- YM3812 OPL2 FM (jtopl2) + OKI M6295 ADPCM (jt6295)
- 320x224 active video area (Seibu D-Con timings)
- BG / MG / FG tilemaps + Text layer + 16x16 sprites (SEI0211)
- Seibu CRTC registers (scroll, layer enable, flip screen)
- xBGR_555 palette, 2048 entries

Includes:
- 16 SystemVerilog RTL files in rtl/DCon/
- FX68K core (rtl/fx68k/), audio cores (rtl/sound/jtopl, jt6295, t80)
- JTFRAME framework subset (rtl/jtframe/), Sorgelig SDRAM bridge
- MiSTer sys/ framework (HPS_IO, OSD, video scaler, audio)
- Pause overlay with logo, supporters list and patron scroll
- Quartus project files (DCon.qpf/qsf/sdc)
- Prebuilt RBF (releases/DCon_20260530.rbf) and parent MRA
- 6 in-game screenshots in docs/

Licensed under GNU GPL v3 or later. ROMs not included.
2026-05-30 16:43:28 +02:00

69 lines
1.4 KiB
Verilog

module scanlines #(parameter v2=0)
(
input clk,
input [1:0] scanlines,
input [23:0] din,
input hs_in,vs_in,
input de_in,ce_in,
output reg [23:0] dout,
output reg hs_out,vs_out,
output reg de_out,ce_out
);
reg [1:0] scanline;
always @(posedge clk) begin
reg old_hs, old_vs;
old_hs <= hs_in;
old_vs <= vs_in;
if(old_hs && ~hs_in) begin
if(v2) begin
scanline <= scanline + 1'd1;
if (scanline == scanlines) scanline <= 0;
end
else scanline <= scanline ^ scanlines;
end
if(old_vs && ~vs_in) scanline <= 0;
end
wire [7:0] r,g,b;
assign {r,g,b} = din;
reg [23:0] d;
always @(*) begin
case(scanline)
1: // reduce 25% = 1/2 + 1/4
d = {{1'b0, r[7:1]} + {2'b00, r[7:2]},
{1'b0, g[7:1]} + {2'b00, g[7:2]},
{1'b0, b[7:1]} + {2'b00, b[7:2]}};
2: // reduce 50% = 1/2
d = {{1'b0, r[7:1]},
{1'b0, g[7:1]},
{1'b0, b[7:1]}};
3: // reduce 75% = 1/4
d = {{2'b00, r[7:2]},
{2'b00, g[7:2]},
{2'b00, b[7:2]}};
default: d = {r,g,b};
endcase
end
always @(posedge clk) begin
reg [23:0] dout1, dout2;
reg de1,de2,vs1,vs2,hs1,hs2,ce1,ce2;
dout <= dout2; dout2 <= dout1; dout1 <= d;
vs_out <= vs2; vs2 <= vs1; vs1 <= vs_in;
hs_out <= hs2; hs2 <= hs1; hs1 <= hs_in;
de_out <= de2; de2 <= de1; de1 <= de_in;
ce_out <= ce2; ce2 <= ce1; ce1 <= ce_in;
end
endmodule