/*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.*/

void setup() {
  Serial1.begin(9600);
}

extern "C" {
  int lab5_act_2_1_add(int a, int b);
  int lab5_act_2_1_flag(int a, int b);
}

int main() {
  int a, b;

  printf("enter a: ");
  scanf("%i", &a);
  printf("%i\n", a);

  printf("enter b: ");
  scanf("%i", &b);
  printf("%i\n", b);

  int result_flag = lab5_act_2_1_flag(a, b);

  printf("ADD %i, %i = %i\n", a, b, lab5_act_2_1_add(a, b));
  printf("PSR: %i\n", result_flag);
  Serial1.println(result_flag, HEX);
  return 0;
}
BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT