C++ to MIPS Assembly: how to approach
Hello everyone, I have been having trouble writing a program in MIPS assembly language that performs the same function as a program in C++. The program is supposed to toggle a LED light on my chipKIT Uno32 Arduino with adjustable delay. I use MPIDE as my cross compiler.
Code:
/*
Blinks
Turns on a LED (LED 5 in this case) on for half a second, then off for the same amount of time. The cycle repeats.
*/
void setup() {
// the digital pin is initialized as an output
// Pin 13 has an LED connected (LED 5)
pinMode(43, OUTPUT);
}
void loop() {
digitalWrite(43, HIGH); // set the LED on
delay(500); // wait for a half second
digitalWrite(43, LOW); // set the LED off
delay(500); // wait for a half second
}
The program that I want to write in MIPS assembly language probably has to include a function that has to do with looping turning the LED on and off with a delay just like the C++ program. Here is where I run into a lot of questions.
Before I want to write the part to interact with the I/O, I want the function I'm writing to just take a single argument from in a0 that is the number of milliseconds before returning. What are some things I should be considering while approaching the problem? Are there any things the program should include?