I just recently downloaded MARS MIPS on my mac again and tried to re-learn how to program. I wrote this code:
.data
myMessage: .asciiz "Hello World \n"
.text
li $v0, 4
la $a0, myMessage
syscall
When I tried to run it, it gave me this message on a separate exceptions.s tab:
Error in /Users/myname/Desktop/exceptions.s line 180 column 6: Symbol "main" not found in symbol table.
And this was the portion of the exceptions.s code from SPIM, which the MARS manual says should work under MARS.
# 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
I want to start using MIPS again. Any help is appreciated.
Your program must have a global main
label, which serves as the entry point of your program:
.data
# Data goes here
.text
.globl main
main:
# Code goes here