I am writing a MIPS program that asks you for your name and then prints the line Hi , how are you? However my code...
#Program that fulfills the requirements of COS250 lab 1
#Nick Gilbert
.data #Section that declares variables for program
firstPromptString: .asciiz "What is your name: "
secondPromptString: .asciiz "Enter width: "
thirdPromptString: .asciiz "Enter length: "
name: .space 20
firstOutStringOne: .asciiz "Hi "
firstOutStringTwo: .asciiz ", how are you?"
secondOutString: .asciiz "The perimeter is ____"
thirdOutString: .asciiz "The area is _____"
.text #Section that declares methods for program
main:
#Printing string asking for a name
la $a0, firstPromptString #address of the string to print
li $v0, 4 #Loads system call code for printing a string into $v0 so syscall can execute it
syscall #call to print the prompt. register $v0 will have what syscall is, $a0-$a3 contain args for syscall if needed
#Prompting user for response and storing response
la $a0, name
li $v0, 8 #System call code for reading a string
li $a1, 20
syscall
#Printing response to name
la $a0, firstOutStringOne
li $v0, 4 #System call code for printing a string
syscall
la $a0, name
li $v0, 4 #System call code for printing a string
syscall
la $a0, firstOutStringTwo
li $v0, 4 #System call code for printing a string
syscall
Prints "Hi " and then ", how are you" on separate lines. I need the message to be on a single line