Index: common/a8core/address_decoder.vhdl
===================================================================
--- common/a8core/address_decoder.vhdl	(revision 338)
+++ common/a8core/address_decoder.vhdl	(revision 339)
@@ -552,9 +552,9 @@
 	-- TODO, check we can use 320k extended RAM ok (THINK SO)
 
 	-- SRAM memory map (512k) for Papilio duo 
-	SDRAM_CART_ADDR      <= "0000" & "0"&emu_cart_address(15)&"11" & emu_cart_address(14 downto 0); 
-	SDRAM_BASIC_ROM_ADDR <= "0000" & "001" &                       "0000000000000000";
-	SDRAM_OS_ROM_ADDR    <= "0000" & "001" & rom_select(1 downto 0) &"00000000000000";
+	SDRAM_CART_ADDR      <= "0000" & "01"&emu_cart_address(16 downto 0); 
+	SDRAM_BASIC_ROM_ADDR <= "0000" & "0111000000000000000";
+	SDRAM_OS_ROM_ADDR    <= "0000" & "0111100000000000000";
 
 end generate;
 	
Index: firmware/papilioduo/memory.h
===================================================================
--- firmware/papilioduo/memory.h	(nonexistent)
+++ firmware/papilioduo/memory.h	(revision 339)
@@ -0,0 +1,30 @@
+#ifndef MEMORY_H
+#define MEMORY_H
+
+#define SRAM_BASE ((void*) 0x200000)
+#define SDRAM_BASE ((void*) 0x800000)
+
+// Memory usage...
+// 0x20000-0x37FFF (0x820000 in zpu space) = carts - 96k
+// 0x28000-0x37FFF (0x820000 in zpu space) = directory cache - 64k
+// 0x10000-0x1FFFF (0x810000 in zpu space) = freeze backup - 64k
+// 0x38000-0x3FFFF (0x838000 in zpu space) = os rom/basic rom - 32k
+
+#define INIT_MEM
+
+#define DIR_INIT_MEM (SDRAM_BASE + 0x28000)
+#define DIR_INIT_MEMSIZE 65536
+#define FREEZE_MEM (SDRAM_BASE + 0x10000)
+
+#define CARTRIDGE_MEM (SDRAM_BASE + 0x20000) // Share with dir cache, long carts will be wired by dir listing
+
+// offset in SDRAM area
+#define ROM_OFS 0x38000
+
+
+#define atari_regbase  ((void*) 0x10000)
+#define atari_regmirror  ((void*) 0x20000)
+#define zpu_regbase ((void*) 0x40000)
+#define pokey_regbase ((void*) 0x40400)
+
+#endif
Index: papilioduo/atari800core_papilioduo.vhd
===================================================================
--- papilioduo/atari800core_papilioduo.vhd	(revision 338)
+++ papilioduo/atari800core_papilioduo.vhd	(revision 339)
@@ -32,8 +32,10 @@
 		EXT_CLK : in std_logic_vector(ext_clock downto 1);
                 EXT_PLL_LOCKED : in std_logic_vector(ext_clock downto 1);
 
-		PS2_CLK1 :  IN  STD_LOGIC;
-		PS2_DAT1 :  IN  STD_LOGIC;
+		PS2_CLK2 :  IN  STD_LOGIC;
+		PS2_DAT2 :  IN  STD_LOGIC;
+		--PS2_CLK1 :  IN  STD_LOGIC;
+		--PS2_DAT1 :  IN  STD_LOGIC;
 --NET PS2_DAT1      LOC="P120" | IOSTANDARD=LVTTL;                                # A4
 --NET PS2_CLK1      LOC="P121" | IOSTANDARD=LVTTL;                                # A5
 
@@ -392,8 +394,10 @@
 	( 
 		CLK => clk,
 		RESET_N => reset_n,
-		PS2_CLK => PS2_CLK1,
-		PS2_DAT => PS2_DAT1,
+		--PS2_CLK => PS2_CLK1,
+		--PS2_DAT => PS2_DAT1,
+		PS2_CLK => PS2_CLK2, -- First port seems to have issues, use 2nd for now
+		PS2_DAT => PS2_DAT2,
 
 		INPUT => zpu_out4,
 		
Index: papilioduo/papilioduo.ucf
===================================================================
--- papilioduo/papilioduo.ucf	(revision 338)
+++ papilioduo/papilioduo.ucf	(revision 339)
@@ -15,8 +15,8 @@
 #NET RS232_TX      LOC="P117" | IOSTANDARD=LVTTL;                                # A1
 NET SD_MISO       LOC="P118" | IOSTANDARD=LVTTL;                                # A2
 NET SD_CD         LOC="P119" | IOSTANDARD=LVTTL;                                # A3
-NET PS2_DAT1      LOC="P120" | IOSTANDARD=LVTTL;                                # A4
-NET PS2_CLK1      LOC="P121" | IOSTANDARD=LVTTL;                                # A5
+#NET PS2_DAT1      LOC="P120" | IOSTANDARD=LVTTL;                                # A4
+#NET PS2_CLK1      LOC="P121" | IOSTANDARD=LVTTL;                                # A5
 NET JOYSTICK1_5   LOC="P123" | IOSTANDARD=LVTTL;                                # A6
 NET JOYSTICK1_9   LOC="P124" | IOSTANDARD=LVTTL;                                # A7
 NET JOYSTICK1_4   LOC="P126" | IOSTANDARD=LVTTL;                                # A8
@@ -57,8 +57,8 @@
 NET JOYSTICK2_6   LOC="P82"  | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST;          # D5
 NET JOYSTICK2_7   LOC="P80"  | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST;          # D6
 NET JOYSTICK2_9   LOC="P78"  | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST;          # D7
-#NET PS2_CLK2      LOC="P74"  | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST;          # D8
-#NET PS2_DAT2      LOC="P66"  | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST;          # D9
+NET PS2_CLK2      LOC="P74"  | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST;          # D8
+NET PS2_DAT2      LOC="P66"  | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST;          # D9
 #NET AUDIO2_RIGHT  LOC="P61"  | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST;          # D10
 #NET AUDIO2_LEFT   LOC="P58"  | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST;          # D11
 NET LED1          LOC="P56"  | IOSTANDARD=LVTTL | DRIVE=8 | SLEW=FAST;          # D12
Index: papilioduo/zpu_rom.vhdl
===================================================================
--- papilioduo/zpu_rom.vhdl	(revision 338)
+++ papilioduo/zpu_rom.vhdl	(revision 339)
@@ -1434,7 +1434,7 @@
 X"22708a2b",
 X"903dec05",
 X"56705556",
-X"56848680",
+X"56848880",
 X"80527751",
 X"e0803f83",
 X"e0800886",
@@ -2644,7 +2644,7 @@
 X"e0800881",
 X"80802e09",
 X"81068738",
-X"85808053",
+X"8f808053",
 X"9b3983e7",
 X"d80851ff",
 X"bb813f83",
@@ -2651,7 +2651,7 @@
 X"e0800880",
 X"d0802e09",
 X"81069238",
-X"85b08053",
+X"8fb08053",
 X"83e08008",
 X"5283e7d8",
 X"0851fed6",
@@ -2905,7 +2905,7 @@
 X"3d0d800b",
 X"83e7bc34",
 X"84808052",
-X"848c8080",
+X"848a8080",
 X"51ffb49c",
 X"3f83e080",
 X"0880cd38",
@@ -2913,7 +2913,7 @@
 X"f99c51ff",
 X"b8db3f83",
 X"e0800855",
-X"84808054",
+X"8e808054",
 X"80c08053",
 X"80f68052",
 X"83e08008",
@@ -2968,7 +2968,7 @@
 X"e08c08f4",
 X"0508872e",
 X"098106ff",
-X"ab388488",
+X"ab388484",
 X"808051eb",
 X"cf3fff0b",
 X"83e7c00c",
