lib/serialization: add README.md
[nit.git] / contrib / pep8analysis / tests / terrasa / max_tableau.pep
1 ; Programme qui trouve le plus grand élément d'un tableau d'entiers positifs
2 ; LIMITES: Les valeurs stockées dans le tableaux doivent être positives
3 ;
4 ; Alexandre Terrasa (c) 2012
5
6          STRO    strStart, d ; print(strStart) 
7          LDX     0,i         ; X = 0
8                              ; 
9 loop:    LDA     vecteur, x  ; do { A = vecteur[X]
10          DECO    vecteur, x  ; print(vecteur[X])
11          CHARO   " ", i      ; print(" ")
12          CPA     max, d      ; 
13          BRLE    next        ;   if(vecteur[X] > max) {
14          STA     max, d      ;        max = vecteur[X] 
15                              ;   }
16 next:    ADDX    2,i         ;   X++
17          CPX     lenVec,i    
18          BRLT    loop        ; } while (X < lenVec);
19          
20          STRO    strMax, d   ; print(strMax); 
21          DECO    max,d       ; print(max);
22          STOP       
23
24 ; Déclaration du tableau         
25 vecteur: .WORD   5           ; un vecteur d'octets
26          .WORD   6           
27          .WORD   12           
28          .WORD   7           
29          .WORD   8           
30 lenVec:  .EQUATE 10          ; taille du vecteur (en octets)
31
32 ; Autres variables
33 max:     .WORD   -1        ; #2d max du vecteur
34 strStart:.ASCII  "Valeurs contenues dans le tableau: \x00"
35 strMax:  .ASCII  "\nMax: \x00"
36
37          .END