Multiply 16-bit by 16-bit

This subroutine will multiply 16-bit value at r23:r22 with 16-bit value at r21:r20. Result is 16-bit at r17:r16.

    (r23:r22)
    (r21:r20)
    -----------X
    (r17:r16)   


r17:r16 = r23:r22 * r21:r20
Register usage: r0, r1


mul16by16:
    mul r22, r20 ; al * bl
    movw r17:r16, r1:r0
    mul r23, r20 ; ah * bl
    add r17, r0
    mul r21, r22 ; bh * al
    add r17, r0
ret