AIM :Write a program to multiply two 8 bit numbers by repetitive addition method using 8086

Objective:

After completing this experiment, students will be able to :

1. understand opcode and mnemonic of the program
2. Draw the flowchart of the program
3. Write the algorithm of the program to multiply two 8-bit numbers
4. Write the program to multiply two numbers
5. Run and debug the program

System Requirement:

• 8086 Trainer Kit with Key Board

Setting up the Trainer Kit:

• Ensure that standard IBM PC/AT system keyboard is connected
• System is Powered ON
• Student has a handy opcode table for programming

Flow Chart:

Figure: 2.1 Flowchart to multiply two numbers

Logic / Algorithm

1. Start
2. Initialize the CL register to store the multiplier, clear accumulator (AL) and register BL and SI and DI register
3. Read the contents of the memory pointer by SI register in register CL (multiplier)
4. Increment the SI register.
5. Add accumulator with carry with the content pointed by SI
6. Increment the SI register content
7. Decrement counter (CL)
8. If not zero, goto step 5
9. If NO carry goto step 11
10. Store result at location pointed by DI
11. Increment BL
12. Increment DI
13. Save carry at location pointed by DI
14. Stop

Execution :

 Data Segment Address DATA Multiplier Segment  : Offset: 0000 : 1300 Multiplicand Segment  : Offset: 0000 : 1301

Executing The Program

 Key Pressed/Action Display on LCD Press G  from Keyboard BURST or Single Step Press Enter Segm_Adr 0000 Press Enter Ofst 0200 Press Enter Wait Cmd_Wrd= Do not press the Reset Key; Check the result by using ub_Mir Command

Verification of Result

 DATA Multiplicand Multiplier 1st Data Address SegAdr: 0000 Ofst : 1301 Ofst : 1300

 Result Carry Product Address SegAdr: 0000 Ofst : 1303 Ofst : 1302

Viva Question

Q.1.  What is purpose of CX (CH, CL) Register?

1. CX register in 8086 is a general purpose register used to hold 16-bit data
2. CX register is also used a counter register for applications requiring execution of LOOP for repeated operation

Q.2. How is the carry checked

Answer: 8086 microprocessor has a JNC/ JC statements to check the status of the carry flag. The control of the statement can be transferred to any location by the use of JNC or JC. In this experiment we used JNC SAVE to jump to location SAVE when there is no carry as a result of addition. If the statement becomes false on execution then the immediate next instruction (inc BL in this experiment) is executed.

Q.3. Explain how the multiplication of two numbers can be obtained by addition operation

Answer: Multiplication in fact the repeated operation of addition. For this purpose we set the counter value with multiplier and add the multiplicand with itself number of times as given by multiplier.

Updated: April 27, 2019 — 1:53 pm