aboutsummaryrefslogtreecommitdiffstats
path: root/display.v
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@trantor.hos.anvin.org>2010-09-18 23:01:51 -0700
committerH. Peter Anvin <hpa@trantor.hos.anvin.org>2010-09-18 23:01:51 -0700
commitcfae781bf19c4a5e2faa88d25f1bd56cba82f2ab (patch)
tree255d52e84e39e0678e7f56b27aa1eb312f0bd1dd /display.v
parenta378cfc8700a22c4be05a44b4e110241760318e9 (diff)
downloadabc80-cfae781bf19c4a5e2faa88d25f1bd56cba82f2ab.tar.gz
abc80-cfae781bf19c4a5e2faa88d25f1bd56cba82f2ab.tar.xz
abc80-cfae781bf19c4a5e2faa88d25f1bd56cba82f2ab.zip
Make the "high-resolution" graphics unit work (sort of...)
Make the high-resolution graphics unit actually work... at least with 80-character text display. It still doesn't seem to work for a 40-character test display.
Diffstat (limited to 'display.v')
-rw-r--r--display.v67
1 files changed, 53 insertions, 14 deletions
diff --git a/display.v b/display.v
index 55aa914..2b7e8f3 100644
--- a/display.v
+++ b/display.v
@@ -13,8 +13,14 @@ module display (
input [5:0] gd,
output reg [2:0] rgb,
- output reg vsync,
- output reg hsync
+ output vsync,
+ output hsync,
+
+ input [7:0] fg_ctl,
+ input [7:0] fg_data,
+ output fg_ack,
+ output fg_xrst,
+ output fg_yrst
);
// We use the standard VGA 640x480 monitor timings mode, htime = 31.77
@@ -65,7 +71,10 @@ module display (
parameter hsync_minus = 1'b1; // -hsync
parameter vsync_minus = 1'b1; // -vsync
-
+
+ reg hsync_q; // Horizontal sync active
+ reg vsync_q; // Vertical sync active
+
reg [9:0] x; // Horizontal pixel count
reg [9:0] y; // Vertical pixel count
reg [6:0] xchr; // Character column (0..99)
@@ -84,6 +93,9 @@ module display (
reg [5:0] pixrow; // One character worth of pixels
reg prefetch; // True for the prefetch character position
+ // Fine Graphics control
+ reg [7:0] fgpixels; // One byte of fg pixels
+
// For the current text line
reg [2:0] curfg; // Foreground RGB
reg [2:0] curbg; // Background RGB
@@ -165,6 +177,9 @@ module display (
assign xvideo = ( x < x_blank );
assign yvideo = ( y < y_blank );
+ assign hsync = hsync_q ^ hsync_minus;
+ assign vsync = vsync_q ^ vsync_minus;
+
// Flashing
wire flash_on = scan_counter[4];
@@ -173,24 +188,48 @@ module display (
// "reverse" is asserted with invert everything *on top of that*...
wire invert = (inverse & (flash_on|noblink))^reverse;
+ //
+ // Fine graphics
+ //
+ assign fg_ack = xvideo & yvideo & (x[2:0] == 3'b000);
+ assign fg_xrst = yvideo & hsync_q;
+ assign fg_yrst = vsync_q;
+
+ wire [3:0] fg_argb;
+
+ always @(posedge clk)
+ if (x[2:0] == 3'b100)
+ fgpixels <= fg_data;
+ else if (~x[0])
+ fgpixels <= { fgpixels[5:0], 2'bxx };
+
+ fgcolrom fgcolrom (
+ .address ( { fg_ctl[6:0], fgpixels[7:6] } ),
+ .clock ( clk ),
+ .q ( fg_argb )
+ );
+
// Synchronous logic
always @(posedge clk)
begin
- if ( xvideo & yvideo & ~prefetch )
- if ( testpattern )
- // Pixel test pattern for LCD monitor calibration
- rgb <= {3{x[0] ^ y[0]}};
- else if ( pixrow[5] & ~(do_flsh & ~flash_on) & ~(do_hide & ~reveal) )
- rgb <= fg ^ {3{invert}};
- else
- rgb <= bg ^ {3{invert}};
+ if ( ~xvideo | ~yvideo | prefetch )
+ rgb <= 3'b000; // Blank
+ else if ( testpattern )
+ // Pixel test pattern for LCD monitor calibration
+ rgb <= {3{x[0] ^ y[0]}};
+ else if ( ~fg_ctl[7] & pixrow[5]
+ & ~(do_flsh & ~flash_on)
+ & ~(do_hide & ~reveal) )
+ rgb <= fg ^ {3{invert}};
+ else if (fg_ctl[7] | fg_argb[3])
+ rgb <= fg_argb[2:0];
else
- rgb <= 3'b0; // Blank
+ rgb <= bg ^ {3{invert}};
// Sync pulses
- vsync <= ( y >= y_sync && y < y_front ) ^ vsync_minus;
- hsync <= ( x >= x_sync && x < x_front ) ^ hsync_minus;
+ vsync_q <= ( y >= y_sync && y < y_front );
+ hsync_q <= ( x >= x_sync && x < x_front );
// Rotating shift register; may be overridden by the below
// The rotation is so that if we're in GHOL mode we already