ive solved the problem with this code to divide x by 256:

Code:
IF x.31 then                 ' if negative:
    x=~x+1                   ' convert from 2s complement
    x=x>>8                   ' shift
    x=~(x-1)                 ' convert back to 2s complement
    x.31=1                   ' set signed bit (negative)
    if x=$80000000 then x=0  ' negative 0 is 0
ELSE                         ' else (positive):
    x=x>>8                   ' shift
ENDIF