cours_progra/q2/fonctio/tp2/spim-strlen-strcomp.s
2023-05-08 14:10:56 +02:00

38 lines
359 B
ArmAsm

.data
txt: .asciiz "anthony Debucquoy"
.text
main:
la $a0, txt
addiu $sp, $sp, -4
sw $ra, 0($sp)
jal strlen
lw $ra, 0($sp)
addiu $sp, $sp, 4
move $a0, $v0
li $v0, 1
syscall
j fctend
strlen:
li $v0, 0
li $t1, 0
strloop:
lb $t0, 0($a0)
beq $t0, $zero, fctend
addiu $a0, $a0, 1
addiu $v0, $v0, 1
j strloop
strcmp:
fctend:
jr $ra