mirror of
https://github.com/Gehstock/Mist_FPGA.git
synced 2026-05-04 07:19:03 +00:00
Scramble HW: add Anteater and Losttomb
+ Dark Planet, but buggy
This commit is contained in:
@@ -60,7 +60,9 @@ module ScrambleMist
|
|||||||
//`define CORE_NAME "MOONWAR"
|
//`define CORE_NAME "MOONWAR"
|
||||||
//`define CORE_NAME "SPDCOIN"
|
//`define CORE_NAME "SPDCOIN"
|
||||||
//`define CORE_NAME "CALIPSO"
|
//`define CORE_NAME "CALIPSO"
|
||||||
`define CORE_NAME "DARKPLNT"
|
//`define CORE_NAME "DARKPLNT" // video problem
|
||||||
|
//`define CORE_NAME "ANTEATER"
|
||||||
|
`define CORE_NAME "LOSTTOMB"
|
||||||
|
|
||||||
integer hwsel = 0;
|
integer hwsel = 0;
|
||||||
reg [7:0] input0;
|
reg [7:0] input0;
|
||||||
@@ -98,8 +100,21 @@ always @(*) begin
|
|||||||
input0 = ~{ m_coin1, m_coin2, m_left, m_right, m_two_players, 1'b0, m_one_player, 1'b0 };
|
input0 = ~{ m_coin1, m_coin2, m_left, m_right, m_two_players, 1'b0, m_one_player, 1'b0 };
|
||||||
input1 = { 4'hf, 2'b00, 1'b0, 1'b0 }; // 6xunused, freeplay, freeze
|
input1 = { 4'hf, 2'b00, 1'b0, 1'b0 }; // 6xunused, freeplay, freeze
|
||||||
input2 = { 4'hf, 1'b0, 1'b0, 1'b1, 1'b1}; // 4xunused, lives, difficulty, unknown, unused
|
input2 = { 4'hf, 1'b0, 1'b0, 1'b1, 1'b1}; // 4xunused, lives, difficulty, unknown, unused
|
||||||
end else if (`CORE_NAME == "SPDCOIN") begin
|
end else if (`CORE_NAME == "DARKPLNT") begin
|
||||||
hwsel = 4;
|
hwsel = 4;
|
||||||
|
input0 = ~{ m_coin1, m_coin2, 3'b000, m_two_players | m_fireB, m_one_player | m_fireA, m_fireC };
|
||||||
|
input1 = 8'h00;
|
||||||
|
input2 = 8'h00;
|
||||||
|
end else if (`CORE_NAME == "ANTEATER") begin
|
||||||
|
hwsel = 5;
|
||||||
|
input0 = ~{ m_coin1, m_coin2, m_left, m_right, m_down, m_up, m_fireA, m_fireB };
|
||||||
|
input1 = ~{ m_fire2A, m_fire2B, m_left2, m_right2, m_up2, m_down2, 2'b11 };
|
||||||
|
input2 = ~{ 1'b1, m_two_players, 2'b10, 3'b111, m_one_player };
|
||||||
|
end else if (`CORE_NAME == "LOSTTOMB") begin
|
||||||
|
hwsel = 6;
|
||||||
|
input0 = ~{ m_coin1, m_coin2, m_left, m_right, m_down, m_up, m_one_player, m_two_players };
|
||||||
|
input1 = ~{ 1'b0, m_fireA, m_left2, m_right2, m_down2, m_up2, 2'b01 };
|
||||||
|
input2 = ~{ 4'h0, 1'b0, 2'b10, 1'b0 }; //4xunused, demo sounds, 2xcoinage, unused
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -383,7 +383,9 @@ begin
|
|||||||
cpu_busrq_l <= cpu_addr(15);
|
cpu_busrq_l <= cpu_addr(15);
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
if I_HWSEL = I_HWSEL_SCRAMBLE then
|
if I_HWSEL = I_HWSEL_DARKPLNT then
|
||||||
|
if cpu_addr(15) = '1' then page_4to7_l <= '0'; end if;
|
||||||
|
elsif I_HWSEL = I_HWSEL_SCRAMBLE then
|
||||||
if (cpu_addr(15 downto 14) = "01") then page_4to7_l <= '0'; end if;
|
if (cpu_addr(15 downto 14) = "01") then page_4to7_l <= '0'; end if;
|
||||||
else
|
else
|
||||||
if (cpu_addr(15 downto 14) = "10") then page_4to7_l <= '0'; end if;
|
if (cpu_addr(15 downto 14) = "10") then page_4to7_l <= '0'; end if;
|
||||||
@@ -396,7 +398,12 @@ begin
|
|||||||
begin
|
begin
|
||||||
waen_l <= '1';
|
waen_l <= '1';
|
||||||
objen_l <= '1';
|
objen_l <= '1';
|
||||||
if I_HWSEL /= I_HWSEL_FROGGER then
|
if I_HWSEL = I_HWSEL_DARKPLNT then
|
||||||
|
if (page_4to7_l = '0') and (cpu_rfsh_l = '1') then
|
||||||
|
if (cpu_addr(13 downto 11) = "010") then waen_l <= '0'; end if;
|
||||||
|
if (cpu_addr(13 downto 11) = "011") then objen_l <= '0'; end if;
|
||||||
|
end if;
|
||||||
|
elsif I_HWSEL /= I_HWSEL_FROGGER then
|
||||||
if (page_4to7_l = '0') and (cpu_rfsh_l = '1') then
|
if (page_4to7_l = '0') and (cpu_rfsh_l = '1') then
|
||||||
if (cpu_addr(13 downto 11) = "001") then waen_l <= '0'; end if;
|
if (cpu_addr(13 downto 11) = "001") then waen_l <= '0'; end if;
|
||||||
if (cpu_addr(13 downto 11) = "010") then objen_l <= '0'; end if;
|
if (cpu_addr(13 downto 11) = "010") then objen_l <= '0'; end if;
|
||||||
@@ -412,7 +419,11 @@ begin
|
|||||||
vramrd_l <= '1';
|
vramrd_l <= '1';
|
||||||
objramrd_l <= '1';
|
objramrd_l <= '1';
|
||||||
|
|
||||||
if I_HWSEL /= I_HWSEL_FROGGER then
|
if I_HWSEL = I_HWSEL_DARKPLNT then
|
||||||
|
if (page_4to7_l = '0') and (cpu_rd_l = '0') then
|
||||||
|
if (cpu_addr(13 downto 11) = "010") then vramrd_l <= '0'; end if;
|
||||||
|
end if;
|
||||||
|
elsif I_HWSEL /= I_HWSEL_FROGGER then
|
||||||
if (page_4to7_l = '0') and (cpu_rd_l = '0') then
|
if (page_4to7_l = '0') and (cpu_rd_l = '0') then
|
||||||
if (cpu_addr(13 downto 11) = "001") then vramrd_l <= '0'; end if;
|
if (cpu_addr(13 downto 11) = "001") then vramrd_l <= '0'; end if;
|
||||||
if (cpu_addr(13 downto 11) = "010") then objramrd_l <= '0'; end if;
|
if (cpu_addr(13 downto 11) = "010") then objramrd_l <= '0'; end if;
|
||||||
@@ -427,7 +438,13 @@ begin
|
|||||||
objramwr_l <= '1';
|
objramwr_l <= '1';
|
||||||
select_l <= '1';
|
select_l <= '1';
|
||||||
|
|
||||||
if I_HWSEL /= I_HWSEL_FROGGER then
|
if I_HWSEL = I_HWSEL_DARKPLNT then
|
||||||
|
if (page_4to7_l = '0') and (cpu_wr_l = '0') and (wren = '1') then
|
||||||
|
if (cpu_addr(13 downto 11) = "010") then vramwr_l <= '0'; end if;
|
||||||
|
if (cpu_addr(13 downto 11) = "001") then objramwr_l <= '0'; end if;
|
||||||
|
if (cpu_addr(13 downto 11) = "110") then select_l <= '0'; end if; -- control reg
|
||||||
|
end if;
|
||||||
|
elsif I_HWSEL /= I_HWSEL_FROGGER then
|
||||||
if (page_4to7_l = '0') and (cpu_wr_l = '0') and (wren = '1') then
|
if (page_4to7_l = '0') and (cpu_wr_l = '0') and (wren = '1') then
|
||||||
if (cpu_addr(13 downto 11) = "001") then vramwr_l <= '0'; end if;
|
if (cpu_addr(13 downto 11) = "001") then vramwr_l <= '0'; end if;
|
||||||
if (cpu_addr(13 downto 11) = "010") then objramwr_l <= '0'; end if;
|
if (cpu_addr(13 downto 11) = "010") then objramwr_l <= '0'; end if;
|
||||||
@@ -456,7 +473,9 @@ begin
|
|||||||
--6805 ? (POUT2)
|
--6805 ? (POUT2)
|
||||||
--6806 screen vertical flip
|
--6806 screen vertical flip
|
||||||
--6807 screen horizontal flip
|
--6807 screen horizontal flip
|
||||||
if I_HWSEL /= I_HWSEL_FROGGER then
|
if I_HWSEL = I_HWSEL_DARKPLNT then
|
||||||
|
addr := cpu_addr(3 downto 1);
|
||||||
|
elsif I_HWSEL /= I_HWSEL_FROGGER then
|
||||||
addr := cpu_addr(2 downto 0);
|
addr := cpu_addr(2 downto 0);
|
||||||
else
|
else
|
||||||
addr := cpu_addr(4 downto 2);
|
addr := cpu_addr(4 downto 2);
|
||||||
@@ -491,7 +510,14 @@ begin
|
|||||||
|
|
||||||
p_control_reg_assign : process(control_reg, I_HWSEL)
|
p_control_reg_assign : process(control_reg, I_HWSEL)
|
||||||
begin
|
begin
|
||||||
if I_HWSEL /= I_HWSEL_FROGGER then
|
if I_HWSEL = I_HWSEL_DARKPLNT then
|
||||||
|
intst_l <= control_reg(2);
|
||||||
|
iopc7 <= '0';
|
||||||
|
pout1 <= '0';
|
||||||
|
starson <= '0';
|
||||||
|
hcma <= control_reg(7);
|
||||||
|
vcma <= not control_reg(6);
|
||||||
|
elsif I_HWSEL /= I_HWSEL_FROGGER then
|
||||||
-- Scramble
|
-- Scramble
|
||||||
intst_l <= control_reg(1);
|
intst_l <= control_reg(1);
|
||||||
iopc7 <= control_reg(2);
|
iopc7 <= control_reg(2);
|
||||||
|
|||||||
@@ -398,7 +398,18 @@ begin
|
|||||||
i8255_1D_cs_l <= '1';
|
i8255_1D_cs_l <= '1';
|
||||||
i8255_1E_cs_l <= '1';
|
i8255_1E_cs_l <= '1';
|
||||||
|
|
||||||
if I_HWSEL = I_HWSEL_SCOBRA or I_HWSEL = I_HWSEL_CALIPSO then
|
if I_HWSEL = I_HWSEL_DARKPLNT then
|
||||||
|
-- the interface one
|
||||||
|
if (I_ADDR(13 downto 11) = "101") and (I_ADDR(15) = '1') then
|
||||||
|
i8255_1D_cs_l <= '0';
|
||||||
|
end if;
|
||||||
|
|
||||||
|
-- the button one
|
||||||
|
if (I_ADDR(13 downto 11) = "100") and (I_ADDR(15) = '1') then
|
||||||
|
i8255_1E_cs_l <= '0';
|
||||||
|
end if;
|
||||||
|
i8255_addr <= I_ADDR(3 downto 2);
|
||||||
|
elsif I_HWSEL = I_HWSEL_SCOBRA or I_HWSEL = I_HWSEL_CALIPSO or I_HWSEL = I_HWSEL_ANTEATER or I_HWSEL = I_HWSEL_LOSTTOMB then
|
||||||
-- the interface one
|
-- the interface one
|
||||||
if (I_ADDR(13 downto 11) = "100") and (I_ADDR(15) = '1') then
|
if (I_ADDR(13 downto 11) = "100") and (I_ADDR(15) = '1') then
|
||||||
i8255_1D_cs_l <= '0';
|
i8255_1D_cs_l <= '0';
|
||||||
@@ -489,7 +500,12 @@ begin
|
|||||||
|
|
||||||
i8255_1E_pa <= I_PA;
|
i8255_1E_pa <= I_PA;
|
||||||
i8255_1E_pb <= I_PB;
|
i8255_1E_pb <= I_PB;
|
||||||
i8255_1E_pc <= I_PC when I_HWSEL = I_HWSEL_SCOBRA or I_HWSEL = I_HWSEL_CALIPSO else I_PC or net_1e10_i&'0'&net_1e12_i&"00000";
|
i8255_1E_pc <= I_PC when I_HWSEL = I_HWSEL_SCOBRA or
|
||||||
|
I_HWSEL = I_HWSEL_CALIPSO or
|
||||||
|
I_HWSEL = I_HWSEL_DARKPLNT or
|
||||||
|
I_HWSEL = I_HWSEL_ANTEATER or
|
||||||
|
I_HWSEL = I_HWSEL_LOSTTOMB
|
||||||
|
else I_PC or net_1e10_i&'0'&net_1e12_i&"00000";
|
||||||
|
|
||||||
O_COIN_COUNTER <= not I_IOPC7; -- open drain actually
|
O_COIN_COUNTER <= not I_IOPC7; -- open drain actually
|
||||||
|
|
||||||
|
|||||||
@@ -8,5 +8,7 @@ package scramble_pack is
|
|||||||
constant I_HWSEL_SCOBRA : integer := 2; -- SuperCobra, TazzMania
|
constant I_HWSEL_SCOBRA : integer := 2; -- SuperCobra, TazzMania
|
||||||
constant I_HWSEL_CALIPSO : integer := 3; -- Calipso
|
constant I_HWSEL_CALIPSO : integer := 3; -- Calipso
|
||||||
constant I_HWSEL_DARKPLNT : integer := 4; -- Dark Planet
|
constant I_HWSEL_DARKPLNT : integer := 4; -- Dark Planet
|
||||||
|
constant I_HWSEL_ANTEATER : integer := 5; -- Ant Eater (SCOBRA with obj_ram address line obfuscation)
|
||||||
|
constant I_HWSEL_LOSTTOMB : integer := 6; -- Lost Tomb (SCOBRA with obj_ram address line obfuscation)
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|||||||
@@ -407,17 +407,33 @@ begin
|
|||||||
end process;
|
end process;
|
||||||
|
|
||||||
p_obj_rom_addr : process(h256, vram_addr_xor, vram_dout, objdata, I_HCNT, I_HWSEL)
|
p_obj_rom_addr : process(h256, vram_addr_xor, vram_dout, objdata, I_HCNT, I_HWSEL)
|
||||||
|
variable obj_rom_addr_base : std_logic_vector(12 downto 0);
|
||||||
begin
|
begin
|
||||||
obj_rom_addr( 2 downto 0) <= vram_addr_xor(2 downto 0);
|
obj_rom_addr_base( 2 downto 0) := vram_addr_xor(2 downto 0);
|
||||||
if (h256 = '0') then
|
if (h256 = '0') then
|
||||||
-- a
|
obj_rom_addr_base(12 downto 3) := "00" & vram_dout; -- background objects
|
||||||
obj_rom_addr(12 downto 3) <= "00" & vram_dout; -- background objects
|
|
||||||
else
|
else
|
||||||
obj_rom_addr(12 downto 11) <= "00";
|
obj_rom_addr_base(12 downto 11) := "00";
|
||||||
if I_HWSEL = I_HWSEL_CALIPSO then
|
if I_HWSEL = I_HWSEL_CALIPSO then
|
||||||
obj_rom_addr(12 downto 11) <= objdata(7 downto 6);
|
obj_rom_addr_base(12 downto 11) := objdata(7 downto 6);
|
||||||
end if;
|
end if;
|
||||||
obj_rom_addr(10 downto 3) <= objdata(5 downto 0) & vram_addr_xor(3) & (objdata(6) xor I_HCNT(3)); -- sprites
|
obj_rom_addr_base(10 downto 3) := objdata(5 downto 0) & vram_addr_xor(3) & (objdata(6) xor I_HCNT(3)); -- sprites
|
||||||
|
end if;
|
||||||
|
|
||||||
|
if I_HWSEL = I_HWSEL_ANTEATER then
|
||||||
|
obj_rom_addr <= "00" & not(obj_rom_addr_base(0) xor obj_rom_addr_base(6)) &
|
||||||
|
(obj_rom_addr_base(2) xor obj_rom_addr_base(10)) &
|
||||||
|
obj_rom_addr_base(8 downto 7) &
|
||||||
|
(obj_rom_addr_base(4) xor obj_rom_addr_base(9) xor (obj_rom_addr_base(2) and obj_rom_addr_base(10))) &
|
||||||
|
obj_rom_addr_base(5 downto 0);
|
||||||
|
elsif I_HWSEL = I_HWSEL_LOSTTOMB then
|
||||||
|
obj_rom_addr <= "00" & ((obj_rom_addr_base(1) and obj_rom_addr_base(7)) or (not obj_rom_addr_base(1) and obj_rom_addr_base(8))) &
|
||||||
|
obj_rom_addr_base(9) &
|
||||||
|
(obj_rom_addr_base(7) xor (obj_rom_addr_base(1) and (obj_rom_addr_base(7) xor obj_rom_addr_base(10)))) &
|
||||||
|
((obj_rom_addr_base(1) and obj_rom_addr_base(8)) or (not obj_rom_addr_base(1) and obj_rom_addr_base(10))) &
|
||||||
|
obj_rom_addr_base(6 downto 0);
|
||||||
|
else
|
||||||
|
obj_rom_addr <= obj_rom_addr_base;
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
end process;
|
end process;
|
||||||
|
|||||||
Reference in New Issue
Block a user