mirror of
https://github.com/Gehstock/Mist_FPGA.git
synced 2026-01-31 13:51:56 +00:00
LodeRunner: all ROMs are external, add Kung Fu Master MRA
This commit is contained in:
@@ -57,7 +57,6 @@ set_global_assignment -name VHDL_FILE rtl/video_mixer.vhd
|
||||
set_global_assignment -name VHDL_FILE rtl/video_controller_pkg_body.vhd
|
||||
set_global_assignment -name VHDL_FILE rtl/video_controller_pkg.vhd
|
||||
set_global_assignment -name VHDL_FILE rtl/video_controller.vhd
|
||||
set_global_assignment -name VHDL_FILE rtl/tilemapctl_e.vhd
|
||||
set_global_assignment -name VHDL_FILE rtl/tilemapctl.vhd
|
||||
set_global_assignment -name VHDL_FILE rtl/bitmapctl_e.vhd
|
||||
set_global_assignment -name VHDL_FILE rtl/spritereg.vhd
|
||||
@@ -202,7 +201,7 @@ set_global_assignment -name USE_CONFIGURATION_DEVICE OFF
|
||||
# SignalTap II Assignments
|
||||
# ========================
|
||||
set_global_assignment -name ENABLE_SIGNALTAP OFF
|
||||
set_global_assignment -name USE_SIGNALTAP_FILE output_files/sp.stp
|
||||
set_global_assignment -name USE_SIGNALTAP_FILE output_files/sprite.stp
|
||||
|
||||
# Power Estimation Assignments
|
||||
# ============================
|
||||
@@ -272,4 +271,6 @@ set_global_assignment -name OUTPUT_IO_TIMING_FAR_END_VMEAS "HALF SIGNAL SWING" -
|
||||
# ---------------------------
|
||||
set_global_assignment -name SIGNALTAP_FILE output_files/sp.stp
|
||||
set_location_assignment PLL_1 -to pll|altpll_component|auto_generated|pll1
|
||||
set_global_assignment -name SIGNALTAP_FILE output_files/tilemap.stp
|
||||
set_global_assignment -name SIGNALTAP_FILE output_files/sprite.stp
|
||||
set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top
|
||||
@@ -0,0 +1,112 @@
|
||||
<misterromdescription>
|
||||
<name>Lode Runner</name>
|
||||
<mameversion>0216</mameversion>
|
||||
<setname>kungfum</setname>
|
||||
<manufacturer>Irem</manufacturer>
|
||||
<rbf>iremm62</rbf>
|
||||
<rom index="1"><part>1</part></rom>
|
||||
<rom index="0" zip="kungfum.zip" md5="9e4c8423a33f0c5bf558d475d89e041a" type="merged|nonmerged">
|
||||
<!-- CPU1, 128k -->
|
||||
<part name="a-4e-c.bin"/>
|
||||
<part name="a-4d-c.bin"/>
|
||||
<part name="a-4e-c.bin"/>
|
||||
<part name="a-4d-c.bin"/>
|
||||
<part name="a-4e-c.bin"/>
|
||||
<part name="a-4d-c.bin"/>
|
||||
<part name="a-4e-c.bin"/>
|
||||
<part name="a-4d-c.bin"/>
|
||||
|
||||
<!-- SND CPU2, 64k -->
|
||||
<part name="a-3e-.bin"/>
|
||||
<part name="a-3f-.bin"/>
|
||||
<part name="a-3h-.bin"/>
|
||||
<part name="a-3h-.bin"/>
|
||||
|
||||
<part name="a-3e-.bin"/>
|
||||
<part name="a-3f-.bin"/>
|
||||
<part name="a-3h-.bin"/>
|
||||
<part name="a-3h-.bin"/>
|
||||
|
||||
<!-- GFX1, 128k -->
|
||||
<part name="g-4c-a.bin"/>
|
||||
<part name="g-4d-a.bin"/>
|
||||
<part name="g-4e-a.bin"/>
|
||||
<part name="g-4e-a.bin"/>
|
||||
|
||||
<part name="g-4c-a.bin"/>
|
||||
<part name="g-4d-a.bin"/>
|
||||
<part name="g-4e-a.bin"/>
|
||||
<part name="g-4e-a.bin"/>
|
||||
|
||||
<part name="g-4c-a.bin"/>
|
||||
<part name="g-4d-a.bin"/>
|
||||
<part name="g-4e-a.bin"/>
|
||||
<part name="g-4e-a.bin"/>
|
||||
|
||||
<part name="g-4c-a.bin"/>
|
||||
<part name="g-4d-a.bin"/>
|
||||
<part name="g-4e-a.bin"/>
|
||||
<part name="g-4e-a.bin"/>
|
||||
|
||||
<!-- GFX2, 256k -->
|
||||
<part name="b-4k-.bin"/>
|
||||
<part name="b-4f-.bin"/>
|
||||
<part name="b-4l-.bin"/>
|
||||
<part name="b-4l-.bin"/>
|
||||
|
||||
<part name="b-4h-.bin"/>
|
||||
<part name="b-3n-.bin"/>
|
||||
<part name="b-4n-.bin"/>
|
||||
<part name="b-4n-.bin"/>
|
||||
|
||||
<part name="b-4m-.bin"/>
|
||||
<part name="b-3m-.bin"/>
|
||||
<part name="b-4c-.bin"/>
|
||||
<part name="b-4c-.bin"/>
|
||||
|
||||
<part name="b-4e-.bin"/>
|
||||
<part name="b-4d-.bin"/>
|
||||
<part name="b-4a-.bin"/>
|
||||
<part name="b-4a-.bin"/>
|
||||
|
||||
<part name="b-4k-.bin"/>
|
||||
<part name="b-4f-.bin"/>
|
||||
<part name="b-4l-.bin"/>
|
||||
<part name="b-4l-.bin"/>
|
||||
|
||||
<part name="b-4h-.bin"/>
|
||||
<part name="b-3n-.bin"/>
|
||||
<part name="b-4n-.bin"/>
|
||||
<part name="b-4n-.bin"/>
|
||||
|
||||
<part name="b-4m-.bin"/>
|
||||
<part name="b-3m-.bin"/>
|
||||
<part name="b-4c-.bin"/>
|
||||
<part name="b-4c-.bin"/>
|
||||
|
||||
<part name="b-4e-.bin"/>
|
||||
<part name="b-4d-.bin"/>
|
||||
<part name="b-4a-.bin"/>
|
||||
<part name="b-4a-.bin"/>
|
||||
|
||||
<!-- GFX3, 64k -->
|
||||
<part repeat="0x10000">FF</part>
|
||||
|
||||
<!-- spr_color_proms, 3*256b -->
|
||||
<part name="b-1m-.bin"/>
|
||||
<part name="b-1n-.bin"/>
|
||||
<part name="b-1l-.bin"/>
|
||||
|
||||
<!-- chr_color_proms, 3*256b -->
|
||||
<part name="g-1j-.bin"/>
|
||||
<part name="g-1f-.bin"/>
|
||||
<part name="g-1h-.bin"/>
|
||||
|
||||
<!-- fg_color_proms, 3*256b -->
|
||||
<part repeat="0x300">FF</part>
|
||||
|
||||
<!-- spr_height_prom -->
|
||||
<part name="b-5f-.bin"/>
|
||||
|
||||
</rom>
|
||||
</misterromdescription>
|
||||
@@ -9,10 +9,14 @@ use work.video_controller_pkg.all;
|
||||
use work.sprite_pkg.all;
|
||||
--use work.project_pkg.all;
|
||||
use work.platform_pkg.all;
|
||||
use work.platform_variant_pkg.all;
|
||||
|
||||
entity Graphics is
|
||||
port
|
||||
(
|
||||
hwsel : in integer;
|
||||
sprite_prom : in prom_a(0 to 31);
|
||||
|
||||
bitmap_ctl_i : in to_BITMAP_CTL_a(1 to PACE_VIDEO_NUM_BITMAPS);
|
||||
bitmap_ctl_o : out from_BITMAP_CTL_a(1 to PACE_VIDEO_NUM_BITMAPS);
|
||||
tilemap_ctl_i : in to_TILEMAP_CTL_a(1 to PACE_VIDEO_NUM_TILEMAPS);
|
||||
@@ -46,7 +50,7 @@ architecture SYN of Graphics is
|
||||
signal rgb_data : RGB_t;
|
||||
-- before OSD is mixed in
|
||||
signal video_o_s : to_VIDEO_t;
|
||||
|
||||
|
||||
begin
|
||||
|
||||
-- dodgy OSD transparency...
|
||||
@@ -104,7 +108,7 @@ begin
|
||||
(
|
||||
bitmap_ctl_o => bitmap_ctl_o_s,
|
||||
tilemap_ctl_o => tilemap_ctl_o_s,
|
||||
sprite_rgb => sprite_ctl_o_s.rgb,
|
||||
sprite_rgb => sprite_ctl_i.rgb,
|
||||
sprite_set => sprite_ctl_o_s.set,
|
||||
sprite_pri => sprite_pri,
|
||||
|
||||
@@ -231,7 +235,7 @@ begin
|
||||
tilemap_ctl_o <= tilemap_ctl_o_s;
|
||||
|
||||
GEN_NO_SPRITES : if PACE_VIDEO_NUM_SPRITES = 0 generate
|
||||
sprite_ctl_o_s <= ((others => '0'), (others => (others => '0')), '0');
|
||||
sprite_ctl_o_s <= ((others => '0'), '0', (others => '0'));
|
||||
sprite_pri <= '0';
|
||||
spr0_hit <= '0';
|
||||
end generate GEN_NO_SPRITES;
|
||||
@@ -247,7 +251,9 @@ begin
|
||||
port map
|
||||
(
|
||||
reset => video_i.reset,
|
||||
|
||||
sprite_prom => sprite_prom,
|
||||
|
||||
hwsel => hwsel,
|
||||
-- register interface
|
||||
reg_i => sprite_reg_i,
|
||||
|
||||
@@ -259,7 +265,7 @@ begin
|
||||
row_a => sprite_ctl_o_s.a,
|
||||
row_d => sprite_ctl_i.d,
|
||||
|
||||
rgb => sprite_ctl_o_s.rgb,
|
||||
pal_a => sprite_ctl_o_s.pal_a,
|
||||
set => sprite_ctl_o_s.set,
|
||||
pri => sprite_pri,
|
||||
spr0_set => spr0_hit
|
||||
|
||||
@@ -31,6 +31,7 @@ module LodeRunner_MiST(
|
||||
`include "rtl/build_id.v"
|
||||
|
||||
`define CORE_NAME "LDRUN"
|
||||
wire [6:0] core_mod;
|
||||
|
||||
localparam CONF_STR = {
|
||||
`CORE_NAME,";;",
|
||||
@@ -89,6 +90,7 @@ user_io(
|
||||
.scandoubler_disable (scandoublerD ),
|
||||
.ypbpr (ypbpr ),
|
||||
.no_csync (no_csync ),
|
||||
.core_mod (core_mod ),
|
||||
.key_strobe (key_strobe ),
|
||||
.key_pressed (key_pressed ),
|
||||
.key_code (key_code ),
|
||||
@@ -222,6 +224,7 @@ target_top target_top(
|
||||
.clock_vid(clk_vid),//11MHz
|
||||
.clk_aud(clk_aud),//0.895MHz
|
||||
.reset_in(reset),
|
||||
.hwsel(core_mod),
|
||||
.audio_out(audio),
|
||||
.usr_coin1(m_coin1),
|
||||
.usr_coin2(m_coin2),
|
||||
@@ -245,6 +248,11 @@ target_top target_top(
|
||||
.VGA_R(r),
|
||||
.VGA_G(g),
|
||||
.VGA_B(b),
|
||||
|
||||
.dl_addr(ioctl_addr - 20'hA0000),
|
||||
.dl_data(ioctl_dout),
|
||||
.dl_wr(ioctl_wr),
|
||||
|
||||
.cpu_rom_addr(rom_addr),
|
||||
.cpu_rom_do( rom_addr[0] ? rom_do[15:8] : rom_do[7:0] ),
|
||||
.snd_rom_addr(snd_rom_addr),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.std_logic_unsigned.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
library work;
|
||||
@@ -7,6 +8,7 @@ use work.pace_pkg.all;
|
||||
use work.video_controller_pkg.all;
|
||||
use work.sprite_pkg.all;
|
||||
use work.platform_pkg.all;
|
||||
use work.platform_variant_pkg.all;
|
||||
--use work.project_pkg.all;
|
||||
|
||||
entity PACE is
|
||||
@@ -14,6 +16,9 @@ entity PACE is
|
||||
(
|
||||
-- clocks and resets
|
||||
clkrst_i : in from_CLKRST_t;
|
||||
|
||||
-- hardware variant
|
||||
hwsel : in integer;
|
||||
|
||||
-- misc I/O
|
||||
buttons_i : in from_BUTTONS_t;
|
||||
@@ -33,6 +38,11 @@ entity PACE is
|
||||
-- project_o : out to_PROJECT_IO_t;
|
||||
platform_i : in from_PLATFORM_IO_t;
|
||||
platform_o : out to_PLATFORM_IO_t;
|
||||
|
||||
dl_addr : in std_logic_vector(11 downto 0);
|
||||
dl_data : in std_logic_vector(7 downto 0);
|
||||
dl_wr : in std_logic;
|
||||
|
||||
cpu_rom_addr : out std_logic_vector(14 downto 0);
|
||||
cpu_rom_do : in std_logic_vector(7 downto 0);
|
||||
gfx1_addr : out std_logic_vector(17 downto 2);
|
||||
@@ -44,6 +54,8 @@ end entity PACE;
|
||||
|
||||
architecture SYN of PACE is
|
||||
|
||||
alias clk_sys : std_logic is clkrst_i.clk(0);
|
||||
|
||||
constant CLK_1US_COUNTS : integer :=
|
||||
integer(27 * PACE_CLK0_MULTIPLY_BY / PACE_CLK0_DIVIDE_BY);
|
||||
|
||||
@@ -63,6 +75,7 @@ architecture SYN of PACE is
|
||||
|
||||
signal to_graphics : to_GRAPHICS_t;
|
||||
signal from_graphics : from_GRAPHICS_t;
|
||||
signal sprite_prom : prom_a(0 to 31);
|
||||
|
||||
begin
|
||||
|
||||
@@ -92,6 +105,8 @@ begin
|
||||
(
|
||||
-- clocking and reset
|
||||
clkrst_i => clkrst_i,
|
||||
|
||||
hwsel => hwsel,
|
||||
|
||||
-- misc inputs and outputs
|
||||
buttons_i => buttons_i,
|
||||
@@ -122,6 +137,10 @@ begin
|
||||
platform_i => platform_i,
|
||||
platform_o => platform_o,
|
||||
|
||||
dl_addr => dl_addr,
|
||||
dl_data => dl_data,
|
||||
dl_wr => dl_wr,
|
||||
|
||||
cpu_rom_addr => cpu_rom_addr,
|
||||
cpu_rom_do => cpu_rom_do,
|
||||
gfx1_addr => gfx1_addr,
|
||||
@@ -133,6 +152,9 @@ begin
|
||||
graphics_inst : entity work.Graphics
|
||||
Port Map
|
||||
(
|
||||
hwsel => hwsel,
|
||||
sprite_prom => sprite_prom,
|
||||
|
||||
bitmap_ctl_i => to_bitmap_ctl,
|
||||
bitmap_ctl_o => from_bitmap_ctl,
|
||||
|
||||
@@ -151,4 +173,12 @@ begin
|
||||
video_o => video_o
|
||||
);
|
||||
|
||||
process(clk_sys) begin
|
||||
if rising_edge(clk_sys) then
|
||||
-- 900-91F
|
||||
if dl_wr = '1' and dl_addr(11 downto 5) = x"9"&"000" then
|
||||
sprite_prom(to_integer(unsigned(dl_addr(4 downto 0)))) <= to_integer(unsigned(dl_data(1 downto 0)));
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
end SYN;
|
||||
|
||||
@@ -21,6 +21,8 @@ entity platform is
|
||||
-- clocking and reset
|
||||
clkrst_i : in from_CLKRST_t;
|
||||
|
||||
hwsel : in integer;
|
||||
|
||||
-- misc I/O
|
||||
buttons_i : in from_BUTTONS_t;
|
||||
switches_i : in from_SWITCHES_t;
|
||||
@@ -52,6 +54,11 @@ entity platform is
|
||||
-- project_o : out to_PROJECT_IO_t;
|
||||
platform_i : in from_PLATFORM_IO_t;
|
||||
platform_o : out to_PLATFORM_IO_t;
|
||||
|
||||
dl_addr : in std_logic_vector(11 downto 0);
|
||||
dl_data : in std_logic_vector(7 downto 0);
|
||||
dl_wr : in std_logic;
|
||||
|
||||
cpu_rom_addr : out std_logic_vector(14 downto 0);
|
||||
cpu_rom_do : in std_logic_vector(7 downto 0);
|
||||
gfx1_addr : out std_logic_vector(17 downto 2);
|
||||
@@ -107,7 +114,13 @@ architecture SYN of platform is
|
||||
-- misc signals
|
||||
signal in_cs : std_logic;
|
||||
signal in_d_o : std_logic_vector(7 downto 0);
|
||||
|
||||
signal pal_r_wr : std_logic;
|
||||
signal pal_g_wr : std_logic;
|
||||
signal pal_b_wr : std_logic;
|
||||
signal sp_pal_r_wr : std_logic;
|
||||
signal sp_pal_g_wr : std_logic;
|
||||
signal sp_pal_b_wr : std_logic;
|
||||
|
||||
-- other signals
|
||||
signal rst_platform : std_logic;
|
||||
signal pause : std_logic;
|
||||
@@ -155,14 +168,14 @@ begin
|
||||
-- SPRITE $C000-$C0FF
|
||||
sprite_cs <= '1' when STD_MATCH(cpu_a, X"C0"& "--------") else '0';
|
||||
-- VRAM/CRAM $D000-$DFFF
|
||||
vram_cs <= '1' when PLATFORM_VARIANT = "kungfum" and
|
||||
vram_cs <= '1' when hwsel = HW_KUNGFUM and
|
||||
STD_MATCH(cpu_a, X"D"&"0-----------") else
|
||||
'1' when PLATFORM_VARIANT /= "kungfum" and
|
||||
'1' when hwsel /= HW_KUNGFUM and
|
||||
STD_MATCH(cpu_a, X"D"&"-----------0") else
|
||||
'0';
|
||||
cram_cs <= '1' when PLATFORM_VARIANT = "kungfum" and
|
||||
cram_cs <= '1' when hwsel = HW_KUNGFUM and
|
||||
STD_MATCH(cpu_a, X"D"&"1-----------") else
|
||||
'1' when PLATFORM_VARIANT /= "kungfum" and
|
||||
'1' when hwsel /= HW_KUNGFUM and
|
||||
STD_MATCH(cpu_a, X"D"&"-----------1") else
|
||||
'0';
|
||||
-- RAM $E000-$EFFF
|
||||
@@ -313,11 +326,11 @@ begin
|
||||
if cpu_clk_en = '1' and cpu_mem_wr = '1' then
|
||||
case cpu_a is
|
||||
when X"A000" =>
|
||||
if PLATFORM_VARIANT = "kungfum" then
|
||||
if hwsel = HW_KUNGFUM then
|
||||
m62_hscroll(7 downto 0) <= cpu_d_o;
|
||||
end if;
|
||||
when X"B000" =>
|
||||
if PLATFORM_VARIANT = "kungfum" then
|
||||
if hwsel = HW_KUNGFUM then
|
||||
m62_hscroll(15 downto 8) <= cpu_d_o;
|
||||
end if;
|
||||
when others =>
|
||||
@@ -408,7 +421,7 @@ begin
|
||||
alias cram_a : std_logic_vector(10 downto 0) is vram_a;
|
||||
begin
|
||||
|
||||
vram_a <= cpu_a(10 downto 0) when PLATFORM_VARIANT = "kungfum" else
|
||||
vram_a <= cpu_a(10 downto 0) when hwsel = HW_KUNGFUM else
|
||||
cpu_a(11 downto 1);
|
||||
|
||||
vram_inst : entity work.dpram
|
||||
@@ -471,6 +484,140 @@ begin
|
||||
q => wram_d_o
|
||||
);
|
||||
|
||||
-- tilemap 1 palettes
|
||||
pal_r : entity work.dpram
|
||||
generic map
|
||||
(
|
||||
init_file => "",
|
||||
widthad_a => 8
|
||||
)
|
||||
port map
|
||||
(
|
||||
clock_b => clk_sys,
|
||||
address_b => dl_addr(7 downto 0),
|
||||
wren_b => pal_r_wr,
|
||||
data_b => dl_data(3 downto 0) & dl_data(3 downto 0),
|
||||
q_b => open,
|
||||
|
||||
clock_a => not clk_video,
|
||||
address_a => tilemap_i(1).pal_a,
|
||||
wren_a => '0',
|
||||
data_a => (others => 'X'),
|
||||
q_a => tilemap_o(1).rgb.r(9 downto 2)
|
||||
);
|
||||
pal_r_wr <= '1' when dl_wr = '1' and dl_addr(11 downto 8) = x"3" else '0'; -- 300-3FF
|
||||
|
||||
pal_g : entity work.dpram
|
||||
generic map
|
||||
(
|
||||
init_file => "",
|
||||
widthad_a => 8
|
||||
)
|
||||
port map
|
||||
(
|
||||
clock_b => clk_sys,
|
||||
address_b => dl_addr(7 downto 0),
|
||||
wren_b => pal_g_wr,
|
||||
data_b => dl_data(3 downto 0) & dl_data(3 downto 0),
|
||||
q_b => open,
|
||||
|
||||
clock_a => not clk_video,
|
||||
address_a => tilemap_i(1).pal_a,
|
||||
wren_a => '0',
|
||||
data_a => (others => 'X'),
|
||||
q_a => tilemap_o(1).rgb.g(9 downto 2)
|
||||
);
|
||||
pal_g_wr <= '1' when dl_wr = '1' and dl_addr(11 downto 8) = x"4" else '0'; -- 400-4FF
|
||||
|
||||
pal_b : entity work.dpram
|
||||
generic map
|
||||
(
|
||||
init_file => "",
|
||||
widthad_a => 8
|
||||
)
|
||||
port map
|
||||
(
|
||||
clock_b => clk_sys,
|
||||
address_b => dl_addr(7 downto 0),
|
||||
wren_b => pal_b_wr,
|
||||
data_b => dl_data(3 downto 0) & dl_data(3 downto 0),
|
||||
q_b => open,
|
||||
|
||||
clock_a => not clk_video,
|
||||
address_a => tilemap_i(1).pal_a,
|
||||
wren_a => '0',
|
||||
data_a => (others => 'X'),
|
||||
q_a => tilemap_o(1).rgb.b(9 downto 2)
|
||||
);
|
||||
pal_b_wr <= '1' when dl_wr = '1' and dl_addr(11 downto 8) = x"5" else '0'; -- 500-5FF
|
||||
|
||||
-- sprite palettes
|
||||
sp_pal_r : entity work.dpram
|
||||
generic map
|
||||
(
|
||||
init_file => "",
|
||||
widthad_a => 8
|
||||
)
|
||||
port map
|
||||
(
|
||||
clock_b => clk_sys,
|
||||
address_b => dl_addr(7 downto 0),
|
||||
wren_b => sp_pal_r_wr,
|
||||
data_b => dl_data(3 downto 0) & dl_data(3 downto 0),
|
||||
q_b => open,
|
||||
|
||||
clock_a => not clk_video,
|
||||
address_a => sprite_i.pal_a,
|
||||
wren_a => '0',
|
||||
data_a => (others => '0'),
|
||||
q_a => sprite_o.rgb.r(9 downto 2)
|
||||
);
|
||||
sp_pal_r_wr <= '1' when dl_wr = '1' and dl_addr(11 downto 8) = x"0" else '0'; -- 000-0FF
|
||||
|
||||
sp_pal_g : entity work.dpram
|
||||
generic map
|
||||
(
|
||||
init_file => "",
|
||||
widthad_a => 8
|
||||
)
|
||||
port map
|
||||
(
|
||||
clock_b => clk_sys,
|
||||
address_b => dl_addr(7 downto 0),
|
||||
wren_b => sp_pal_g_wr,
|
||||
data_b => dl_data(3 downto 0) & dl_data(3 downto 0),
|
||||
q_b => open,
|
||||
|
||||
clock_a => not clk_video,
|
||||
address_a => sprite_i.pal_a,
|
||||
wren_a => '0',
|
||||
data_a => (others => '0'),
|
||||
q_a => sprite_o.rgb.g(9 downto 2)
|
||||
);
|
||||
sp_pal_g_wr <= '1' when dl_wr = '1' and dl_addr(11 downto 8) = x"1" else '0'; -- 100-1FF
|
||||
|
||||
sp_pal_b : entity work.dpram
|
||||
generic map
|
||||
(
|
||||
init_file => "",
|
||||
widthad_a => 8
|
||||
)
|
||||
port map
|
||||
(
|
||||
clock_b => clk_sys,
|
||||
address_b => dl_addr(7 downto 0),
|
||||
wren_b => sp_pal_b_wr,
|
||||
data_b => dl_data(3 downto 0) & dl_data(3 downto 0),
|
||||
q_b => open,
|
||||
|
||||
clock_a => not clk_video,
|
||||
address_a => sprite_i.pal_a,
|
||||
wren_a => '0',
|
||||
data_a => (others => '0'),
|
||||
q_a => sprite_o.rgb.b(9 downto 2)
|
||||
);
|
||||
sp_pal_b_wr <= '1' when dl_wr = '1' and dl_addr(11 downto 8) = x"2" else '0'; -- 200-2FF
|
||||
|
||||
-- unused outputs
|
||||
|
||||
sprite_o.ld <= '0';
|
||||
|
||||
@@ -9,8 +9,10 @@ use work.platform_pkg.all;
|
||||
package platform_variant_pkg is
|
||||
|
||||
|
||||
constant PLATFORM_VARIANT : string := "ldrun";
|
||||
|
||||
constant HW_LDRUN : integer := 0;
|
||||
constant HW_KUNGFUM : integer := 1;
|
||||
constant HW_BATTROAD : integer := 2;
|
||||
|
||||
type rom_a is array (natural range <>) of string;
|
||||
|
||||
constant M62_ROM : rom_a(0 to 3) :=
|
||||
@@ -416,25 +418,45 @@ package platform_variant_pkg is
|
||||
|
||||
-- table of sprite heights
|
||||
type prom_a is array (natural range <>) of integer range 0 to 3;
|
||||
constant sprite_prom : prom_a(0 to 31) :=
|
||||
(
|
||||
4 => 0,
|
||||
5 => 0,
|
||||
6 => 0,
|
||||
7 => 0,
|
||||
12 => 0,
|
||||
13 => 0,
|
||||
14 => 0,
|
||||
15 => 0,
|
||||
20 => 0,
|
||||
21 => 0,
|
||||
22 => 0,
|
||||
23 => 0,
|
||||
28 => 0,
|
||||
29 => 0,
|
||||
30 => 0,
|
||||
31 => 0,
|
||||
others => 1
|
||||
);
|
||||
|
||||
|
||||
-- ldrun
|
||||
-- constant sprite_prom : prom_a(0 to 31) :=
|
||||
-- (
|
||||
-- 4 => 0,
|
||||
-- 5 => 0,
|
||||
-- 6 => 0,
|
||||
-- 7 => 0,
|
||||
-- 12 => 0,
|
||||
-- 13 => 0,
|
||||
-- 14 => 0,
|
||||
-- 15 => 0,
|
||||
-- 20 => 0,
|
||||
-- 21 => 0,
|
||||
-- 22 => 0,
|
||||
-- 23 => 0,
|
||||
-- 28 => 0,
|
||||
-- 29 => 0,
|
||||
-- 30 => 0,
|
||||
-- 31 => 0,
|
||||
-- others => 1
|
||||
-- );
|
||||
|
||||
-- kungfum
|
||||
-- constant sprite_prom : prom_a(0 to 31) :=
|
||||
-- (
|
||||
-- 0 => 0,
|
||||
-- 1 => 0,
|
||||
-- 8 => 0,
|
||||
-- 9 => 0,
|
||||
-- 12 => 2,
|
||||
-- 13 => 2,
|
||||
-- 14 => 2,
|
||||
-- 15 => 2,
|
||||
-- 16 => 0,
|
||||
-- 21 => 0,
|
||||
-- 23 => 0,
|
||||
-- 24 => 0,
|
||||
-- 27 => 0,
|
||||
-- others => 1
|
||||
-- );
|
||||
end package platform_variant_pkg;
|
||||
|
||||
@@ -8,6 +8,7 @@ library work;
|
||||
use work.pace_pkg.all;
|
||||
use work.video_controller_pkg.all;
|
||||
use work.sprite_pkg.all;
|
||||
use work.platform_variant_pkg.all;
|
||||
use work.platform_pkg.all;
|
||||
|
||||
entity sprite_array is
|
||||
@@ -20,6 +21,9 @@ entity sprite_array is
|
||||
(
|
||||
reset : in std_logic;
|
||||
|
||||
hwsel : in integer;
|
||||
sprite_prom : in prom_a(0 to 31);
|
||||
|
||||
-- register interface
|
||||
reg_i : in to_SPRITE_REG_t;
|
||||
|
||||
@@ -34,7 +38,7 @@ entity sprite_array is
|
||||
row_d : in SPRITE_ROW_D_t;
|
||||
|
||||
-- video data
|
||||
rgb : out RGB_t;
|
||||
pal_a : out std_logic_vector(7 downto 0);
|
||||
set : out std_logic;
|
||||
pri : out std_logic;
|
||||
spr0_set : out std_logic
|
||||
@@ -96,9 +100,11 @@ begin
|
||||
-- sprite row data fan-out
|
||||
GEN_ROW_D : for i in 0 to N_SPRITES-1 generate
|
||||
ctl_i(i).ld <= ld_r(i);
|
||||
ctl_i(i).height <= sprite_prom(to_integer(unsigned(reg_o(i).n(9 downto 5))));
|
||||
ctl_i(i).d <= row_d;
|
||||
ctl_i(i).rgb <= (others => (others => '0'));
|
||||
end generate GEN_ROW_D;
|
||||
|
||||
|
||||
-- Sprite Priority Encoder
|
||||
-- - determines which sprite pixel (if any) is to be displayed
|
||||
-- We can use a clocked process here because the tilemap
|
||||
@@ -115,7 +121,7 @@ begin
|
||||
if spr_pri_v = '0' and ctl_o(i).set = '1' then
|
||||
-- if no sprite on or this priority = 1
|
||||
if spr_on_v = '0' or reg_o(i).pri = '1' then
|
||||
rgb <= ctl_o(i).rgb;
|
||||
pal_a <= ctl_o(i).pal_a;
|
||||
spr_on_v := '1'; -- flag as sprite on
|
||||
spr_pri_v := reg_o(i).pri; -- store priority
|
||||
end if;
|
||||
@@ -156,9 +162,11 @@ begin
|
||||
)
|
||||
port map
|
||||
(
|
||||
hwsel => hwsel,
|
||||
|
||||
-- sprite registers
|
||||
reg_i => reg_o(i),
|
||||
|
||||
|
||||
-- video control signals
|
||||
video_ctl => video_ctl,
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ use ieee.std_logic_unsigned.all;
|
||||
|
||||
library work;
|
||||
use work.video_controller_pkg.all;
|
||||
use work.platform_variant_pkg.all;
|
||||
|
||||
package sprite_pkg is
|
||||
|
||||
@@ -35,16 +36,18 @@ package sprite_pkg is
|
||||
|
||||
subtype SPRITE_ROW_D_t is std_logic_vector(63 downto 0);
|
||||
subtype SPRITE_ROW_A_t is std_logic_vector(15 downto 0);
|
||||
|
||||
|
||||
type to_SPRITE_CTL_t is record
|
||||
ld : std_logic;
|
||||
d : SPRITE_ROW_D_t;
|
||||
height : integer range 0 to 3;
|
||||
rgb : RGB_t;
|
||||
end record;
|
||||
|
||||
|
||||
type from_SPRITE_CTL_t is record
|
||||
a : SPRITE_ROW_A_t;
|
||||
rgb : RGB_t;
|
||||
set : std_logic;
|
||||
pal_a : std_logic_vector(7 downto 0);
|
||||
end record;
|
||||
|
||||
function NULL_TO_SPRITE_CTL return to_SPRITE_CTL_t;
|
||||
@@ -58,6 +61,8 @@ package sprite_pkg is
|
||||
port
|
||||
(
|
||||
reset : in std_logic;
|
||||
hwsel : integer;
|
||||
sprite_prom : in prom_a(0 to 31);
|
||||
|
||||
-- register interface
|
||||
reg_i : in to_SPRITE_REG_t;
|
||||
@@ -73,7 +78,7 @@ package sprite_pkg is
|
||||
row_d : in SPRITE_ROW_D_t;
|
||||
|
||||
-- video data
|
||||
rgb : out RGB_t;
|
||||
pal_a : out std_logic_vector(7 downto 0);
|
||||
set : out std_logic;
|
||||
pri : out std_logic;
|
||||
spr0_set : out std_logic
|
||||
|
||||
@@ -11,7 +11,7 @@ package body sprite_pkg is
|
||||
|
||||
function NULL_TO_SPRITE_CTL return to_SPRITE_CTL_t is
|
||||
begin
|
||||
return ('0', (others => '0'));
|
||||
return ('0', (others => '0'), 0, (others => (others => '0')));
|
||||
end function NULL_TO_SPRITE_CTL;
|
||||
|
||||
function flip_row
|
||||
|
||||
@@ -16,18 +16,20 @@ entity spritectl is
|
||||
INDEX : natural;
|
||||
DELAY : integer
|
||||
);
|
||||
port
|
||||
port
|
||||
(
|
||||
hwsel : in integer;
|
||||
|
||||
-- sprite registers
|
||||
reg_i : in from_SPRITE_REG_t;
|
||||
|
||||
|
||||
-- video control signals
|
||||
video_ctl : in from_VIDEO_CTL_t;
|
||||
|
||||
-- sprite control signals
|
||||
ctl_i : in to_SPRITE_CTL_t;
|
||||
ctl_o : out from_SPRITE_CTL_t;
|
||||
|
||||
|
||||
graphics_i : in to_GRAPHICS_t
|
||||
);
|
||||
end entity spritectl;
|
||||
@@ -36,10 +38,9 @@ architecture SYN of spritectl is
|
||||
|
||||
alias clk : std_logic is video_ctl.clk;
|
||||
alias clk_ena : std_logic is video_ctl.clk_ena;
|
||||
|
||||
|
||||
signal flipData : std_logic_vector(47 downto 0); -- flipped row data
|
||||
|
||||
alias rgb : RGB_t is ctl_o.rgb;
|
||||
|
||||
signal ld_r : std_logic;
|
||||
signal left_d : std_logic;
|
||||
signal rowStore : std_logic_vector(47 downto 0); -- saved row of spt to show during visibile period
|
||||
@@ -67,10 +68,8 @@ begin
|
||||
-- which part of the sprite is being drawn
|
||||
alias segment : unsigned(1 downto 0) is rowCount(5 downto 4);
|
||||
|
||||
variable prom_i : integer range sprite_prom'range;
|
||||
variable code : std_logic_vector(9 downto 0);
|
||||
variable pal_i : std_logic_vector(7 downto 0);
|
||||
variable pal_rgb : pal_rgb_t;
|
||||
|
||||
begin
|
||||
|
||||
@@ -83,9 +82,8 @@ begin
|
||||
y := 256 + 128 - 18 - unsigned(reg_i.y);
|
||||
|
||||
-- hande sprite height, placement
|
||||
prom_i := to_integer(unsigned(reg_i.n(9 downto 5)));
|
||||
code := reg_i.n(9 downto 0); -- default
|
||||
case sprite_prom(prom_i) is
|
||||
case ctl_i.height is
|
||||
when 1 =>
|
||||
-- double height
|
||||
height := to_unsigned(2*16,height'length);
|
||||
@@ -97,7 +95,7 @@ begin
|
||||
when others =>
|
||||
height := to_unsigned(16,height'length);
|
||||
end case;
|
||||
|
||||
|
||||
-- do this 1st because we don't have many clocks
|
||||
if y = unsigned(video_ctl.y) then
|
||||
-- start counting sprite row
|
||||
@@ -107,7 +105,7 @@ begin
|
||||
yMat := false;
|
||||
end if;
|
||||
|
||||
case sprite_prom(prom_i) is
|
||||
case ctl_i.height is
|
||||
when 1 =>
|
||||
-- double height
|
||||
if reg_i.yflip = '1' then
|
||||
@@ -176,17 +174,14 @@ begin
|
||||
|
||||
end if;
|
||||
|
||||
if PLATFORM_VARIANT = "ldrun" or
|
||||
PLATFORM_VARIANT = "battroad" then
|
||||
if hwsel = HW_LDRUN or
|
||||
hwsel = HW_BATTROAD then
|
||||
pal_i := '0' & reg_i.colour(3 downto 0) & pel;
|
||||
else
|
||||
pal_i := reg_i.colour(4 downto 0) & pel;
|
||||
end if;
|
||||
--pal_i := "000" & std_logic_vector(to_unsigned(INDEX,5));
|
||||
pal_rgb := sprite_pal(to_integer(unsigned(pal_i)));
|
||||
rgb.r <= pal_rgb(0) & "00";
|
||||
rgb.g <= pal_rgb(1) & "00";
|
||||
rgb.b <= pal_rgb(2) & "00";
|
||||
ctl_o.pal_a <= pal_i;
|
||||
|
||||
-- set pixel transparency based on match
|
||||
ctl_o.set <= '0';
|
||||
|
||||
@@ -13,6 +13,7 @@ entity target_top is port(
|
||||
clock_vid : in std_logic;
|
||||
clk_aud : in std_logic;
|
||||
reset_in : in std_logic;
|
||||
hwsel : in integer;
|
||||
audio_out : out std_logic_vector(11 downto 0);
|
||||
usr_coin1 : in std_logic;
|
||||
usr_coin2 : in std_logic;
|
||||
@@ -38,6 +39,11 @@ entity target_top is port(
|
||||
VGA_R : out std_logic_vector(3 downto 0);
|
||||
VGA_G : out std_logic_vector(3 downto 0);
|
||||
VGA_B : out std_logic_vector(3 downto 0);
|
||||
|
||||
dl_addr : in std_logic_vector(11 downto 0);
|
||||
dl_data : in std_logic_vector(7 downto 0);
|
||||
dl_wr : in std_logic;
|
||||
|
||||
cpu_rom_addr : out std_logic_vector(14 downto 0);
|
||||
cpu_rom_do : in std_logic_vector(7 downto 0);
|
||||
snd_rom_addr : out std_logic_vector(13 downto 0);
|
||||
@@ -106,6 +112,7 @@ Sound_Board : entity work.Sound_Board
|
||||
pace_inst : entity work.pace
|
||||
port map(
|
||||
clkrst_i => clkrst_i,
|
||||
hwsel => hwsel,
|
||||
buttons_i => buttons_i,
|
||||
switches_i => switches_i,
|
||||
inputs_i => inputs_i,
|
||||
@@ -114,6 +121,11 @@ pace_inst : entity work.pace
|
||||
sound_data_o => sound_data,
|
||||
platform_i => platform_i,
|
||||
platform_o => platform_o,
|
||||
|
||||
dl_addr => dl_addr,
|
||||
dl_data => dl_data,
|
||||
dl_wr => dl_wr,
|
||||
|
||||
cpu_rom_addr => cpu_rom_addr,
|
||||
cpu_rom_do => cpu_rom_do,
|
||||
gfx1_addr => gfx1_addr,
|
||||
|
||||
@@ -14,6 +14,25 @@ use work.video_controller_pkg.all;
|
||||
--
|
||||
-- Tile data is 2 BPP.
|
||||
--
|
||||
entity tilemapCtl is
|
||||
generic
|
||||
(
|
||||
DELAY : integer
|
||||
);
|
||||
port
|
||||
(
|
||||
reset : in std_logic;
|
||||
|
||||
-- video control signals
|
||||
video_ctl : in from_VIDEO_CTL_t;
|
||||
|
||||
-- tilemap controller signals
|
||||
ctl_i : in to_TILEMAP_CTL_t;
|
||||
ctl_o : out from_TILEMAP_CTL_t;
|
||||
|
||||
graphics_i : in to_GRAPHICS_t
|
||||
);
|
||||
end entity tilemapCtl;
|
||||
|
||||
architecture TILEMAP_1 of tilemapCtl is
|
||||
|
||||
@@ -31,6 +50,8 @@ architecture TILEMAP_1 of tilemapCtl is
|
||||
|
||||
begin
|
||||
|
||||
ctl_o.rgb <= ctl_i.rgb;
|
||||
|
||||
-- not used
|
||||
ctl_o.map_a(ctl_o.map_a'left downto 11) <= (others => '0');
|
||||
ctl_o.attr_a(ctl_o.attr_a'left downto 11) <= (others => '0');
|
||||
@@ -49,8 +70,6 @@ begin
|
||||
variable tile_d_r : std_logic_vector(23 downto 0);
|
||||
variable attr_d_r : std_logic_vector(7 downto 0);
|
||||
variable pel : std_logic_vector(2 downto 0);
|
||||
variable pal_i : std_logic_vector(7 downto 0);
|
||||
variable pal_rgb : pal_rgb_t;
|
||||
|
||||
begin
|
||||
|
||||
@@ -83,11 +102,7 @@ begin
|
||||
|
||||
-- extract R,G,B from colour palette
|
||||
pel := tile_d_r(tile_d_r'left-16) & tile_d_r(tile_d_r'left-8) & tile_d_r(tile_d_r'left);
|
||||
pal_i := attr_d_r(4 downto 0) & pel;
|
||||
pal_rgb := tile_pal(to_integer(unsigned(pal_i)));
|
||||
ctl_o.rgb.r <= pal_rgb(0) & "00";
|
||||
ctl_o.rgb.g <= pal_rgb(1) & "00";
|
||||
ctl_o.rgb.b <= pal_rgb(2) & "00";
|
||||
ctl_o.pal_a <= attr_d_r(4 downto 0) & pel;
|
||||
ctl_o.set <= '0'; -- default
|
||||
-- if pel /= "000" then
|
||||
-- pal_rgb(0)(7 downto 5) /= "000" or
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
|
||||
library work;
|
||||
use work.pace_pkg.all;
|
||||
--use work.project_pkg.all;
|
||||
use work.platform_pkg.all;
|
||||
use work.video_controller_pkg.all;
|
||||
|
||||
entity tilemapCtl is
|
||||
generic
|
||||
(
|
||||
DELAY : integer
|
||||
);
|
||||
port
|
||||
(
|
||||
reset : in std_logic;
|
||||
|
||||
-- video control signals
|
||||
video_ctl : in from_VIDEO_CTL_t;
|
||||
|
||||
-- tilemap controller signals
|
||||
ctl_i : in to_TILEMAP_CTL_t;
|
||||
ctl_o : out from_TILEMAP_CTL_t;
|
||||
|
||||
graphics_i : in to_GRAPHICS_t
|
||||
);
|
||||
end entity tilemapCtl;
|
||||
@@ -113,6 +113,7 @@ package video_controller_pkg is
|
||||
map_d : TILEMAP_D_t;
|
||||
tile_d : TILE_D_t;
|
||||
attr_d : ATTR_D_t;
|
||||
rgb : RGB_t;
|
||||
end record;
|
||||
|
||||
type to_TILEMAP_CTL_a is array (natural range <>) of to_TILEMAP_CTL_t;
|
||||
@@ -125,6 +126,7 @@ package video_controller_pkg is
|
||||
attr_a : ATTR_A_t;
|
||||
rgb : RGB_t;
|
||||
set : std_logic;
|
||||
pal_a : std_logic_vector(7 downto 0);
|
||||
end record;
|
||||
|
||||
type from_TILEMAP_CTL_a is array (natural range <>) of from_TILEMAP_CTL_t;
|
||||
|
||||
@@ -15,7 +15,7 @@ package body video_controller_pkg is
|
||||
|
||||
function NULL_TO_TILEMAP_CTL return to_TILEMAP_CTL_t is
|
||||
begin
|
||||
return ((others => '0'), (others => '0'), (others => '0'));
|
||||
return ((others => '0'), (others => '0'), (others => '0'), (others => (others => '0')));
|
||||
end NULL_TO_TILEMAP_CTL;
|
||||
|
||||
function NULL_TO_GRAPHICS return to_GRAPHICS_t is
|
||||
|
||||
Reference in New Issue
Block a user