Skip to content
Snippets Groups Projects
Commit e88446fb authored by PEREZ-SIERRA ERIC's avatar PEREZ-SIERRA ERIC
Browse files

Fichier pour le traitement de cellules ajouté

parent c5ba3354
Branches
No related merge requests found
.data
.text
li $a0, 4 #int n = 4; argument 1 de la fonction
li $a1, 1 # int i = 1; argument 2 de la fonction
# On vient de mettre les arguments dans le bon endroit
# jal cell_lecture_bit
jal cell_mettre_bit_a1
move $s0, $v0 # pour avoir le resultat de la fonction
move $a0, $s0
li $v0, 1
syscall
li $v0, 10
syscall
cell_lecture_bit:
move $t0, $a0
move $t1, $a1
li $t2, 1
sllv $t3, $t2, $t1 # (1<<i)
and $t4, $t0, $t3 # n & (1<<i)
move $v0, $t4
jr $ra
cell_mettre_bit_a1:
move $t0, $a0
move $t1, $a1
li $t2, 1
sllv $t3, $t2, $t1 # (1<<i)
or $t4, $t0, $t3 # n & (1<<i)
move $v0, $t4
jr $ra
cell_mettre_bit_a0:
move $t0, $a0
move $t1, $a1
li $t2, 1
sllv $t3, $t2, $t1 # (1<<i)
xor $t4, $t0, $t3 # n & (1<<i)
move $v0, $t4
jr $ra
st_creer:
move $t0, $a0
mul $t0, $t0, 4 # pour avoir le bon numero à allouer
#t0 contient les bits à allouer
move $a0, $t0
li $v0, 9
syscall
# adresse du premier element de la pile dans v0
jr $ra
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