ret EQ 0 # Address where product goes. n0 EQ 1 # Address for multiplicand - doubles each iteration. n1 EQ 2 # Address for multiplier - rotates right each iteration. i EQ 3 # Address for counter from 8 down to 0. vn1 EQ 4 # Address for constant -1. LI 7 # Set up parameters for multiplication. ST n0 LI 5 ST n1 LI 0 # Set up result for product, initially 0. ST ret LI 8 # Set up counter, starting at 8. ST i LI -1 # Set up constant -1. ST vn1 loop LM n1 # Load multiplier, rotate it right once. RL 7 ST n1 BN add # If top bit is set after rotation, go to add. double LM n0 # Double multiplicand. AD n0 ST n0 LI -1 # Decrement counter. AD i ST i BN exit LI 0 # Repeat loop. BZ loop add LM ret # Add multiplicand into product AD n0 ST ret LI 0 # Go back to continuing the loop. BZ double exit LI 0 # Stop computer. BZ 0