Skip to content
Snippets Groups Projects
Commit 96a89806 authored by AMIRAT LYDIA's avatar AMIRAT LYDIA
Browse files

commit

parents 9fffd196 22a1ec9a
No related merge requests found
......@@ -4,6 +4,7 @@
.text:
main:
<<<<<<< HEAD
li $a0,1010101
li $a1,2#stocker dans a1 le i=3, c'est a dire on met le bit d'index 3 de 0 a 1
jal cell_lecture_bit
......@@ -57,16 +58,55 @@ cell_mettre_bit_a0:
sub_pow_10: #sub function used to init pow_10
li $a1,1
j pow_10
=======
li $a0 4
jal sub_pow_init
move $a0 $v1
li $v0 1
syscall
j Exit
cell_lecture_bit:
pow_10: #function to get the 10**n for a given n
#the function cell_lecture_bit takes an int coded on 32 bytes,
li $t0, 31
sub $a1, $t0, $a1 # modify the value to get a shift of 31 -I digits
sllv $a0, $a0,$a1
srl $a0, $a0,31
move $v0 $a0
jr $ra
<<<<<<< HEAD
sub_pow_init:
addi $sp $sp -4
sw $ra 0($sp)
li $v1, 1
>>>>>>> 22a1ec9a0c88a023c2c5e6254e73714c653e6988
j pow_10
=======
>>>>>>> 5b1a44c68dcf856d2de5367f6bf981a9b8b3c4fc
pow_10: #function to get the 10**n for a given n
#prolog
#mettre l'addresse de Ra dans la pile sp
beq $a0,$zero,continue ##rename for loop later in the code
li $a2, 10
mul $a1, $a1,$a2
mul $v1, $v1,$a2
addi $a0,$a0,-1
b pow_10
continue:
lw $ra 0($sp)
jr $ra
Exit:
li $v0, 10
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment