Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .data
- indice: .word 0
- numero: .string "3"
- mil: .word 0,1000,2000,3000,4000,5000,6000,7000,8000,9000
- centena: .word 0,100,200,300,400,500,600,700,800,900
- decena: .word 0,10 ,20, 30, 40, 50, 60, 70, 80, 90
- unidad: .word 0,1 ,2 ,3, 4, 5, 6, 7, 8, 9
- .text
- #Lectura
- la x5 numero
- la x6 indice
- lw x6 0(x6)
- loop:
- add x7 x5 x6
- lb x8 0(x7)
- beq x8 x0 carga
- addi x6 x6 1
- beq x0 x0 loop
- carga:
- #Unidad
- beq x6 x0 fin
- addi x6 x6 -1
- add x7 x5 x6
- lb x8 0(x7)
- addi x8 x8 -48
- slli x8 x8 2
- la x9 unidad
- add x15 x9 x8
- lb x9 0(x15)
- add x11 x11 x9
- #Decena
- beq x6 x0 fin
- addi x6 x6 -1
- add x7 x5 x6
- lb x8 0(x7)
- addi x8 x8 -48
- slli x8 x8 2
- la x9 decena
- add x15 x9 x8
- lb x9 0(x15)
- add x11 x11 x9
- #Centena
- beq x6 x0 fin
- addi x6 x6 -1
- add x7 x5 x6
- lb x8 0(x7)
- addi x8 x8 -48
- slli x8 x8 2
- la x9 centena
- add x15 x9 x8
- lh x9 0(x15)
- add x11 x11 x9
- #Mil
- beq x6 x0 fin
- addi x6 x6 -1
- add x7 x5 x6
- lb x8 0(x7)
- addi x8 x8 -48
- slli x8 x8 2
- la x9 mil
- add x15 x9 x8
- lh x9 0(x15)
- add x11 x11 x9
- fin:
- nop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement