MPMC 4 Programs
MPMC 4 Programs
AIM:
To write an assembly language program to perform logical manipulations using 8086
microprocessor instructions.
APPARATUS REQUIRED:
1. 8086-Microprocessor Kit.
2. DC Power supply – 5V.
ALGORITHM:
1. Initialize the SI register and store the data.
2. Move the contents from memory to AH and AL registers.
3. Perform AND, OR, NOT and XOR operations based on the values stored in AH and AL
register.
4. Store the results in the memory location.
PROGRAM:
MOV SI,1200
MOV AH,[SI]
MOV AL,[SI+1]
AND AH,0FH
OR AH,20H
XOR AH,AL
NOT AH
MOV [SI+2],AH
HLT
OBSERVATION:
Input Output
Address Data Address Data
1200 03 1202 D9
1201 05
RESULT:
Thus the assembly language program for performing various logical
operationsusing 8086 was executed and verified successfully .
1
2. Move a data block without overlap
AIM:
To write an assembly language program to move a block of data from one memory location
to another without overlap.
APPARATUS REQUIRED:
1. 8086-Microprocessor Kit.
2. DC Power supply – 5V.
ALGORITHM:
1. Initialize the address register.
2. Initialize a count for number of elements to be transferred in register CL.
3. Load the contents in SI and DI index register.
4. Move the contents from register SI to DI.
5. Till the counter reaches zero, repeat step 4.
PROGRAM:
MOV SI, 1200
MOV CL, [1200]
MOV DI, 1500
INC SI
LOOP1: LODSB
MOV [DI], AL
INC DI
DEC CL
JNZ LOOP1
HLT
OBSERVATION:
Input Output
Addres Data Address Data
s
1200 04 1500 05
1201 05 1501 07
1202 07 1502 0A
1203 0A 1503 FF
1204 FF
RESULT:
Thus the assembly language program for block transfer of data without overlap
using 8086 was executed and verified successfully.
2
3. HEX to ASCII Conversion
AIM:
To write an assembly language program to convert a hexadecimal number to its equivalent
ASCII value.
APPARATUS REQUIRED:
1. 8086-Microprocessor Kit -1.
2. DC Power supply – 5V.
ALGORITHM:
1. Loads register AL with input data(HEX value).
2. Compare the input data with 0A.
3. Check if AL<0A, if so add 30 with register AL else goto step 4.
4. Add 7 with the register AL.
5. Store the result in register AL.
PROGRAM:
MOV SI, 2000
MOV AL, [SI]
CMP AL, 0AH
JC NEXT
ADD AL, 07H
JMP END
NEXT: ADD AL, 30H
END:MOV [SI+1], AL
HLT
OBSERVATION:
Input Output
Address Data Address Data
2000 05 2001 35
RESULT:
Thus the assembly language program for Hex to ASCII conversion using 8086 was
executed and verified successfully.
3
4. BCD Addition
AIM:
To write an assembly language program for performing addition and subtraction of two
BCD numbers using 8086 microprocessor.
APPARATUS REQUIRED:
1. 8086-Microprocessor Kit -1.
2. DC Power supply – 5V.
ALGORITHM:
1. Initialize the pointer to memory for data and result.
2. Load CL with count.
3. Add two matrices by each element.
4. Store the result into memory.
PROGRAM:
MOV SI, 3000H
MOV AH,[SI]
MOV AL, [SI+1]
MOV DI, 4000H
MOV BH,[DI]
MOV BL, [DI+1]
ADD AL, BL
DAA
MOV BL, AL
ADC AH, BH
MOV AL, AH
DAA
MOV BH, AL
MOV CH, 04H
MOV CL, 04H
L2:ROL BX, CL
MOV DL, BL
AND DL, 0FH
CMP DL, 09
JBE L4
ADD DL, 07
L4: ADD DL, 30H
DEC CH
JNZ L2
MOV [SI+2], BH
MOV [SI+3], BL
HLT
4
OBSERVATION:
Input Output
Address Data Address Data Address Data
3000 36 4000 47 3002 83
RESULT:
Thus the assembly language program for BCD addition and subtraction using 8086
was executed and verified successfully.