Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /Subroutine for finding cube of number
- /
- Load Num /Load the first number
- Store Count /Store this number to use for looping repeated addition
- Loop, Load Sum /Load the sum for first number into AC
- AddI Num /Add the value in AC of first number
- Store Sum /Store the sum
- Load Count /Load Count again
- Subt One /Subtract one from our counter
- Store Count /Store this new number for our counter
- Skipcond 800 /If Count > 0, skip next instruction
- Jump Loop /Continue loop if Count is greater than 0
- Loop, Load Sum
- Add Num
- Output/Keeping track of the process.
- Store Sum
- Load Count
- Skipcond 800
- Jump End /When count=0 end program.
- Subt One
- Store Count
- Jump Loop
- Output
- End, Halt
- Num, Dec 4
- Count, Dec 15/Intialise count to numxnum-1
- Sum, Dec 0
- One, Dec 1
- Input
- Store Num
- Subt Count
- Store Count
- Store GetCount
- CounterLoop, Load Count
- Add Num
- Store Count
- Load GetCount
- Subt One
- Store GetCount
- Skipcond 800
- Jump CubeLoop /When GetCount=0 go to the CubeLoop.
- Jump CounterLoop
- CubeLoop, Load Sum
- Add Num
- Output/Keeping track of the process.
- Store Sum
- Load Count
- Skipcond 800
- Jump End /When count=0 end program.
- Subt One
- Store Count
- Jump CubeLoop
- Output
- End, Halt
- Num, Dec 0
- Count, Dec 1
- GetCount, Dec 0
- Sum, Dec 0
- One, Dec 1
Add Comment
Please, Sign In to add comment