--- a/fpga/examples/pong/draw.vhd
+++ b/fpga/examples/pong/draw.vhd
@@ -11,7 +11,6 @@
     palet_height : positive := 20
   );
   port (
-    update : in std_logic;
     x_pixel : in integer range 0 to 639;
     y_pixel : in integer range 0 to 479;
     ball_x : in integer range 0 to size_x - 1;
@@ -27,26 +26,21 @@
 
   constant left_empty : natural := palet_width * 2;
   constant up_empty : natural := 20;
-
+  constant ball_radius : natural := 3;
+  constant width_border : natural := 2;
+  
   signal current_x : integer;
   signal current_y : integer;
   
   signal px : integer;
   signal py : integer;
-  signal locx : integer range 0 to 3;
-  signal locy : integer range 0 to 3;
   signal tmpx : natural;
   signal tmpy : natural;
 
   signal in_ball : std_logic;
   signal in_palet_l : std_logic;
   signal in_palet_r : std_logic;
-
-  constant rom : rom_type :=
-    ((1,3,0,0),
-     (2,1,3,0),
-     (0,2,1,3),
-     (0,0,0,1));
+  signal in_border : std_logic;
 begin
 
   current_x <= x_pixel - left_empty;
@@ -58,71 +52,24 @@
   tmpx <= abs (current_x - px);
   tmpy <= abs (current_y - py);
 
-  in_ball <= '1' when (tmpx <= 3) and (tmpy <= 3)
+  in_ball <= '1' when (tmpx*tmpx + tmpy*tmpy <= ball_radius*ball_radius)
                  else '0';
 
   in_palet_l <= '1' when current_x <= 0
                          and current_x >= -palet_width
-                         and abs ( current_x - palet_l ) <= palet_height / 2
+                         and abs ( current_y - palet_l ) <= palet_height / 2
                     else '0';
-  in_palet_r <= '1' when current_x >= size_y
-                         and current_x <= size_y + palet_width
-                         and abs ( current_x - palet_r ) <= palet_height / 2
+  in_palet_r <= '1' when current_x >= size_x
+                         and current_x <= size_x + palet_width
+                         and abs ( current_y - palet_r ) <= palet_height / 2
                     else '0';
-  
-  --locx <= tmpx when tmpx <= 3 else 3;
-  --locy <= tmpy when tmpy <= 3 else 0;
 
-  --with rom(locx,locy) select
-  --  color <=
-  --  "00000000" when 0,
-  --  "11100000" when 1,
-  --  "00011100" when 2,
-  --  "00000011" when 3;
+  in_border <= '1' when current_x >= 0 and current_x < size_x
+                    and (     ( current_y <= 0 and current_y > -width_border )
+                           or ( current_y > size_y and current_y < size_y + width_border ) )
+                   else '0';
 
-  color <= "11111111" when in_ball = '1' or in_palet_l = '1' or in_palet_r = '1'
+  color <= "00111000" when in_ball = '1' or in_palet_l = '1' or in_palet_r = '1' or in_border = '1'
                       else "00000000";
-
---update_process: process (update)
---  variable x : integer := 100;
---  variable y : integer := 100;
---  variable direction_x : std_logic := '1';
---  variable direction_y : std_logic := '1';
---begin
---  if rising_edge(update) then
---    if x >= 639 and direction_x = '1'
---    then
---      direction_x := '0';
---    end if;
---    if x <= 0 and direction_x = '0'
---    then
---      direction_x := '1';
---    end if;
---    if y >= 479 and direction_y = '1'
---    then
---      direction_y := '0';
---    end if;
---    if y <= 0 and direction_y = '0'
---    then
---      direction_y := '1';
---    end if;
-
---    if direction_x = '0' then
---      x := x - 1;
---    else
---      x := x + 1;
---    end if;
---    if direction_y = '0' then
---      y := y - 1;
---    else
---      y := y + 1;
---    end if;
-
---  end if;
-
---  px <= x;
---  py <= y;
-
---end process update_process;
     
 end draw;