Long question, sorry in advance. Okay, so I'm working with a few unusual constraints which is why I haven't found much help online so far. The main constraint is that I can not use an emulator, and therefore I can not use syscalls. I need to do a few things with MIPS and C and don't know enough about how these programs are executed to understand how to get them to work the way I need them to. Firstly, as per my professor's instructions, I need to create a file called "rng.s". He also specifies that it should begin with the following code:
.abicalls
.option pic0
.globl rng, seed
.set nomips16
As I understand it, this means that I am creating two functions "rng" and "seed", and I don't need to create a main function. In a template provided for earlier assignments, there was some code that looked like this:
.ent main
.type main, @function
And I'm unsure about whether or not I need to do something similar here with my functions rng and seed. Furthermore, when I don't include main the assembler kicks back an error. Later on in the assignment I am supposed to write a C program that calls the function rng() (the same one written in my MIPS program) and pass it some values. I don't quite understand how to call rng() from inside of my C program. At first I tried it like this:
#include<stdio.h>
int main(int argc, char* argv[])
{
//int a, b, c are input from command line using atoi(argv)
//i've tested it and that part works fine, so it's not important
rng(a, b, c);
return 0;
}
My professor included a Makefile that is supposed to compile both programs into one executable file, but if I try to use this, I get an error because there are multiple declarations of main.
So the big question is how do I get my MIPS program to run without main? And then how do I call the function inside of my MIPS program from inside of my C program?
I've already spent two days on this and I've gotten nowhere, so any help would be greatly appreciated. Thank you.