.text
la $t5, prompt
la $t6, prompt_char
la $t7, prompt_loop
loop:
la $t4, 0 #count
askForString:
la $a0, prompt
li $v0, 4
syscall
li $v0,8
li $a1, 5 #text einlesen
syscall
j quit
quit:
la $a0, ($t7)
li $v0, 4 #info
syscall
li $a1, 5 #text einlesen
li $v0,5
syscall
beq $v0,1,askForString
exit:
.data
prompt: .asciiz "\nPlease enter text\n"
prompt_char: .asciiz "\njetzt bitte ein Zeichen\n"
prompt_loop: .asciiz "\nAgain: 1, Exit: 0.\n"
endl: .asciiz "\n\n"
The problem if i continue the loop my text stored in "prompt"(syscall 4) will be overridden by the input(syscall 5). do i need to clean $a0 or what is the problem. please help
My Result:
Please enter text
aa
Again: 1, Exit: 0.
1
aa (here should be "Please enter text")
1
Again: 1, Exit: 0.
1
1 (here should be "Please enter text")
0
Again: 1, Exit: 0.
0
-- program is finished running (dropped off bottom) --