1
0
mirror of https://github.com/Gehstock/Mist_FPGA.git synced 2026-04-27 20:58:30 +00:00

Added Wave playing of tape loop to Journey core.

This commit is contained in:
Alastair M. Robinson
2024-03-04 14:40:38 +00:00
parent 209336f404
commit 74f39d4239
7 changed files with 479 additions and 12 deletions

View File

@@ -181,7 +181,7 @@ set_global_assignment -name PARTITION_NETLIST_TYPE SOURCE -section_id Top
set_global_assignment -name PARTITION_FITTER_PRESERVATION_LEVEL PLACEMENT_AND_ROUTING -section_id Top
set_global_assignment -name PARTITION_COLOR 16764057 -section_id Top
set_global_assignment -name ENABLE_SIGNALTAP OFF
set_global_assignment -name USE_SIGNALTAP_FILE output_files/jo.stp
set_global_assignment -name USE_SIGNALTAP_FILE output_files/stp1.stp
set_global_assignment -name SYSTEMVERILOG_FILE rtl/Journey_MiST.sv
set_global_assignment -name VHDL_FILE rtl/journey.vhd
set_global_assignment -name VHDL_FILE rtl/satans_hollow_sound_board.vhd
@@ -196,4 +196,7 @@ set_global_assignment -name QIP_FILE ../../../common/CPU/T80/T80.qip
set_global_assignment -name VHDL_FILE ../../../common/Sound/ym2149/vol_table_array.vhd
set_global_assignment -name VHDL_FILE ../../../common/Sound/ym2149/YM2149.vhd
set_global_assignment -name QIP_FILE ../../../common/mist/mist.qip
set_global_assignment -name VHDL_FILE ../../../common/Sound/diskimage_by_byte.vhd
set_global_assignment -name SYSTEMVERILOG_FILE ../../../common/Sound/wave_sound.sv
set_global_assignment -name SIGNALTAP_FILE output_files/stp1.stp
set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top

View File

@@ -5,7 +5,7 @@
<year>1984</year>
<manufacturer>Bally Midway</manufacturer>
<category>Action</category>
<rbf>MCR3</rbf>
<rbf>Journey</rbf>
<setname>journey</setname>
<rom index="0" zip="journey.zip" md5="95d0859c7922308b094486d0d624c727" type="merged|nonmerged">
<part crc="f2618913" name="d2"/>

View File

@@ -16,13 +16,15 @@
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//============================================================================
`default_nettype none
module Journey_MiST(
output LED,
output [5:0] VGA_R,
output [5:0] VGA_G,
output [5:0] VGA_B,
output VGA_HS,
output VGA_VS,
output reg VGA_HS,
output reg VGA_VS,
output AUDIO_L,
output AUDIO_R,
input SPI_SCK,
@@ -53,6 +55,7 @@ localparam CONF_STR = {
"O5,Blend,Off,On;",
"O6,Service,Off,On;",
"R2048,Save NVRAM;",
// "S0U,WAVVHD,Cas Audio:;",
"T0,Reset;",
"V,v1.0.",`BUILD_DATE
};
@@ -95,10 +98,21 @@ wire key_pressed;
wire [7:0] key_code;
wire key_strobe;
wire [31:0] sd_lba;
wire sd_rd;
wire sd_ack;
wire sd_ack_conf;
wire [7:0] sd_dout;
wire sd_dout_strobe;
wire img_mounted;
wire [63:0] img_size;
user_io #(
.STRLEN(($size(CONF_STR)>>3)))
user_io(
.STRLEN(($size(CONF_STR)>>3)),
.SD_IMAGES(1)
) user_io(
.clk_sys (clk_sys ),
.clk_sd (clk_sys ),
.conf_str (CONF_STR ),
.SPI_CLK (SPI_SCK ),
.SPI_SS_IO (CONF_DATA0 ),
@@ -114,6 +128,23 @@ user_io(
.key_code (key_code ),
.joystick_0 (joystick_0 ),
.joystick_1 (joystick_1 ),
// SD CARD
.sd_lba (sd_lba ),
.sd_rd (sd_rd ),
.sd_wr (1'b0 ),
.sd_ack (sd_ack ),
.sd_ack_conf (sd_ack_conf ),
.sd_conf (1'b0 ),
.sd_sdhc (1'b1 ),
.sd_dout (sd_dout ),
.sd_dout_strobe (sd_dout_strobe),
.sd_din ( ),
.sd_din_strobe ( ),
.sd_buff_addr ( ),
.img_mounted (img_mounted ),
.img_size (img_size ),
.status (status )
);
@@ -223,6 +254,8 @@ wire hs, vs, cs;
wire blankn;
wire [2:0] g, r, b;
wire [7:0] output_4;
journey journey(
.clock_40(clk_sys),
.reset(reset),
@@ -243,6 +276,8 @@ journey journey(
.input_2 ( input_2 ),
.input_3 ( input_3 ),
.input_4 ( input_4 ),
.output_4 ( output_4 ),
.cpu_rom_addr ( rom_addr ),
.cpu_rom_do ( rom_addr[0] ? rom_do[15:8] : rom_do[7:0] ),
@@ -259,8 +294,10 @@ journey journey(
wire vs_out;
wire hs_out;
assign VGA_HS = (~no_csync & scandoublerD & ~ypbpr)? cs : hs_out;
assign VGA_VS = (~no_csync & scandoublerD & ~ypbpr)? 1'b1 : vs_out;
always @(posedge clk_sys) begin
VGA_HS <= (~no_csync & scandoublerD & ~ypbpr)? cs : hs_out;
VGA_VS <= (~no_csync & scandoublerD & ~ypbpr)? 1'b1 : vs_out;
end
mist_video #(.COLOR_DEPTH(3), .SD_HCNT_WIDTH(10)) mist_video(
.clk_sys ( clk_sys ),
@@ -286,21 +323,99 @@ mist_video #(.COLOR_DEPTH(3), .SD_HCNT_WIDTH(10)) mist_video(
.ypbpr ( ypbpr )
);
// Wave sound
wire wav_mounted;
wire [31:0] wav_addr;
wire wav_rd;
wire wav_rd_next;
wire [7:0] wav_d;
wire wav_ack;
assign wav_addr[31:28] = 4'h0;
assign sd_lba[31:23] = 8'h00;
// Bytewise interface to disk images
diskimage_by_byte waveinterface (
.clk(clk_sys),
.reset_n(~reset),
.sd_lba(sd_lba),
.sd_rd(sd_rd),
.sd_ack(sd_ack),
.sd_d(sd_dout),
.sd_d_strobe(sd_dout_strobe),
.sd_imgsize(img_size),
.sd_imgmounted(img_mounted),
.client_mounted(wav_mounted),
.client_addr(wav_addr),
.client_rd(wav_rd),
.client_rd_next(wav_rd_next),
.client_q(wav_d),
.client_ack(wav_ack)
);
// Wave player
wire [15:0] wav_out_l;
wire [15:0] wav_out_r;
wire playing;
assign playing = wav_mounted && output_4[0];
wave_sound #(.SYSCLOCK(40000000)) waveplayer
(
.I_CLK(clk_sys),
.I_RST(reset | img_mounted),
.I_BASE_ADDR(0),
.I_LOOP(1'b1),
.I_PAUSE(~playing),
.O_ADDR(wav_addr),
.O_READ(wav_rd),
.O_READNEXT(wav_rd_next),
.I_DATA(wav_d),
.I_READY(wav_ack),
.O_PCM_L(wav_out_l),
.O_PCM_R(wav_out_r)
);
reg [16:0] audio_l_sum;
reg [16:0] audio_r_sum;
reg [16:0] dac_in_l;
reg [16:0] dac_in_r;
always @(posedge clk_sys) begin
audio_l_sum <= {wav_out_l[15],wav_out_l} + {audio_l,1'b0} - 16'h4000;
audio_r_sum <= {wav_out_r[15],wav_out_r} + {audio_r,1'b0} - 16'h4000;
dac_in_l <= {~audio_l_sum[16],audio_l_sum[15:0]};
dac_in_r <= {~audio_r_sum[16],audio_r_sum[15:0]};
end
dac #(
.C_bits(16))
.C_bits(17))
dac_l(
.clk_i(clk_sys),
.res_n_i(1),
.dac_i(audio_l),
.dac_i(dac_in_l),
.dac_o(AUDIO_L)
);
dac #(
.C_bits(16))
.C_bits(17))
dac_r(
.clk_i(clk_sys),
.res_n_i(1),
.dac_i(audio_r),
.dac_i(dac_in_r),
.dac_o(AUDIO_R)
);

View File

@@ -158,6 +158,8 @@ port(
input_2 : in std_logic_vector( 7 downto 0);
input_3 : in std_logic_vector( 7 downto 0);
input_4 : in std_logic_vector( 7 downto 0);
output_4 : out std_logic_vector( 7 downto 0);
cpu_rom_addr : out std_logic_vector(15 downto 0);
cpu_rom_do : in std_logic_vector(7 downto 0);
@@ -851,6 +853,8 @@ port map(
input_3 => input_3,
input_4 => input_4,
output_4 => output_4,
separate_audio => separate_audio,
audio_out_l => audio_out_l,
audio_out_r => audio_out_r,

View File

@@ -68,6 +68,7 @@ port(
input_2 : in std_logic_vector(7 downto 0);
input_3 : in std_logic_vector(7 downto 0);
input_4 : in std_logic_vector(7 downto 0);
output_4 : out std_logic_vector(7 downto 0);
separate_audio : in std_logic;
audio_out_l : out std_logic_vector(15 downto 0);
@@ -446,8 +447,12 @@ begin
iram_1_do <= (others => '0');
iram_2_do <= (others => '0');
iram_3_do <= (others => '0');
output_4 <= (others => '0');
else
if rising_edge(clock_snd) then
if ssio_iowe = '1' and main_cpu_addr(7 downto 2) = "000001" then -- 0x04 - 0x07
output_4 <= ssio_di;
end if;
if ssio_iowe = '1' and main_cpu_addr(7 downto 2) = "000111" then -- 0x1C - 0x1F
case main_cpu_addr(1 downto 0) is
when "00" => iram_0_do <= ssio_di;