1
0
mirror of https://github.com/mist-devel/mist-board.git synced 2026-01-26 20:01:48 +00:00

- Video fix, scanlines support

This commit is contained in:
jcgamestoy
2013-08-22 00:07:44 +00:00
parent bee90b5d3e
commit 7d3c1085cc
4 changed files with 1307 additions and 1094 deletions

View File

@@ -53,6 +53,8 @@
-- NOTE, this component uses a volume table for accurate mixing of the three analogue channels,
-- where the outputs are wired together - like in the Atari ST
-- Modified for stereo sound by Juan Carlos González Amestoy.
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
@@ -71,8 +73,10 @@ entity YM2149 is
I_BC2 : in std_logic;
I_BC1 : in std_logic;
I_SEL_L : in std_logic;
stereo : in std_logic;
O_AUDIO : out std_logic_vector(7 downto 0);
O_AUDIO_L : out std_logic_vector(7 downto 0);
O_AUDIO_R : out std_logic_vector(7 downto 0);
-- port a
I_IOA : in std_logic_vector(7 downto 0);
O_IOA : out std_logic_vector(7 downto 0);
@@ -130,8 +134,10 @@ architecture RTL of YM2149 is
signal env_inc : std_logic;
signal env_vol : std_logic_vector(4 downto 0);
signal vol_table_in : std_logic_vector(11 downto 0);
signal vol_table_out : std_logic_vector(9 downto 0);
signal vol_table_in_l : std_logic_vector(11 downto 0);
signal vol_table_in_r : std_logic_vector(11 downto 0);
signal vol_table_out_l : std_logic_vector(9 downto 0);
signal vol_table_out_r : std_logic_vector(9 downto 0);
begin
-- cpu i/f
@@ -516,41 +522,71 @@ begin
chan_mixed(1) := (reg(7)(1) or tone_gen_op(2)) and (reg(7)(4) or noise_gen_op);
chan_mixed(2) := (reg(7)(2) or tone_gen_op(3)) and (reg(7)(5) or noise_gen_op);
vol_table_in <= x"000";
vol_table_in_l <= x"000";
vol_table_in_r <= x"000";
if (chan_mixed(0) = '1') then
if (reg(8)(4) = '0') then
vol_table_in(3 downto 0) <= reg(8)(3 downto 0);
if(stereo='1') then
if (reg(8)(4) = '0') then
vol_table_in_l(3 downto 0) <= reg(8)(3 downto 0);
else
vol_table_in_l(3 downto 0) <= env_vol(4 downto 1);
end if;
else
vol_table_in(3 downto 0) <= env_vol(4 downto 1);
if (reg(8)(4) = '0') then
vol_table_in_l(3 downto 0) <= reg(8)(3 downto 0);
vol_table_in_r(3 downto 0) <= reg(8)(3 downto 0);
else
vol_table_in_l(3 downto 0) <= env_vol(4 downto 1);
vol_table_in_r(3 downto 0) <= env_vol(4 downto 1);
end if;
end if;
end if;
if (chan_mixed(1) = '1') then
if (reg(9)(4) = '0') then
vol_table_in(7 downto 4) <= reg(9)(3 downto 0);
vol_table_in_l(7 downto 4) <= reg(9)(3 downto 0);
vol_table_in_r(7 downto 4) <= reg(9)(3 downto 0);
else
vol_table_in(7 downto 4) <= env_vol(4 downto 1);
vol_table_in_l(7 downto 4) <= env_vol(4 downto 1);
vol_table_in_r(7 downto 4) <= env_vol(4 downto 1);
end if;
end if;
if (chan_mixed(2) = '1') then
if (reg(10)(4) = '0') then
vol_table_in(11 downto 8) <= reg(10)(3 downto 0);
if(stereo='1') then
if (reg(10)(4) = '0') then
vol_table_in_r(11 downto 8) <= reg(10)(3 downto 0);
else
vol_table_in_r(11 downto 8) <= env_vol(4 downto 1);
end if;
else
vol_table_in(11 downto 8) <= env_vol(4 downto 1);
if (reg(10)(4) = '0') then
vol_table_in_l(11 downto 8) <= reg(10)(3 downto 0);
vol_table_in_r(11 downto 8) <= reg(10)(3 downto 0);
else
vol_table_in_l(11 downto 8) <= env_vol(4 downto 1);
vol_table_in_r(11 downto 8) <= reg(10)(3 downto 0);
end if;
end if;
end if;
end if;
end process;
u_vol_table : vol_table
u_vol_table_l : vol_table
port map (
CLK => clk,
ADDR => vol_table_in,
DATA => vol_table_out
ADDR => vol_table_in_l,
DATA => vol_table_out_l
);
u_vol_table_r : vol_table
port map(
CLK=>clk,
ADDR=>vol_table_in_r,
DATA=>vol_table_out_r
);
p_op_mixer : process
variable chan_mixed : std_logic;
variable chan_amp : std_logic_vector(4 downto 0);
@@ -558,9 +594,11 @@ begin
wait until rising_edge(CLK);
if (RESET_L = '0') then
O_AUDIO(7 downto 0) <= "00000000";
O_AUDIO_L(7 downto 0) <= "00000000";
O_AUDIO_R(7 downto 0) <= "00000000";
else
O_AUDIO(7 downto 0) <= vol_table_out(9 downto 2);
O_AUDIO_L(7 downto 0) <= vol_table_out_l(9 downto 2);
O_AUDIO_R(7 downto 0) <= vol_table_out_r(9 downto 2);
end if;
end process;

File diff suppressed because it is too large Load Diff

View File

@@ -182,8 +182,9 @@ wire init = ~pll_locked;
video video (
.reset (init ), // reset input
.clk (clk_32 ),
.clk27 (CLOCK_27[0]),
.bus_cycle (bus_cycle ),
.scanlines (system_ctrl[31:30]),
// spi for OSD
.sdi (SPI_DI ),
.sck (SPI_SCK ),
@@ -320,16 +321,23 @@ wire [7:0] port_a_out;
assign floppy_side = port_a_out[0];
assign floppy_sel = port_a_out[2:1];
wire [7:0] audio_out;
assign AUDIO_R = AUDIO_L;
wire [7:0] audio_out_l,audio_out_r;
//assign AUDIO_R = AUDIO_L;
sigma_delta_dac sigma_delta_dac (
sigma_delta_dac sigma_delta_dac_l (
.DACout (AUDIO_L),
.DACin (audio_out),
.DACin (audio_out_l),
.CLK (clk_32),
.RESET (reset)
);
sigma_delta_dac sigma_delta_dac_r (
.DACout (AUDIO_R),
.DACin (audio_out_r),
.CLK (clk_32),
.RESET (reset)
);
YM2149 ym2149 (
.I_DA ( tg68_dat_out[15:8] ),
.O_DA ( psg_data_out ),
@@ -343,8 +351,10 @@ YM2149 ym2149 (
.I_BC1 ( psg_sel && !tg68_adr[1]),
.I_SEL_L ( 1'b1 ),
.O_AUDIO ( audio_out ),
.O_AUDIO_L (audio_out_l),
.O_AUDIO_R (audio_out_r),
.stereo (system_ctrl[29]),
// port a
.I_IOA ( 8'd0 ),
.O_IOA ( port_a_out ),

File diff suppressed because it is too large Load Diff