In: Computer Science
Write an assembly program that demonstrates multiplication operation in 80x86 assy languuage
An 80x86 assembly program that demonstrates multiplication operation:
• Assume that we want to to perform multiplication of two 8-bit number 04 and 06, that are at memory location 700 and 701 respectively.
• The 16-bit Result of the multiplication will be stored at memory location 800 and 801.
Assembly Program:
MOV SI, 700
MOV DI, 800
MOV AL, [SI]
INC SI
MOV BL, [SI]
MUL BL
MOV [DI], AX
HLT
Description:
MOV SI, 700 // SI = 700. Set the source index register to 700.
MOV DI, 800 // DI = 800. Set the Destination index register to 800.
MOV AL, [SI] // AL ← [SI]. load the contents from memory address SI to AL register. AL = 04
INC SI // SI = SI + 1. Increment the SI register value. SI = 701
MOV BL, [SI] // BL ← [SI]. load the contents from memory address SI to BL register. BL = 06
MUL BL // AX = AL * BL. Multiply register BL with AL. AX = 04 * 06
MOV [DI], AX // AX → [DI]. Store the content from AX register to destination address DI.
HLT // END the program.
The result is placed at memory location 800 and 801. Which is 04 * 06 = 18 (hexadecimal).