我想在Mips中顯示「Hello World」(來自互聯網上的一個例子),看看它是如何工作的,但是我最終出現了錯誤。我首先出現以下錯誤: 「spim:(parser)標籤在文件C的第6行第二次定義:程序文件(x86) main:#執行從標籤」main「開始」 ^ 要修復它,我重新初始化並重新加載。然後我運行Qtspim,結果出現以下錯誤:「0x00400028/Notepad ++/test.asm [0x00400028] 0x3c010000 lui $ 1,0 [Greetings]; 8:la $ a0,Greetings#指令引用未定義符號字符串被打印成$ a0Mips:「Hello World」遇到錯誤
有人可以請解釋是什麼導致第一個和第二個錯誤?我只是想測試我在網上找到的代碼,並理解Qtspim如何工作,然後再嘗試我的任務。在Windows 08.您的幫助將非常感激。貝婁是代碼。
# Program: Hello, World!
.data # data declaration section; specifies values to be stored
# in memory and labels whereby the values are accessed
Greeting: .asciiz "\nHello, World!\n"
.text # Start of code section
main: # Execution begins at label "main"
li $v0, 4 # system call code for printing string = 4
la $a0, Greetings # load address of string to be printed into $a0
syscall # call operating system to perform operation;
# $v0 specifies the system function called;
# syscall takes $v0 (and opt arguments)
#This illustrates the basic structure of an assembly language program.
我不知道第一個錯誤是什麼,但第二個意思是沒有叫* Greetings *的標籤。我明白你的意思是*問候*。 – m0skit0 2013-02-25 09:18:12
Oups !!!!我沒有看到那個!我修復了它,但現在,我有另一個錯誤:「嘗試在0x00400030處執行非指令」。我知道它與內存位置有關。但我無法弄清爲什麼我有這個新錯誤。 – T4000 2013-02-25 09:22:25
如果你不斷改變問題,我們永遠不會結束。 – m0skit0 2013-02-25 16:37:29