Index: ultimate_cart/veronica/sram_mux.vhd
===================================================================
--- ultimate_cart/veronica/sram_mux.vhd	(revision 438)
+++ ultimate_cart/veronica/sram_mux.vhd	(revision 439)
@@ -27,11 +27,17 @@
 END sram_mux;
 
 ARCHITECTURE vhdl OF sram_mux IS
-	signal sram_we_next : std_logic;
-	signal sram_we_reg : std_logic;
+	signal sram_we_n_next : std_logic;
+	signal sram_we_n_reg : std_logic;
+
+	signal sram_drive_data_next : std_logic;
+	signal sram_drive_data_reg : std_logic;
 	
 	signal tick_next : std_logic;
 	signal tick_reg : std_logic;
+
+	signal tick_last_fast_next : std_logic;
+	signal tick_last_fast_reg : std_logic;
 	
 	signal tick_fast_next : std_logic_vector(6 downto 0);
 	signal tick_fast_reg : std_logic_vector(6 downto 0);
@@ -41,23 +47,24 @@
 
 	-- Back to back writes from 65816?
 	process(veronica_address, veronica_write_data, veronica_w_n, veronica_sram_select,
-			atari_bus_request, atari_address,atari_write_data, atari_w_n, atari_sram_select)
+			atari_bus_request, atari_address,atari_write_data, atari_w_n, atari_sram_select, tick_fast_reg)
 	begin
 		sram_addr <= (others=>'0');
 		sram_data_out <= (others=>'0');
-		sram_drive_data <= '0';
+		sram_drive_data_next <= '0';
 	
 		if (atari_bus_request='1') then
 			sram_addr(16 downto 0) <= atari_address;
 			sram_data_out <= atari_write_data;
-			sram_we_next <= (atari_w_n or not(atari_sram_select));
-			sram_drive_data <= not(atari_w_n);
+			sram_we_n_next <= (atari_w_n or not(atari_sram_select) or tick_fast_reg(6));
 		else
 			sram_addr(16 downto 0) <= veronica_address;
 			sram_data_out <= veronica_write_data;
-			sram_we_next <= (veronica_w_n or not(veronica_sram_select));
-			sram_drive_data <= not(veronica_w_n);
+			sram_we_n_next <= (veronica_w_n or not(veronica_sram_select) or tick_fast_reg(6));
 		end if;
+
+
+		sram_drive_data_next <= not(sram_we_n_next or tick_fast_reg(0) or tick_fast_reg(1) or tick_fast_reg(6));
 	end process;
 	
 	-- 
@@ -78,21 +85,26 @@
 	begin
 		if (reset_n='0') then
 			tick_fast_reg <= (others=>'0');
-			sram_we_reg <= '1';
+			tick_last_fast_reg <= '0';
+			sram_we_n_reg <= '1';
+			sram_drive_data_reg <= '0';
 		elsif (clk7x'event and clk7x='1') then
 			tick_fast_reg <= tick_fast_next;
-			sram_we_reg <= sram_we_next;
+			tick_last_fast_reg <= tick_last_fast_next;
+			sram_we_n_reg <= sram_we_n_next;
+			sram_drive_data_reg <= sram_drive_data_next;
 		end if;
 	end process;
-	tick_fast_next <= tick_fast_reg(5 downto 0)&tick_reg;
+	tick_last_fast_next <= tick_reg;
+
+	tick_fast_next <= tick_fast_reg(5 downto 1)&(tick_reg xor tick_last_fast_reg)&tick_fast_reg(6);
 	
-	tick_mask <= (tick_reg&tick_reg&tick_reg&tick_reg&tick_reg&tick_reg&tick_reg) xor tick_fast_reg; --1000000 1000000 1000000 (raise WE - how long must WE be high?)
- 
 	-- 55 addr, 45 write pulse, 20 we -> drive
 	-- 71.4 total -> 7x clock-> about 10ns
 	-- 10 (we high), 60 (we low) 1 000 000
 	-- 30 (no drive), 40 (drive) 0 001 111
 	
-	sram_we_n <= sram_we_reg;
+	sram_we_n <= sram_we_n_reg;
+	sram_drive_data <= sram_drive_data_reg;
 
 end vhdl;
Index: ultimate_cart/veronica/tb_sram/sram_tb.vhd
===================================================================
--- ultimate_cart/veronica/tb_sram/sram_tb.vhd	(revision 438)
+++ ultimate_cart/veronica/tb_sram/sram_tb.vhd	(revision 439)
@@ -98,13 +98,13 @@
 	process_setup_sram : process
 	begin
 	atari_bus_request <= '0';
-	atari_sram_select <= '0';
-	atari_address <= (others=>'0');
+	atari_sram_select <= '1';
+	atari_sram_address <= (others=>'0');
 	atari_w_n <= '1';
 	atari_write_data <= (others=>'0');
 	
-	veronica_address <= (others=>'0');
-	veronica_sram_select <= '0';
+	veronica_sram_address <= (others=>'0');
+	veronica_sram_select <= '1';
 	veronica_w_n <= '1';
 	veronica_write_data <= (others=>'0');
 
@@ -111,20 +111,24 @@
 	wait for 1100ns;
 
 	wait until clk'event and clk = '1';
+	atari_bus_request <= '1';
 	atari_w_n <= '0';
-	atari_address<= '0'&x"402";
+	atari_sram_address<= '0'&x"D402";
 	atari_write_data <= x"56";
 
 	wait until clk'event and clk = '1';
 	atari_w_n <= '0';
-	atari_address<= '0'&x"313";
+	atari_sram_address<= '0'&x"C313";
 	atari_write_data <= x"65";
 
 	wait until clk'event and clk = '1';
 	atari_w_n <= '0';
-	atari_address<= '0'&x"402";
+	atari_sram_address<= '0'&x"D402";
 	atari_write_data <= x"56";
 
+	wait until clk'event and clk = '1';
+	atari_bus_request <= '0';
+
 	wait for 100000000us;
 
 	end process;
@@ -153,5 +157,9 @@
 		veronica_write_data => veronica_write_data
 	);
 
+	EXT_SRAM_DATA <= sram_write_data when sram_drive_data='1' else (others=>'Z');
+	EXT_SRAM_OE <= '0';
+	sram_read_data <= EXT_SRAM_DATA;
+
 end rtl;
 
