Professional Documents
Culture Documents
SESSION 2018-19
MICROPROCESSOR
INDEX
Program:
Instructions Comments
ORG 100h
END
End of program
Explanation:
● This program add two 8-bit numbers.
● ORG 100h is a compiler directive. It tells compiler how to handle the source code.
● It tells compiler that the executable file will be loaded at the offset of 100h (256 bytes).
● The 1st 8-bit number 05H is moved to accumulator AL.
● The 2nd 8-bit number 03H is moved to register BL.
● Then, both the numbers are added and the result is stored in AL.
Output:
Before Execution: After Execution:
AX = 05H AX = 08H
BX = 03H
PROGRAM- 1(b)
Program:
INSTRUCTION COMMENTS
ORG100h
END
End of program
Explanation:
● This program subtract two 8-bit numbers.
● ORG 100h is a compiler directive. It tells compiler how to handle the source code.
● It tells compiler that the executable file will be loaded at the offset of 100h (256 bytes).
● The 1st 8-bit number 05H is moved to accumulator AL.
● The 2nd 8-bit number 03H is moved to register BL.
● Then, both the numbers are subtracted and the result is stored in AL.
Output:
Before Execution: After Execution:
AX = 05H AX = 02H
BX = 03H
PROGRAM 2(a)
Aim: Write a program to Add two 16-bit numbers.
REQUIREMENT:EMU 8086 SOFTWARE, PC.
Program:
Instructions Comments
ORG100h
MOVAX,0005H Move1st16-bitnumbertoAX
MOVBX,0003H Move2nd16-bitnumbertoBX
Explanation:
This program adds two16-bit numbers.
ORG100h is a compiler directive. It tells compiler how to handle the source code.
It tells compiler that the executable file will be loaded at the offset of 100h (256bytes).
The 1st 16-bit number 0005H is moved to accumulator AX.
The 2nd 16-bit number 0003H is moved to register BX.
Then, both the numbers are added and the result is stored in AX.
Output:
Before Execution: After Execution:
AX=0005HAX=0008H
BX=0003H
PROGRAM 2(b)
AIM: Write a Program to Subtract two 16-bit numbers.
REQUIREMENT: EMU 8086 SOFTWARE, PC.
Program:
Instructions Comments
ORG100h
Explanation:
This program subtract two16-bit numbers.
ORG100h is a compiler directive. It tells compiler how to handle the source code.
It tells compiler that the executable file will be loaded at the offset of 100h (256bytes).
The 1st 16-bit number 0005H is moved to accumulator AX.
The 2nd 16-bit number 0003H is moved to register BX.
Then, both the numbers are subtracted and the result is stored in AX.
Output:
Before Execution: After Execution:
AX=0005H,BX=0003HAX=0002H
PROGRAM - 3
PROGRAM-04(a)
AIM: Write a Program to perform addition of 2 decimal digits 9 and 7 using ASCII
codes and store the result in A SCII format.
Instructions Comments
ORG100h
ADDAX,3030h
Explanation:
This program ASCII addition.
ORG100h is a compiler directive. It tells compiler how to handle the source code.
It tells compiler that the executable file will be loaded at the offset of 100h (256bytes).
The 1st decimal number 9 is moved to accumulator AL.
The 2nd decimal number 9 is added and result will store in AL.
After addition AAA is performed and result will moved in CX.
Output: CX=0106.
PROGRAM-04(b)
Instructions Comments
ORG100h
ADDAL,30H
Explanation:
This program ASCII addition.
ORG100h is a compiler directive. It tells compiler how to handle the source code.
It tells compiler that the executable file will be loaded at the offset of 100h (256bytes).
The 1st decimal number 9 is moved to accumulator AL.
The 2nd decimal number 9 is added and result will store in AL.
After addition AAA is performed and result will moved in CX.
Output: CH=02.
PROGRAM - 5
AIM: Write a Program to Multiply 4 into 5.
REQUIREMENT: EMU 8086 SOFTWARE, PC.
Program:
Instructions Comments
ORG 100h
Explanation:
● This program multiply two 8-bit numbers.
● ORG 100h is a compiler directive. It tells compiler how to handle the source code.
● It tells compiler that the executable file will be loaded at the offset of 100h (256 bytes).
● The 1st 8-bit number 05H is moved to accumulator AL.
● The 2nd 8-bit number 04H is moved to register BL.
● Then, both the numbers are multiplied and the result is stored in AL.
Output:
Before Execution: After Execution:
AX = 05H AX = 14H
BX = 04H
PROGRAM-6
Program:
Instructions Comments
ORG100h
Explanation:
This program multiplies two 8-bit numbers.
ORG100h is a compiler directive. It tells compiler how to handle the source code.
It tells compiler that the executable file will be loaded at the offset of 100h (256bytes).
The 1st 16- bit number 0008H, i.e. dividend, is moved to accumulator AX.
The2nd8-bitnumberFEH(-2indecimal),i.e.divisor,ismovedtoregisterBL.
Then, both the numbers are divided.
The result of division is stored in AX. AL contains the quotient and AH contains the
remainder.
Output:
Before Execution: After Execution:
AX=0008HAL=FCH(-4indecimal)(Quotient)
BL=FEH(-2indecimal)AH=00H(Remainder)
PROGRAM -7
AIM: Write an assembly language program to solve following arithmetic equation:
3AX+5DX+BP.
PROGRAM:
org 100h
MOV BX,AX
SAL AX,1
ADD BX,AX
ADD BX,DX
ADD CL,02
SAL DX,CL
ADD BX,DX
SAL BP,1
ADD BX,BP
MOV CX,BX
HLT
PROGRAM - 8
OUTPUT: 1+2+3+4+5………=210.
PROGRAM - 9
MOV DS,AX
MOV SI,0500H
MOV DI,0604H
MOV AX,0000H
MOV CL,05H
CMP AL,[DI]
JNZ L2
INC SI
DEC DI
DEC CL
JNZ L1
MOV DX,01H
JMP L3
L3: HLT
OUTPUT: DX=01