Advertisement
Guest User

ARM

a guest
Dec 20th, 2017
429
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.02 KB | None | 0 0
  1. message1 .asciz "Please enter your team: "
  2. message2 .asciz "Please enter your name: "
  3. message3 .asciz ""*****Print Name*****"
  4.  
  5. TMP .asciz "" @以下都全域變數@
  6. TEAM .asciz ""
  7. NAME1 .asciz ""
  8. NAME2 .asciz ""
  9. NAME3 .asciz ""
  10. ID1: .word 0
  11. ID2: .word 0
  12. ID3: .word 0
  13. num: .word 0 @以上都全域變數@
  14.  
  15.  
  16. @------------------NAME-----------------@
  17. i: .word 0
  18.  
  19. NAME:
  20.  
  21. LDR R1, i
  22.  
  23. LOOP: @while i<4
  24. CMP R1, #4 @while i<4
  25. BGE DONE @>4跳出
  26. CMP R1, #0 @if i==0
  27. BEQ MSG1 @Print message1
  28. LDR R0, =STNG @Scanf不知道怎麼讀
  29. LDR R2, =TMP @Scanf到TMP
  30. BL scanf @Scanf不知道怎麼讀
  31. ???? @TEAM = TMP
  32. CMP R1, #0 @if i!=0
  33. BNE MSG2 @Print message2
  34. LDR R0, =STNG @Scanf不知道怎麼讀
  35. LDR R2, =TMP @Scanf到TMP
  36. BL scanf @Scanf不知道怎麼讀
  37. CMP R1, #1 @if i==1
  38. BEQ ???? @NAME1 = TMP
  39. CMP R1, #2 @if i==2
  40. BEQ ???? @NAME2 = TMP
  41. CMP R1, #3 @if i==3
  42. BEQ ???? @NAME3 = TMP
  43. ADD R1, 1, R1 @i++
  44. BL LOOP
  45.  
  46. DONE:
  47.  
  48. ???? @cout << "*****Print Name*****" << endl;
  49. ???? @cout << team << endl;
  50. ???? @cout << name1 << endl;
  51. ???? @cout << name2 << endl;
  52. ???? @cout << name3 << endl;
  53. ???? @cout << "*****End Print*****" << endl;
  54.  
  55.  
  56. MSG1:
  57. LDR R0, =message1
  58. BL printf
  59.  
  60. MSG2:
  61. LDR R0, =message2
  62. BL printf
  63.  
  64. MSG3:
  65. LDR R0, =message3
  66. BL printf
  67.  
  68. STNG: .string "%s" @SCANF要用的!?
  69.  
  70. @------------------NAME-----------------@
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ID@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  81.  
  82. ID:
  83.  
  84. i: .word 1 @int i=1;
  85. ???? @cout << "*****Input ID*****" << endl;
  86. LDR R1, i @LOAD i=1;
  87. LOOP: @while i<4
  88. CMP R1, 1 @while i<4
  89. BGE DONE2 @>4跳出
  90. LDR R0, =STNG @Scanf不知道怎麼讀
  91. LDR R2, =NUM @Scanf到NUM
  92. BL scanf @Scanf不知道怎麼讀
  93. CMP R1, #1 @if i==1
  94. BEQ ???? @ID1 = NUM
  95. CMP R1, #2 @if i==2
  96. BEQ ???? @ID2 = NUM
  97. CMP R1, #3 @if i==3
  98. BEQ ???? @ID3 = NUM
  99. ADD R1, 1, R1 @i++
  100. BL LOOP
  101.  
  102. DONE2:
  103.  
  104. ADD NUM, ID1, NUM @NUM = NUM + ID1;
  105. ADD NUM, ID2, NUM @NUM = NUM + ID2;
  106. ADD NUM, ID3, NUM @NUM = NUM + ID3;
  107. ???? @cout << "** Please Enter Command **" << endl;
  108. LDR R0, =STNG @Scanf不知道怎麼讀
  109. LDR R2, =TMP @Scanf到TMP
  110. BL scanf @Scanf不知道怎麼讀
  111. CMP TMP, "p" @ if(tmp == "p")
  112. BEQ printf @ printf
  113. ???? @cout << "*****Print Team Member ID and ID Summation*****" << endl;
  114. ???? @cout << ID1 << endl << ID2 << endl << ID3 << endl;
  115. ???? @cout << "ID Summation = " << num << endl;
  116. ???? @cout << "*****End Print*****" << endl;
  117.  
  118.  
  119.  
  120. STNG: .string "%s" @SCANF要用的!?
  121.  
  122. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ID@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  123.  
  124.  
  125.  
  126.  
  127.  
  128. @-----------------MAIN-----------------@
  129.  
  130. MAIN:
  131.  
  132. .string INPUT @String input;
  133.  
  134. LOOP:
  135. CMP ???? @while(true)????
  136. BNE printf @while(true)????
  137. ???? @cout <<" Press 0 to quit" << endl;
  138. ???? @cout << "Press 1 to do Function 1(NAME)" << endl;
  139. ???? @cout << "Press 2 to do Function 2(ID)" << endl;
  140. ???? @cout << "Press 3 to do Main Function" << endl;
  141. LDR R0, =STNG @Scanf不知道怎麼讀
  142. LDR R2, =INPUT@Scanf到INPUT
  143. BL scanf @Scanf不知道怎麼讀
  144. CMP INPUT, #0 @if(input == 0)
  145. BEQ DONE3 @Break;
  146. CMP INPUT, #1 @if(input == 1)
  147. BEQ NAME @NAME()
  148. CMP INPUT, #2
  149. BEQ ID @ID()
  150. CMP INPUT, #3
  151. BEQ printf @printf
  152. ???? @cout << "*****Print All*****" << endl;
  153. ???? @cout << team << endl ;
  154. ???? @cout << ID1 << " " << name1 << endl;
  155. ???? @cout << ID2 << " " << name2 << endl;
  156. ???? @cout << ID3 << " " << name3 << endl;
  157. ???? @cout << "ID Summation = " << num << endl;
  158. ???? @cout << "*****End Print*****" << endl;
  159. CMP INPUT, #? @else 怎麼比?
  160. ???? @cout << "Please try again." << endl;
  161.  
  162. DONE3:
  163.  
  164. LDR R1, #0 @return 0
  165. LDR PC, LR @return 0
  166.  
  167.  
  168. STNG: .string "%s" @SCANF要用的!?
  169.  
  170. @-----------------MAIN-----------------@
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement