PCSpim添加错误

时间:2014-01-26 14:22:48

标签: assembly mips pcspim

#    PROGRAM TO ADD TWO NUMBERS 
        .text           #directive identifying the start of instructions 
        .globl  __start

__start:

    #print
        la      $a0, prompt     #prompt goes in 
        li      $v0, 4         
        syscall

    #read in integer 
        li      $v0, 5          # service code 
        syscall 
        sw      $v0, Num1       # store what was entered 
    #read another 
        li      $v0, 5          # service code 
        syscall 
        sw      $v0, Num2       # store what was entered

    #do the addition
        lw      $t0, Num1 
        add     $a0, $t0, $v0

    #print the sum
        li      $v0, 1          # print integer service call 
        syscall

    #print a final string line 
        la      $a0, final 
        li      $v0, 4 
        syscall

        li      $v0, 10         # exit program service 
        syscall

    #Data segment 

        .data 
Num1:   .word   0 
Num2:   .word   0 
prompt: .ascii  "Please type 2 integers, end each with the " 
        .asciiz "Enter key:\n" 
final:  .asciiz " is the sum.\n"

我正在使用PCSpim 9.1.9。我试图重新安装PcSpim但它仍然无法正常工作。 我在文件的第8行收到错误“spim :( parser)语法错误。 la $ a0,提示#prompt进入。

请帮助

0 个答案:

没有答案