I load up 2 files into SPIM in order.
File 1:
.globl getCount
.data
count: .word 50
.text
getCount: lw $v0, count($0)
jr $ra
File 2:
.text
main: #code to call the getCount label and print the result stored in $v0
jr $ra
When SPIM merges the 2 files, it always seem to know to run at adress main
and use the jr $ra
in main
to exit the program after printing the result. It doesn't run at address getCount
and exit program with that method's jr $ra
.
So I'm asking, is the main
label a reseerved label that SPIM detects to run first or maybe that main
chunk is put above the address of other ones?