(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
IMPLEMENTING ARITHMETIC INSTRUCTIONS IN EMU 8086
1. Lab Report 03 Group No 10 10/10/2017
1 | L a b 0 3
IMPLEMENTING ARITHMETIC INSTRUCTIONS IN EMU 8086
Objective:
Learn how to:
Write programs in Emu8086 using arithmetic instructions
Write a complete assembly program.
Use Emu8086 to execute written programs
Use Emu8086 to execute single instruction at a time.
Edit an existing source program.
Lab Outcomes:
Practice 8086 Emulator
Loading, verifying and saving machine code of arithmetic instructions.
Executing arithmetic instructions and tracing programs.
Arithmetic instructions: These instructions are used to perform various mathematical
operations like addition, subtraction, multiplication and division etc.
Addition instructions
1. ADD: Add specified byte to byte or word to word
2. ADC: Add with carry
3. INC: Increment specified byte or specified word by 1
4. AAA: ASCII adjust after addition
5. DAA : Decimal (BCD) adjust after addition
Subtraction instructions
1. SUB : Subtract byte from byte or word from word
2. SBB : Subtract with borrow
3. DEC : Decrement specified byte or word by 1
4. NEG : Negate or invert each bit of a specified byte or word and add 1 (2’s complement)
5. CMP : Compare two specified byte or two specified words
6. AAS : ASCII adjust after subtraction
7. DAS : Decimal adjust after subtraction
Multiplication instructions
1. MUL : Multiply unsigned byte by byte or unsigned word or word.
2. IMUL : Multiply signed bye by byte or signed word by word
3. AAM : ASCII adjust after multiplication
Division instructions
1. DIV : Divide unsigned word by byte or unsigned double word by word
2. IDIV : Divide signed word by byte or signed double word by word
3. AAD : ASCII adjust after division
4. CBW : Fill upper byte of word with copies of sign bit of lower byte
5. CWD : Fill upper word of double word with sign bit of lower word.
2. Lab Report 03 Group No 10 10/10/2017
2 | L a b 0 3
TASK No 1:
Write an assembly language program for 8086 in which you will store two
nonzero 8-bit numbers to AL and BL registers and perform the following
operations
1. Add both values and store the answer in CH register.
2. Subtract the value placed in BL from AL and store the answer in CL.
3. Multiply the values and store it in AX register.(with and without using
MUL instruction)
4. Divide the value at AL with BL and store the quotient in CH and
remainder in DH register.
Step No 01:
3. Lab Report 03 Group No 10 10/10/2017
3 | L a b 0 3
Step No 2: Moving values to AL and BL registers.
Step No 03: Adding values of AL and BL and storing into CH register.
4. Lab Report 03 Group No 10 10/10/2017
4 | L a b 0 3
Step No 04: Moving back value of AL from DL.
Step No 06: Subtracting values of AL and BL and storing it in CL register.
5. Lab Report 03 Group No 10 10/10/2017
5 | L a b 0 3
Step No 07: Multiplying both values of AL and BL registers with MUL command.
Step No 8: Multiplying both values of AL and BL registers without MUL command.
6. Lab Report 03 Group No 10 10/10/2017
6 | L a b 0 3
Step No 09: Moving value of AL back from DL.
Step No 10: Deviding values of AL and BL and storing quotient in CH and remainder in DH.
7. Lab Report 03 Group No 10 10/10/2017
7 | L a b 0 3
Table No 01
Task No 2:
Write an assembly language program for 8086 in which you will add two BCD
numbers placed in AL and BL registers. Store the final answer in DL register. If
the sum exceeds 8 bit value,store the high byte in DH register. The result must
be in BCD.
(Hint: Use JC and JNC instructions)
Example 01: Without carry
Step No 01: Coding
Instructions
AX BX CX DX CS IP SS SP BP SI DI DS ES
AL AH BL BH CL CH DL DH
MOV AL,09H 09 00 00 00 00 00 00 00 0100 0002 0100 FFFE 0000 0000 0000 0100 0100
MOV BL,02H 09 00 02 00 00 00 00 00 0100 0004 0100 FFFE 0000 0000 0000 0100 0100
MOV DL,AL 09 00 02 00 00 00 09 00 0100 0006 0100 FFFE 0000 0000 0000 0100 0100
ADD AL,BL 0B 00 02 00 00 00 09 00 0100 0008 0100 FFFE 0000 0000 0000 0100 0100
MOV CH,AL 0B 00 02 00 00 0B 09 00 0100 000A 0100 FFFE 0000 0000 0000 0100 0100
MOV AL,DL 09 00 02 00 00 0B 09 00 0100 000C 0100 FFFE 0000 0000 0000 0100 0100
SUB AL,BL 07 00 02 00 00 0B 09 00 0100 000E 0100 FFFE 0000 0000 0000 0100 0100
MOV CL,AL 07 00 02 00 07 0B 09 00 0100 0010 0100 FFFE 0000 0000 0000 0100 0100
MOV AL,DL 09 00 02 00 07 0B 09 00 0100 0012 0100 FFFE 0000 0000 0000 0100 0100
MUL BL 12 00 02 00 07 0B 09 00 0100 0014 0100 FFFE 0000 0000 0000 0100 0100
MOV AL,DL 09 00 02 00 07 0B 09 00 0100 0016 0100 FFFE 0000 0000 0000 0100 0100
MOV DH,BL 09 00 02 00 07 0B 09 02 0100 0018 0100 FFFE 0000 0000 0000 0100 0100
DEC DH 09 00 02 00 07 0B 09 01 0100 001A 0100 FFFE 0000 0000 0000 0100 0100
DEC DH 09 00 02 00 07 0B 09 00 0100 001E 0100 FFFE 0000 0000 0000 0100 0100
DIV BL 04 01 02 00 07 0B 09 00 0100 0020 0100 FFFE 0000 0000 0000 0100 0100
MOV CH,AL 04 01 02 00 07 04 09 00 0100 0022 0100 FFFE 0000 0000 0000 0100 0100
MOV DH,AH 04 01 02 00 07 04 09 01 0100 0024 0100 FFFE 0000 0000 0000 0100 0100
8. Lab Report 03 Group No 10 10/10/2017
8 | L a b 0 3
Step No 02: Storing values in AL,BL registers.
Step No 3: Adding values in AL and BL.
9. Lab Report 03 Group No 10 10/10/2017
9 | L a b 0 3
Step No 04: Storing value of AL in DL register.
Step No 05: Storing value of DX in AX and Adjusting BCD of the value stored in register
AX.
10. Lab Report 03 Group No 10 10/10/2017
10 | L a b 0 3
Example 2: With carry
Step No 01: Coding
11. Lab Report 03 Group No 10 10/10/2017
11 | L a b 0 3
Step No 02: Storing values in AL and BL registers.
Step No 3:Adding values of AL and BL, storing in DL and carry in DH.
12. Lab Report 03 Group No 10 10/10/2017
12 | L a b 0 3
Step No 04: Adjusting BCD using DAA command.