-1

I have tried everything, please explain in detail too why am I running into this problem, I am learning to code in assembly myself.

.text
.globl main
main:
    li $t0, 10
    li $t1, 0
    li $t2, 17
loop:
    beq $t1, $t0, end 
    add $t2, $t2, $t1
    addi $t1, $t1, 1
    j loop
end:
    syscall
Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
  • 2
    Whey you type *an error*, the very next thing from your keyboard should be the **exact** error message you're seeing. When you type *this problem*, the very next thing should be a **clear, complete description** of that problem. You've provided neither here, and you've not asked any sort of specific question. You'll find your experiences here will be much better if you spend some time taking the [tour] and reading the [help] pages to learn how the site works before you begin posting. – Ken White Mar 27 '21 at 18:17

2 Answers2

3

The answer you're looking for is quite simple. Firstly, all you have to do is add the following line: li $v0, 10 above the syscall line.

Explanation: Let me explain in detail. You see, mips has 32 registers. what syscall does is that it executes the code loaded in the register : $v0. what you have missed is exactly this. you have to save 10 in it as it is the code for "Terminate Execution"

Hope that solves your problem. CHEERS!

0

its a custom to write

li $v0, 10

before the ending syscall.