Vous êtes sur la page 1sur 10

EMBEDDED

SYSTEMS
LAB REPORT

NAME – Arnab Roy


ROLL NO. – 17101011
BRANCH - ECE
8085 Microprocessor Programs
Lab-1 Programs
1. Write an assembly language program for two 8-bits addition.
MVI B,04H
MVI C,05H
MOV A,C
ADD B
OUT 01H
HLT

Input:04 05
Output: 09

2. Write an assembly language program for two 8-bits subtraction.


MVI B,03H
MVI C,08H
MOV A,C
SUB B
MOV D,A
HLT

Input:03 08
Output: 05

3. Write an assembly language program for two 8-bits multiplication.


MVI B,03H
MVI C,02H
MVI A,00H
L1: ADD B
DCR C
JNZ L1
HLT

Input:03 02
Output: 06

4. Write an assembly language program for swapping two register values.

MVI B,08H
MVI C,06H
MOV A,C
MOV C,B
MOV B,A
HLT
Input:08 06
Output:06 08

5. Write an assembly language program for swapping two memory values.

LDA 2500
MOV B,A
LDA 2501
STA 2500
MOV A,B
STA 2501
HLT

Input:
2500 : 06
2501 : 04

Output:
2500 : 04
2501 : 06

Lab-2 Programs
1. Write an assembly language program for 8-bits 1’s and 2’s complement.
LDA 2000H
CMA
STA 2001H
INR A
STA 2002H
HLT

Input:
2000 : 55H

Output:
2001: AAH
2002: ABH

2. Write an assembly language program for 8-bits BCD addition.


MVI C,00H
LDA 2500H
MOV B,A
LDA 2501H
ADD B
DAA
JNC FWD
INR C
FWD : STA 2502H
MOV A,C
STA 2503H
HLT

Input-
2500H:32 (BCD no. 1 in decimal)
2501H:77 (BCD no.2 in decimal)

Output-
2502:01(Lower Byte)
2503H:09(Upper Byte)

3. Write an assembly language program for 16-bits addition.


LHLD 4000H
XCHG
LHLD 4002H
DAD D
SHLD 4004H
HLT

Input:
4000 : 15H
4001 : 1CH
4002 : B7H
4003 : 5AH

Output:
4004 : CCH
4005 : 76H

4. Write an assembly language program for summation from 1 to 10.


MVI B,01H
MVI C,0AH
MVI A,00H
L1: ADD B
INR B
DCR C
JNZ L1
STA 0010H
HLT
Output: 37H
Lab-3 Programs
1. Write an assembly language program for 1 second delay and count from 0 to 9.
START: MVI B,00H
DISPLAY: OUT 01
LXI H,92C2H
LOOP: DCX H
MOV A,L
ORA H
JNZ LOOP
INR B
MOV A,B
CPI 0AH
JNZ DISPLAY
JZ START

Output:
The light indicator beeps by 1 sec interval
0 1 2 3 4 5 6 7 8 9 10 1 2 3 ...

2. Write an assembly language program to count from FF TO 00.


MVI B,00H
DCR B
MVI C,8CH
DCR C
JNZ 0005H
MOV A,B
OUT 01
JMP 0002H

Lab-4 Programs
1. Traffic Signal controller-
1-Green D0 15 seconds
2-Yellow D2 5 seconds
3-Red D4 20 seconds
4-Walk D6 15 seconds
5-Don’t Walk D7 25 seconds

LXI SP,1099
START: MVI A,41H
OUT 01H
MVI B,0FH
CALL DELAY
MVI A,84H
OUT 02H
MVI B,05H
CALL DELAY
MVI A,90H
OUT 03H
MVI B,14H
CALL DELAY
JMP START
DELAY: PUSH D
PUSH PSW
SECOND: LXI D,2020H
LOOP: DCX D
MOV A,D
ORA E
JNZ LOOP
DCR B
JNZ SECOND
POP PSW
POP D
RET

2. Write a program to count continuously in binary with one second delay between each count.
Service routine at XX70H to flash FFH five times when the interrupt occurs with some appropriate
delay between flash.

Main Program:

LXI SP, XX99H


EI
MVI A, 00H
NXTCNT: OUT 01H
MVI C, 01H
CALL DELAY
INR A
JMP NXTCNT

Interrupt instruction: EF
At 0028H JMP xx70H

Service routine:

XX70: SERV: PUSH B


PUSH PSW
MVI B, 0AH
MVI A, 00H
FLASH: OUT 02H
MVI C, 01H
CALL DELAY
CMA
DCR B
JNZ FLASH
POP PSW
POP B
EI
RET
8086 Microprocessor Programs
1. To add two Binary numbers each 8 Bytes long:
CLC
MOV CX,0004
MOV SI,0500
MOV DI,0508
MOV AX,[SI]
ADC [DI],AX
INC SI
INC SI
INC DI
INC DI
DEC CX
JNE 040A
HLT

Input: Output:
0500: 01 0508 : 0A 0508 : 0B
0501: 02 0509 : 0B 0509 : 0D
0502: 03 050A : 0C 050A : 0F
0503: 04 050B : 0E 050B : 12
0504: 05 050C : 0F 050C : 14
0505: 06 050D : 10 050D: 16
0506: 07 050E : 11 050E : 18
0507: 08 050F : 12 050F : 1A

2. To find the maximum no. in a given string (16 Bytes long) and store it in location 0510.
MOV SI,0500
MOV CX,0010
MOV AH,00
CMP AH,[SI]
JNB 040E
MOV AH,[SI]
INC SI
LOOPNE 0408
MOV [SI],AH
HLT

Input:
0500 : 01 0508 : 12
0501 : 02 0509 : 08
0502 : 03 050A : 09
0503 : 04 050B : 0A
0504 : 05 050C : 0B
0505 : 06 050D : 0E
0506 : 15 050E : 0C
0507 : 07 050F : 0D

Output:
0510 : 15
3. To sort a string of a no. of bytes in descending order:
MOV SI,0500
MOV BX,[SI]
DEC BX
MOV CX,[SI]
DEC CX
MOV SI,0502
MOV AL,[SI]
INC SI
CMP AL,[SI]
JNB 0419
XCHG [SI],AL
DEC SI
MOV [SI],AL
INC SI
LOOP 040C
DEC BX
MOV SI,0500
JNE 0406
HLT

Input: Output:
0500: 05 0500: 28
0501: 00 0501: 25
0502: 20 0502 :20
0503: 25 0503 :15
0504: 28 0504 :07
0505: 15 0505 :05
0506: 07 0506 : 00

4. ASCII MULTIPLICATION: To multiply an ASCII string of eight numbers by a single ASCII digit.
The result is a string of unpacked BCD digits.

MOV SI,0500
MOV DI,0508
MOV DL,34
MOV CX,0008
MOV BYTE[DI],00
AND DL,0F
MOV AL, [SI]
INC SI
AND AL,0F
MUL DL
AAM
ADD AL,[DI]
AAA
MOV [DI],AL
INC DI
MOV [DI],AH
DEC CX
HLT
Input: Output:
0508 : 0A 0508 : 0B
0509 : 0B 0509 : 0D
050A : 0C 050A : 0F
050B : 0E 050B :12
050C :14
050C : 0F
050D : 16
050D :10 050E : 18
050E : 11 050F :1A
050F : 12

5. To multiply a string (ASCII Digits), of eight numbers starting at location 0500 H, by a single
8-bit 34 H. Then, store the result in the location starting at 0508 H.
MOV SI,0500
MOV DI,0508
MOV DL,34
MOV CX,0008
MOV BYTE[DI],00
AND DL,0F
MOV AL,[SI]
INC SI
AND AL,0F
MUL DL
AAM
ADD AL,[DI]
AAA
MOV [DI],AL
INC DI
MOV [DI],AH
DEC CX
JNE 0411
HLT

Input Output
0500: 31 0508 : 04
0501: 32 0509 : 08
0502: 33 050A : 02
0503: 34 050B : 07
0504: 35 050C : 01
0505: 36 050D : 06
0506: 31 050E : 06
0507: 32 050F : 08
6. Sixteen bytes data are stored in memory locations at XX50H to XX5FH.Transfer thirteen
block of data to new memory locations starting at XX70H.
MOV CX, 16
MOV SI, 1450
MOV DI, 1570
LODSB
MOV [DI], AL
INC DI
DEC CL
JNC Loop
INT 3

Input- Output-
1450 : 01 1570 : 01
1451 : 02 1571 : 02
1452 : 03 1572 : 03
1453 : 04 1573 : 04
1454 : 05 1574 : 05
1455 : 06 1575 : 06
1456 : 07 1576 : 07
1457 : 08 1577 : 08
1458 : 09 1578 : 09
1459 : 0A 1579 : 0A
145A : 0B 158A : 0B
145B : 0C 158B : 0C
145C : 0D 158C : 0D
145D : 0E 158D : 0E
145E : 0F 158E : 0F
145F : 10 158F : 10

Vous aimerez peut-être aussi