solved it myself

here's the function i use now, in case someone ever needs it. Is the function good written ? i really have no clue, i'm happy most of the time when it works If someone has some comments please tell !

Code:
function SDL_movepallete(Surface : PSDL_Surface; Movedown : boolean) : boolean;
var
 Pal : TSDL_ColorArray;
 Temp : TSDL_Color;
 Tel : integer;
begin

 //check if surface has 8 bits per pixel
 if surface.format.BitsPerPixel <> 8 then
 begin
  SDL_movepallete &#58;= false;
  exit;
 end;

 // Get the current palette from the surface
  CopyMemory&#40;@Pal,Surface.Format.Palette.Colors,256*sizeof&#40;TSDL_Color&#41;&#41;;

 if Movedown then
 begin
  Temp &#58;= Pal&#91;255&#93;;
  for Tel &#58;= 254 downto  0  do Pal&#91;Tel+1&#93; &#58;= Pal&#91;Tel&#93;;
  Pal&#91;0&#93; &#58;= Temp;
 end
 else
 begin
  Temp &#58;= Pal&#91;0&#93;;
  for Tel &#58;= 0 to 254 do Pal&#91;tel&#93; &#58;= Pal&#91;tel+1&#93;;
  Pal&#91;255&#93; &#58;= Temp;
 end;

 //return true if the pallete has been succesfully set & rotated
 SDL_movepallete &#58;= &#40;SDL_SetPalette&#40;Surface,SDL_LOGPAL or SDL_PHYSPAL,@Pal,0,256&#41; = 1&#41;

end;