을 .space 사용. 내가 값에 입력 할 때마다, QTSPIM는 내가 레지스터에 저장 어떤 임의의 값으로 가정 268,501,016 밖으로 뱉어.나는 그것이 배열을 채울 때까지 배열로 사용자 입력 정수를 추가하는 루프를 만들기 위해 노력하고
내 프로그램이 전체 루프를 통과하는지 테스트하려면 프로그램이 내 beq의 분기 부분에 도달했을 때 아스키 라인에 대한 호출을 추가했습니다. 프로그램은 비록 값이 (적어도 내 이해에) 동등하지 않더라도 분기하는 것처럼 보였다. 내가 생각할 수있는
.data
array1: .space 24
str1: .ascii "Type in numbers:"
str2: .ascii "Reached Terminate"
.text
main:
li $t2, 5
li $t3, 0
loop1:
beq $t3, $t2, terminate #branch if equal
la $a0, str1
syscall
ori $v0, $0, 5 #instruction to store user input in v0
syscall #get user input and store it in v0
la $t4, array1 #load the address of the array
addu $t0, $0, $v0 #add v0 (our user input) to $t0
sw 0($t4), t0 #stores the value in $t4 to our array
addi $t3, $t3, 1 #add 1 to t3 (incrementing the counter)
addi $t4, $t4, 4 $add 4 to increment the array 4 bits to the next array slot
jal loop1
terminate:
la $a2, str2 #load the string to check when the program reaches terminate
syscall
ori $v0, $0, 10 # end the program
syscall
유일한 것은 내 점프 호출이 다시 loop1은에 예정되지 않는 것입니다,하지만, 이러한 경우 그 문제를 해결하는 방법을 모르고입니다.
이
32 MIPS 비트 코드이다.