Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .data
- numero: .string "1003"
- 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
- lb x6,0(x5) #x6->mil
- addi x6,x6,-48 #Paso el numero de char a ASCII
- lb x7,1(x5) #x7->centena
- addi x7,x7,-48
- lb x8,2(x5) #x8->decena
- addi x8,x8,-48
- lb x9,3(x5) #x9->unidad
- addi x9,x9,-48
- #Calculo mil
- addi x11 x0 0
- la x10 mil
- slli x6 x6 2
- add x10 x10 x6
- lw x12 0(x10)
- add x11 x11 x12
- #Calculo Centena
- la x10 centena
- slli x7 x7 2
- add x10 x10 x7
- lh x12 0(x10)
- add x11 x11 x12
- #Calculo Decena
- la x10 decena
- slli x8 x8 2
- add x10 x10 x8
- lb x12 0(x10)
- add x11 x11 x12
- #Calculo Unidad
- la x10 unidad
- slli x9 x9 2
- add x10 x10 x9
- lb x12 0(x10)
- add x11 x11 x12
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement