Is there Another way to print string array in MIPS Assembly Language

0

I'm using #la tag for printing string array but i get this as output

Enter name : Faizi

Enter Adress : Pakistan

Name is : รด Address is :

When i'm using #lb & #lw tag fro print string array but i get that error with #lw Runtime exception at 0x00400090: address out of range 0x000000f4

with #lb Runtime exception at 0x004000b8: address out of range 0x00000012

My Code is Given

.data

.data
array:.space 500
namespace:.space 30
addressspace:.space 50
ename:.asciiz "\nEnter name : "
eadress:.asciiz "\nEnter Adress : "
name:.asciiz "\nName is : "
address:.asciiz "\nAddress is : "

.text

.text
la $t0,0 #index array
li $v0,4
la $a0,ename
syscall
# get name from user & store in array
la $a0,namespace
li $a1,30
li $v0,8
syscall 
sb $a0,array($t0)
addi $t0,$t0,30

li $v0,4
la $a0,eadress
syscall

# get adress from user & store in array
la $a0,addressspace
li $a1,50
li $v0,8
syscall
sb $a0,array($t0)
addi $t0,$t0,50

li $t1,0
#print name
li $v0,4
la $a0,name
syscall

li $v0,4
lb $a0,array($t1)
syscall

addi $t1,$t1,30
#print address
li $v0,4
la $a0,address
syscall

li $v0,4
lb $a0,array($t1)
syscall
addi $t1,$t1,50

li $v0,10
syscall

i expect the output to be

Name is : Faizi
Address : Pakistan
mips32
asked on Stack Overflow Apr 14, 2019 by Faizi

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0