aboutsummaryrefslogtreecommitdiffstats
path: root/display.v
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2003-10-04 22:33:41 +0000
committerH. Peter Anvin <hpa@zytor.com>2003-10-04 22:33:41 +0000
commit15b82f2df6fb23892444704e5a7fb7178e2dc924 (patch)
tree007767167fc608e374828ea3c7d1b67f4764e580 /display.v
parent57cf7b918d8cb925282920bec3d342a2495aff99 (diff)
downloadabc80-15b82f2df6fb23892444704e5a7fb7178e2dc924.tar.gz
abc80-15b82f2df6fb23892444704e5a7fb7178e2dc924.tar.xz
abc80-15b82f2df6fb23892444704e5a7fb7178e2dc924.zip
It works now... mostly :) SRAM problem resolved by pulling up WE# earlier.
Diffstat (limited to 'display.v')
-rw-r--r--display.v84
1 files changed, 38 insertions, 46 deletions
diff --git a/display.v b/display.v
index 74526b7..6dca8a7 100644
--- a/display.v
+++ b/display.v
@@ -1,6 +1,7 @@
module display (
clk,
width,
+ reveal,
a,
d,
ga,
@@ -11,6 +12,7 @@ module display (
);
input clk;
input width;
+ input reveal;
output [10:0] a;
input [7:0] d;
output [10:0] ga;
@@ -29,18 +31,26 @@ module display (
// is far, far less than the margin of error in real systems.
//
// This gives us the following timings:
+//
// Horizontal: 96 pixels (12 char) sync
// 40 pixels ( 5 char) back porch/border
// 640 pixels (80 char) graphics
// 24 pixels ( 3 char) front porch
+// ----------
+// 800 pixels
+//
// Vertical: 2 lines sync
// 41 lines back porch/border
// 384 lines graphics (24 rows @ 16 pixels)
// 22 lines front porch
+// ---------
+// 449 lines
//
// The DAC has an 8-cycle latency, plus we read each character 8
-// cycles beforehand. Thus we reduce the front porch
-// by 16 and add it to the back porch.
+// cycles beforehand. Thus we reduce the horizontal front porch
+// by 16 and add it to the back porch. The front and back porch
+// values can be adjusted to justify the positioning of the picture
+// on the screen.
//
// In this implementation we start timing with the display area in both
// cases, *except* that we prefetch by one character, and therefore start
@@ -55,14 +65,14 @@ module display (
// and +vsync, meaning hsync is active low and vsync is active high.
parameter x_blank = 640+8;
- parameter x_sync = x_blank+48;
+ parameter x_sync = x_blank+32;
parameter x_front = x_sync+96;
- parameter x_max = x_front+8;
+ parameter x_max = 800;
parameter y_blank = 384;
- parameter y_sync = y_blank+22;
+ parameter y_sync = y_blank+30;
parameter y_front = y_sync+2;
- parameter y_max = y_front+41;
+ parameter y_max = 449;
parameter hsync_polarity = 1'b0; // -hsync
parameter vsync_polarity = 1'b1; // +vsync
@@ -77,15 +87,16 @@ module display (
reg inverse; // Inverse video
reg isgraph; // Graphic mode?
reg isgsep; // Separated graphics?
+ reg isgrel; // Hold graphics?
+ reg isdble; // Double height?
reg isflsh; // Flashing?
+ reg ishide; // Hidden
reg [7:0] thischar; // Character code currently processing
wire [3:0] xmiddle; // Used in address calculation
wire [3:0] ymiddle; // Used in address calculation
wire xvideo; // Non-blanked in the x direction
wire yvideo; // Non-blanked in the y direction
-
- // Combinatorial logic
-
+
// Address mapping for 80 characters; for 40 characters
// we shift this left by 1
assign a80[3:0] = x[6:3];
@@ -114,7 +125,7 @@ module display (
always @(posedge clk)
begin
if ( xvideo & yvideo )
- if ( pixrow[7] & ~(isflsh & flash_blank) )
+ if ( pixrow[7] & ~(isflsh & flash_blank) & ~(ishide & ~reveal) )
begin
rgb[5] <= fg[2] ^ iflash;
rgb[4] <= fg[2] ^ iflash;
@@ -139,9 +150,11 @@ module display (
vsync <= ( y >= y_sync && y < y_front ) ^ ~vsync_polarity;
hsync <= ( x >= x_sync && x < x_front ) ^ ~hsync_polarity;
- // Shift register; may be overridden by the below
+ // Rotating shift register; may be overridden by the below
+ // The rotation is so that if we're in GHOL mode we already
+ // have the reserved value
if ( width | x[0] )
- pixrow <= { pixrow[6:0], 1'bx };
+ pixrow <= { pixrow[6:0], pixrow[7] };
// This code is run 8 times per character; regardless of width
if ( width | ~x[3] )
@@ -167,6 +180,12 @@ module display (
fg <= thischar[2:0];
isgraph <= thischar[4];
end
+ 5'b0110x:
+ isdble <= thischar[0];
+ 5'b11000:
+ ishide <= 1'b1;
+ 5'b1111x:
+ isgrel <= thischar[0];
5'b0100x:
isflsh <= ~thischar[0];
5'b11001:
@@ -185,11 +204,11 @@ module display (
end
endcase // casex( thischar[4:0] )
end // if ( thischar[6:5] == 2'b00 )
-
+
if ( isgraph & thischar[5] )
begin
// Generate graphical character
- case ( y[3:0] )
+ case ( ga[3:0] )
4'h0, 4'h1, 4'h2, 4'h3:
begin
pixrow[7] <= thischar[0];
@@ -256,9 +275,9 @@ module display (
pixrow[1] <= thischar[6] & ~isgsep;
pixrow[0] <= thischar[6] & ~isgsep;
end
- endcase // case( y[3:0] )
+ endcase // case( ga[3:0] )
end // if ( isgraph & thischar[5] )
- else
+ else if ( (thischar[6:5] != 2'b00) | isgrel )
pixrow <= gd; // Input from character ROM
end // if ( xvideo )
inverse <= thischar[7];
@@ -276,6 +295,9 @@ module display (
inverse <= 0; // Not inverse video
isflsh <= 0; // Not flashing
isgsep <= 0; // Not separated
+ isdble <= 0; // Not double
+ isgrel <= 1; // Release graphics
+ ishide <= 0; // Not hidden
pixrow <= 8'b0; // Read-ahead spot is blank
if ( y == y_max-1 )
begin
@@ -289,34 +311,4 @@ module display (
x <= x + 1;
end // always @ (posedge clk)
endmodule // display
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file