https://www.felixcloutier.com/x86/mul
> Performs an unsigned multiplication of the first operand (destination operand)
> and the second operand (source operand) and stores the result in the destination operagtnd
mul a b is equivalent to
a *= b
> The destination operand is an implied operand located in register AL, AX or EAX
> (depending on the size of the operand)
mul b is equivalent to
al *= b
> The result is stored in register AX (...)
> with the high-order bits of the product contained in register AH
so it's actually
mul b === ax = al*b
so
1 2
|
mov al, [bNum3]
mul al
|
is equivalent to al*al, same as bNum3*bNum3
1 2 3
|
mov ax, [bNum2]
mov ah, [bNum3]
mul ah
|
'ah' is a byte, so that did
ax = al*ah
`bNum2' happens to enter in al
1 2 3
|
mov ax, [bNum2]
mov cx, [bNum3]
mul cx
|
because cx is a 'word' the result will be in dx:ax
(see table 4-9)
> Would have helped if the professor had made it clear that
> al/ah and ax weren't different memory locations
think of it like a
union
al, lower bits of ax
ah, higher bits of ax
ax, lower bits of eax