Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Assembly 程序计数器无效导致崩溃_Assembly_Mips_Mars Simulator - Fatal编程技术网

Assembly 程序计数器无效导致崩溃

Assembly 程序计数器无效导致崩溃,assembly,mips,mars-simulator,Assembly,Mips,Mars Simulator,所以我的问题是如何修复这个错误。这是我的程序结构吗?或者我是如何使用寄存器的 #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" RE

所以我的问题是如何修复这个错误。这是我的程序结构吗?或者我是如何使用寄存器的

#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

我认为问题在于你没有把你的跳转链接到红色

将第23行的j红色更改为日航红色


addi$t0,$0,1000更改为
addi$t0,$t0,1000
在第34行添加1000到
$t0
并存储它。

对汇编语言来说非常陌生,所以我不理解错误。如果你能发布完整的代码而不使用所有格式,并使用注释而不是标题,这样我就可以复制粘贴并运行它。是的,Mips在代码段中做得不是很好,这是一个粘贴栏我很欣赏这个粘贴栏-看起来你只是没有把它贴上标签,但我不想在编辑之前假设它。你刚发了密码吗?如果你愿意的话,我可以帮你把它制表并修改格式。我这么做了,解决了这个问题。然而,在那之后,似乎再也没有其他事情发生了。这是一张重新购买并更正的表格,我想这与我的第二条循环线有关。bgeI正在向计数器添加1000,正在睡觉,只是不想在测试时等待。我必须有一个计数器才能退出loopK,因为你将1000和0相加,所以它永远不会改变-它只是停留在1000
addi$t0,$zero,1000
-
$t0=$zero+1000
,应该是
addi$t0,$t0,1000