I'm trying to design a basic calculator with MIPS. I promt the user for the first operand, the operator, and then the second operand. I get and store the first operand, but after the user enters the operator the prompt for the second operand appears on the same line, immediately after the user's input. Here's a sample of what I mean:
Enter first number: 8
Select operator: -Enter second number: 3
Result: 5
-- program is finished running (dropped off bottom) --
The "Enter second number" was printed right after the minus sign. I use read string, with length of string = 2 to get the operator. Here's the relevant code for that:
GetOperator:
la $a0, prompt2 #Load prompt 2
add $v0, $zero, 4 #Load syscall 4
syscall
la $a0, operator
add $a1, $zero, 2
add $v0, $zero, 8 #Load syscall 8
syscall #Store the input string to memory
jr $ra
"operator" is a .word variable I declared under .data. I then use a syscall 4 to print the next prompt. I think there's just some subtle thing going on here that I'm missing. I'm still quite new with MIPS, so any pointers would be awesome.