ARM сборка, как программа для Java? - PullRequest
0 голосов
/ 08 сентября 2018

Это мой код. Я искал некоторые ссылки, но понятия не имею, правильны ли они , например, эта

   if( op == addCode) {
      a = b + c;
      *should I return something?*
  }
  else if (op == subCode){
      a = b - c;
      *should I return something?*
  }
  else if (op == multCode){
      a = b * c;
      *should I return something?*
  }
  else if (op == divCode){
      a = b / c;
     *should I return something?*
  }
  else if (op == remCode){
      a = b % c;
      *should I return something?*
  }
  else if (op == equalCode){
      if( b == c){
         **not sure what to do here**
      }
      else {
      System.out.println("The numbers are not equal");
      }

  }
  else if (op ==notEqualCode){

      if (b != c){
          **not sure what to do here**
      }
      else {
      System.out.print("The numbers are are equal");
      }
  }
  else if (op == lessCode){
      if (b < c){
          **not sure what to do here**
      }
      else {
      System.out.println("The numbers is not less than each other");
      }
  }
  else if (op == lessEqualCode){
      if (b <= c){
         **not sure what to do here**
      }
      else{
      System.out.println("The numbers is not less than or equal to each other");
      }


}

9 a b c     add         Add the values in cell b and cell c and store the 
result in cell a. 
10 a b c        subtract            Same as 9, but do cell b − cell c. 
11 a b c        multiply            Same as 9, but do cell b ∗ cell c. 
12 a b c        divide          Same as 9, but do cell b / cell c.
13 a b c        remainder       Same as 9, but do cell b % cell c. 
14 a b c        equal           Same as 9, but do cell b == cell c. 
15 a b c        not equal       Same as 9, but do cell b != cell c. 
16 a b c        less than       Same as 9, but do cell b < cell c. 
17 a b c        less than or equal      Same as 9, but do cell b <= cell c

Я пытался изменить этот ARM как кодирование на Java. Но, похоже, я неправильно понял мою арифметику. Я также не могу вернуть int, так как основная программа возвращает void, поэтому есть ограничение. Все инициализируется как частное, и код операции должен соответствовать следующим операциям.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...