8085 Lab Manual
8085 Lab Manual
PROGRAM-1
AIM: Identify the components of the microprocessor trainer to configure in the programming
mode.
8085 Kit allows you to enter hex code of the program and run the program. You
can observe content of registers and memory locations after and before execution
of assembly language program.
8085 Kit has 8Kbyte CMOS RAM chip 6264 and 8Kbyte EPROM.
8085 Kit has various input-output devices such as 8279 (Keyboard display
interface), 8255 (Programmable peripheral interface), 8155 (Programmable I/O
port and timer), 8253 (Programmable interval timer)
8085 Following keys to enter execute and observe result of the program.
1
3341101 MALP GTU
8085 kit has six digit seven segment displays. First four digits are called “address field”
and last two digits are called “data field”.
Memory map for the kit is as follow:
EPROM: 0000 to 1FFF (Used to store in built monitor program)
RAM: 2000 to 3FFF (Used to enter program code in the kit)
Scratch Pad RAM used by monitor program: 2770 to 27FF
Steps for entering and executing assembly language program in the Kit
Let us understand how to enter and execute following program in the kit
MEMORY
LABLE MNEMONICS HEX CODE COMMENT
ADDRESS
2000 MVI A,10h 3E
2001 10
2002 MOV B,A 78
2003 RST-5 EF
2
3341101 MALP GTU
3
3341101 MALP GTU
PROGRAM-2
AIM: Develop/Execute a simple programmed to move data from one register to the other
register.
PROGRAM: - Write & Execute Program to store 45h in register A and 59h in register B. Also
copy data of register A & B into register C & D respectively.
ALGORITHM:
MEMORY HEX
LABEL MNEMONICS COMMENT
LOCATION CODE
2000 MVI A, 45H
2001
2002 MVI B,59H
2003
2004 MOV C,A
2005 MOV D,B
2006 RST-5
RESULT:
INPUT OUTPUT
REG. / MEM. REG. / MEM.
DATA DATA
LOCATION LOCATION
45H A 45H
59H B 59H
C 45H
D 59H
4
3341101 MALP GTU
PROGRAM: - Write & Execute Program to load 8-bit number in memory location 2050h.
ALGORITHM:
MEMORY HEX
LABEL MNEMONICS COMMENT
LOCATION CODE
2000 MVI A, 25H
2001
2002 LDA 2050H
2003
2004
2005 RST-5/HLT
RESULT:
INPUT OUTPUT
REG. / MEM. REG. / MEM.
DATA DATA
LOCATION LOCATION
A 25H 2050H 25H
5
3341101 MALP GTU
PROGRAM: - Write & Execute Program to Store content of memory location 2050h into
register B & memory location 2060h.
ALGORITHM:
MEMORY HEX
LABEL MNEMONICS COMMENT
LOCATION CODE
2000 LDA 2050H
2001
2002
2003 MOV B,A
2004 LDA 2060H
2005
2006
2007 RST-5/HLT
6
3341101 MALP GTU
RESULT:
INPUT OUTPUT
REG. / MEM. REG. / MEM.
DATA DATA
LOCATION LOCATION
2050H 15H B 15H
2060H 15H
PROGRAM: - Write & Execute Program to copy content of memory location 2050h which is
stored in BC register pair into register D & location 2060h which is stored in DE
register pair.
ALGORITHM:
MEMORY HEX
LABEL MNEMONICS COMMENT
LOCATION CODE
2000 LXI B,2050H
2001
2002
2003 LDAX B
2004 MOV D,A
2005 LXI D,2060H
2006
2007
2008 STAX D
2009 RST-5/HLT
7
3341101 MALP GTU
RESULT:
INPUT OUTPUT
REG. / MEM. REG. / MEM.
DATA DATA
LOCATION LOCATION
BC 2050H D 23H
DE 2060H 2060H 23H
2050H 23H
PROGRAM: - Write & Execute Program to exchange content of HL and DE reg. pair.
ALGORITHM:
MEMORY HEX
LABEL MNEMONICS COMMENT
LOCATION CODE
2000 LXI H,2050H
2001
2002
2003 LXI D,1045H
2004
2005
2006 XCHG
2007 RST-5/HLT
8
3341101 MALP GTU
RESULT:
INPUT OUTPUT
REG. / MEM. REG. / MEM.
DATA DATA
LOCATION LOCATION
HL 2050H HL 1045H
DE 1045H DE 2050H
9
3341101 MALP GTU
PROGRAM-3
AIM: Develop/Execute a programmed for addition.
ALGORITHM:
MEMORY HEX
LABEL MNEMONICS COMMENT
LOCATION CODE
2000 MVI A,05H
2001
2002 MVI B,04H
2003
2004 ADD B
2005 RST-5/HLT
RESULT:
INPUT OUTPUT
REG. / MEM. REG. / MEM.
DATA DATA
LOCATION LOCATION
A 05H A 09H
B 04H
10
3341101 MALP GTU
PROGRAM: - Write & Execute Program to add content of two memory location.
ALGORITHM:
Start the program by loading HL reg. pair with address of mem. Location.
Move the data into reg. A.
Increment HL reg. pair.
Add two reg. contents.
Increment HL reg. pair and store result on it.
End the program.
MEMORY HEX
LABEL MNEMONICS COMMENT
LOCATION CODE
2000 LXI H,2050H
2001
2002
2003 MOV A,M
2004 INX H
2005 ADD M
2006 INX H
2007 MOV M,A
2008 RST-5/HLT
RESULT:
INPUT OUTPUT
REG. / MEM. REG. / MEM.
DATA DATA
LOCATION LOCATION
2050H 04H 2052H 07H
2051H 03H
11
3341101 MALP GTU
ALGORITHM:
MEMORY HEX
LABEL MNEMONICS COMMENT
LOCATION CODE
2000 LXI H,1025H
2001
2002
2003 LXI D,2534H
2004
2005
2006 DAD D
2007 RST-5/HLT
RESULT:
INPUT OUTPUT
REG. / MEM. REG. / MEM.
DATA DATA
LOCATION LOCATION
HL 1025H HL 3559H
DE 2534H
12
3341101 MALP GTU
Q-1 W.A.P to add two 16-bit number. (With out using DAD instruction)
13
3341101 MALP GTU
PROGRAM-4
AIM: Develop/Execute a programmed for subtraction.
ALGORITHM:
MEMORY HEX
LABEL MNEMONICS COMMENT
LOCATION CODE
2000 MVI A,07H
2001
2002 MVI B,04H
2003
2004 SUB B
2005 RST-5/HLT
RESULT:
INPUT OUTPUT
REG. / MEM. REG. / MEM.
DATA DATA
LOCATION LOCATION
A 07H A 03H
B 04H
PROGRAM: - Write & Execute Program to subtract content of two memory location.
14
3341101 MALP GTU
ALGORITHM:
Start the program by loading HL reg. pair with address of mem. Location.
Move the data into reg. A.
Increment HL reg. pair.
Subtract two reg. contents.
Increment HL reg. pair and store result on it.
End the program.
MEMORY HEX
LABEL MNEMONICS COMMENT
LOCATION CODE
2000 LXI H,2050H
2001
2002
2003 MOV A,M
2004 INX H
2005 SUB M
2006 INX H
2007 MOV M,A
2008 RST-5/HLT
RESULT:
15
3341101 MALP GTU
INPUT OUTPUT
REG. / MEM. REG. / MEM.
DATA DATA
LOCATION LOCATION
2050H 04H 2052H 01H
2051H 03H
Q-1 W.A.P. to subtract content of mem. Location 2050h and reg. C. store result in mem.
Location 2060h.
16
3341101 MALP GTU
PROGRAM-5
AIM: Develop/Execute a programmed for multiplication.
ALGORITHM:
MEMORY HEX
LABEL MNEMONICS COMMENT
LOCATION CODE
2000 MVI B,02H
2001
2002 MVI C,05H
2003
2004 MVI A,00H
2005
BACK ADD C
JNC NEXT
INR D
NEXT DCR B
JNZ BACK
RST-5/HLT
RESULT:
17
3341101 MALP GTU
INPUT OUTPUT
REG. / MEM. REG. / MEM.
DATA DATA
LOCATION LOCATION
B 02H A 0AH
C 05H
Q-1 W.A.P. to multiply content of two register. Store LSB of result on mem. Location 2050h
18
3341101 MALP GTU
PROGRAM-6
AIM: Develop/Execute a programmed for division.
ALGORITHM:
MEMORY HEX
LABEL MNEMONICS COMMENT
LOCATION CODE
LXI H,2050H
MOV A,M
INX H
MOV B,M
BACK SUB B
JC NEXT
INR C
JMP BACK
NEXT ADD B
MOV D,A
RST-5/HLT
19
3341101 MALP GTU
RESULT:
INPUT OUTPUT
REG. / MEM. REG. / MEM.
DATA DATA
LOCATION LOCATION
2050H 07H C 02H
2051H 03H D 01H
Q-1 W.A.P. to divide content of two register. Store quotient of result on mem. Location
20
3341101 MALP GTU
PROGRAM-7
AIM: Develop/Execute an Assembly language program to convert Hexadecimal to ASCII code
conversion.
ALGORITHM:
MEMORY HEX
LABEL MNEMONICS COMMENT
LOCATION CODE
LXI H,2050H
MVI B,05H
JZ NEXT
JC NEXT
21
3341101 MALP GTU
ADI 07H
RST-5/HLT
RESULT:
INPUT OUTPUT
REG. / MEM. REG. / MEM.
DATA DATA
LOCATION LOCATION
2050 05 2050 35
2051 03 2051 33
2052 09 2052 39
2053 0A 2053 41
2054 0B 2054 42
22
3341101 MALP GTU
23
3341101 MALP GTU
PROGRAM-8
AIM: Develop/Execute Assembly language program to check whether given no is odd or even.
PROGRAM: - Write & Execute Program to count ODD numbers from 10-blocks of data. Data
are stored on location 2050h.
ALGORITHM:
MEMORY HEX
LABEL MNEMONICS COMMENT
LOCATION CODE
LXI H,2050H
MVI C,0AH
MOV A,M
BACK RAR
JNC NEXT
INR B
NEXT INX H
DCR C
JNZ BACK
24
3341101 MALP GTU
RST-5/HLT
RESULT:
INPUT OUTPUT
REG. / MEM. REG. / MEM.
DATA DATA
LOCATION LOCATION
2050 01 B 06H
2051 02
2052 05
2053 06
2054 07
2055 03
2056 08
2057 09
2058 05
2059 04
Q-1 Write & Execute Program to count EVEN numbers from 05-blocks of data. Store result
On 3000h location.
25
3341101 MALP GTU
PROGRAM-9
AIM: Develop/Execute a programmed to transfer a block of data from one memory location to
another memory location.
PROGRAM: - Write & Execute Program to move ten block of data from memory location
2050h to memory location 2070h.
ALGORITHM:
MEMORY HEX
LABEL MNEMONICS COMMENT
LOCATION CODE
LXI H,2050H
LXI D,2060H
MVI C,0AH
26
3341101 MALP GTU
RST-5/HLT
RESULT:
INPUT OUTPUT
REG. / MEM. REG. / MEM.
DATA DATA
LOCATION LOCATION
2050 01 2060 01
2051 02 2061 02
2052 03 2062 03
2053 04 2063 04
2054 05 2064 05
2055 06 2065 06
2056 07 2066 07
2057 08 2067 08
2058 09 2068 09
2059 0A 2069 0A
Q-1 Write & Execute Program to exchange content of two reg. pair.
27
3341101 MALP GTU
PROGRAM-10
AIM: Develop/Execute a programmed to add 2 decimal numbers in BCD format.
ALGORITHM:
MEMORY HEX
LABEL MNEMONICS COMMENT
LOCATION CODE
MVI A,45H
MVI B,25H
ADD B
DAA
RST-5/HLT
RESULT:
INPUT OUTPUT
REG. / MEM. REG. / MEM.
DATA DATA
LOCATION LOCATION
A 45H A 70
B 25H
28
3341101 MALP GTU
PROGRAM-11
AIM: Develop/Execute a programmed to convert data from grey code to binary code.
ALGORITHM:
MEMORY HEX
LABEL MNEMONICS COMMENT
LOCATION CODE
LXI H,2050H
MVI D,08H
MOV B,M
MOV A,B
BACK RAR
XRA B
MOV B,A
DCR D
JNZ BACK
MOV M,A
29
3341101 MALP GTU
RST-5/HLT
RESULT:
INPUT OUTPUT
REG. / MEM. REG. / MEM.
DATA DATA
LOCATION LOCATION
2050H 04H 2050H 07H
30
3341101 MALP GTU
PROGRAM-12
AIM: Develop/Execute a programmed to convert data from binary code to gray code.
ALGORITHM:
MEMORY HEX
LABEL MNEMONICS COMMENT
LOCATION CODE
LXI H,2050H
MOV A,M
MOV B,A
RAR
XRA B
INX H
MOV M,A
RST-5/HLT
31
3341101 MALP GTU
RESULT:
INPUT OUTPUT
REG. / MEM. REG. / MEM.
DATA DATA
LOCATION LOCATION
2050 07 2051 04
32
3341101 MALP GTU
PROGRAM-13
AIM: Develop/Execute an Assembly language programs based on 8 bit Logical instructions.
PROGRAM: - Write & Execute Program to perform Logical AND operation between two 8-bit
numbers. Store result on location 2050h.
ALGORITHM:
MEMORY HEX
LABEL MNEMONICS COMMENT
LOCATION CODE
MVI A,45H
MVI B,0FH
ANA B
RST-5/HLT
RESULT:
INPUT OUTPUT
REG. / MEM. REG. / MEM.
DATA DATA
LOCATION LOCATION
A 45H A 05H
B 0FH
33
3341101 MALP GTU
Q-1 Write & Execute Program to perform Logical OR operation between two 8-bit numbers.
Store result on location 2050h.
Q-2 Write & Execute Program to perform Logical EX-OR operation between content of two
mem. Location.
34
3341101 MALP GTU
PROGRAM-14
AIM: Develop/Execute an Assembly language programmed to sum integers from 0 to 9.
ALGORITHM:
MEMORY HEX
LABEL MNEMONICS COMMENT
LOCATION CODE
LXIH,2050H
MVI C,09H
MOV A,M
INX H
BACK ADD M
INX H
DCR C
JNZ BACK
RST-5/HLT
35
3341101 MALP GTU
RESULT:
INPUT OUTPUT
REG. / MEM. REG. / MEM.
DATA DATA
LOCATION LOCATION
2050H 00 A 2Dh
2051 01
2052 02
2053 03
2054 04
2055 05
2056 06
2057 07
2058 08
2059 09
36
3341101 MALP GTU
PROGRAM-15
AIM: Develop a programmed to find the smallest number from an array of 10 numbers.
ALGORITHM:
MEMORY HEX
LABEL MNEMONICS COMMENT
LOCATION CODE
LXIH,2050H
MVI B,09H
MOV A,M
BACK INX H
CMP M
JC NEXT
MOV A,M
NEXT DCR B
JNZ BACK
37
3341101 MALP GTU
STA 2060H
RST-5/HLT
RESULT:
INPUT OUTPUT
REG. / MEM. REG. / MEM.
DATA DATA
LOCATION LOCATION
2050H 23 2060 01
2051 45
2052 67
2053 43
2054 05
2055 36
2056 89
2057 27
2058 01
2059 63
Q-1 Develop a programmed to find the maximum number from an array of 05 numbers.
38
3341101 MALP GTU
PROGRAM-16
AIM: Develop a programmed to count negative values from 10- block of data.
ALGORITHM:
MEMORY HEX
LABEL MNEMONICS COMMENT
LOCATION CODE
LXI H,2050H
MVI B,0AH
INR C
NEXT INX H
DCR B
JNZ BACK
RST-5/HLT
39
3341101 MALP GTU
RESULT:
INPUT OUTPUT
REG. / MEM. REG. / MEM.
DATA DATA
LOCATION LOCATION
2050 95 C 05H
2051 06
2052 65
2053 83
2054 20
2055 45
2056 95
2057 40
2058 86
2059 70
Q-1 Develop a programmed to count positive number from 05- block of data.
Q-2 Develop a programmed to count number of zero (00h) from 05- block of data.
PROGRAM-17
40
3341101 MALP GTU
ALGORITHM:
MEMORY HEX
LABEL MNEMONICS COMMENT
LOCATION CODE
LXI H,2050H
MOV B,M
MOV C,B
MVI A,00H
BACK ADD B
DCR C
JNZ BACK
INX H
MOV M,A
RST-5/HLT
41
3341101 MALP GTU
RESULT:
INPUT OUTPUT
REG. / MEM. REG. / MEM.
DATA DATA
LOCATION LOCATION
2050H 04H 2051H 10H
42
3341101 MALP GTU
PROGRAM-18
AIM: Develop/Execute an Assembly language programmed to sort given array of ten bytes in
descending order.
ALGORITHM:
MEMORY HEX
LABEL MNEMONICS COMMENT
LOCATION CODE
MVI B,05H
MVI C,04H
MOV D,M
MOV M,A
43
3341101 MALP GTU
DCX H
MOV M,D
INX H
NEXT DCR C
JNZ BACK
DCR B
JNZ LOOP
RST-5/HLT
RESULT:
INPUT OUTPUT
REG. / MEM. REG. / MEM.
DATA DATA
LOCATION LOCATION
2050H 05 2050H 09
2051 08 2051 08
2052 06 2052 06
2053 09 2053 05
2054 04 2054 04
44
3341101 MALP GTU
Ascending order.
45
3341101 MALP GTU
PROGRAM-19
AIM: Write & Execute program to alternatively blink LEDs connected on Port –B of 8255 at an
interval of 0.1 second. Draw Interface diagram.
Introduction:
The programmable peripheral interface (PPI) IC-8255 is widely used parallel input output
device. It can be programmed to transfer data under various conditions. It has three 8 bit ports
named as Port A, Port B & Port C. Pin diagram of IC-8255 is as shown in the Fig. 1 and block
diagram is as shown in the Fig. 2
46
3341101 MALP GTU
In this experiment, we will understand mode 0 that is simple input output mode Control word
format is shown in the Fig. 3
In simple I/O mode,
Outputs are latched
Inputs are not latched
Ports do not have handshaking or interrupt facility
Port A,B & C can be used as an input or output port
Depending upon required operation, control word is decided from the specified format & written
into control register. Port A, Port B, Port C & control register (CR) can be selected with chip
select signal and Address lines A0, A1.
47
3341101 MALP GTU
D7 D6 D5 D4 D3 D2 D1 D0
1 0 0 0 0 0 0 0 = 80H
PORT A: 00h
PORT B: 01h
PORT C: 02h
Control Word: 03h
48
3341101 MALP GTU
Procedure:
Connect your LED/seven segment card with 8085 kit connector CN4
Connect power supply with the microprocessor kit & switch on the unit
Enter software code and execute program
Observe Flashing of LEDs
If you have not prepared card, measure voltage carefully
Change the delay and execute program again
MEMORY HEX
LABEL MNEMONICS COMMENT
LOCATION CODE
49
3341101 MALP GTU
50
3341101 MALP GTU
PROGRAM-20
AIM: Develop/Execute an Assembly language programmed for 8279 to Interface keypad and
display on 7-segment LED.
Introduction:
The INTEL 8279 is specially developed for interfacing keyboard and display devices to
8085/8086/8088 microprocessor based system. The important features of 8279 are,
1 6-character display.
51
3341101 MALP GTU
The four major sections of 8279 are keyboard, scan, display and CPU interface.
It has two additional inputs: shift and control/strobe. The keys are automatically
debounced.
The two operating modes of keyboard section are 2-key lockout and N-key rollover.
In the 2-key lockout mode, if two keys are pressed simultaneously, only the first key is
recognized.
In the N-key rollover mode simultaneous keys are recognized and their codes are stored
in FIFO.
The keyboard sections also have an 8 x 8 FIFO (First in First Out) RAM.
52
3341101 MALP GTU
The FIFO can store eight key codes in the scan keyboard mode. The status of the shift
key and control key are also stored along with key code. The 8279 generate an interrupt
signal when there is an entry in FIFO. The format of key code entry in FIFO for scan
keyboard mode is,
In sensor matrix mode the condition (i.e., open/close status) of 64 switches is stored in
FIFO RAM. If the condition of any of the switches changes then the 8279 asserts IRQ as
high to interrupt the processor.
Display section:
The display section has eight output lines divided into two groups A0-A3 and B0-B3.
The output lines can be used either as a single group of eight lines or as two groups of
four lines, in conjunction with the scan lines for a multiplexed display.
The output lines are connected to the anodes through driver transistor in case of common
cathode 7-segment LEDs.
The display section consists of 16 x 8 display RAM. The CPU can read from or write into
any location of the display RAM.
Scan section:
The scan section has a scan counter and four scan lines, SL0 to SL3.
In decoded scan mode, the output of scan lines will be similar to a 2-to-4 decoder.
In encoded scan mode, the output of scan lines will be binary count, and so an external
decoder should be used to convert the binary count to decoded output.
The scan lines are used to form the rows of a matrix keyboard and also connected to digit
drivers of a multiplexed display, to turn ON/OFF.
53
3341101 MALP GTU
It requires two internal address A =0 for selecting data buffer and A = 1 for selecting
control register of8279.
The control signals WR (low), RD (low), CS (low) and A0 are used for read/write to
8279.
It has an interrupt request line IRQ, for interrupt driven data transfer with processor.
The 8279 require an internal clock frequency of 100 kHz. This can be obtained by
dividing the input clock by an internal prescaler.
The RESET signal sets the 8279 in 16-character display with two -key lockout keyboard
modes.
In a microprocessor b system, when keyboard and 7-segment LED display is interfaced using
ports or latches then the processor has to carry the following task.
Keyboard scanning
Key debouncing
Display refreshing
54
3341101 MALP GTU
The circuit can be used in 8085 microprocessor system and consist of 16 numbers of hex-
keys and 6 numbers of 7-segment LEDs.
The 7-segment LEDs can be used to display six digit alphanumeric character.
The 8279 can be either memory mapped or I/O mapped in the system. In the circuit
shown is the 8279 is I/O mapped.
The clock signal for 8279 is obtained by dividing the output clock signal of 8085 by a
clock divider circuit.
The chip select signal is obtained from the I/O address decoder of the 8085 system. The
chip select signals for I/O mapped devices are generated by using a 3-to-8 decoder.
The address line A7 and the control signal IO/M (low) are used as enable for decoder.
55
3341101 MALP GTU
The I/O addresses of the internal devices of 8279 are shown in table.
The circuit has 6 numbers of 7-segment LEDs and so the 8279 has to be programmed in
encoded scan. (Because in decoded scan, only 4 numbers of 7-segment LEDs can be
interfaced)
In encoded scan the output of scan lines will be binary count. Therefore an external, 3-to-
8 decoder is used to decode the scan lines SL0, SL1 and SL2 of 8279 to produce eight
scan lines S0 to S7.
The decoded scan lines S0 and S1 are common for keyboard and display.
The decoded scan lines S2 to S5 are used only for display and the decoded scan lines S6
and S7 are not used in the system.
Anode and Cathode drivers are provided to take care of the current requirement of LEDs.
The anode drivers are called segment drivers and cathode drivers are called digit drivers.
The 8279 output the display code for one digit through its output lines (OUT A0 to OUT
A3 and OUT B0 to OUT B3) and send a scan code through, SL0- SL3.
The display code is inverted by segment drivers and sent to segment bus.
The scan code is decoded by the decoder and turns ON the corresponding digit driver.
Now one digit of the display character is displayed. After a small interval (10 milli-
second, typical), the display is turned OFF (i.e., display is blanked) and the above process
is repeated for next digit. Thus multiplexed display is performed by 8279.
The keyboard matrix is- formed using the return lines, RL0 to RL3 of 8279 as columns
and decoded scan lines S0 and S1 as rows.
56
3341101 MALP GTU
A hex key is placed at the crossing point of each row and column. A key press will short
the row and column. Normally the column and row line will be high.
During scanning the 8279 will output binary count on SL0 to SL3, which is decoded by
decoder to make a row as zero. When a row is zero the 8279 reads the columns. If there is
a key press then the corresponding column will be zero.
If 8279 detects a key press then it waits for debounce time and again read the columns to
generate key code.
In encoded scan keyboard mode, the 8279 stores an 8-bit code for each valid key press.
The key code consist of the binary value of the column and row in which the key is found
and the status of shift and control key.
After a scan time, the next row is made zero and the above process is repeated and so on. Thus 8279 continuously scan
the keyboard.
MEMORY HEX
LABEL MNEMONICS COMMENT
LOCATION CODE
57
3341101 MALP GTU
58