Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .DATA
- valInit DW 6 ; initialisation de valInit à 6
- fact DSW 1 ; factoriel non initialisé sur 1 mot
- .CODE
- LD R0, 1 ; R0 = 1
- LD R1, 2 ; R1 = 2
- boucle: CMP R1, valInit ; On compare R1 à valInit
- BGTU fin ; Si R1 > valInit alors on passe à fin
- MUL R0, R1 ; R0 = R0 * R1
- INC R1 ; On incrémente R1
- JMP boucle ; on retourne au début de la boucle
- fin: ST R0, fact ; On stock le reésultat dans R0
- HLT ; Fin du programme
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement