Silver_Smoulder

[ASM] Project 1

Oct 21st, 2019
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. Write a program that asks the user what he wants the sentinel to be
  2.  
  3. enter numbers until the sentinel is entered.--do not save the entered numbers
  4.  
  5. output the sum of all the positive numbers
  6.  
  7. the sum of all the negative numbers
  8.  
  9. how many positive numbers were entered
  10.  
  11. how many negative numbers were entered
  12.  
  13. how many zeros were entered
  14.  
  15. output if the most "type" of numbers is positive, negative or zero
  16.  
  17. do not need to check for an invalid sentinel
  18.  
  19. may assume the counts for positive, negative, and zero will all be different.]
  20.  
  21. if you check for an invalid sentinel, and check for "types" being the same you will get extra credit-remember any 2 may be the same, all 3 may be the same
  22.  
  23. use only instructions we've done in class (add, addi, sub, subi, move, li, la, syscall, all forms of branch, jump). no functions
  24.  
  25. name your file firstInitianLastNameP1.asm or it will not be graded (my file would be named ELichtenthalP1.asm)
  26.  
  27. if you use an incorrect name, or instructions we haven't done as of today, it will not be graded.
  28.  
  29. be sure to comment
  30.  
  31. 1) Prompt user for sentinel value
  32.  
  33. 2) Store that in t0.
  34.  
  35. 3) Begin loop.
  36. a) prompt user for integer value
  37. b) check for sentinel, if sentinel, break (if $v0 = t0)
  38. c) store it in t3
  39. d) If t3>0 add 1 to s0, if t2<0 add 1 to s1, if t2 = 0 add 1 to s2.
  40. e) If t3>0 add it to t1, if t3<0 add it to t2.
  41. f) Set t3 = 0.
  42. g) go back to the start of the loop
  43.  
  44. 4) Output
  45. a) Output sums
  46. b) Output counters
  47. c) Comparison
  48. i) Compare positive and negative, if positive go to ii, else go to iii
  49. ii) compare positive and zeroes, output
  50. iii) compare negative and zeroes, output
  51.  
  52. 5) Terminate
Advertisement
Add Comment
Please, Sign In to add comment