0
.data
hello: .asciiz "hello "
msg: .asciiz "Enter ur Name: "
buffer: .space 10
.text
.globl main
main:
li $v0 , 4
la $a0 , msg
syscall

li $v0 , 8
la $a0 , buffer
li $a1 , 20

move $t0 , $a0

syscall

li $v0 , 4
la $a0 , hello

syscall

li $v0 , 4
la $a0 , buffer

move $a0 , $t0

syscall

li $v0 , 10

syscall

.end main

//===========

I need To Know What is the advantage of this line (la $a0 , buffer) , as i tried to remove it and nothing changed, I've increased and decreased in the buffer size with the existence of this line and also nothing changed ?! ... So What is advantage of this line ?

Tony
  • 16,527
  • 15
  • 80
  • 134

1 Answers1

1

(la $a0 , buffer) is used to load "buffer" address to $a0 to let you write string on it when you put 8 into $v0 and put length of "buffer" into $a1 then syscall

To fix your problem I think syscall must be before move $t0 , $a0 in your code.

AmgadMHM
  • 146
  • 8