aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2004-10-01 06:56:02 +0000
committerH. Peter Anvin <hpa@zytor.com>2004-10-01 06:56:02 +0000
commit9b5b4b4acaf2f2be2aaf59d1b93f5abd3f046caf (patch)
tree54a73ad8ac04a8194a62f5de24af944663e7b601
parent580854924e409bc380887af2ffc604b94ba0307f (diff)
downloadabc80-9b5b4b4acaf2f2be2aaf59d1b93f5abd3f046caf.tar.gz
abc80-9b5b4b4acaf2f2be2aaf59d1b93f5abd3f046caf.tar.xz
abc80-9b5b4b4acaf2f2be2aaf59d1b93f5abd3f046caf.zip
Make the printer interface more ABC-likeabc80-15
-rw-r--r--CHANGES3
-rwxr-xr-xabc80.qpf2
-rw-r--r--printer.v34
3 files changed, 21 insertions, 18 deletions
diff --git a/CHANGES b/CHANGES
index 51771fd..6d7903a 100644
--- a/CHANGES
+++ b/CHANGES
@@ -22,6 +22,9 @@ Changes in release 14:
have all the capabilities of the ABC800C video unit, plus black text
and being able to press SW0 to reveal hidden text.
+* Make the printer interface closer to the original ABC80 Centronics
+ card. See data/printer.asm and printer.v.
+
Changes in release 13:
----------------------
diff --git a/abc80.qpf b/abc80.qpf
index 5697cde..7bb59c3 100755
--- a/abc80.qpf
+++ b/abc80.qpf
@@ -21,7 +21,7 @@
QUARTUS_VERSION = "4.1"
-DATE = "22:33:06 September 30, 2004"
+DATE = "23:53:32 September 30, 2004"
# Revisions
diff --git a/printer.v b/printer.v
index ea2bb2b..9487593 100644
--- a/printer.v
+++ b/printer.v
@@ -62,7 +62,7 @@ module printer (
output select;
// Which select code this device uses
- parameter selectcode = 6'd24;
+ parameter selectcode = 6'd60;
reg selected;
assign select = selected; // LED
@@ -72,40 +72,43 @@ module printer (
assign tty_txd = data_out;
// Baud rate divider
- reg [15:0] baud_rate;
+ parameter baud_rate = 115200;
+ parameter baud_div = (25000000/baud_rate)-1;
reg [15:0] baud_rate_ctr;
// Time to advance the serial register
wire advance_bit = (baud_rate_ctr == 0);
// BREAK generation counter
+ parameter break_len = 32;
reg [8:0] break_ctr;
wire break_bit = break_ctr[8];
+ reg active;
// BUSY counter
reg [4:0] busy_ctr;
wire busy_bit = ~busy_ctr[4];
// Status generation
- wire [7:0] status = { 5'b0, ~tty_cts, ~break_bit, busy_bit };
+ wire [7:0] status = { ~tty_cts, ~break_bit, busy_bit, 5'b0 };
assign abc_di = (selected & ~abc_status_n) ? status : 8'hFF;
-
+
// Edge detect
reg abc_out_q;
- reg abc_c1_q;
+ reg active_q;
always @(negedge reset_n or posedge clk)
begin
if ( ~reset_n )
begin
selected <= 0;
- baud_rate <= 216; // 115200 bps
baud_rate_ctr <= 0;
data_sr <= ~9'b0;
data_out <= 1;
break_ctr <= ~9'b0;
busy_ctr <= ~5'b0;
abc_out_q <= 1;
- abc_c1_q <= 1;
+ active <= 0;
+ active_q <= 0;
end
else
begin
@@ -124,12 +127,15 @@ module printer (
data_out <= data_sr[0];
if ( advance_bit )
- baud_rate_ctr <= baud_rate;
+ baud_rate_ctr <= baud_div;
else
baud_rate_ctr <= baud_rate_ctr - 1;
- if ( selected & ~abc_c1_n & abc_c1_q )
- break_ctr <= { 1'b0, abc_do };
+ if ( selected & ~abc_c2_n )
+ active <= abc_do[7];
+
+ if ( ~active & active_q ) // Send BREAK on end of job
+ break_ctr <= { 1'b0, break_len };
else if ( advance_bit & ~break_bit )
break_ctr <= break_ctr - 1;
@@ -138,14 +144,8 @@ module printer (
else if ( advance_bit & busy_bit )
busy_ctr <= busy_ctr - 1;
- if ( selected & ~abc_c2_n )
- baud_rate[7:0] <= abc_do;
-
- if ( selected & ~abc_c3_n )
- baud_rate[15:8] <= abc_do;
-
abc_out_q <= abc_out_n;
- abc_c1_q <= abc_c1_n;
+ active_q <= active;
end // else: !if( ~reset_n )
end // always @ (negedge reset_n or posedge clk)