/* Write ARM assembly functions for:
a) Function to take two unsigned parameters, and performs an ADD operation.
b) Function to Read the flag bits from the PSR.
Return both outputs to the main function. */
#include <stdio.h>
void setup() {
Serial1.begin(9600);
}
extern "C" {
unsigned int lab5_act_1_1_add(unsigned int a, unsigned int b);
int lab5_act_1_1_flag(int, int);
}
int main () {
unsigned int a, b;
printf("enter a: ");
scanf("%i", &a);
printf("%i\n", a);
printf("enter b: ");
scanf("%i", &b);
printf("%i\n", b);
printf("ADD %i, %i, %i = %i\n", a, a, b, lab5_act_1_1_add(a, b));
int result_flag = lab5_act_1_1_flag(a, b);
printf("Result of flag bits: %d\n", result_flag);
Serial1.println(result_flag,HEX);
return 0;
}