/* Write ARM assembly functions for:
a) Function to take two signed parameters, and performs an ADD operation.
b) Function to Read the flag bits from the PSR.
Return both outputs to the main function.
Function prototype: lab5_act_2_1_add(int, int)
lab5_act_2_1_flag(int, int) */
#include <stdio.h>
#include <stdlib.h>
extern "C"{
signed int lab5_act_2_1_add(int x,int y);
unsigned int lab5_act_2_1_flag(void);
}
void setup() {
// put your setup code here, to run once:
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
signed int asm_ret_val;
signed int flag_bits;
int x,y;
printf("Enter x: ");
scanf("%d",&x);
printf("%d\n",x);
printf("Enter y: ");
scanf("%d",&y);
printf("%d\n",y);
asm_ret_val = lab5_act_2_1_add(x,y);
flag_bits = lab5_act_2_1_flag();
printf("\n");
printf("%d + %d: %d\n",x,y,asm_ret_val);
printf("The Flag Bits are: %X\n",flag_bits);
printf("\n");
}