I am trying to display "Hello World" (from an example found on internet) in Mips and see how it works, but I end up with errors.I first had the following error :"spim: (parser) Label is defined for the second time on line 6 of file C:Program Files (x86) main: # Execution begins at label "main" " ^ To fix it, I reinitialized and reloaded. Then I run Qtspim and I end up with the following error: "Instruction references undefined symbol at 0x00400028/Notepad++/test.asm [0x00400028] 0x3c010000 lui $1, 0 [Greetings] ;8:la $a0, Greetings # load address of string to be printed into $a0
Can someone please explain what causes the first and second error? I am just trying to test the code that I found online and understand how Qtspim works before I try my assignment. I am using Notepad++ on Windows 08. Your help will be very appreciated. Bellow is the code.
# 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.
.globl
, but the problem being asked about is different spellings of another label. It's actually just a typo bug. – Peter Cordes