-3

Write a program that reads 10 numbers from the keyboard and store them in memory. Then it prints the numbers in reverse order and print their sum. In addition to indicate a variable which takes as argument a letter of the alphabet and print the ascii number. Can you help ?

.data
pin:.space 40
.text
.globl main
main: addi $20, $0, 10
      addi $17, $0, 0
      addi $6, $0, 0
loop: addi $2, $0, 5
      syscall
      add $7, $0, $2
      sw $7, pin($6)
      addi $17, $17, 1
      addi $6, $6, 4
      bne $20, $17, loop
      addi $17, $0, 0
      addi $6, $0, 0
loop1:lw $8,pin($6)
      addi $2,$0,1
      add $4,$8,$0
      syscall
      addi $17,$17,1
      addi $6,$6,4
      bne $17,$20,loop1
      j main
Michael Petch
  • 46,082
  • 8
  • 107
  • 198

1 Answers1

-2
.data
pin:.space 40
.text
.globl main
main: addi $20, $0, 10
      addi $17, $0, 0
      addi $6, $0, 0
loop: addi $2, $0, 5
      syscall
      add $7, $0, $2
      sw $7, pin($6)
      addi $17, $17, 1
      addi $6, $6, 4
      bne $20, $17, loop
      addi $17, $0, 0
      addi $6, $0, 0
loop1:lw $8,pin($6)
      addi $2,$0,1
      add $4,$8,$0
      syscall
      addi $17,$17,1
      addi $6,$6,4
      bne $17,$20,loop1
      j main
Michael Petch
  • 46,082
  • 8
  • 107
  • 198