1
0
Files
Laboratori-MIPS/Laboratorio7/Esercizio1.asm
2024-03-22 13:53:19 +01:00

30 lines
489 B
NASM

.data
num: .word 3141592653
.text
.globl main
.ent main
main:
lw $t0, num
addi $t2, $0, 10
move $t3, $sp
seq_divide:
divu $t0, $t2
mfhi $t1 # remainder to $a2
mflo $t0
addi $sp, $sp, -4
sw $t1, 0($sp)
bne $t1, $0, seq_divide
print:
addi $sp, $sp, 4
lw $t0, 0($sp)
addi $a0, $t0, 48 # $t0 = $v0 - '0'
li $v0, 11
syscall
bne $sp, $t3, print
li $v0, 10
syscall
.end main