Multiplication
This assignment asks you to write an assembly-language program that multiplies two integers.

Your task is to compute $0 × $1 and store the result in $2. The result is guaranteed to be in the range 0, 1, …, 65535. Both $0 and $1 should be viewed as unsigned integers.

Hints: For this exercise you want to use arithmetic instructions (such as add) to accumulate the product one addition at a time, shift instructions (such as lsl and lsr) to shift the bits in the operands, and Boolean instructions (such as ior, and, eor to set, reset, and toggle bits). If you want, it is possible to solve this exercise without comparison, branch and jump instructions. However, it is easier to use these instructions rather than avoid them. You probably want to have at least one loop that shifts the operands, and at least one conditional expression that decides whether to accumulate the product based on the bits of one operand. It may be a good idea to look at the examples of pen and paper multiplication in Round 2 to figure out what needs to be done. If all else fails, write a Scala solution first and then think how to do it in assembly language. (See further hints below.)

More hints and notes:

Assembly-language programming is a skill that amounts to being able to cast what you want the machine to do in terms of individual machine instructions.
One instruction does not accomplish a great deal, so you must be prepared to think in very small steps what you want to be done.
Before you start writing an assembly-language program to solve an assignment, it may be useful to think how you would go about solving the assignment using Scala, where you intentionally restrict yourself to using only eight variables (which imitate the eight registers of the armlet), and one array (which imitates the armlet memory).
Also, it may be useful to think about a solution in Scala that uses only if-statements and while-loops in Scala, since these are easily implemented using the armlet comparison, branch, and jump instructions. (Branching and jumping is not needed for the first exercises, such as expression evaluation.)
The assignment package contains a helper object launchTicker (located in armlet) that launches Ticker where you can load and execute the program to test it.
Study the example code for patterns on how to program in assembly language.
Make use of Ticker to debug your program. Ticker enables you to execute the program one clock tick at a time, so you can follow with minute precision what your program is actually doing.
For exercises that require you to manipulate the bits in a register, observe that Ticker displays the register contents in binary (as well as in hexadecimal and decimal).
Mind your registers. When writing your program, for every instruction that you write you should keep in mind exactly which register contains what value for purposes of completing the desired computation.
Write comments to keep track of what your program should be doing. Then use Ticker to witness that this is actually what happens.
Even with all the hints above, assembly-language programming is tedious. Yet, to be able to write efficient programs (in any programming language), there is no substitute to understanding how the machine operates and how to speak directly to the machine, in its native tongue.

You will use armlet assembly.

Armlet assembly instruction set:
(Instructions controlling the data path)
nop # no operation
mov $L, $A # $L = $A (copy the value of $A to $L)
and $L, $A, $B # $L = bitwise AND of $A and $B
ior $L, $A, $B # $L = bitwise (inclusive) OR of $A and $B
eor $L, $A, $B # $L = bitwise exclusive-OR of $A and $B
not $L, $A # $L = bitwise NOT of $A
add $L, $A, $B # $L = $A + $B
sub $L, $A, $B # $L = $A - $B
neg $L, $A # $L = -$A
lsl $L, $A, $B # $L = $A shifted to the left by $B bits
lsr $L, $A, $B # $L = $A shifted to the right by $B bits
asr $L, $A, $B # $L = $A (arithmetically) shifted to the right by $B bits
mov $L, I # $L = I (copy the immediate data I to $L)
add $L, $A, I # $L = $A + I
sub $L, $A, I # $L = $A - I
and $L, $A, I # $L = bitwise AND of $A and I
ior $L, $A, I # $L = bitwise (inclusive) OR of $A and I
eor $L, $A, I # $L = bitwise exclusive OR of $A and I
lsl $L, $A, I # $L = $A shifted to the left by I bits
lsr $L, $A, I # $L = $A shifted to the right by I bits
asr $L, $A, I # $L = $A (arithmetically) shifted to the right by I bits
loa $L, $A # $L = [contents of memory word at address $A]
sto $L, $A # [contents of memory word at address $L] = $A

(Instruction controlling the flow of execution)
cmp $A, $B # compare $A (left) and $B (right)
cmp $A, I # compare $A (left) and I (right)
jmp $A # jump to address $A
beq $A # ... if left == right (in the most recent comparison)
bne $A # ... if left != right
bgt $A # ... if left > right (signed)
blt $A # ... if left < right (signed)
bge $A # ... if left >= right (signed)
ble $A # ... if left <= right (signed)
bab $A # ... if left > right (unsigned)
bbw $A # ... if left < right (unsigned)
bae $A # ... if left >= right (unsigned)
bbe $A # ... if left <= right (unsigned)
jmp I # jump to address I
beq I # ... if left == right (in the most recent comparison)
bne I # ... if left != right
bgt I # ... if left > right (signed)
blt I # ... if left < right (signed)
bge I # ... if left >= right (signed)
ble I # ... if left <= right (signed)
bab I # ... if left > right (unsigned)
bbw I # ... if left < right (unsigned)
bae I # ... if left >= right (unsigned)
bbe I # ... if left <= right (unsigned)
hlt # halt execution

Comments are made with # signs.
Loops begin with the symbol @. For example @loop: ...
When accessing a loop, we use > sign. For example, jmp >loop or bge >loop, ble >loop, etc

Do not code hlt. It is already in the task framework.