所以我的问题是如何修复此错误。这是我程序的结构吗?或者我如何使用寄存器?
#JTWILKI - Just The Way I Like It Cooking Assistant
# Created By: Samuel Buzas
#For CS2028 Sect.002
.data
preface: .asciiz "Place you Steak in the oven, and kick back. I'll take care of the rest! \n"
RED: .asciiz "Steaks Not Ready Yet Come Back Soon! \n"
YELLOW: .asciiz "Get Ready to Eat!! \n"
GREEN: .asciiz "Were Ready to Go!!! \n Get The Steak Out Now, Before it Burns!\n"
BROWN: .asciiz "Quick It's Starting to Burn!! \n Take it Out!!! \n"
BLACK: .asciiz "So how about Soup? \n"
.text
main:
# Tell User the program is starting
li $v0, 4
la $a0, preface
syscall
# Pause for 10 seconds while users places steak in oven, handy MARS Feature
li $v0, 32
la $a0, 10000
syscall
#Display message,Start Cooking
j red
addi $s1, $zero, 150000 # Tihs is 2 min 30seconds
addi $s0, $zero, 0
#Start The cooking Loop
jal loop
loop: beq $s1,$s0,exit # Exit if t9 == t1
bge $s0, 120000, yellow # If 30secs from being ready, print yellow warning
#Otherwise, Increment
addi $s0, $zero, 1000
#Pause for 1 sec
#li $v0, 32
#la $a0, 1000
#syscall
j loop
exit:
#Display message, Cooking complete
jal green
#Wait 30 Seconds, then overcooking
li $v0, 32
la $a0, 30000
syscall
#Now overcooked
jal brown
#Wait another 30 seconds
li $v0, 32
la $a0, 30000
syscall
# Now its burned
jal black
# Terminate Program
li $v0, 10
syscall
#Progress Update Functions
red:
li $v0, 4
la $a0, RED
syscall
jr $ra
yellow:
li $v0, 4
la $a0, YELLOW
syscall
jr $ra
green:
li $v0, 4
la $a0, GREEN
syscall
jal beep
jr $ra
brown:
li $v0, 4
la $a0, BROWN
syscall
jr $ra
black:
li $v0, 4
la $a0, BLACK
syscall
jr $ra
beep:
li $v0, 31
li $a0, 112
li $a1, 2000
li $a2, 10
li $a3, 100
syscall
jr $ra
答案 0 :(得分:1)
我认为问题是你没有将你的跳跃链接到红色。
第23行将j red
更改为jal red
在第34行将addi $t0, $zero, 1000
更改为addi $t0, $t0, 1000
,将1000添加到$t0
并存储。