aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2015-06-09 15:19:58 -0700
committerH. Peter Anvin <hpa@zytor.com>2015-06-09 15:22:06 -0700
commit2b65a31fbf1658d2bc831aa83542c3f861b9b0bc (patch)
treee9d558087bbb633c514febd2b63066fe2af08dd0
parent7eb0b43357bcf8a6ef224bce6426646631c45f66 (diff)
downloadabc80-2b65a31fbf1658d2bc831aa83542c3f861b9b0bc.tar.gz
abc80-2b65a31fbf1658d2bc831aa83542c3f861b9b0bc.tar.xz
abc80-2b65a31fbf1658d2bc831aa83542c3f861b9b0bc.zip
sound.v: Change the one-shot generator to handle short inhibit pulses
The BASIC interpreter sends 0x00 (clear) and 0x83 (beep) in very short order. We have to clear the oneshot immediately, not on the next strobe.
-rw-r--r--sound.v30
1 files changed, 20 insertions, 10 deletions
diff --git a/sound.v b/sound.v
index ad3a0a7..5e8fa46 100644
--- a/sound.v
+++ b/sound.v
@@ -1,4 +1,15 @@
-// $Id$
+// -----------------------------------------------------------------------
+//
+// Copyright 2003-2015 H. Peter Anvin - All Rights Reserved
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, Inc., 53 Temple Place Ste 330,
+// Bostom MA 02111-1307, USA; either version 2 of the License, or
+// (at your option) any later version; incorporated herein by reference.
+//
+// -----------------------------------------------------------------------
+
//
// Sound controller for ABC80
//
@@ -152,16 +163,15 @@ module oneshot(
wire ctr_or = |ctr;
always @(posedge clk)
- if ( clk_en )
- begin
- inhibit1 <= inhibit;
- oneshot <= ctr_or;
+ begin
+ inhibit1 <= inhibit;
+ oneshot <= ctr_or;
- if ( ~inhibit & inhibit1 )
- ctr <= 11'd1624; // ~26 ms
- else if ( ctr_or )
- ctr <= ctr - 1;
- end
+ if ( ~inhibit & inhibit1 )
+ ctr <= 11'd1624; // ~26 ms
+ else if ( ctr_or & clk_en )
+ ctr <= ctr - 1;
+ end
endmodule // oneshot
module envelope_select(