.text .globl main main: # input the string # push each character onto the stack # pop chars from stack back into the buffer # print the reversed string .data str: .space 128 # character buffer
The stack pointer is initialized by the operating system before it passes control to the program. (In our case, the stack pointer is initialized by SPIM.)
The first section of the program reads a line from the terminal in the usual way. To shorten the program, there is no user prompt.
Next, null is pushed onto the stack. Later on, the stack will be popped until this null is encountered.
Fill in the blanks of the program.