feat: Initial commit
This commit is contained in:
30
Laboratorio7/Esercizio1.asm
Normal file
30
Laboratorio7/Esercizio1.asm
Normal file
@@ -0,0 +1,30 @@
|
||||
.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
|
||||
Reference in New Issue
Block a user