I am multiplying 3 numbers which works good even with a carry. I want to add a 4th number to multiply just for learning purposes.
After i multiply 3 numbers i shift into EDX and print. Works great. After i add a 4th number i think i am multiplying 32bit x 32bit? So it stores into EDX:EAX?
Would i then need to shift EAX into EDX so they are together to print? Im not sure if i am doing it right for the 4th number?
.data?
num1 dd ?
num2 dd ?
num3 dd ?
num4 dd ?
.data
sum dd 0
prod dd 0
prod2 dd 0
here are the prompts
mov EAX, sval(input("Enter first number: "))
mov num1, EAX
mov EAX, sval(input("Enter second number: "))
mov num2, EAX
mov EAX, sval(input("Enter third number: "))
mov num3, EAX
mov EAX, sval(input("Enter fourth number: "))
mov num4, EAX
here is the logic
mov EAX, num1
mov EBX, num2
mul BL ; 8 bit x 8 bit ----> AX / 16bit
mov EBX, num3
mul BX ; 16bit x 16bit --->DX:AX
shl EDX, 16 ; shift low to high ;high / low in EDX
mov DX, AX ; mov in all reg
mov ECX, num4 ; 32bit x 32bit ---> EDX:EAX
mul CX
mov prod2, EAX ; for printing
I am not sure if i should move num4 into ECX and multiplying by CX Should i be multiplying by 32bit instead? What am i doing wrong for the 4th number? Thank you