Guest User

Untitled

a guest
Nov 16th, 2018
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. /Subroutine for finding cube of number
  2. /
  3. Load Num /Load the first number
  4. Store Count /Store this number to use for looping repeated addition
  5. Loop, Load Sum /Load the sum for first number into AC
  6. AddI Num /Add the value in AC of first number
  7. Store Sum /Store the sum
  8. Load Count /Load Count again
  9. Subt One /Subtract one from our counter
  10. Store Count /Store this new number for our counter
  11. Skipcond 800 /If Count > 0, skip next instruction
  12. Jump Loop /Continue loop if Count is greater than 0
  13.  
  14. Loop, Load Sum
  15. Add Num
  16. Output/Keeping track of the process.
  17. Store Sum
  18.  
  19. Load Count
  20. Skipcond 800
  21. Jump End /When count=0 end program.
  22. Subt One
  23. Store Count
  24.  
  25. Jump Loop
  26.  
  27. Output
  28. End, Halt
  29.  
  30. Num, Dec 4
  31. Count, Dec 15/Intialise count to numxnum-1
  32. Sum, Dec 0
  33. One, Dec 1
  34.  
  35. Input
  36. Store Num
  37. Subt Count
  38. Store Count
  39. Store GetCount
  40. CounterLoop, Load Count
  41. Add Num
  42. Store Count
  43.  
  44. Load GetCount
  45. Subt One
  46. Store GetCount
  47.  
  48. Skipcond 800
  49. Jump CubeLoop /When GetCount=0 go to the CubeLoop.
  50.  
  51. Jump CounterLoop
  52.  
  53.  
  54. CubeLoop, Load Sum
  55. Add Num
  56. Output/Keeping track of the process.
  57. Store Sum
  58.  
  59. Load Count
  60. Skipcond 800
  61. Jump End /When count=0 end program.
  62. Subt One
  63. Store Count
  64.  
  65. Jump CubeLoop
  66.  
  67. Output
  68. End, Halt
  69.  
  70. Num, Dec 0
  71. Count, Dec 1
  72. GetCount, Dec 0
  73. Sum, Dec 0
  74. One, Dec 1
Add Comment
Please, Sign In to add comment