diff options
author | hpa <hpa@trantor.hos.anvin.org> | 2008-12-22 12:33:17 -0800 |
---|---|---|
committer | hpa <hpa@trantor.hos.anvin.org> | 2008-12-22 12:33:17 -0800 |
commit | 98d1e7af134cba39a1bcd273b5d425220bbd65bf (patch) | |
tree | c26af3ce32372becefe946a584995d6062e8806d /display.v | |
parent | 4fce22f9566f27ed87c906c09b0b575207b1661f (diff) | |
download | abc80-98d1e7af134cba39a1bcd273b5d425220bbd65bf.tar.gz abc80-98d1e7af134cba39a1bcd273b5d425220bbd65bf.tar.xz abc80-98d1e7af134cba39a1bcd273b5d425220bbd65bf.zip |
Drop the idiotic 6-bit RGB from the display unit; add reverse video
Output 3-bit RGB from the display unit since that's what we're
actually generating. Add a reverse video option on SW7.
Diffstat (limited to 'display.v')
-rw-r--r-- | display.v | 46 |
1 files changed, 17 insertions, 29 deletions
@@ -1,6 +1,7 @@ module display ( clk, width, + reverse, reveal, a, d, @@ -12,13 +13,14 @@ module display ( ); input clk; input width; + input reverse; input reveal; output [10:0] a; input [7:0] d; output [10:0] ga; input [7:0] gd; - output [5:0] rgb; - reg [5:0] rgb; + output [2:0] rgb; + reg [2:0] rgb; output vsync; reg vsync; output hsync; @@ -46,12 +48,6 @@ module display ( // --------- // 449 lines // -// The DAC has an 8-cycle latency, plus we read each character 8 -// 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 // 1 character shy of the actual start of display. @@ -85,6 +81,7 @@ module display ( wire [10:0] a80u; // Character row assuming 80 columns (up 1 line) reg [5:0] scan_counter; // Counter of total scans (for flashing et al) reg [7:0] pixrow; // One character worth of pixels + reg prefetch; // True for the prefetch character position // For the current text line reg [2:0] curfg; // Foreground RGB @@ -148,33 +145,21 @@ module display ( // Flashing wire flash_blank = scan_counter[5]; - wire iflash = inverse & ~flash_blank; + wire iflash = (inverse & ~flash_blank)^reverse; // Synchronous logic always @(posedge clk) begin - if ( xvideo & yvideo ) + // The x[9:4] means ignore the first character prefetch. We really + // should realign the counters, here. + if ( xvideo & yvideo & ~prefetch ) if ( pixrow[7] & ~(do_flsh & flash_blank) & ~(do_hide & ~reveal) ) - begin - rgb[5] <= fg[2] ^ iflash; - rgb[4] <= fg[2] ^ iflash; - rgb[3] <= fg[1] ^ iflash; - rgb[2] <= fg[1] ^ iflash; - rgb[1] <= fg[0] ^ iflash; - rgb[0] <= fg[0] ^ iflash; - end + rgb <= fg ^ {3{iflash}}; else - begin - rgb[5] <= bg[2] ^ iflash; - rgb[4] <= bg[2] ^ iflash; - rgb[3] <= bg[1] ^ iflash; - rgb[2] <= bg[1] ^ iflash; - rgb[1] <= bg[0] ^ iflash; - rgb[0] <= bg[0] ^ iflash; - end + rgb <= bg ^ {3{iflash}}; else - rgb <= 6'b0; + rgb <= 3'b0; // Blank // Sync pulses vsync <= ( y >= y_sync && y < y_front ) ^ ~vsync_polarity; @@ -207,9 +192,8 @@ module display ( // Load a new pixel row? if ( xvideo ) begin - // Attribute engine for current row - + if ( thischar[6:5] == 2'b00 ) begin // Control character @@ -356,6 +340,9 @@ module display ( end // if ( wasdble ? (wasgraph & thatchar[5]) : (isgraph & thischar[5]) ) else if ( (somechar[6:5] != 2'b00) | (wasdble ? wasgrel : isgrel) ) pixrow <= gd; // Input from character ROM + + // This is no longer a prefetch character... + prefetch <= 1'b0; end // if ( xvideo ) inverse <= somechar[7]; end // case: 3'b111 @@ -367,6 +354,7 @@ module display ( begin x <= 0; pixrow <= 8'b0; // Read-ahead spot is blank + prefetch <= 1'b1; // Prefetch character inverse <= 0; // Not inverse video curfg <= 3'b111; // Default fg is white curbg <= 3'b000; // Default bg is black |