SECTION .text ALIGN 16 BITS 32 GLOBAL _Product _Product: ; Function prototype: ; ------------------- ; long long Product64(long long A, long long B) ; ; ; Function description: ; --------------------- ; Returns the product of integers "A" and "B". ; The first byte of "A" is located at [ESP+4] ; The first byte of "B" is located at [ESP+12] ; ; Note: ; ----- ; You may use registers EAX, ECX, and EDX without ; worrying about preserving their original contents. ; However, you must preserve and restore the contents ; of any other register you modify. ; ; Step 1: ; ------- ; Form the 64-bit unsigned product AL x BH, where ; "AL" refers to the "Least-Significant Word of A" and ; "BH" refers to the "Most-Significant Word of B". ; (Each 64-bit integer consists of two 32-bit "words".) ; ; Step 2: ; ------- ; Form the 64-bit unsigned product AH x BL. ; ; Step 3: ; ------- ; Form the 32-bit sum of the LSW's of the two products ; produced in steps 1 and 2. ; ; Step 4: ; ------- ; Form the 64-bit product AL x BL ; ; Step 5: ; ------- ; Add the 32-bit sum developed in Step 3 to the MSW of ; the 64-bit product developed in Step 4. ; ; The 64-bit result must be left in registers EDX.EAX, ; with the MSW in EDX and the LSW in EAX. RET ; Return to calling program.