当我运行简单的MIPS程序时,在某些代码行上会收到编译器错误。这是我的.data部分,我在其中初始化变量:

.data
    prompt1:    .asciiz "Please enter the rain fall for month "
    prompt2:    .asciiz ": "
    array_size: .word 12
    array:      .word 0,0,0,0,0,0,0,0,0,0,0,0
    avg:        .asciiz "The average rainfall is "
    inches:     .asciiz " inches."
    max:        .asciiz "The month with the most rainfall was month "
    min:        .asciiz "The month with the least rainfall was month "
    neg:        .asciiz "That number is a negative number  Please enter a positive number."
    max_num:    .word 0
    min_num:    .word 0
    avg_num:    .word 0
    month_num:  .word 1

问题出现在特定的行上,如果接收到的整数为负数,我将在其中初始化“neg”以显示一条消息。
neg:    .asciiz "That number is a negative number  Please enter a positive number."

它只是告诉我在此位置有一个spim(解析器)错误。我想知道我的语法是不正确的,还是编译器有问题。提前致谢。

最佳答案

neg是MIPS助记符。将其重命名为neg_msg或其他名称。

10-05 23:35