aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@trantor.hos.anvin.org>2010-09-18 16:05:27 -0700
committerH. Peter Anvin <hpa@trantor.hos.anvin.org>2010-09-18 16:05:27 -0700
commitcd6787f59338c5f4feced73eab3c0e5b8ba89023 (patch)
tree9ed761b5ade84753855e414558276881a11a005e
parent58b28518d10b10b92143f64a6e438c214bb7860d (diff)
downloadabc80-cd6787f59338c5f4feced73eab3c0e5b8ba89023.tar.gz
abc80-cd6787f59338c5f4feced73eab3c0e5b8ba89023.tar.xz
abc80-cd6787f59338c5f4feced73eab3c0e5b8ba89023.zip
Fix bugs in the new display.v
Fix bugs in the new 6x10 display.v, mostly involving using the wrong counter bits in various places.
-rw-r--r--display.v54
1 files changed, 39 insertions, 15 deletions
diff --git a/display.v b/display.v
index 3ac13e9..55aa914 100644
--- a/display.v
+++ b/display.v
@@ -7,7 +7,7 @@ module display (
input testpattern,
input reveal,
- output [10:0] a,
+ output reg [10:0] a,
input [7:0] d,
output [10:0] ga,
input [5:0] gd,
@@ -78,6 +78,8 @@ module display (
wire yvideo; // Non-blanked in the y direction
wire [10:0] a80; // Memory address assuming 80 columns
wire [10:0] a80u; // Memory address assuming 80 columns (-1 line)
+ wire [10:0] a40; // Memory address assuming 40 columns
+ wire [10:0] a40u; // Memory address assuming 40 columns (-1 line)
reg [4:0] scan_counter; // Counter of total scans (for flashing et al)
reg [5:0] pixrow; // One character worth of pixels
reg prefetch; // True for the prefetch character position
@@ -116,25 +118,42 @@ module display (
// Should we advance the character pixel?
wire advance = width | x[0];
- // Address mapping for 80 characters; for 40 characters
- // we shift this left by 1
+ // Address mapping for 40 and 80 characters
assign a80[3:0] = xchr[3:0];
- wire [3:0] xmiddle = { 1'b0, xchr[6:4] };
+ wire [3:0] x80middle = { 1'b0, xchr[6:4] };
wire [3:0] ymiddle = { ychr[4:3] , ychr[4:3] };
- assign a80[7:4] = xmiddle+ymiddle;
+ assign a80[7:4] = x80middle+ymiddle;
assign a80[10:8] = ychr[2:0];
- // Address mapping for 80 characters minus one line
+ assign a40[2:0] = xchr[2:0];
+ wire [3:0] x40middle = { 1'b0, xchr[5:3] };
+ assign a40[6:3] = x40middle + ymiddle;
+ assign a40[10:7] = { 1'b1, ychr[2:0] };
+
+ // Address mapping for 40 and 80 characters minus one line
assign a80u[3:0] = xchr[3:0];
wire [3:0] yumiddle = { ylu[4:3] , ylu[4:3] };
- assign a80u[7:4] = xmiddle+yumiddle;
+ assign a80u[7:4] = x80middle+yumiddle;
assign a80u[10:8] = ylu[2:0];
+ assign a40u[2:0] = xchr[2:0];
+ assign a40u[6:3] = x40middle+yumiddle;
+ assign a40u[10:7] = { 1'b1, ylu[2:0] };
+
// Final address mapping
// Note: We read the current char between pixels 0 and 1,
- // and the char above between pixels 2 and 3; hence the use of xchr[1].
- wire [10:0] amap = xchr[1] ? a80u : a80;
- assign a = width ? amap[10:0] : { 1'b1, amap[10:1] };
+ // and the char above between pixels 2 and 3; hence the use of xpxl[1].
+ always @(*)
+ case ( { width, xpxl[1] } )
+ 2'b00:
+ a = a40;
+ 2'b01:
+ a = a40u;
+ 2'b10:
+ a = a80;
+ 2'b11:
+ a = a80u;
+ endcase // case( { width, xchr[1] } )
// Character generator address mapping
assign ga[10:4] = somechar[6:0];
@@ -274,7 +293,9 @@ module display (
// Character generation
- if ( wasdble ? (wasgraph & thatchar[5]) : (isgraph & thischar[5]) )
+ if ( wasdble
+ ? (wasgraph & thatchar[5])
+ : (isgraph & thischar[5]) )
begin
// Generate graphical character
case ( ga[3:0] )
@@ -336,13 +357,16 @@ module display (
pixrow <= 5'bxxxxxx;
endcase // case( ga[3:0] )
end // if ( wasdble ? (wasgraph & thatchar[5]) : (isgraph & thischar[5]) )
- else if ( (somechar[6:5] != 2'b00) | (wasdble ? wasgrel : isgrel) )
+ else if ( (somechar[6:5] != 2'b00) |
+ (wasdble ? wasgrel : isgrel) )
pixrow <= gd; // Input from character ROM
+ // Flash/inverse
+ inverse <= somechar[7];
+
// This is no longer a prefetch character...
prefetch <= 1'b0;
end // if ( xvideo )
- inverse <= somechar[7];
end // case: 3'b101
endcase // case( xpxl )
end // if ( advance )
@@ -353,7 +377,7 @@ module display (
x <= 10'd0;
xchr <= 7'd0;
xpxl <= 3'd0;
- pixrow <= 8'b0; // Read-ahead spot is blank
+ pixrow <= 6'b0; // Read-ahead spot is blank
prefetch <= 1'b1; // Prefetch character
inverse <= 1'b0; // Not inverse video
curfg <= 3'b111; // Default fg is white
@@ -397,7 +421,7 @@ module display (
end // if ( x == x_max-1 )
else
begin
- if ( width | x[0] )
+ if ( advance )
begin
if ( xpxl == 3'd5 )
begin