0

我最近刚刚在我的 Mac 上再次下载了 Mars MIPS,并尝试重新学习如何编程。我写了这段代码:

.data
    myMessage: .asciiz "Hello World \n"
.text
    li $v0, 4
    la $a0, myMessage
    syscall

当我尝试运行它时,它在一个单独的 exceptions.s 选项卡上给了我这条消息:

Error in /Users/myname/Desktop/exceptions.s line 180 column 6: Symbol "main" not found in symbol table.

这是 exceptions.s 代码的一部分:

# Standard startup code.  Invoke the routine "main" with arguments:
#   main(argc, argv, envp)
#
.text
.globl __start          #line 173
__start:
    lw $a0 0($sp)       # argc
    addiu $a1 $sp 4     # argv
    addiu $a2 $a1 4     # envp
    sll $v0 $a0 2
    addu $a2 $a2 $v0
    jal main            #line 180
    nop

    li $v0 10
    syscall         # syscall 10 (exit)

    .globl __eoth
__eoth:             #last line 187

我想再次开始使用 MIPS。任何帮助表示赞赏。

4

1 回答 1

1

你的程序必须有一个全局main标签,作为你程序的入口点:

.data
# Data goes here

.text
.globl main
main:
# Code goes here
于 2017-01-16T06:47:49.497 回答