Index: common/a8core/atari800core.vhd
===================================================================
--- common/a8core/atari800core.vhd	(revision 3)
+++ common/a8core/atari800core.vhd	(revision 4)
@@ -94,6 +94,7 @@
 		CONSOL_OPTION : IN STD_LOGIC;
 		CONSOL_SELECT : IN STD_LOGIC;
 		CONSOL_START : IN STD_LOGIC;
+		GTIA_TRIG : IN STD_LOGIC_VECTOR(3 downto 0);
 
 		-----------------------
 		-- After here all FPGA implementation specific
@@ -213,8 +214,6 @@
 -- TODO - review/explain what all these are for
 SIGNAL	CPU_SHARED_ENABLE :  STD_LOGIC;
 SIGNAL	ENABLE_179_MEMWAIT :  STD_LOGIC;
-SIGNAL	PAUSE_6502 :  STD_LOGIC;
-SIGNAL	HALT_OR_PAUSE_6502 :  STD_LOGIC;
 SIGNAL	POKEY_ENABLE_179 :  STD_LOGIC;
 SIGNAL	ANTIC_ENABLE_179 :  STD_LOGIC;
 SIGNAL	SCANDOUBLER_SHARED_ENABLE_HIGH :  STD_LOGIC;
@@ -265,7 +264,11 @@
 SIGNAL	PIA_IRQB :  STD_LOGIC;
 SIGNAL	PIA_READ_ENABLE :  STD_LOGIC;
 SIGNAL	PIA_WRITE_ENABLE :  STD_LOGIC;
+SIGNAL PORTB_OUT_INT : STD_LOGIC_VECTOR(7 downto 0);
 
+-- PBI
+SIGNAL PBI_ADDR_INT : std_logic_vector(15 downto 0);
+
 BEGIN 
 
 PBI_WIDTH_8bit_ACCESS <= WIDTH_8bit_access;
@@ -274,8 +277,6 @@
 PBI_WRITE_DATA <= WRITE_DATA;
 PBI_SNOOP_DATA <= MEMORY_DATA;
 
-HALT_OR_PAUSE_6502 <= HALT or PAUSE_6502;
-
 enables : entity work.shared_enable
 GENERIC MAP(cycle_length => cycle_length)
 PORT MAP(CLK => CLK,
@@ -282,7 +283,7 @@
 		 RESET_N => RESET_N,
 		 MEMORY_READY_CPU => MEMORY_READY_CPU,
 		 MEMORY_READY_ANTIC => MEMORY_READY_ANTIC,
-		 PAUSE_6502 => HALT_OR_PAUSE_6502,
+		 PAUSE_6502 => HALT,
 		 THROTTLE_COUNT_6502 => THROTTLE_COUNT_6502,
 		 POKEY_ENABLE_179 => POKEY_ENABLE_179,
 		 ANTIC_ENABLE_179 => ANTIC_ENABLE_179,
@@ -292,6 +293,7 @@
 		 SCANDOUBLER_ENABLE_HIGH => SCANDOUBLER_SHARED_ENABLE_HIGH);
 
 
+CPU_6502_RESET <= NOT(RESET_N); -- TODO, allow external reset
 cpu6502 : entity work.cpu
 PORT MAP(CLK => CLK,
 		 RESET => CPU_6502_RESET,
@@ -317,7 +319,7 @@
 		 ANTIC_ENABLE_179 => ANTIC_ENABLE_179,
 		 PAL => PAL,
 		 lightpen => LIGHTPEN,
-		 ADDR => PBI_ADDR(3 DOWNTO 0),
+		 ADDR => PBI_ADDR_INT(3 DOWNTO 0),
 		 CPU_DATA_IN => WRITE_DATA(7 DOWNTO 0),
 		 MEMORY_DATA_IN => MEMORY_DATA(7 DOWNTO 0),
 		 NMI_N_OUT => NMI_n,
@@ -363,7 +365,7 @@
 		 ANTIC_MEMORY_READY => MEMORY_READY_ANTIC,
 		 WR_EN => POKEY2_WRITE_ENABLE,
 		 RESET_N => RESET_N,
-		 ADDR => PBI_ADDR(3 DOWNTO 0),
+		 ADDR => PBI_ADDR_INT(3 DOWNTO 0),
 		 DATA_IN => WRITE_DATA(7 DOWNTO 0),
 		 CHANNEL_0_OUT => POKEY2_CHANNEL0,
 		 CHANNEL_1_OUT => POKEY2_CHANNEL1,
@@ -389,7 +391,7 @@
 		 CB2_DIR_OUT => CB2_DIR_OUT,
 		 CB2_IN => CB2_IN,
 		 CB2_OUT => CB2_OUT,
-		 ADDR => PBI_ADDR(1 DOWNTO 0),
+		 ADDR => PBI_ADDR_INT(1 DOWNTO 0),
 		 CPU_DATA_IN => WRITE_DATA(7 DOWNTO 0),
 		 IRQA_N => PIA_IRQA,
 		 IRQB_N => PIA_IRQB,
@@ -399,7 +401,7 @@
 		 PORTA_OUT => PORTA_OUT,
 		 PORTB_IN => PORTB_IN,
 		 PORTB_DIR_OUT => PORTB_DIR_OUT,
-		 PORTB_OUT => PORTB_OUT);
+		 PORTB_OUT => PORTB_OUT_INT);
 
 mmu1 : entity work.address_decoder
 PORT MAP(CLK => CLK,
@@ -433,14 +435,14 @@
 		 CACHE_POKEY2_DATA => CACHE_POKEY2_DO,
 		 POKEY_DATA => POKEY_DO,
 		 CACHE_POKEY_DATA => CACHE_POKEY_DO,
-		 PORTB => PORTB_OUT,
+		 PORTB => PORTB_OUT_INT,
 		 RAM_DATA => RAM_DO,
 		 ram_select => RAM_SELECT(2 downto 0),
 		 ROM_DATA => ROM_DO,
 		 rom_select => ROM_SELECT, 
 		 SDRAM_DATA => SDRAM_DO,
-		 DMA_ADDR => DMA_ADDR_FETCH,
-		 DMA_WRITE_DATA => DMA_DO,
+		 DMA_ADDR => DMA_ADDR,
+		 DMA_WRITE_DATA => DMA_WRITE_DATA,
 		 MEMORY_READY_ANTIC => MEMORY_READY_ANTIC,
 		 MEMORY_READY_DMA => MEMORY_READY_DMA,
 		 MEMORY_READY_CPU => MEMORY_READY_CPU,
@@ -466,7 +468,7 @@
 		 SDRAM_REQUEST => SDRAM_REQUEST,
 		 SDRAM_REFRESH => SDRAM_REFRESH,
 		 MEMORY_DATA => MEMORY_DATA,
-		 PBI_ADDR => PBI_ADDR,
+		 PBI_ADDR => PBI_ADDR_INT,
 		 RAM_ADDR => RAM_ADDR,
 		 ROM_ADDR => ROM_ADDR,
 		 SDRAM_ADDR => SDRAM_ADDR,
@@ -485,7 +487,7 @@
 		 SIO_IN1 => SIO_RXD,
 		 SIO_IN2 => '1',
 		 SIO_IN3 => '1',
-		 ADDR => PBI_ADDR(3 DOWNTO 0),
+		 ADDR => PBI_ADDR_INT(3 DOWNTO 0),
 		 DATA_IN => WRITE_DATA(7 DOWNTO 0),
 		 keyboard_response => KEYBOARD_RESPONSE,
 		 POT_IN => POT_IN,
@@ -517,15 +519,11 @@
 		 CONSOL_START => CONSOL_START,
 		 CONSOL_SELECT => CONSOL_SELECT,
 		 CONSOL_OPTION => CONSOL_OPTION,
-		 TRIG0 => joy2_n(4), -- TODO - joystick trigger too
-		 TRIG1 => joy1_n(4),
-		 --TRIG0 => VIRTUAL_TRIGGERS(0) and joy2_n(4), -- TODO - joystick trigger too
-		 --TRIG1 => VIRTUAL_TRIGGERS(1) and joy1_n(4),
-		 --TRIG0 => VIRTUAL_TRIGGERS(0),
-		 --TRIG1 => VIRTUAL_TRIGGERS(1),
-		 TRIG2 => VIRTUAL_TRIGGERS(2),
-		 TRIG3 => VIRTUAL_TRIGGERS(3),
-		 ADDR => PBI_ADDR(4 DOWNTO 0),
+		 TRIG0 => GTIA_TRIG(0),
+		 TRIG1 => GTIA_TRIG(1),
+		 TRIG2 => GTIA_TRIG(2),
+		 TRIG3 => GTIA_TRIG(3),
+		 ADDR => PBI_ADDR_INT(4 DOWNTO 0),
 		 AN => ANTIC_AN,
 		 CPU_DATA_IN => WRITE_DATA(7 DOWNTO 0),
 		 MEMORY_DATA_IN => MEMORY_DATA(7 DOWNTO 0),
@@ -569,7 +567,7 @@
 generic map(BYTES=>16,WIDTH=>4)
 port map(
 	CLK => CLK,
-	ADDR => PBI_ADDR(3 downto 0),
+	ADDR => PBI_ADDR_INT(3 downto 0),
 	DATA_IN => WRITE_DATA(7 downto 0),
 	WR_EN => POKEY_WRITE_ENABLE,
 	DATA_OUT => CACHE_POKEY_DO
@@ -579,7 +577,7 @@
 generic map(BYTES=>16,WIDTH=>4)
 port map(
 	CLK => CLK,
-	ADDR => PBI_ADDR(3 downto 0),
+	ADDR => PBI_ADDR_INT(3 downto 0),
 	DATA_IN => WRITE_DATA(7 downto 0),
 	WR_EN => POKEY2_WRITE_ENABLE,
 	DATA_OUT => CACHE_POKEY2_DO
@@ -589,7 +587,7 @@
 generic map(BYTES=>32,WIDTH=>5)
 port map(
 	CLK => CLK,
-	ADDR => PBI_ADDR(4 downto 0),
+	ADDR => PBI_ADDR_INT(4 downto 0),
 	DATA_IN => WRITE_DATA(7 downto 0),
 	WR_EN => GTIA_WRITE_ENABLE,
 	DATA_OUT => CACHE_GTIA_DO
@@ -599,7 +597,7 @@
 generic map(BYTES=>16,WIDTH=>4)
 port map(
 	CLK => CLK,
-	ADDR => PBI_ADDR(3 downto 0),
+	ADDR => PBI_ADDR_INT(3 downto 0),
 	DATA_IN => WRITE_DATA(7 downto 0),
 	WR_EN => ANTIC_WRITE_ENABLE,
 	DATA_OUT => CACHE_ANTIC_DO
@@ -609,7 +607,7 @@
 	PORT map
 	( 
 		clk => clk,
-		addr => pbi_addr(1 downto 0),
+		addr => pbi_addr_int(1 downto 0),
 		data_in => WRITE_DATA(7 DOWNTO 0),
 		wr_en => covox_write_enable,
 		covox_channel0 => covox_channel0,
@@ -618,4 +616,8 @@
 		covox_channel3 => covox_channel3
 	);
 
+-- outputs
+PBI_ADDR <= PBI_ADDR_INT;
+PORTB_OUT <= PORTB_OUT_INT;
+
 END bdf_type;
Index: common/a8core/atari800core_helloworld.vhd
===================================================================
--- common/a8core/atari800core_helloworld.vhd	(revision 3)
+++ common/a8core/atari800core_helloworld.vhd	(revision 4)
@@ -1,3 +1,17 @@
+---------------------------------------------------------------------------
+-- (c) 2013 mark watson
+-- I am happy for anyone to use this for non-commercial use.
+-- If my vhdl files are used commercially or otherwise sold,
+-- please contact me for explicit permission at scrameta (gmail).
+-- This applies for source and binary form and derived works.
+---------------------------------------------------------------------------
+
+LIBRARY ieee;
+USE ieee.std_logic_1164.all; 
+use IEEE.STD_LOGIC_MISC.all;
+use ieee.numeric_std.all;
+
+LIBRARY work;
 -- Simple version that:
 -- i) needs: CLK(58 or 28MHZ) joystick,PS2 keyboard
 -- ii) provides: VIDEO,AUDIO,ROM,RAM
@@ -10,7 +24,7 @@
 	(
 		-- use CLK of 1.79*cycle_length
 		-- I've tested 16 and 32 only, but 4 and 8 might work...
-		cycle_length : integer := 16 -- or 32...
+		cycle_length : integer := 16; -- or 32...
 	
 		internal_ram : integer := 16384  -- at start of memory map
 	);
@@ -41,6 +55,7 @@
 
 		-- video standard
 		PAL :  in STD_LOGIC
+	);
 end atari800core_helloworld;
 
 ARCHITECTURE vhdl OF atari800core_helloworld IS 
@@ -53,10 +68,14 @@
 SIGNAL CONSOL_START : std_logic;
 SIGNAL CONSOL_SELECT : std_logic;
 SIGNAL CONSOL_OPTION : std_logic;
+
+-- 6502 throttling
+SIGNAL THROTTLE_COUNT_6502 : std_logic_vector(5 downto 0);
+
 BEGIN
 
 -- PS2 to pokey
-keyboard_map1 : ps2_to_atari800 IS
+keyboard_map1 : entity work.ps2_to_atari800
 	PORT MAP
 	( 
 		CLK => clk,
@@ -75,16 +94,16 @@
 	);
 
 -- THROTTLE
-THROTTLE_COUNT_6502 <= to_unsigned(cycle_length-1,6);
+THROTTLE_COUNT_6502 <= std_logic_vector(to_unsigned(cycle_length-1,6));
 
-atarixl_simplesdram1 : entity work.atari800_simplesdram
+atarixl_simple_sdram1 : entity work.atari800core_simple_sdram
 	GENERIC MAP
 	(
 		cycle_length => cycle_length,
 		internal_rom => 1,
 		internal_ram =>internal_ram
-	);
-	PORT
+	)
+	PORT MAP
 	(
 		CLK => CLK,
 		RESET_N => RESET_N,
@@ -110,7 +129,7 @@
 
 		CONSOL_OPTION => CONSOL_OPTION,
 		CONSOL_SELECT => CONSOL_SELECT,
-		CONSOL_START => CONSOL_START
+		CONSOL_START => CONSOL_START,
 
 		SDRAM_REQUEST => open,
 		SDRAM_REQUEST_COMPLETE => '1',
Index: common/a8core/atari800core_simple_sdram.vhd
===================================================================
--- common/a8core/atari800core_simple_sdram.vhd	(revision 3)
+++ common/a8core/atari800core_simple_sdram.vhd	(revision 4)
@@ -1,3 +1,17 @@
+---------------------------------------------------------------------------
+-- (c) 2013 mark watson
+-- I am happy for anyone to use this for non-commercial use.
+-- If my vhdl files are used commercially or otherwise sold,
+-- please contact me for explicit permission at scrameta (gmail).
+-- This applies for source and binary form and derived works.
+---------------------------------------------------------------------------
+
+LIBRARY ieee;
+USE ieee.std_logic_1164.all; 
+use IEEE.STD_LOGIC_MISC.all;
+use ieee.numeric_std.all;
+
+LIBRARY work;
 -- Simple version that:
 -- i) needs: CLK(58 or 28MHZ) SDRAM,joystick,keyboard
 -- ii) provides: VIDEO,AUDIO
@@ -5,15 +19,15 @@
 
 -- THIS SHOULD DO FOR ALL PLATFORMS EXCEPT THOSE USING GPIO FOR PBI etc
 
-ENTITY atari800core_simplesdram is
+ENTITY atari800core_simple_sdram is
 	GENERIC
 	(
 		-- use CLK of 1.79*cycle_length
 		-- I've tested 16 and 32 only, but 4 and 8 might work...
-		cycle_length : integer := 16 -- or 32...
+		cycle_length : integer := 16; -- or 32...
 	
 		-- For initial port may help to have no
-		internal_rom : integer := 1  -- if 0 expects it in sdram,is 1:16k os+basic, is 2:... TODO
+		internal_rom : integer := 1;  -- if 0 expects it in sdram,is 1:16k os+basic, is 2:... TODO
 		internal_ram : integer := 16384  -- at start of memory map
 	);
 	PORT
@@ -102,14 +116,15 @@
    		RAM_SELECT : in std_logic_vector(2 downto 0); -- 64K,128K,320KB Compy, 320KB Rambo, 576K Compy, 576K Rambo, 1088K, 4MB
     		ROM_SELECT : in std_logic_vector(5 downto 0); -- 16KB ROM Bank - 0 is illegal (slot used for BASIC!)
 		PAL :  in STD_LOGIC;
-		HALT : in std_logic
-		THROTTLE_COUNT_6502 : in std_logic_vector(5 downto 0); -- standard speed is cycle_length-1
-end atari800core_simplesdram;
+		HALT : in std_logic;
+		THROTTLE_COUNT_6502 : in std_logic_vector(5 downto 0) -- standard speed is cycle_length-1
+	);
+end atari800core_simple_sdram;
 
-ARCHITECTURE vhdl OF atari800core_simplesdram IS 
+ARCHITECTURE vhdl OF atari800core_simple_sdram IS 
 -- PIA
 SIGNAL	CA1_IN :  STD_LOGIC;
-SIGNAL	CA2_IN:  STD_LOGIC;
+SIGNAL	CB1_IN:  STD_LOGIC;
 SIGNAL	CA2_OUT :  STD_LOGIC;
 SIGNAL	CA2_DIR_OUT:  STD_LOGIC;
 SIGNAL	CB2_OUT :  STD_LOGIC;
@@ -117,8 +132,15 @@
 SIGNAL	CA2_IN:  STD_LOGIC;
 SIGNAL	CB2_IN:  STD_LOGIC;
 SIGNAL	PORTA_IN :  STD_LOGIC_VECTOR(7 DOWNTO 0);
+SIGNAL	PORTA_OUT :  STD_LOGIC_VECTOR(7 DOWNTO 0);
+SIGNAL	PORTA_DIR_OUT :  STD_LOGIC_VECTOR(7 DOWNTO 0);
 SIGNAL	PORTB_IN :  STD_LOGIC_VECTOR(7 DOWNTO 0);
+SIGNAL	PORTB_OUT :  STD_LOGIC_VECTOR(7 DOWNTO 0);
+SIGNAL	PORTB_DIR_OUT :  STD_LOGIC_VECTOR(7 DOWNTO 0);
 
+-- GTIA
+signal GTIA_TRIG : std_logic_vector(3 downto 0);
+
 -- CARTRIDGE ACCESS
 SIGNAL	CART_RD4 :  STD_LOGIC;
 SIGNAL	CART_RD5 :  STD_LOGIC;
@@ -138,6 +160,10 @@
 SIGNAL	ROM_REQUEST :  STD_LOGIC;
 SIGNAL	ROM_REQUEST_COMPLETE :  STD_LOGIC;
 
+-- CONFIG
+SIGNAL USE_SDRAM : STD_LOGIC;
+SIGNAL ROM_IN_RAM : STD_LOGIC;
+
 BEGIN
 
 -- PIA mapping
@@ -149,6 +175,9 @@
 PORTA_IN <= ((JOY1_n(3)&JOY1_n(2)&JOY1_n(1)&JOY1_n(0)&JOY2_n(3)&JOY2_n(2)&JOY2_n(1)&JOY2_n(0)) and not (porta_dir_out)) or (porta_dir_out and porta_out);
 PORTB_IN <= PORTB_OUT;
 
+-- GTIA triggers
+GTIA_TRIG <= CART_RD5&"1"&JOY1_n(4)&JOY2_n(4);
+
 -- Cartridge not inserted
 CART_RD4 <= '0';
 CART_RD5 <= '0';
@@ -158,35 +187,37 @@
 	GENERIC MAP
 	(
 		internal_rom => internal_rom,
-		internal_ram => internal_ram,
-	);
+		internal_ram => internal_ram
+	)
 	PORT MAP (
  		clock   => CLK,
 		reset_n => RESET_N,
 
 		ROM_ADDR => ROM_ADDR,
-		ROM_REQUEST_COMPLETE => ROM_ADDR_COMPLETE,
+		ROM_REQUEST_COMPLETE => ROM_REQUEST_COMPLETE,
 		ROM_REQUEST => ROM_REQUEST,
 		ROM_DATA => ROM_DO,
 		
 		RAM_ADDR => RAM_ADDR,
-		RAM_WR_ENABLE => RAM_WR_ENABLE,
+		RAM_WR_ENABLE => RAM_WRITE_ENABLE,
 		RAM_DATA_IN => PBI_WRITE_DATA(7 downto 0),
 		RAM_REQUEST_COMPLETE => RAM_REQUEST_COMPLETE,
 		RAM_REQUEST => RAM_REQUEST,
-		RAM_DATA => RAM_DO
+		RAM_DATA => RAM_DO(7 downto 0)
 	);
-END internalromram;
 
+	USE_SDRAM <= '1' when internal_ram=0 else '0';
+	ROM_IN_RAM <= '1' when internal_rom=0 else '0';
+
 atari800xl : entity work.atari800core
 	GENERIC MAP
 	(
 		cycle_length => cycle_length
-	);
+	)
 	PORT MAP
 	(
 		CLK => CLK,
-		RESET_N => RESET_N
+		RESET_N => RESET_N,
 
 		VGA_VS => VGA_VS,
 		VGA_HS => VGA_HS,
@@ -240,6 +271,7 @@
 		CONSOL_OPTION => CONSOL_OPTION,
 		CONSOL_SELECT => CONSOL_SELECT,
 		CONSOL_START=> CONSOL_START,
+		GTIA_TRIG => GTIA_TRIG,
 
 		SDRAM_REQUEST => SDRAM_REQUEST,
 		SDRAM_REQUEST_COMPLETE => SDRAM_REQUEST_COMPLETE,
Index: common/a8core/cpu_65xx_a.vhd
===================================================================
--- common/a8core/cpu_65xx_a.vhd	(revision 3)
+++ common/a8core/cpu_65xx_a.vhd	(revision 4)
@@ -769,9 +769,9 @@
 			ninebits := rmwBits;
 		end case;
 
-		if (opcInfo(aluMode1From to aluMode1To) = aluModeFlg) then
+		if (to_01(opcInfo(aluMode1From to aluMode1To)) = aluModeFlg) then
 			varZ := rmwBits(1);
-		elsif ninebits(7 downto 0) = X"00" then
+		elsif to_01(ninebits(7 downto 0)) = X"00" then
 			varZ := '1';
 		else
 			varZ := '0';
@@ -792,14 +792,14 @@
 			null;
 		end case;
 
-		if (opcInfo(aluMode1From to aluMode1To) = aluModeBit)
-		or (opcInfo(aluMode1From to aluMode1To) = aluModeFlg) then
+		if (to_01(opcInfo(aluMode1From to aluMode1To)) = aluModeBit)
+		or (to_01(opcInfo(aluMode1From to aluMode1To)) = aluModeFlg) then
 			varN := rmwBits(7);
 		else
 			varN := nineBits(7);
 		end if;
 		varC := ninebits(8);
-		if opcInfo(aluMode2From to aluMode2To) = aluModeArr then
+		if to_01(opcInfo(aluMode2From to aluMode2To)) = aluModeArr then
 			varC := aluInput(7);
 			varV := aluInput(7) xor aluInput(6);
 		end if;
@@ -908,7 +908,7 @@
 		nextOpcode <= myNextOpcode;
 	end process;
 
-	nextOpcInfo <= opcodeInfoTable(to_integer(nextOpcode));
+	nextOpcInfo <= opcodeInfoTable(to_integer(to_01(nextOpcode)));
 	process(clk)
 	begin
 		if rising_edge(clk) then
Index: common/a8core/generic_ram_infer.vhdl
===================================================================
--- common/a8core/generic_ram_infer.vhdl	(revision 3)
+++ common/a8core/generic_ram_infer.vhdl	(revision 4)
@@ -34,11 +34,11 @@
    BEGIN
       IF (clock'event AND clock = '1') THEN
          q<= (others=>'1');
-         IF (to_integer(unsigned(address)) < space) THEN
+         IF (to_integer(to_01(unsigned(address))) < space) THEN
            IF (we = '1') THEN
-              ram_block(to_integer(unsigned(address))) <= data;
+              ram_block(to_integer(to_01(unsigned(address)))) <= data;
            END IF;
-           q <= ram_block(to_integer(unsigned(address)));
+           q <= ram_block(to_integer(to_01(unsigned(address))));
          END IF;
       END IF;
    END PROCESS;
Index: common/a8core/internalromram.vhd
===================================================================
--- common/a8core/internalromram.vhd	(revision 3)
+++ common/a8core/internalromram.vhd	(revision 4)
@@ -6,7 +6,7 @@
 ENTITY internalromram IS
 	GENERIC
 	(
-		internal_rom : integer := 1  
+		internal_rom : integer := 1;  
 		internal_ram : integer := 16384 
 	);
   PORT(
@@ -81,7 +81,7 @@
 		end if;
 	end process;
 
-gen_internal_os : if internal_os==1 generate
+gen_internal_os : if internal_rom=1 generate
 	rom16a : os16
 	PORT MAP(clock => clock,
 			 address => rom_addr(13 downto 0),
@@ -105,13 +105,13 @@
 	rom_request_complete <= rom_request_reg;
 	
 end generate;
-gen_no_internal_os : if internal_rom==0 generate
+gen_no_internal_os : if internal_rom=0 generate
 	ROM16_data <= (others=>'0');
 
-	rom_request_compelte <= '0';
+	rom_request_complete <= '0';
 end generate;
 	
-gen_internal_ram: if space>0 generate
+gen_internal_ram: if internal_ram>0 generate
 	ramint1 : generic_ram_infer
         generic map
         (
@@ -127,7 +127,7 @@
 			 );	
 	ram_request_complete <= ram_request_reg;
 end generate;
-gen_no_internal_ram : if space==0 generate
+gen_no_internal_ram : if internal_ram=0 generate
 	ram_request_complete <='0';
 	ram_data <= (others=>'1');
 end generate;
Index: common/a8core/ps2_to_atari800.vhdl
===================================================================
--- common/a8core/ps2_to_atari800.vhdl	(revision 3)
+++ common/a8core/ps2_to_atari800.vhdl	(revision 4)
@@ -21,22 +21,31 @@
 	KEYBOARD_SCAN : IN STD_LOGIC_VECTOR(5 downto 0);
 	KEYBOARD_RESPONSE : OUT STD_LOGIC_VECTOR(1 downto 0);
 
-	CONSOL_START : STD_LOGIC;
-	CONSOL_SELECT : STD_LOGIC;
-	CONSOL_OPTION : STD_LOGIC
+	CONSOL_START : OUT STD_LOGIC;
+	CONSOL_SELECT : OUT STD_LOGIC;
+	CONSOL_OPTION : OUT STD_LOGIC
 );
-END ps2_keyboard;
+END ps2_to_atari800;
 
-ARCHITECTURE vhdl OF ps2_keyboard IS
+ARCHITECTURE vhdl OF ps2_to_atari800 IS
 	signal ps2_keys_next : std_logic_vector(255 downto 0);
 	signal ps2_keys_reg : std_logic_vector(255 downto 0);
 
+	signal key_event : std_logic;
+	signal key_value : std_logic_vector(7 downto 0);
+	signal key_extended : std_logic;
+	signal key_up : std_logic;
+
+	signal CONSOL_START_INT : std_logic;
+	signal CONSOL_SELECT_INT : std_logic;
+	signal CONSOL_OPTION_INT : std_logic;
+
 	signal atari_keyboard : std_logic_vector(63 downto 0);
 	SIGNAL	SHIFT_PRESSED :  STD_LOGIC;
 	SIGNAL	BREAK_PRESSED :  STD_LOGIC;
 	SIGNAL	CONTROL_PRESSED :  STD_LOGIC;
 BEGIN
-	keyboard1: ps2_keyboard
+	keyboard1: entity work.ps2_keyboard
 	PORT MAP
 	( 
 		CLK => CLK,
@@ -74,7 +83,7 @@
 	end process;
 
 	-- map to atari key code
-	process(keyboard)
+	process(ps2_keys_reg)
 	begin
 		atari_keyboard <= (others=>'0');
 
@@ -81,71 +90,71 @@
 		shift_pressed <= '0';
 		control_pressed <= '0';
 		break_pressed <= '0';
-		consol_start <= '0';
-		consol_select <= '0';
-		consol_option <= '0';
+		consol_start_int <= '0';
+		consol_select_int <= '0';
+		consol_option_int <= '0';
 
-		atari_keyboard(63)<=ps2_keys_regs(X"1C");
-		atari_keyboard(21)<=ps2_keys_regs(X"32");
-		atari_keyboard(18)<=ps2_keys_regs(X"21");
-		atari_keyboard(58)<=ps2_keys_regs(X"23");
-		atari_keyboard(42)<=ps2_keys_regs(X"24");
-		atari_keyboard(56)<=ps2_keys_regs(X"2B");
-		atari_keyboard(61)<=ps2_keys_regs(X"34");
-		atari_keyboard(57)<=ps2_keys_regs(X"33");
-		atari_keyboard(13)<=ps2_keys_regs(X"43");
-		atari_keyboard(1)<=ps2_keys_regs(X"3B");
-		atari_keyboard(5)<=ps2_keys_regs(X"42");
-		atari_keyboard(0)<=ps2_keys_regs(X"4B");
-		atari_keyboard(37)<=ps2_keys_regs(X"3A");
-		atari_keyboard(35)<=ps2_keys_regs(X"31");
-		atari_keyboard(8)<=ps2_keys_regs(X"44");
-		atari_keyboard(10)<=ps2_keys_regs(X"4D");
-		atari_keyboard(47)<=ps2_keys_regs(X"15");
-		atari_keyboard(40)<=ps2_keys_regs(X"2D");
-		atari_keyboard(62)<=ps2_keys_regs(X"1B");
-		atari_keyboard(45)<=ps2_keys_regs(X"2C");
-		atari_keyboard(11)<=ps2_keys_regs(X"3C");
-		atari_keyboard(16)<=ps2_keys_regs(X"2A");
-		atari_keyboard(46)<=ps2_keys_regs(X"1D");
-		atari_keyboard(22)<=ps2_keys_regs(X"22");
-		atari_keyboard(43)<=ps2_keys_regs(X"35");
-		atari_keyboard(23)<=ps2_keys_regs(X"1A");
-		atari_keyboard(50)<=ps2_keys_regs(X"45");
-		atari_keyboard(31)<=ps2_keys_regs(X"16");
-		atari_keyboard(30)<=ps2_keys_regs(X"1E");
-		atari_keyboard(26)<=ps2_keys_regs(X"26");
-		atari_keyboard(24)<=ps2_keys_regs(X"25");
-		atari_keyboard(29)<=ps2_keys_regs(X"2E");
-		atari_keyboard(27)<=ps2_keys_regs(X"36");
-		atari_keyboard(51)<=ps2_keys_regs(X"3D");
-		atari_keyboard(53)<=ps2_keys_regs(X"3E");
-		atari_keyboard(48)<=ps2_keys_regs(X"46");
-		atari_keyboard(17)<=ps2_keys_regs(X"ec");
-		atari_keyboard(52)<=ps2_keys_regs(X"66");
-		atari_keyboard(28)<=ps2_keys_regs(X"76");
-		atari_keyboard(39)<=ps2_keys_regs(X"91");
-		atari_keyboard(60)<=ps2_keys_regs(X"58");
-		atari_keyboard(44)<=ps2_keys_regs(X"0D");
-		atari_keyboard(12)<=ps2_keys_regs(X"5A");
-		atari_keyboard(33)<=ps2_keys_regs(X"29");
-		atari_keyboard(54)<=ps2_keys_regs(X"4E");
-		atari_keyboard(55)<=ps2_keys_regs(X"55");
-		atari_keyboard(15)<=ps2_keys_regs(X"5B");
-		atari_keyboard(14)<=ps2_keys_regs(X"54");
-		atari_keyboard(6)<=ps2_keys_regs(X"52");
-		atari_keyboard(7)<=ps2_keys_regs(X"5D");
-		atari_keyboard(38)<=ps2_keys_regs(X"4A");
-		atari_keyboard(2)<=ps2_keys_regs(X"4C");
-		atari_keyboard(32)<=ps2_keys_regs(X"41");
-		atari_keyboard(34)<=ps2_keys_regs(X"49");
+		atari_keyboard(63)<=ps2_keys_reg(16#1C#);
+		atari_keyboard(21)<=ps2_keys_reg(16#32#);
+		atari_keyboard(18)<=ps2_keys_reg(16#21#);
+		atari_keyboard(58)<=ps2_keys_reg(16#23#);
+		atari_keyboard(42)<=ps2_keys_reg(16#24#);
+		atari_keyboard(56)<=ps2_keys_reg(16#2B#);
+		atari_keyboard(61)<=ps2_keys_reg(16#34#);
+		atari_keyboard(57)<=ps2_keys_reg(16#33#);
+		atari_keyboard(13)<=ps2_keys_reg(16#43#);
+		atari_keyboard(1)<=ps2_keys_reg(16#3B#);
+		atari_keyboard(5)<=ps2_keys_reg(16#42#);
+		atari_keyboard(0)<=ps2_keys_reg(16#4B#);
+		atari_keyboard(37)<=ps2_keys_reg(16#3A#);
+		atari_keyboard(35)<=ps2_keys_reg(16#31#);
+		atari_keyboard(8)<=ps2_keys_reg(16#44#);
+		atari_keyboard(10)<=ps2_keys_reg(16#4D#);
+		atari_keyboard(47)<=ps2_keys_reg(16#15#);
+		atari_keyboard(40)<=ps2_keys_reg(16#2D#);
+		atari_keyboard(62)<=ps2_keys_reg(16#1B#);
+		atari_keyboard(45)<=ps2_keys_reg(16#2C#);
+		atari_keyboard(11)<=ps2_keys_reg(16#3C#);
+		atari_keyboard(16)<=ps2_keys_reg(16#2A#);
+		atari_keyboard(46)<=ps2_keys_reg(16#1D#);
+		atari_keyboard(22)<=ps2_keys_reg(16#22#);
+		atari_keyboard(43)<=ps2_keys_reg(16#35#);
+		atari_keyboard(23)<=ps2_keys_reg(16#1A#);
+		atari_keyboard(50)<=ps2_keys_reg(16#45#);
+		atari_keyboard(31)<=ps2_keys_reg(16#16#);
+		atari_keyboard(30)<=ps2_keys_reg(16#1E#);
+		atari_keyboard(26)<=ps2_keys_reg(16#26#);
+		atari_keyboard(24)<=ps2_keys_reg(16#25#);
+		atari_keyboard(29)<=ps2_keys_reg(16#2E#);
+		atari_keyboard(27)<=ps2_keys_reg(16#36#);
+		atari_keyboard(51)<=ps2_keys_reg(16#3D#);
+		atari_keyboard(53)<=ps2_keys_reg(16#3E#);
+		atari_keyboard(48)<=ps2_keys_reg(16#46#);
+		atari_keyboard(17)<=ps2_keys_reg(16#ec#);
+		atari_keyboard(52)<=ps2_keys_reg(16#66#);
+		atari_keyboard(28)<=ps2_keys_reg(16#76#);
+		atari_keyboard(39)<=ps2_keys_reg(16#91#);
+		atari_keyboard(60)<=ps2_keys_reg(16#58#);
+		atari_keyboard(44)<=ps2_keys_reg(16#0D#);
+		atari_keyboard(12)<=ps2_keys_reg(16#5A#);
+		atari_keyboard(33)<=ps2_keys_reg(16#29#);
+		atari_keyboard(54)<=ps2_keys_reg(16#4E#);
+		atari_keyboard(55)<=ps2_keys_reg(16#55#);
+		atari_keyboard(15)<=ps2_keys_reg(16#5B#);
+		atari_keyboard(14)<=ps2_keys_reg(16#54#);
+		atari_keyboard(6)<=ps2_keys_reg(16#52#);
+		atari_keyboard(7)<=ps2_keys_reg(16#5D#);
+		atari_keyboard(38)<=ps2_keys_reg(16#4A#);
+		atari_keyboard(2)<=ps2_keys_reg(16#4C#);
+		atari_keyboard(32)<=ps2_keys_reg(16#41#);
+		atari_keyboard(34)<=ps2_keys_reg(16#49#);
 
-		consol_start<=ps2_keys_regs(X"06");
-		consol_select<=ps2_keys_regs(X"04");
-		consol_option<=ps2_keys_regs(X"0C");
-		shift_pressed<=ps2_keys_regs(X"12") or ps2_keys_regs(X"59");
-		control_pressed<=ps2_keys_regs(X"14") or ps2_keys_regs(X"94");
-		break_pressed<=ps2_keys_reg(X"77");
+		consol_start_int<=ps2_keys_reg(16#06#);
+		consol_select_int<=ps2_keys_reg(16#04#);
+		consol_option_int<=ps2_keys_reg(16#0C#);
+		shift_pressed<=ps2_keys_reg(16#12#) or ps2_keys_reg(16#59#);
+		control_pressed<=ps2_keys_reg(16#14#) or ps2_keys_reg(16#94#);
+		break_pressed<=ps2_keys_reg(16#77#);
 	end process;
 
 	-- provide results as if we were a grid to pokey...
@@ -169,5 +178,10 @@
 				keyboard_response(1) <= '0';
 			end if;
 	end process;		 
+
+	-- outputs
+	CONSOL_START <= CONSOL_START_INT;
+	CONSOL_SELECT <= CONSOL_SELECT_INT;
+	CONSOL_OPTION <= CONSOL_OPTION_INT;
 END vhdl;
 
Index: common/atari800core_helloworld.cmd
===================================================================
--- common/atari800core_helloworld.cmd	(nonexistent)
+++ common/atari800core_helloworld.cmd	(revision 4)
@@ -0,0 +1,6 @@
+#onerror {resume}
+# GAME
+#=====================
+#run 18871970 ns
+#isim force add {/replay_tb/uut/tpp2/cpu/dd_s} 11111111 -radix bin -cancel 250 ns 
+#run 200 ms
Index: common/atari800core_helloworld.wcfg
===================================================================
--- common/atari800core_helloworld.wcfg	(nonexistent)
+++ common/atari800core_helloworld.wcfg	(revision 4)
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wave_config>
+   <wave_state>
+   </wave_state>
+   <db_ref_list>
+      <db_ref path="atari800core_helloworld.wdb" id="1" type="auto">
+         <top_modules>
+            <top_module name="atari800core_helloworld_tb" />
+            <top_module name="attributes" />
+            <top_module name="math_real" />
+            <top_module name="numeric_std" />
+            <top_module name="std_logic_1164" />
+            <top_module name="std_logic_arith" />
+            <top_module name="std_logic_misc" />
+            <top_module name="std_logic_textio" />
+            <top_module name="std_logic_unsigned" />
+            <top_module name="textio" />
+         </top_modules>
+      </db_ref>
+   </db_ref_list>
+   <WVObjectSize size="20" />
+   <wvobject fp_name="/atari800core_helloworld_tb/clk_a" type="logic" db_ref_id="1">
+      <obj_property name="ElementShortName">clk_a</obj_property>
+      <obj_property name="ObjectShortName">clk_a</obj_property>
+   </wvobject>
+   <wvobject fp_name="/atari800core_helloworld_tb/atari800xl/atarixl_simple_sdram1/atari800xl/cpu6502/di" type="array" db_ref_id="1">
+      <obj_property name="ElementShortName">di[7:0]</obj_property>
+      <obj_property name="ObjectShortName">di[7:0]</obj_property>
+      <obj_property name="Radix">HEXRADIX</obj_property>
+   </wvobject>
+   <wvobject fp_name="/atari800core_helloworld_tb/atari800xl/atarixl_simple_sdram1/atari800xl/cpu6502/a" type="array" db_ref_id="1">
+      <obj_property name="ElementShortName">a[15:0]</obj_property>
+      <obj_property name="ObjectShortName">a[15:0]</obj_property>
+      <obj_property name="Radix">HEXRADIX</obj_property>
+   </wvobject>
+   <wvobject fp_name="/atari800core_helloworld_tb/atari800xl/atarixl_simple_sdram1/atari800xl/cpu6502/reset" type="logic" db_ref_id="1">
+      <obj_property name="ElementShortName">reset</obj_property>
+      <obj_property name="ObjectShortName">reset</obj_property>
+   </wvobject>
+   <wvobject fp_name="/atari800core_helloworld_tb/atari800xl/atarixl_simple_sdram1/atari800xl/cpu6502/cpu_enable" type="logic" db_ref_id="1">
+      <obj_property name="ElementShortName">cpu_enable</obj_property>
+      <obj_property name="ObjectShortName">cpu_enable</obj_property>
+   </wvobject>
+   <wvobject fp_name="/atari800core_helloworld_tb/atari800xl/atarixl_simple_sdram1/atari800xl/enables/oldcpu_enable" type="logic" db_ref_id="1">
+      <obj_property name="ElementShortName">oldcpu_enable</obj_property>
+      <obj_property name="ObjectShortName">oldcpu_enable</obj_property>
+   </wvobject>
+   <wvobject fp_name="/atari800core_helloworld_tb/atari800xl/atarixl_simple_sdram1/atari800xl/enables/cpu_enable_out" type="logic" db_ref_id="1">
+      <obj_property name="ElementShortName">cpu_enable_out</obj_property>
+      <obj_property name="ObjectShortName">cpu_enable_out</obj_property>
+   </wvobject>
+   <wvobject fp_name="/atari800core_helloworld_tb/atari800xl/atarixl_simple_sdram1/atari800xl/enables/antic_enable_179" type="logic" db_ref_id="1">
+      <obj_property name="ElementShortName">antic_enable_179</obj_property>
+      <obj_property name="ObjectShortName">antic_enable_179</obj_property>
+   </wvobject>
+   <wvobject fp_name="/atari800core_helloworld_tb/atari800xl/atarixl_simple_sdram1/atari800xl/enables/pokey_enable_179" type="logic" db_ref_id="1">
+      <obj_property name="ElementShortName">pokey_enable_179</obj_property>
+      <obj_property name="ObjectShortName">pokey_enable_179</obj_property>
+   </wvobject>
+   <wvobject fp_name="/atari800core_helloworld_tb/atari800xl/atarixl_simple_sdram1/atari800xl/pokey1/enable_179" type="logic" db_ref_id="1">
+      <obj_property name="ElementShortName">enable_179</obj_property>
+      <obj_property name="ObjectShortName">enable_179</obj_property>
+   </wvobject>
+   <wvobject fp_name="/atari800core_helloworld_tb/atari800xl/atarixl_simple_sdram1/atari800xl/enables/throttle_count_6502" type="array" db_ref_id="1">
+      <obj_property name="ElementShortName">throttle_count_6502[5:0]</obj_property>
+      <obj_property name="ObjectShortName">throttle_count_6502[5:0]</obj_property>
+   </wvobject>
+   <wvobject fp_name="/atari800core_helloworld_tb/atari800xl/atarixl_simple_sdram1/atari800xl/enables/throttle_count_reg" type="array" db_ref_id="1">
+      <obj_property name="ElementShortName">throttle_count_reg[5:0]</obj_property>
+      <obj_property name="ObjectShortName">throttle_count_reg[5:0]</obj_property>
+   </wvobject>
+   <wvobject fp_name="/atari800core_helloworld_tb/atari800xl/atarixl_simple_sdram1/atari800xl/enables/pause_6502" type="logic" db_ref_id="1">
+      <obj_property name="ElementShortName">pause_6502</obj_property>
+      <obj_property name="ObjectShortName">pause_6502</obj_property>
+   </wvobject>
+   <wvobject fp_name="/atari800core_helloworld_tb/reset_n" type="logic" db_ref_id="1">
+      <obj_property name="ElementShortName">reset_n</obj_property>
+      <obj_property name="ObjectShortName">reset_n</obj_property>
+   </wvobject>
+   <wvobject fp_name="/atari800core_helloworld_tb/atari800xl/atarixl_simple_sdram1/internalromram1/rom_data" type="array" db_ref_id="1">
+      <obj_property name="ElementShortName">rom_data[7:0]</obj_property>
+      <obj_property name="ObjectShortName">rom_data[7:0]</obj_property>
+      <obj_property name="Radix">HEXRADIX</obj_property>
+   </wvobject>
+   <wvobject fp_name="/atari800core_helloworld_tb/atari800xl/atarixl_simple_sdram1/internalromram1/rom_addr" type="array" db_ref_id="1">
+      <obj_property name="ElementShortName">rom_addr[21:0]</obj_property>
+      <obj_property name="ObjectShortName">rom_addr[21:0]</obj_property>
+      <obj_property name="Radix">HEXRADIX</obj_property>
+   </wvobject>
+   <wvobject fp_name="/atari800core_helloworld_tb/atari800xl/atarixl_simple_sdram1/internalromram1/ram_data_in" type="array" db_ref_id="1">
+      <obj_property name="ElementShortName">ram_data_in[7:0]</obj_property>
+      <obj_property name="ObjectShortName">ram_data_in[7:0]</obj_property>
+      <obj_property name="Radix">HEXRADIX</obj_property>
+   </wvobject>
+   <wvobject fp_name="/atari800core_helloworld_tb/atari800xl/atarixl_simple_sdram1/internalromram1/ram_data" type="array" db_ref_id="1">
+      <obj_property name="ElementShortName">ram_data[7:0]</obj_property>
+      <obj_property name="ObjectShortName">ram_data[7:0]</obj_property>
+      <obj_property name="Radix">HEXRADIX</obj_property>
+   </wvobject>
+   <wvobject fp_name="/atari800core_helloworld_tb/atari800xl/atarixl_simple_sdram1/internalromram1/ram_addr" type="array" db_ref_id="1">
+      <obj_property name="ElementShortName">ram_addr[18:0]</obj_property>
+      <obj_property name="ObjectShortName">ram_addr[18:0]</obj_property>
+      <obj_property name="Radix">HEXRADIX</obj_property>
+   </wvobject>
+   <wvobject fp_name="/atari800core_helloworld_tb/atari800xl/atarixl_simple_sdram1/internalromram1/ram_wr_enable" type="logic" db_ref_id="1">
+      <obj_property name="ElementShortName">ram_wr_enable</obj_property>
+      <obj_property name="ObjectShortName">ram_wr_enable</obj_property>
+   </wvobject>
+</wave_config>
Index: common/simulate.sh
===================================================================
--- common/simulate.sh	(nonexistent)
+++ common/simulate.sh	(revision 4)
@@ -0,0 +1,65 @@
+#!/bin/bash
+
+echo "---------------------------------------------------------"
+echo "Use 'simulate -run' to skip compilation stage."
+echo "Use 'simulate -view' to show previous simulation results."
+echo "---------------------------------------------------------"
+
+name=atari800core_helloworld
+
+
+
+. /home/markw/fpga/xilinx/14.7/ISE_DS/settings64.sh
+
+mkdir -p sim
+pushd sim
+
+# if we have a WDB file, we can view it if requested (otherwise we remove it)
+if [ ! -e $name.wdb -o "$1" != "-view" ]; then
+
+    rm -f $name.wdb
+
+    # if we have a EXE, we can run it if requested (otherwise we remove it)
+    if [ ! -e $name.exe -o "$1" != "-run" ]; then
+
+        rm -f $name.exe
+
+        # copy testbench files
+        cp -p ../tb/* .
+
+        # copy source files
+	cp `find ../a8core/ -iname "*.vhd"` .
+	cp `find ../a8core/ -iname "*.vhdl"` .
+	cp `find ../components/ -iname "*.vhd"` .
+	cp `find ../components/ -iname "*.vhdl"` .
+
+        # set up project definition file
+	ls *.vhd* | perl -e 'while (<>){s/(.*)/vhdl work $1/;print $_;}' | cat > $name.prj
+	echo NumericStdNoWarnings = 1 >> xilinxsim.ini
+
+        # verbose & no multthreading - fallback in case of problems
+        # fuse -v 1 -mt off -incremental -prj %name%.prj -o %name%.exe -t %name%
+
+        fuse -timeprecision_vhdl 1fs -incremental -prj $name.prj -o $name.exe -t ${name}_tb || exit 1
+        # fuse --mt off -prj %name%.prj -o %name%.exe -t %name%_tb
+
+        # Check for the EXE again, independent of the errorlevel of fuse...
+        [ -e $name.exe ] || echo "No simulation executable created"
+
+
+    fi
+
+    # Open the iSIM GUI and run the simulation
+    ./$name.exe -gui -f ../$name.cmd -wdb $name.wdb -log $name.log -view ../$name.wcfg || exit 1
+    #strace ./$name.exe -gui -f ../$name.cmd -wdb $name.wdb -log $name.log -view ../$name.wcfg >& out
+    #./$name.exe -h -log $name.log 
+
+
+else
+
+    # Only start the viewer on an existing wave configuration (from an old simulation)
+    isimgui -view ../$name.wcfg || exit 1
+
+fi
+
+popd

Property changes on: common/simulate.sh
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: common/tb/atari800core_helloworld_tb.vhd
===================================================================
--- common/tb/atari800core_helloworld_tb.vhd	(nonexistent)
+++ common/tb/atari800core_helloworld_tb.vhd	(revision 4)
@@ -0,0 +1,84 @@
+library ieee;
+  use ieee.std_logic_1164.all;
+  use ieee.std_logic_unsigned.all;
+  use ieee.numeric_std.all;
+  use ieee.std_logic_textio.all;
+
+library std_developerskit ; -- used for to_string
+--  use std_developerskit.std_iopak.all;
+
+entity atari800core_helloworld_tb is
+end;
+
+architecture rtl of atari800core_helloworld_tb is
+
+  constant CLK_A_PERIOD : time := 1 us / (1.79*32);
+
+  signal VGA_VS : std_logic;
+  signal VGA_HS : std_logic;
+
+  signal VGA_G : std_logic_vector(7 downto 0);
+  signal VGA_B : std_logic_vector(7 downto 0);
+  signal VGA_R : std_logic_vector(7 downto 0);
+
+  signal AUDIO_L : std_logic_vector(15 downto 0);
+  signal AUDIO_R : std_logic_vector(15 downto 0);
+
+  signal JOY1_n : std_logic_vector(4 downto 0);
+  signal JOY2_n : std_logic_vector(4 downto 0);
+
+  signal PS2_CLK : std_logic;
+  signal PS2_DAT : std_logic;
+
+  signal CLK_A : std_logic;
+
+  signal reset_n : std_logic;
+
+begin
+	p_clk_gen_a : process
+	begin
+	clk_a <= '1';
+	wait for CLK_A_PERIOD/2;
+	clk_a <= '0';
+	wait for CLK_A_PERIOD - (CLK_A_PERIOD/2 );
+	end process;
+
+	reset_n <= '0', '1' after 1000ns;
+
+	JOY1_n <= (others=>'1');
+	JOY2_n <= (others=>'1');
+
+	PS2_CLK <= '1';
+	PS2_DAT <= '1';
+
+atari800xl : entity work.atari800core_helloworld
+	GENERIC MAP
+	(
+		cycle_length => 32,
+		internal_ram => 16384
+	)
+	PORT MAP
+	(
+		CLK => clk_a,
+		RESET_N => reset_n,
+
+		VGA_VS => vga_vs,
+		VGA_HS => vga_hs,
+		VGA_B => vga_b,
+		VGA_G => vga_g,
+		VGA_R => vga_r,
+
+		AUDIO_L => audio_l,
+		AUDIO_R => audio_r,
+
+		JOY1_n => joy1_n,
+		JOY2_n => joy2_n,
+
+		PS2_CLK => ps2_clk,
+		PS2_DAT => ps2_dat,
+
+		PAL => '1'
+	);
+
+end rtl;
+
