1
0
mirror of https://github.com/Gehstock/Mist_FPGA.git synced 2026-01-22 10:21:02 +00:00

IremM62: add Kid Niki (very broken)

This commit is contained in:
Gyorgy Szombathelyi 2020-03-06 21:21:46 +01:00
parent ced0510dd2
commit c1fdb9b431
5 changed files with 128 additions and 18 deletions

View File

@ -0,0 +1,80 @@
<misterromdescription>
<name>Kid Niki - Radical Ninja</name>
<mameversion>0216</mameversion>
<setname>kidniki</setname>
<manufacturer>Irem</manufacturer>
<rbf>iremm62</rbf>
<rom index="1"><part>6</part></rom>
<rom index="0" zip="kidniki.zip" md5="e4dd9d396dd574a11189c2183cf4cead" type="merged|nonmerged">
<!-- CPU1, 128k -->
<part name="ky_a-4e-g.bin"/>
<part name="dr03.4cd"/>
<part name="ky_t-8k-g.bin"/>
<part name="dr12.8l"/>
<!-- SND CPU2, 64k -->
<part repeat="0x4000">FF</part>
<part name="dr00.3a"/>
<part name="dr01.3cd"/>
<part name="dr02.3f"/>
<!-- GFX1, 128k -->
<group width="32">
<part name="dr06.2b"/>
<part name="dr07.2dc"/>
<part name="dr05.2a"/>
<part name="dr05.2a"/>
</group>
<!-- GFX2, 256k -->
<group width="32">
<part name="dr21.4k"/>
<part name="dr14.3p"/>
<part name="dr16.4cb"/>
<part name="dr16.4cb"/>
</group>
<group width="32">
<part name="dr19.4f"/>
<part name="dr24.4p"/>
<part name="dr18.4e"/>
<part name="dr18.4e"/>
</group>
<group width="32">
<part name="dr22.4l"/>
<part name="dr23.4nm"/>
<part name="dr17.4dc"/>
<part name="dr17.4dc"/>
</group>
<group width="32">
<part name="dr20.4jh"/>
<part name="dr13.3nm"/>
<part name="dr15.4a"/>
<part name="dr15.4a"/>
</group>
<!-- GFX3, 64k -->
<group width="32">
<part name="dr08.4l"/>
<part name="dr09.4m"/>
<part name="dr10.4n"/>
<part name="dr10.4n"/>
</group>
<!-- spr_color_proms, 3*256b -->
<part name="dr30.1m"/>
<part name="dr31.1n"/>
<part name="dr29.1l"/>
<!-- chr_color_proms, 3*256b -->
<part name="dr25.3f"/>
<part name="dr26.3h"/>
<part name="dr27.3j"/>
<!-- fg_color_proms, 3*256b br-c-1j -->
<part repeat="0x300">FF</part>
<!-- spr_height_prom -->
<part name="dr32.5p"/>
</rom>
</misterromdescription>

View File

@ -74,7 +74,8 @@ begin
irem62_hsize <= 384+16 when hwsel = HW_LDRUN or
hwsel = HW_LDRUN2 or
hwsel = HW_LDRUN3 or
hwsel = HW_LDRUN4 else
hwsel = HW_LDRUN4 or
hwsel = HW_KIDNIKI else
256+16;
pace_video_controller_inst : entity work.pace_video_controller

View File

@ -141,6 +141,7 @@ architecture SYN of platform is
-- Kidniki, Battle Road
signal kidniki_bank : std_logic_vector(3 downto 0);
signal kidniki_gfxbank: std_logic;
begin
@ -180,11 +181,11 @@ begin
-- chip select logic
-- ROM $0000-$7FFF
-- $0000-$9FFF - LDRUN2
-- $0000-$9FFF - LDRUN2, KIDNIKI
-- $0000-$BFFF - LDRUN3,4, HORIZON
-- $A000-$BFFF - BATTROAD
rom_cs <= '1' when STD_MATCH(cpu_a, "0---------------") else
'1' when hwsel = HW_LDRUN2 and cpu_a(15 downto 13) = "100" else
'1' when (hwsel = HW_LDRUN2 or hwsel = HW_KIDNIKI) and cpu_a(15 downto 13) = "100" else
'1' when (hwsel = HW_LDRUN3 or hwsel = HW_LDRUN4 or hwsel = HW_HORIZON) and cpu_a(15 downto 14) = "10" else
'1' when hwsel = HW_BATTROAD and cpu_a(15 downto 13) = "101" else
'0';
@ -195,21 +196,27 @@ begin
'1' when cpu_a(15 downto 9) = x"C"&"000" and hwsel = HW_HORIZON else
'0';
-- VRAM/CRAM $D000-$DFFF
-- VRAM/CRAM $D000-$DFFF, ($A000-$AFFF - KIDNIKI)
vram_cs <= '1' when hwsel = HW_KUNGFUM and
STD_MATCH(cpu_a, X"D"&"0-----------") else
'1' when hwsel /= HW_KUNGFUM and
STD_MATCH(cpu_a, X"D"&"-----------0") else
STD_MATCH(cpu_a, X"D"&"0-----------") else
'1' when hwsel = HW_KIDNIKI and
STD_MATCH(cpu_a, X"A"&"-----------0") else
'1' when hwsel /= HW_KUNGFUM and hwsel /= HW_KIDNIKI and
STD_MATCH(cpu_a, X"D"&"-----------0") else
'0';
cram_cs <= '1' when hwsel = HW_KUNGFUM and
STD_MATCH(cpu_a, X"D"&"1-----------") else
'1' when hwsel /= HW_KUNGFUM and
STD_MATCH(cpu_a, X"D"&"-----------1") else
STD_MATCH(cpu_a, X"D"&"1-----------") else
'1' when hwsel = HW_KIDNIKI and
STD_MATCH(cpu_a, X"A"&"-----------1") else
'1' when hwsel /= HW_KUNGFUM and hwsel /= HW_KIDNIKI and
STD_MATCH(cpu_a, X"D"&"-----------1") else
'0';
-- Text RAM $C800-$CFFF
-- Text RAM $C800-$CFFF, ($D000-$DFFF - KIDNIKI)
textram_cs <= '1' when hwsel = HW_BATTROAD and
cpu_a(15 downto 11) = x"C"&'1' else
'1' when hwsel = HW_KIDNIKI and
cpu_a(15 downto 12) = x"D" else
'0';
-- RAM $E000-$EFFF
@ -311,6 +318,7 @@ begin
'0' & "10" & ld24_bank & cpu_a(12 downto 0) when hwsel = HW_LDRUN2 and cpu_a(15) = '1' else
'0' & '1' & ld24_bank & cpu_a(13 downto 0) when hwsel = HW_LDRUN4 and cpu_a(15) = '1' else
'1' & kidniki_bank(2 downto 0) & cpu_a(12 downto 0) when hwsel = HW_BATTROAD and cpu_a(15 downto 13) = "101" else
(kidniki_bank(3 downto 0) + "100") & cpu_a(12 downto 0) when hwsel = HW_KIDNIKI and cpu_a(15 downto 13) = "100" and kidniki_bank(3 downto 2) /= "11" else
'0' & cpu_a(15 downto 0);
-- Lode Runner 2 bank switching - some kind of protection, only the level number is used to select bank 0 or 1 at $8000
@ -324,12 +332,16 @@ begin
ld2_bankr2 <= (others => '0');
ld24_bank <= '0';
kidniki_bank <= (others => '0');
kidniki_gfxbank <= '0';
elsif rising_edge(clk_sys) then
if cpu_clk_en = '1' and cpu_io_wr = '1' then
case cpu_a(7 downto 0) is
when X"80" => ld2_bankr1 <= cpu_d_o(5 downto 0);
when X"81" => ld2_bankr2 <= cpu_d_o;
when X"83" => if hwsel = HW_BATTROAD then kidniki_bank <= cpu_d_o(3 downto 0); end if;
when X"84" => if hwsel = HW_KIDNIKI then kidniki_gfxbank <= cpu_d_o(0); end if;
-- Kidniki banks: 0-7, C-F, 8-B not used
when X"85" => if hwsel = HW_KIDNIKI then kidniki_bank <= cpu_d_o(3) & (not cpu_d_o(3) and cpu_d_o(2)) & cpu_d_o(1 downto 0); end if;
when others => null;
end case;
end if;
@ -403,6 +415,7 @@ begin
BLK_SCROLL : block
signal m62_hscroll : std_logic_vector(15 downto 0);
signal m62_vscroll : std_logic_vector(15 downto 0);
signal m62_vscroll2 : std_logic_vector(15 downto 0);
signal m62_topbottom_mask: std_logic;
signal scrollram_d_o : std_logic_vector(15 downto 0);
signal scrollram_wr : std_logic;
@ -438,6 +451,7 @@ begin
if rst_sys = '1' then
m62_hscroll <= (others => '0');
m62_vscroll <= (others => '0');
m62_vscroll2 <= (others => '0');
m62_topbottom_mask <= '0';
elsif rising_edge(clk_sys) then
if cpu_clk_en = '1' and cpu_mem_wr = '1' then
@ -456,19 +470,29 @@ begin
end if; -- cpu_wr
if cpu_clk_en = '1' and cpu_io_wr = '1' then
-- background 1 vscroll
if (hwsel = HW_LDRUN3 or hwsel = HW_BATTROAD) and cpu_a(7 downto 0) = x"80" then
m62_vscroll(7 downto 0) <= cpu_d_o;
end if;
-- background 1 hscroll
if (hwsel = HW_LDRUN4 and cpu_a(7 downto 0) = x"82") or
((hwsel = HW_BATTROAD or hwsel = HW_KIDNIKI) and cpu_a(7 downto 0) = x"81") then
m62_hscroll(15 downto 8) <= cpu_d_o;
end if;
if (hwsel = HW_LDRUN4 and cpu_a(7 downto 0) = x"83") or
(hwsel = HW_BATTROAD and cpu_a(7 downto 0) = x"82") or
(hwsel = HW_KIDNIKI and cpu_a(7 downto 0) = x"80") then
m62_hscroll(7 downto 0) <= cpu_d_o;
end if;
if hwsel = HW_LDRUN3 and cpu_a(7 downto 0) = x"81" then
m62_topbottom_mask <= cpu_d_o(0);
end if;
if (hwsel = HW_LDRUN4 and cpu_a(7 downto 0) = x"82") or
(hwsel = HW_BATTROAD and cpu_a(7 downto 0) = x"81") then
m62_hscroll(15 downto 8) <= cpu_d_o;
-- backrground 2 vscroll
if hwsel = HW_KIDNIKI and cpu_a(7 downto 0) = x"82" then
m62_vscroll2(7 downto 0) <= cpu_d_o;
end if;
if (hwsel = HW_LDRUN4 and cpu_a(7 downto 0) = x"83") or
(hwsel = HW_BATTROAD and cpu_a(7 downto 0) = x"82") then
m62_hscroll(7 downto 0) <= cpu_d_o;
if hwsel = HW_KIDNIKI and cpu_a(7 downto 0) = x"83" then
m62_vscroll2(15 downto 8) <= cpu_d_o;
end if;
end if;
@ -489,7 +513,7 @@ begin
begin
-- external background ROMs
gfx1_addr <= "00"&tilemap_i(1).tile_a(13 downto 0);
gfx1_addr <= '0' & kidniki_gfxbank & tilemap_i(1).tile_a(13 downto 0);
tilemap_o(1).tile_d(23 downto 0) <= gfx1_do(7 downto 0) & gfx1_do(15 downto 8) & gfx1_do(23 downto 16);
-- internal background ROMs

View File

@ -16,6 +16,7 @@ package platform_variant_pkg is
constant HW_KUNGFUM : integer := 4;
constant HW_HORIZON : integer := 5;
constant HW_BATTROAD : integer := 6;
constant HW_KIDNIKI : integer := 7;
type rom_a is array (natural range <>) of string;

View File

@ -90,11 +90,15 @@ begin
if x(2 downto 0) = "010" then
if hwsel = HW_LDRUN4 or hwsel = HW_HORIZON then
ctl_o.tile_a(13) <= ctl_i.attr_d(5);
elsif hwsel = HW_KIDNIKI then
ctl_o.tile_a(13) <= ctl_i.attr_d(7);
else
ctl_o.tile_a(13) <= '0';
end if;
if hwsel = HW_BATTROAD then
ctl_o.tile_a(12 downto 11) <= ctl_i.attr_d(6) & ctl_i.attr_d(4);
elsif hwsel = HW_KIDNIKI then
ctl_o.tile_a(12 downto 11) <= ctl_i.attr_d(6 downto 5);
else
ctl_o.tile_a(12 downto 11) <= ctl_i.attr_d(7 downto 6);
end if;