library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; -- Uncomment the following lines to use the declarations that are -- provided for instantiating Xilinx primitive components. --library UNISIM; --use UNISIM.VComponents.all; entity SATURN is Port ( --SATURN Address : in std_logic_vector(25 downto 1); Data : inout std_logic_vector(15 downto 0); WE : in std_logic; OE : in std_logic; CE : in std_logic; --FX2 PB : inout std_logic_vector(7 downto 0); FX2_CLK : in std_logic; CTL0 : in std_logic; CTL1 : in std_logic; CTL2 : in std_logic; RDY0 : out std_logic; --FLASH fOE : out std_logic; fCE : out std_logic; --DEBUG2 : in std_logic; LED : out std_logic; DEBUG : out std_logic_vector(2 downto 0) ); end SATURN; architecture Behavioral of SATURN is signal data1 : std_logic_vector(7 downto 0); signal flag : std_logic:='0'; begin PB<=data1 when CTL0='1' else (others=>'Z'); RDY0<=flag; process(FX2_CLK,Data,Address) begin fCE<='1'; fOE<='1'; Data(7 downto 0)<=(others=>'Z'); flag<='1'; if(Address(25 downto 19)="1000000")then --FLASH mem if(WE='1')then fOE<='0'; else fOE<='1'; end if; fCE<='0'; --EMS rip of datel firmware with hacked register locations elsif(Address(25 downto 19)="1000001")then --Data output to Comms Link $02080001 if(WE='0')then data1<=Data(7 downto 0); flag<='0'; end if; elsif(Address(25 downto 19)="1000010")then --status flag in bit 0 $02100001 if(WE='1')then Data(0)<=not CTL1; else Data(0)<='Z'; end if; elsif(Address(25 downto 19)="1000011")then --Data input from Comms Link $02180001 if(WE='1')then Data(7 downto 0)<=PB; else Data(7 downto 0)<=(others=>'Z'); end if; --Datel locations of comms registers elsif(Address(25 downto 19)="1001000")then --Data output to Comms Link $02400001 if(WE='0')then data1<=Data(7 downto 0); flag<='0'; end if; elsif(Address(25 downto 19)="1001010")then --status flag in bit 0 $02500001 if(WE='1')then Data(0)<=not CTL1; else Data(0)<='Z'; end if; elsif(Address(25 downto 19)="1001100")then --Data input from Comms Link $02600001 if(WE='1')then Data(7 downto 0)<=PB; else Data(7 downto 0)<=(others=>'Z'); end if; --Drive 0xFD on the databus to 0x03000000 and beyond , the cart uses this as a sort of signature, firmware requires it unless you wanna patch it elsif(Address(25 downto 24)="11")then if(WE='1')then Data(1)<='0'; else Data(1)<='Z'; end if; else fCE<='1'; fOE<='1'; Data(7 downto 0)<=(others=>'Z'); end if; end process; --FX2 process: --when CTL0=1 then read data --when CTL0=0 then write data -- CTL1 is status flag to tell saturn data was written end Behavioral;