Skip to content

Commit

Permalink
added CR3 flags for disabling main border or vertical border
Browse files Browse the repository at this point in the history
  • Loading branch information
SNB committed Jan 25, 2023
1 parent e6248a1 commit f629792
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 10 deletions.
2 changes: 1 addition & 1 deletion boards/rev_4H/build.sh
Expand Up @@ -4,7 +4,7 @@ mkdir -p build
#MAJ=1
MAJ=0
#MIN=12
MIN=1
MIN=2

#ALL="MAINLH DOTCLH MKIILH SARULH"
ALL="WIV1LH"
Expand Down
4 changes: 2 additions & 2 deletions disks/util/flash/Makefile.LH
@@ -1,8 +1,8 @@
include Makefile.inc

DISKNUMS=1 2 3 4 5
NAME=kawari
VERSION=0.1
NAME=whatif
VERSION=0.2
FPGA=efinix_t20
START_ADDRESS=659456
IMAGE_SIZE=659456
Expand Down
16 changes: 16 additions & 0 deletions hdl/border.v
Expand Up @@ -29,6 +29,10 @@ module border(
input csel,
input den,
input dot_rising,
`ifdef WIV_EXTENSIONS
input wiv_dvb, // VIC-WIV disable vertical border
input wiv_dmb, // VIC-WIV disable main border
`endif
output reg vborder,
output reg main_border
);
Expand All @@ -44,7 +48,11 @@ begin
// check vborder bottom
if ((raster_line == 247 && rsel == `FALSE) ||
(raster_line == 251 && rsel == `TRUE))
`ifdef WIV_EXTENSIONS
set_vborder = ~wiv_dvb;
`else
set_vborder = 1;
`endif
vborder = set_vborder;
if (vborder == 0) begin
main_border = 0;
Expand All @@ -53,7 +61,11 @@ begin
// check hborder - lands on 56 & 57 at the right pixels
else if ((xpos == 351 && csel == `TRUE) ||
(xpos == 342 && csel == `FALSE)) begin
`ifdef WIV_EXTENSIONS
main_border = ~wiv_dmb;
`else
main_border = 1;
`endif
end

if (clk_phi) begin
Expand All @@ -67,7 +79,11 @@ begin
// check vborder bottom
if ((raster_line == 247 && rsel == `FALSE) ||
(raster_line == 251 && rsel == `TRUE))
`ifdef WIV_EXTENSIONS
set_vborder = ~wiv_dvb;
`else
set_vborder = 1;
`endif

if (cycle_num == 0)
vborder = set_vborder;
Expand Down
23 changes: 16 additions & 7 deletions hdl/registers.v
Expand Up @@ -182,7 +182,10 @@ module registers

`ifdef WIV_EXTENSIONS
output reg wiv_cre = 1'b0, // VIC-WIV control registers read enable
output reg [7:1] wiv_cr3_unused = 7'b0000000,
output reg wiv_cr3_unused_1 = 1'b0,
output reg wiv_dvb = 1'b0, // VIC-WIV disable vertical border
output reg wiv_dmb = 1'b0, // VIC-WIV disable main border
output reg [7:4] wiv_cr3_unused = 4'b0000,
output reg [7:0] wiv_cr4_unused = 8'b00000000,
`endif

Expand Down Expand Up @@ -849,7 +852,10 @@ begin
/* 0x13 */ `REG_LIGHT_PEN_X: begin
if (wiv_cre) begin
dbo[0] <= wiv_cre;
dbo[7:1] <= wiv_cr3_unused;
dbo[1] <= wiv_cr3_unused_1;
dbo[2] <= wiv_dvb;
dbo[3] <= wiv_dmb;
dbo[7:4] <= wiv_cr3_unused;
end else begin
dbo[7:0] <= lpx;
end
Expand Down Expand Up @@ -1103,12 +1109,15 @@ begin
/* 0x12 */ `REG_RASTER_LINE: raster_irq_compare[7:0] <= dbi[7:0];
`ifdef WIV_EXTENSIONS
/* 0x13 */ `REG_LIGHT_PEN_X: begin
wiv_cre <= dbi[0];
wiv_cr3_unused[7:1] = dbi[7:1];
end
wiv_cre <= dbi[0];
wiv_cr3_unused_1 <= dbi[1];
wiv_dvb <= dbi[2];
wiv_dmb <= dbi[3];
wiv_cr3_unused[7:4] = dbi[7:4];
end
/* 0x14 */ `REG_LIGHT_PEN_Y: begin
wiv_cr4_unused[7:0] = dbi[7:0];
end
wiv_cr4_unused[7:0] = dbi[7:0];
end
`endif //WIV_EXTENSIONS
/* 0x15 */ `REG_SPRITE_ENABLE: sprite_en <= dbi[7:0];
/* 0x16 */ `REG_SCREEN_CONTROL_2: begin
Expand Down
15 changes: 15 additions & 0 deletions hdl/vicii.v
Expand Up @@ -305,6 +305,12 @@ reg hires_badline;
`endif
`endif // WITH_EXTENSIONS

`ifdef WIV_EXTENSIONS
wire wiv_cre; // VIC-WIV control registers read enable
wire wiv_dvb; // VIC-WIV disable vertical border
wire wiv_dmb; // VIC-WIV disable main border
`endif

wire idle;

wire den; // display enable
Expand Down Expand Up @@ -542,6 +548,10 @@ border vic_border(
.csel(csel),
.den(den),
.dot_rising(dot_rising[1]),
`ifdef WIV_EXTENSIONS
.wiv_dvb(wiv_dvb),
.wiv_dmb(wiv_dmb),
`endif
.vborder(top_bot_border),
.main_border(main_border)
);
Expand Down Expand Up @@ -1103,6 +1113,11 @@ registers vic_registers(
.dma_done(dma_done),
`endif
`endif // WITH_EXTENSIONS
`ifdef WIV_EXTENSIONS
.wiv_cre(wiv_cre),
.wiv_dvb(wiv_dvb),
.wiv_dmb(wiv_dmb),
`endif
.rw_ctl(rw_ctl),
.chip(chip) // config out
);
Expand Down

0 comments on commit f629792

Please sign in to comment.