****** Algorithme de compression ******

nbbitplanes	equ	4	; Nbbits par pixel.
nbbits_rept	equ	8	; Nbbits pour compter les repts.
length		equ	320	; Longueur de l'image.
heigth		equ	200	; Hauteur de l'image.

main_proggy:
  remplir la BSS avec des 0
  nbrept_max==2^nbbits_rept-1
boucle1: x==0 a (heigth-1)
  boucle2: y==0 a (length-1)
    si pixels_tab(x;y)=1 => jmp fin_boucle2
    color==image(x;y)
    mettre 0 sur 1 bit dans codage
    mettre color sur nbbitplanes bits dans codage
    (x2;y2)==(x;y)
    next_dir:
      maxnbrept==0
      maxdir==0
      boucle3: dir==0 a 7
        (x3;y3)==(x2;y2)
        nbrept==0
        calcul_nbrept:
          (x3;y3)==(x3;y3)+directions(dir)
          si x3<0 ou x3>(length-1) => jmp fin_calcul
          si y3<0 ou y3>(heigth-1) => jmp fin_calcul
          si pixels_tab(x3;y3)=1 => jmp calcul_nbrept
          si image(x3;y3)<>color => jmp fin_calcul
          nbrept==nbrept+1
          si nbrept=nbrept_max => jmp fin_calcul
          jmp calcul_nbrept
        fin_calcul
        si nbrept>maxnbrept => maxnbrept==nbrept et maxdir==dir
      fin_boucle3
      si maxnbrept<(nbbits_rept+3+1)/nbbitplanes => jmp fin_nextdir
      mettre 1 sur 1 bit dans codage
      mettre maxdir sur 3 bits dans codage
      mettre maxnbrept sur nbbits_rept bits dans codage
      maxnbrept==maxnbrept-1
      boucle4:
        (x2;y2)==(x2;y2)+directions(maxdir)
        si pixels_tab(x2;y2)=1 => jmp boucle4
        pixels_tab(x2;y2)==1
      dbra maxnbrept,boucle4
      jmp next_dir
    fin_nextdir:
  fin_boucle2:
fin_boucle1:

** section BSS **
  pixels_tab	length*heigth bits	; Pour savoir si un pixel est traite.
  color			longword	; Devinette.
  dir			longword	; Sert avec le tableau directions.
  nbrept		longword	; Pour stocker le nb de repetitions.
  maxnbrept		longword	; Maximum des 8 directions.
  nbrept_max		longword	; Maximum reel.
  maxdir		longword	; Dir qui offre maxnbrept.
  x,y,x2,y2,x3,y3	longwords	; Re-devinette.
  codage		???		; Le fichier packe.

** section DATA **
  image		length*heigth*nbbitplanes bits
  directions	(1;0)~(0;1)~(-1;0)~(0;-1)
  		(1;1)~(-1;1)~(-1;-1)~(1;-1)
