Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* TriBulle : Programme du laboratoitre #4
- Entree : aucune.
- Sortie : Tableau trié
- Auteur : Benjamin Ross (15 092 061)
- Antoine Theberge (15 092 016)
- */
- .global TriBulle
- .section ".text" ! section d'instructions
- TriBulle:
- setx tabNon,%l7,%l0
- setx tabTri,%l7,%l1
- setx ptfmt1,%l7,%o0
- call printf
- clr %l2
- TriBulle0:
- setx pftmt3,%l7,%o0
- lduw [%l0+%l2],%o1
- call printf
- nop
- inc 4,%l2
- sub %l2,40,%l3
- brlz %l3,TriBulle0
- nop
- setx ptfmt4,%l7,%o0
- call printf
- nop
- clr %l2
- TriBulle03:
- lduw [%l0+%l2],%l3
- stuw %l3,[%l1+%l2]
- inc 4,%l2
- cmp %l2,48
- bl TriBulle03
- nop
- TriBulle05:
- mov 40,%l2 ! i/n
- TriBulle10:
- clr %l3 ! j
- TriBulle11:
- lduw [%l1+%l3],%l4
- add %l3,4,%l6
- lduw [%l1+%l6],%l5
- cmp %l4,%l5
- ble TriBulle20
- nop
- TriBulle15:
- stuw %l5,[%l1+%l3]
- stuw %l4,[%l1+%l6]
- nop
- TriBulle20:
- inc 4,%l3
- add %l3,4,%l6
- cmp %l6,%l2
- bge TriBulle25
- nop
- ba TriBulle11
- nop
- TriBulle25: ! Outer Loop
- dec 4,%l2
- brlez %l2,TriBulle50
- nop
- ba TriBulle10
- nop
- TriBulle50:
- setx ptfmt2,%l7,%o0
- call printf
- nop
- clr %l2
- TriBulle51: ! Affichage final
- setx pftmt3,%l7,%o0
- lduw [%l1+%l2],%o1
- call printf
- nop
- inc 4,%l2
- sub %l2,40,%l3
- brlz %l3,TriBulle51
- nop
- setx ptfmt4,%l7,%o0
- call printf
- nop
- TriBulle100:
- ! terminaison du programme
- clr %o0 ! 1er parametre
- call fflush ! vidange des tampons de fichiers
- nop
- clr %o0 ! 1er parametre
- call exit ! sortie du programme
- nop
- /* Definition des donnees */
- .section ".bss" ! section de donnees non initialisees
- .align 4
- tabTri: .skip 4*10
- .section ".rodata" ! section de donnees en lecture seulement
- ptfmt1: .asciz "Tableau non trie: \n"
- ptfmt2: .asciz "Tableau trie: \n"
- pftmt3: .asciz "%d "
- ptfmt4: .asciz "\n"
- .align 4
- tabNon: .word 15,2,65,54,8,12,61,32,94,88
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement