Lower square wave volume to stop audio clipping

This commit is contained in:
jimmystones
2022-02-22 11:40:11 +00:00
parent ef7e8b4ae3
commit 647a0f6782
3 changed files with 44 additions and 37 deletions

View File

@@ -1,22 +1,23 @@
//============================================================================
// Arcade: Blockade
//
// TODO - MENTIONS
//
// 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; either version 2 of the License, or (at your option)
// any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
// more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//============================================================================
/*============================================================================
FPGA implementation of Blockade by Gremlin Industries for MiSTer
Author: Jim Gregory - https://github.com/JimmyStones/
Version: 1.0
Date: 2022-02-13
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; either version 3 of the License, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program. If not, see <http://www.gnu.org/licenses/>.
===========================================================================*/
module emu
(

View File

@@ -307,7 +307,7 @@ begin
end
// Amplify square wave to produce output
wire signed [15:0] sound_out = u6766_count == 8'd255 ? 0 : (!u60_2_q ? -18000 : 18000);
wire signed [15:0] sound_out = u6766_count == 8'd255 ? 0 : (!u60_2_q ? -12000 : 12000);
// Low-pass filter the square wave
// - Cut-off frequency of 723.43Hz calculated from 220K resistor and 0.001µF capacitor pairing

View File

@@ -37,15 +37,15 @@ using namespace std;
int initialReset = 48;
bool run_enable = 1;
bool pause_game = 0;
int batchSize = 25000000 / 100000;
int batchSize = 25000000 / 100;
bool single_step = 0;
bool multi_step = 0;
int multi_step_amount = 1024;
#define IS_BLOCKADE
//#define IS_BLOCKADE
//#define IS_COMOTION
//#define IS_HUSTLE
//#define IS_BLASTO
#define IS_BLASTO
// Debug GUI
@@ -275,6 +275,10 @@ bool vbl_last;
#endif
void saveScreenshot() {
}
int verilate()
{
@@ -490,14 +494,14 @@ int main(int argc, char** argv, char** env)
#endif
#ifdef IS_COMOTION
bus.QueueDownload("roms/comotion/316-007.u2", 0);
bus.QueueDownload("roms/comotion/316-008.u3", 0);
bus.QueueDownload("roms/comotion/316-009.u4", 0);
bus.QueueDownload("roms/comotion/316-010.u5", 0);
bus.QueueDownload("roms/comotion/316-006.u43", 0);
bus.QueueDownload("roms/comotion/316-006.u43", 0); // Repeat PROMs for padding (256 bytes only)
bus.QueueDownload("roms/comotion/316-005.u29", 0);
bus.QueueDownload("roms/comotion/316-005.u29", 0); // Repeat PROMs for padding (256 bytes only)
bus.QueueDownload("roms/comotion/316-0007.u2", 0);
bus.QueueDownload("roms/comotion/316-0008.u3", 0);
bus.QueueDownload("roms/comotion/316-0009.u4", 0);
bus.QueueDownload("roms/comotion/316-0010.u5", 0);
bus.QueueDownload("roms/comotion/316-0006.u43", 0);
bus.QueueDownload("roms/comotion/316-0006.u43", 0); // Repeat PROMs for padding (256 bytes only)
bus.QueueDownload("roms/comotion/316-0005.u29", 0);
bus.QueueDownload("roms/comotion/316-0005.u29", 0); // Repeat PROMs for padding (256 bytes only)
// Set overlay
top->emu__DOT__overlay_type = 0;
#endif
@@ -514,12 +518,12 @@ int main(int argc, char** argv, char** env)
#endif
#ifdef IS_BLASTO
bus.QueueDownload("roms/blasto/blasto.u2", 0);
bus.QueueDownload("roms/blasto/blasto.u3", 0);
bus.QueueDownload("roms/blasto/blasto.u4", 0);
bus.QueueDownload("roms/blasto/blasto.u5", 0);
bus.QueueDownload("roms/blasto/blasto.u29", 0);
bus.QueueDownload("roms/blasto/blasto.u43", 0);
bus.QueueDownload("roms/blasto/316-0089.u2", 0);
bus.QueueDownload("roms/blasto/316-0090.u3", 0);
bus.QueueDownload("roms/blasto/316-0091.u4", 0);
bus.QueueDownload("roms/blasto/316-0092.u5", 0);
bus.QueueDownload("roms/blasto/316-0093.u29", 0);
bus.QueueDownload("roms/blasto/316-0094.u43", 0);
// Set overlay
top->emu__DOT__overlay_type = 1;
#endif
@@ -584,6 +588,8 @@ int main(int argc, char** argv, char** env)
ImGui::Checkbox("Pause game", &pause_game); ImGui::SameLine();
top->emu__DOT__pause_cpu = pause_game;
if (ImGui::Button("Save screenshot")) { saveScreenshot(); }
#ifdef CPU_DEBUG
ImGui::NewLine();
ImGui::Checkbox("Log CPU instructions", &log_instructions);