8085 ALP For LAB
8085 ALP For LAB
8-BIT ADDITION
PROGRAM:
Program Explanation
MNEMONICS:
ADDRESS INSTRUCTIONS OPCODE
C000 MVI A, 05 3E
C001 05
C002 MVI B, 04 06
C003 04
C004 ADD B 80
C006 00
C007 C3
C008 RST 1 CF
CALCULATION:
INPUT 1 = 05 = 0000 0101
INPUT 2 = 04 = 0000 0100
+ 09 = 0000 1000
8 BIT MULTIPLICATION
OBJECTIVE: To multiply two 8-bit hexadecimal numbers using 8085 microprocessor
PROGRAM:
Address/Label Program Explanation
C001 01
C002 C2
C003 XRA A AF
C005 INX H 23
C007 ADD D 82
C008 DCR B 05
C00A 07
C00B C0
C00F INX H 23
C010 MOV M, A 77
C011 INX H 23
C012 RST 1 CF
INPUT & OUTPUT:
C201 INPUT 1 5
C202 INPUT 2 3
C203 PRODUCT F
CALCULATION:
05 = 0000 0101
+ 05 = 0000 0101
= 0000 1010
+ 05 = 0000 0101
= 0F = 0000 1111
= 0F H
RESULT: The program to multiply two 8-bit hexadecimal numbers using 8085 was executed.
LAB – 3
8-BIT DIVISION
OBJECTIVE: To divide two 8-bit hexadecimal numbers using 8085 microprocessor
PROGRAM:
Address/ Label Program Explanation
Memory
MOV A,C Move contents of Register C to Accumulator
MNEMONICS:
ADDRESS INSTRUCTIONS OPCODE
01
C2
00
C2
C007 MVI C, 00 0E
00
C009 CMP B B8
C00A JC Store DA
12
C0
C00D SUB B 90
C00E INR C 0C
09
C0
03
C2
02
C2
C019 RST 1 CF
i)
C200 DIVISOR 3
C201 DIVIDEND 6
C202 REMINDER 0
C203 QUOTIENT 2
ii)
C200 DIVISOR 5
C201 DIVIDEND 9
C300 REMINDER 4
C301 QUOTIENT 1
CALCULATION:
PROGRAM:
Address Program Explanation
01
C2
C004 MVI C, 00 0E
00
C006 XRA A AF
C007 INX H 23
C008 ADD M 86
0D
C0
C00C INR C 0C
C00D DCR B 05
07
C0
00
C3
01
C3
C018 RST 1 CF
C201 DATA 1 2
C202 DATA 2 4
C203 DATA 3 6
C204 DATA 4 8
C205 DATA 5 0A
C206 DATA 6 0C
C300 TOTAL 2A
C301 CARRY 0
CALCULATION:
DATA 1 : 02 - 0000 0010
+ 06 - 0000 0110
+ 14 - 0001 0100
+ 1E - 0001 1110
CARRY : 00
RESULT: Program to add ‘n’ numbers in array and find the sum of those numbers using 8085
Microprocessor with memory pointer was executed.
PROGRAM:
Address Program Explanation
JNZ Loop
00
C2
C004 INX H 23
C006 DCR B 5
C007 INX H 23
C008 CMP M BE
0D
C0
C00D DCR B 5
C3
C014 RST 1 76
C201 DATA 1 04
C202 DATA 2 03
C203 DATA 3 01
C204 DATA 4 22
C205 DATA 5 05
C206 DATA 6 0C
C300 TOTAL 01
CALCULATION:
No. of Data =B =6
A=04 ; B=5
A=22 ;B=2
M=05, Compare M with A: Carry=1, B=1
Example –
Algorithm –
Explanation –
Input 1
3001 04
3002 08
Input 2
3003 07
18
3004
Result was in AX
3005 35
3006 1C
Result was in DX
3007 00
LAB – 7 (8086)
Dosseg
.model small
.stack 100h
.data
String1 db ‘Electrical and Electronics Engineering’, $
.code
Main proc
MOV DS, AX
INT 21H
INT 21H
Main endp
End Main
DISCUSSION AND CONCLUSION:
A string is declared in the .DATA section. The name of the string is set to
aString and the type of the data is byte (DB=data byte). Although it is not only a single byte,
assemblers are only concerned with the data type of the first item, which is then assumed for all
other declarations before a new label. At the end of the string is a 13 and 10 - these are the
carriage return and linefeed characters that are used to go to the next line. The last '$' is needed
by the output function to signal the end of the string.
Before the program can use the data in the data segment, the DS register must first be set up
appropriately. Unlike the CS register which is always set when the program starts, the DS
register must be explicitly set to point to the DATA segment. The first "mov" command gets the
SEGment of the DATA segment and stores it in the AX register. The second "mov" command
sets the DS register value from the AX register. The reason why two commands are necessary is
because the 8086 CPU does not have a command to directly set a value into a segment register.
The value of 9 is inserted into the AH register to select sub-function 9 of the interrupt 21h DOS
interrupts. This interrupt requires that the DS:DX segment:offset pair point to the string to be
output. In this case, DS already points to the segment containing the string. So we just set the DX
register to the OFFSET of the string.
Interrupt 21h is called to output the string and the program terminates like before.