IT Lab Practical Record
IT Lab Practical Record
PRACTICAL RECORD
EC8681:MICROPROCESSORAND
MICROCONTROLLER LABORATORY
NAME Hari M
SEM V
ANNA UNIVERSITY
JAYA ENGINEERING COLLEGE
THIRUNINRAVUR-602 024
(An ISO 9001:2000 Certified Institution)
Email : info@jec.ac.in
Website: www.jec.ac.in
BONAFIDE CERTIFICATE
This is to certify that this is a bonafide record of work done by
1 16-BIT ADDITION
2 16-BIT SUBTRACTION
3 16-BIT MULTIPLICATION
4 16-BIT DIVISION
7 SEARCHING A ELEMENT IN AN
ARRAY
8 ASCENDING ORDER
9 DESCENDING ORDER
10 BLOCK TRANSFER
11 PARALLEL COMMUNICATION
HEXADECIMAL TO DECIMAL
12
CONVERSION
13 SAWTOOTH WAVE GENERATION
16 INTERFACING 8279
19 8-BIT SUBTRACTION
20 8-BIT MULTIPLICATION
21 8-BIT DIVISION
22 LOGICAL AND OPERATION
24 2’S COMPLEMENT
25 FINDING SQUARE
27 BIT MANIPULATION
29 TIMER
MASM PROGRAMS
30 SEARCH WORD
31 STRING MANIPULATION
32 SORTING
33 LOGICAL OPERATION
34 BINARY TO BCD
36 16-BIT ADDITION
37 16-BIT SUBTRACTION
38 16-BIT MULTIPLICATION
39 16-BIT DIVISION
40 3X3 MATRIX
16 BIT ADDITION USING
AIM:
To write a program for 16 bit addition using 8086 microprocessor
APPARATUS REQURIED:
1.8086 microprocessor kit 1
2. Adaptor 1
3. Opcode sheet 1
ALGORITHM:
1. Start the program
2. Get the first operand from the memory
3. Get the second operand from the memory
4. Add both operand
5. Store the result
6. Stop the program and store it in specific notation
7. Execute the program
16 BIT ADDITION USING 8086
RESULT:
Thus the program for 16 bit addition using 8086 is executed and verified successfully
16 BIT SUBTRACTION USING 8086
AIM:
To write the program for 16 bit subtraction using 8086 microprocessor kit.
APPARATUS REQUIRED:
1.8086 Microprocessor kit 1
2. Adaptor 1
3. Opcode sheet 1
ALGORITHM:
1. Start the program
2. Get the first operand from the memory
3.Get the second operand from the memory
4.Subtract both operand
5. Store the result
6. Stop the program and store it in specific notation
7.Execute the program
16 BIT SUBTRACTION USING 8086
RESULT:
Thus the program for 16 bit subtraction using 8086 is executed and verified successfully
16 BIT MULTIPLICATION USING 8086
AIM:
To write the program for 16 bit multiplication using 8086 microprocessor kit.
APPARATUS REQUIRED:
1.8086 Microprocessor kit 1
2. Adaptor 1
3. Opcode sheet 1
ALGORITHM:
1. Start the program
2. Get the first operand from the memory
3.Get the second operand from the memory
4.Multiply both operand
5. Store the result
6. Stop the program and store it in specific notation
7.Execute the program
16 BIT MULTIPLICATION USING 8086
RESULT:
Thus the program for 16 bit multiplication using 8086 is executed and
verified successfully
16 BIT DIVISION USING 8086
AIM:
To write the program for 16 bit division using 8086 microprocessor kit.
APPARATUS REQUIRED:
1.8086 Microprocessor kit 1
2. Adaptor 1
3. Opcode sheet 1
ALGORITHM:
1. Start the program
2. Get the first operand from the memory
3.Get the second operand from the memory
4.Divide both operand
5. Store the result
6. Stop the program and store it in specific notation
7.Execute the program
16 BIT DIVISION USING 8086
RESULT:
Thus the program for 16 bit division using 8086 is executed and verified successfully
FINDING THE SMALLEST NUMBERS
AIM:
To write a program for assembly language to find the smallest number in an array using 8086
microprocessor kit.
APPARATUS REQUIRED:
1.8086 Microprocessor kit 1
2.Power supply adapter 1
ALGORITHM:
1. Start the program
2. Load the number of passes an input each of number of elements in the array.
3.Move 1 to B register and increment BL register
4. Move data to accumulator and the N compare with C register
5. In accumulator value is less than C set carry flag and decrement B register
6.If zero comes go to step 4
7.Stop the program
FINDING SMALLEST NUMBER IN ARRAY
RESULT:
Thus the program for 8 bit smallest number in an array using 8086 microprocessor is executed
successfully
FINDING THE LARGEST OF THREE NUMBERS
AIM:
To write a program for assembly language to find the largest array in the list using 8086
microprocessor kit.
APPARATUS REQUIRED:
1.8086 Microprocessor kit 1
2.Power supply adapter
ALGORITHM:
1. Start the program
2. Load the number of passes an input each of number of elements in the array.
3.Move 1 to B register and increment BL register
4. Move data to accumulator and the compare with C register
5. In accumulator value is greater than C set array flag and decrement B register
6.If zero comes go to step 4
7.Stop the program
FINDING LARGEST NUMBER IN ARRAY
RESULT:
Thus the program for 8 bit largest number in an array using 8086 microprocessor is executed
successfully.
SEARCHING AN ELEMENT FROM THE GIVEN ARRAY
AIM:
To write the program for searching an element from the given array
APPARATUS REQUIRED:
1.8086 Microprocessor kit 1
2. Adaptor 1
3. Opcode sheet 1
ALGORITHM:
1. Start the program
2. Move the content of memory to BL and move data to SI
3.Move the content of memory to DI
4. Compare content of DI and SI
5. When ZF=0 jump to loop and decrement BL by 1
6.Move the content of SI to memory
7.Stop the program
SEARCHING A NUMBER IN AN ARRAY
RESULT:
Thus the program for searching a number in an array using 8086 is executed and verified
successfully
ASCENDING ORDER USING 8086
AIM:
To write the program for ascending order using 8086 microprocessor kit.
APPARATUS REQUIRED:
1.8086 Microprocessor kit 1
2. Adaptor 1
3. Opcode sheet 1
ALGORITHM:
1. Start the program
2. Load the content of accumulator directly from the given address
3.Move the content of pair by B to C and it load it to HL memory
4.Increment the content of pair by 1
5.Compare the value between A and D and the result is stored in flag
6.Store the ordered content in accumulator
7.Stop the program
ASCENDING ORDER USING 8086
RESULT:
Thus the program for 16 bit storing number in ascending order using 8086 microprocessor is
executed successfully
DESCENDING ORDER USING 8086
AIM:
To write the program for descending order using 8086 microprocessor kit.
APPARATUS REQUIRED:
1.8086 Microprocessor kit 1
2. Adaptor 1
3. Opcode sheet 1
ALGORITHM:
1. Start the program
2. Get the data and more immediately to CX register
3. Increment the pointer by 1 to store the data in next memory location
4.Compare the data and store the data in descending order
5.The data which are stored should be arranged in order
6.Increment the pointer
7.Stop the program
DESCENDING ORDER USING 8086
RESULT:
Thus the program for 16 bit storing number in descending order using 8086 microprocessor is
executed successfully
STRING MANIPULATION USING 8086
AIM:
To write the program for string manipulation using 8086 microprocessor kit.
APPARATUS REQUIRED:
1.8086 Microprocessor kit 1
2. Adaptor 1
3. Opcode sheet 1
ALGORITHM:
1. Start the program
2. Move the content of memory to CX
3.Move the immediate data to SI
4.Move immediate data to DI
5.Repeatedly move the content between memory location through SI and DI by looping
6.Stop the program
STRING MANIPULATION PROGRAM FOR BLOCK TRANSFER
RESULT:
Thus the program for block transfer using 8086 microprocessor is executed successfully.
PARALLEL COMMUNNNICATION
AIM:
To write the program for transmitting and receiving the signal in the parallel communication system.
APPARATUS REQUIRED:
1.8086 Microprocessor kit 1
2.Power supply 1
ALGORITHM:
1. Start the program
2. In the transistor side more the content of data to AL
3.Get the port address to the register
4.Get the memory address
5.Use the ‘OUT’ operator
6.In receiver side, get the port address
7.Get the port data
8.Use the ‘IN’ operator
9.Increment the value
10.Stop the program
PROGRAM FOR TRANSMITTER
RESULT:
Thus the program for parallel communication between two microprocessor receives and transmits
using 8086 microprocessor is executed successfully
HEXADECIMAL TO DECIMAL CONVERSION USING 8086
AIM:
To write the program for string manipulation using 8086 microprocessor kit.
APPARATUS REQUIRED:
1.8086 Microprocessor kit 1
2. Adaptor 1
3. Opcode sheet 1
ALGORITHM:
1. Move the Data To Al and Move Al To Dl
2. Move Data To Al And Move Data To Cl
3. Increment Ac and Increment Cl
4. Decrement Dl
5. Move Al To Data and Move Cl To Data
6. End Of The Program
HEXADECIMAL TO DECIMAL
RESULT:
Thus the program for hexadecimal to decimal using 8086 microprocessor is executed
successfully.
SAWTOOTH WAVE FORM GENERATION
AIM:
To write the program to generate saw tooth wave from.
APPARATUS REQUIRED:
1.8086 Microprocessor kit 1
2. Adaptor 1
3. CRO 1
ALGORITHM:
1. Start the program
2. Set the ports as a output and initialize the control word register
3.Clear the accumulator content immediately
4.Increment the accumulator and send the output to the port
5.It will be incremented till it reaches to index value
6.Further increment will jumps uncontionally
7.The process is repeated again and again
8.Stop the program
SAWTOOTH WAVEFORM GENERATION
RESULT:
Thus the program for generation of wave form using 8086 microprocessor is executed successfully
TRIANGULAR WAVE FROM GENERATION
AIM:
To write the program to generate the triangular wave form using 8086
APPARATUS REQUIRED:
1.8086 Microprocessor kit 1
2.Power supply 1
ALGORITHM:
1. Start the program
2. Move the data to the accumulator
3. The accumulator content is set by the SWR
4.accumulator content is being incremented one by one
5.Once the maximum value is reached its starts decrementing till it reach zero
6.After every step, the accumulator sets out the content
7.Stop the program
Address Label Mnemonics Hexcode Comments
Opcode Operand
8000H MOV DX,FFE6 BA Initialize the control word register
8001H E6
8002H FF
8003H MOV AL,80 B0 Configure CWR and all the port
as output
8004H 80
8005H OUT DX EE Out the DX register
8006H START MOV CX,00FF B9 Load the count value
8007H FF
8008H 00
8009H MOV AL,00 B0 Clear the AL register
800AH 00
800BH UP INC AL 40 Increment AL by 1
800CH C0
800DH MOV DX,FFE0 BA Move the port address to DX register
800EH E0
800FH FF
8010H OUT DX,AL EE Move the AL value to port B
8011H MOV DX,FFE2 BA Move the address of port B to DX
register
8012H E2
8013H FF
8014H OUT DX,AL EE Transmit the content from port B
8015H LOOP UP E2
8016H F4
8017H MOV CX,00FF B9 Move the 00FF immediate to CX
8018H FF
8019H 00
801AH MOV AX,CX 8B Move the CX value to AX
801BH C1
801CH DOWN DEC AL FE Decrement AL by 1
801DH C8
801EH MOV DX,FFE0 BA Initialize port A
801FH E0
8020H FF
8021H OUT DX,AL EE Output the value to port A
8022H MOV DX,FFE2 BA
8023H E2
8024H FF
8025H OUT DX,AL EE
8026H LOOP DOWN E2
8027H F8
8028H JMP START EB
8029H E0
RESULT:
Thus the program for generation of triangular wave form using 8086 microprocessor is executed
successfully.
SQUARE WAVE FORM GENERATION
AIM:
To write the program to generate square wave from.
APPARATUS REQUIRED:
1.8086 Microprocessor kit 1
2. Adaptor 1
3. CRO 1
ALGORITHM:
1.Start the program
2.Initialise output program
3.Set maximum value FF to A
4.Call uncondional delay for getting square shape
5.Tthen the value is decrement to 0
6.Again same steps are repeated
7.stop the program
Address Label Mnemonics Operand Hex code Comments
Opcode
8000H MOV DX,FFE6 BA Move the CWR register to DX
register
8001H E6
8002H FF
8003H MOV AL,80 B0 Move the immediate value 80 to
AL register
8004H 80
8005H OUT DX EE Configure the CWD register
8006H START MOV AL,FF B0 Initialize the AL register by FF
8007H FF
8008H MOV DX,FFE0 BA Initialize port A
8009H E0
800AH FF
800BH OUT DX,AL EE Move the AL value to port A
800CH MOV DX,FFE2 BA Initialize port B
800DH E2
800EH FF
800FH OUT DX,AL EE Move the AL value to port B
8010H MOV CX,00FF B9 Move the 00FF immediate value
to C
8011H FF
8012H 00
8013H DLY1 LOOP DLY1 E2 Stay here for while
8014H FE
8015H MOV AL,00 B0 Clear AL
8016H 00
8017H MOV DX,FFE0 BA Initialize port A
8018H E0
8019H FF
801AH OUT DX,AL EE Output value to port A
801BH MOV DX,FFE2 BA Initialize port B
801CH E2
801DH FF
801EH OUT DX,AL EE Output the value to port B
801FH MOV CX,00FF B9 Move the 00FF immediate value
to C
8020H FF
8021H 00
8022H DLY2 LOOP DLY2 E2 Stay here for while
8023H FE
8024H JMP START EB Repeat the program
8025H E0 Indefinitely
RESULT:
Thus the program for generation of square wave form using 8086 microprocessor is executed
successfully.
INTERFACING 8279 WITH 8086
AIM:
To display a characteristics of the first digit and using 8279 interfacing with 8086
microprocessor.
APPARATUS REQUIRED:
1.8086 Microprocessor kit 1
2.Adaptor 1
3.8279 interface 1
ALGORITHM:
1. Start the program.
2. Move the data into accumulator port clear the output port.
RESULT
Thus the program for interfacing display controller using 8086 microprocessor is executed
successfully.
TRAFFIC LIGHT CONTROLLER WITH 8086
AIM:
To interface traffic light conmtroller with 8086 microprocessor.
APPARATUS REQUIRED:
1.8086 Microprocessor kit 1
2. Adaptor 1
3. traffic light interface 1
ALGORITHM:
1. Start the program.
2. Transmit the control word to the traffic light interface through 8086
801B 07
801C 00
801D INC BX E2 Increment bx
801E F1
801F LOOP NEXT E2
8020 EB
8021 JMP START EB
8022 E4
8023 DELAY: PUSH CX 51 Push the count value
8024 MOV CX,0005H B9
8025 00
8026 05
8027 REPEAT: MOV DX,0FFFFH BA
8028 FF
8029 FF
802A LOOP2: DEC DX 4A decrement bx
802B JNZ LOOP2 75
802C FD
802D LOOP REPEAT E2
802E F8
802F POP CX 59 Pop the count value
8030 RET C3
Result:
Thus the traffic light controller is executed.
8 BIT ADDITION USING 8051
AIM:
To write the program for 8 bit addition using 8051 microcontroller kit.
APPARATUS REQUIRED:
1.8051 Microcontroller kit 1
2.Power supply 1
3.Opcode sheet 1
ALGORITHM:
1. Start the program
2. Move the data to memory pointer and then to accumulator
3.Move the accumulator value to R0 register
4.Increment DPTR by 1
5.Move DPTR to accumulator
6.Add accumulator and register value and jump to given loop
7Lload the pointer to accumulator
8. Increment DPTR by 1
9. Move the accumulator content to DPTR
10.Stop the program using interactive short jump
ADDITION PROGRAM FOR 8051
RESULT:
Thus the 8 bit addition using 8051 is verified and executed successfully.
8 BIT SUBTRACTION USING 8051
AIM:
To write the program for 8 bit subtraction using 8051 microcontroller.
APPARATUS REQUIRED:
1.8051 Microcontroller kit 1
2.Power supply 1
3.Opcode sheet 1
ALGORITHM:
1. Start the program
2. Move the data to memory pointer and then to accumulator
3.Move the accumulator value to the R0 register
4.Increment the DPTR by 1
5. Move the DPTR to the accumulator
6. Subtract accumulator and register value and jump to given loop
7.Load the pointer to accumulator
8. Increment the DPTR by 1
9. Move the accumulator content to DPTR
10.Stop the program
SUBTRACTION PROGRAM FOR 8051
RESULT:
Thus the program for 8 bit subtraction using 8051 is executed successfully
8 BIT MULTIPLICATION USING 8051
AIM:
To write the program for 8 bit multiplication using 8051 microcontroller kit.
APPARATUS RQUIRED:
1.8051 Microcontroller kit 1
2. Power supply 1
3. Opcode sheet 1
ALGORITHM:
1. Start the program
2. Move the immediate data 8100H to data pointer
3. Store the address value as data pointer
4. Move the content of data pointer to a register through accumulator
5. Increment DPTR and multiply the two values
6. Store the results in 8200H address location
7. Stop the program
MULTIPLICATION PROGRAM FOR 8051
RESULT:
Thus the program for 8 bit multiplication using 8051 is executed and verified successfully.
8 BIT DIVISION USING 8051
AIM:
To write the program for 8 bit division using 8051 microcontroller
APPARATUS REQUIRED:
1.8051 microcontroller kit 1
2.power supply 1
3.Opcode sheet 1
ALGORITHM:
1. Start the program
2. Move immediate data to data pointer
3.Move the content of accumulator to B
4.increment the DPTR and move its content to A
5.Program division operation on A and B
6.Move the result to data pointer and then to accumulator
7.Increment DPTR and move the content to A
8.Stop the program
DIVISION PROGRAM FOR 8051
RESULT:
Thus the program for 8 bit division using 8051 is executed and verified successfully.
AND OPREATION USING 8051
AIM:
To perform 8 bit logical AND operation using 8051 microcontroller
APPARATUS REQUIRED:
1.8051 microcontroller kit 1
2.Power supply 1
3.Opcode sheet 1
ALGORITHM:
1. Start the program
2. Get the input data from memory location into DPTR register
3.Move the content of DPTR into the accumulator
4.Store the content of accumulator into R0 register
5.Increment the content of DPTR
6.AND the content of the R0 register with the content of accumulator
7.Move the content of 8200H into DPTR
8.Stop the program.
AND OPERATION PROGRAM FOR 8051
RESULT:
Thus the program for logical AND operation using 8051 microcontroller is executed
successfully.
XOR OPERATION USING 8051
AIM:
To perform the 8 bit XOR operation using 8051 microcontroller
APPARATUS REQUIRED:
1.8051 microcontroller kit 1
2.Power supply 1
3.Opcode sheet 1
ALGORITHM:
1. Start the program
2. Stroe the content of 8100 to R0
3.store the content 8101 to A
4.Perform logical XOR operation of A and R0
5.Store the result in 8200 memory location
6.Stop the program
EX-OR OPERATION PROGRAM FOR 8051
RESULT:
Thus the program for logical XOR operation using 8051 microcontroller is executed successfully
2’s COMPLEMENT USING 8051
AIM:
To perform the 2’s complement operation using 8051 microcontroller
APPARATUS REQUIRED:
1.8051 microcontroller kit 1
2.Power supply 1
3.Opcode sheet 1
ALGORITHM:
1.Start the program
2.Store the content DPTR
3.store the DPTR content to A
4.Complement the Accumulator content.
5.Add immediate date 01 to accumulator content.
6.Store the result in 8200 memory location
7.Stop the program
2’S COMPLEMENT PROGRAM FOR 8051
RESULT:
Thus the program for 2’s complement using 8051 microcontroller is executed successfully
FINDING SQUARE OF A NUMBER USING 8051
AIM:
To perform the square of a given number using 8051 microcontroller.
APPARATUS REQUIRED:
1.8051 microcontroller kit 1
2.Power supply 1
3.Opcode sheet 1
ALGORITHM:
1. Start the program
2. Store the content to DPTR
3.Move the content of DPTR to A.
4.Move the content of A to B.
5. Multiply A and B
6. Store the result in 8200 memory location
7.Stop the program
TO FIND SQUARE OF A GIVEN NUMBER PROGRAM FOR 8051
RESULT:
Thus the program for finding square of a given number using 8051 microcontroller is executed
successfully
BCD TO ASCII CONVERSION USING 8051
AIM:
To perform the BCD to ASCII conversion using 8051 microcontroller
APPARATUS REQUIRED:
1.8051 microcontroller kit 1
2.Power supply 1
3.Opcode sheet 1
ALGORITHM:
1. Start the program
2. Move the data to dptr
3. Move dptr to accumulator
8. Move accumulator to register and AND immediate data to accumulator and move register
to accumulator
10.Move a to dptr
AIM:
To write a program for a 8 bit manipulation using 8051 microcontroller.
ALGORITHM:
1.8051 microcontroller kit 1
2. power supply
3. Opcode sheet 1
ALGORITHM:
1. Start the program.
2 .Move the data to the accumulator.
3. Rotate the register towards the right.
4. Complement of the register.
5.AND swap the register.
6. Store the result.
7. Stop the program.
PROGRAM FOR BIT MANIPULATION
RESULT:
Thus the program bit manipulation with 8051 microcontroller is executed.
STEPPER MOTOR USING 8051
AIM:
To write an ALP using 8051 microcontroller to run stepper motor with delay timer
ALGORITHM:
1.8051 microcontroller kit 1
2.power supply
3.Opcode sheet 1
4.Stepper motor 1
ALGORITHM:
1. Start the program
2. load data in A and CWR
3. Create the loop which transistor the control to the given when ZF=0
4.Send the data in A to port A and call the subroutine
5. Call the delay program
6. Create another loop in which logical OR operation is performed between accumulator and D
register
7. Transfer the control to main program
8.Stop the program
PROGRAM FOR STEPPER MOTOR CONTROL
RESULT:
Thus the program stepper motor interfacing with 8051 microcontroller is executed.
PROGRAM TO VERIFY TIMER
AIM:
To write a program to execute the timer using 8051 microcontroller kit.
ALGORITHM:
1.8051 microcontroller kit 1
2. power supply
3. Opcode sheet 1
ALGORITHM:
1. The counter is set for the multiple delay.
5. Complement p1 to toggle.
RESULT :
Thus the program for verifying the timer using 8051 microcontroller is executed.
8086 STRING MANIPULATION – SEARCH AWORD
AIM:
To search a word from the string using MASM.
ALGORITHM:
1. Load the source and destination index register with starting address and destination address
respectively.
2. Initialize the counter with the total number of words to be copied.
3. Clear the destination with the total incrementing node.
4. Use the string manipulation instruction SCASW with the prefix REP to search a word from
string.
5. If the match is found (z=1), display 01 in destination address. Otherwise, display 00 in
destination address
PROGRAM:
ASSUME CS:CODE, DS : DATA
DATA SEGMENT
DATA ENDS
CODE SEGMENT
MOV DS , AX
MOV AX, 00
CLD
REP SCASW
JZ LOOP
MOV AX, 01
INT 21H
CODE ENDS
END START
RESULT:
Thus the program for string manipulation is implemented and the searching word is found from the
string.
STRING TRANSFER
AIM:
To find and replace word from the string using MASM.
ALGORITHM:
1. Load the source index register with the starting address and the ending address respectively.
2. Initialize the counter with the total number of words to be copied.
3. Clear the direction flag for auto incrementing mode of transfer.
4. Use the string manipulation instruction SCASW with the prefix REP to search a word from string
5. If a match is found (z=1), replace the old word with the current word in the destination address,
otherwise stop.
PROGRAM:
ASSUME CS: CODE, DS: DATA
DATA SEGMENT
DATA ENDS
CODE SEGMENT
MOV DS, AX
MOV ES, AX
CLD
LEA SI,STRING 1
REP MOVSB
INT 21H
CODE ENDS
END
RESULT:
Thus the program for string transfer is implemented and the word is found and replaced from the
string.
8086 STRING MANIPULATION – SORTING
AIM:
To sort a group of data bytes using MASM.
ALGORITHM:
1. Place all the elements of an array named list(in the consecutive memory location)
2. Do the following steps until the counter C reaches 0
3. Compare the accumulator content with the next element present in the next memory location.
If the accumulator content is smaller go to next step, otherwise , swap the content of accumulator
with the content of memory location.
4. Increment the memory pointer to point the next element.
5. Decrement the counter C by 1.
6. Stop the program.
PROGRAM:
ASSUME CS: CODE, DS: DATA
DATA SEGMENT
DATA ENDS
CODE SEGMENT
MOV DS, AX
JC LOOP1
XCHG [SI+2], AX
XCHG [SI], AX
LOOP AGAIN
DEC DX
JNZ LOOP2
INT 21H
CODE ENDS
END START
RESULT:
Thus the program for sorting is implemented and the given array is sorted successfully.
LOGICAL CONTROLLER
AIM:
To write a program for performing logical AND operation using MASM.
ALGORITHM:
1. Start the program
2. Get input data from memory location
3. Store the content of accumulator to AX
4. Move the content of memory location
5. Increment content of DX
6. AND content of Al register with data
7. Stop the program
PROGRAM:
CODE SEGMENT
MOV AL,05H
MOV BL,06H
XOR BL,04H
MOV AH,4CH
INT 21H
CODE ENDS
END
RESULT:
Thus the program for logical controller is implemented successfully.
BINARY TO BCD CONVERSION
AIM:
To write a program for performing binary to BCD conversion using MASM.
ALGORITHM:
1. Start the program.
2. Get input data from memory function
3. Store content of accumulator to ax
4. Move the content of memory location
5. Increment the content of C
6. OR the content of AL register with data
7. Stop the program.
PROGRAM:
ASSUME CS: CODE, DS: DATA
DATA SEGMENT
BINARY DB 63H
ANS DB 00H, 00H,, 00H
DATA ENDS
CODE SEGMENT
START: MOV AX, @DATA
MOV DS,AX
MOV AX, 00H
MOV AL, BINARY
MOV CL, 64H
DIV CL
MOV BCD, AL
MOV AL, AH
MOV AH, 00H
MOV CL, 0AH
DIV CL
MOV ANS+ 1, AL
MOV ANS+2,AH
OR ANS, 30H
OR ANS+ 1, 30H
OR ANS+ 2,30H
MOV AH, 4CH
INT 21H
CODE ENDS
END
RUSULT:
Thus the binary number is converted into BCD successfully.
8086 STRING MANIPULATION – FIND AND REPLACE THE WORD
AIM :
To find replace the word from the string using MASM.
ALGORITHM:
1. Load the source index register with the starting address and the ending address respectively.
2. Initialize the counter with the total number of words to be copied.
3. Clear the direction flag for auto incrementing mode of transfer.
4. Use the string manipulation instruction SCASW with the prefix REP to search a word from string
5. If a match is found (z=1), replace the old word with the current word in the destination address,
otherwise stop.
PROGRAM:
ASSUME CS: CODE, DS: DATA
DATA SEGMENT
DATA ENDS
CODE SEGMENT
MOV DS, AX
MOV AX,15H
MOV AX, 00
CLD
REP SCASW
ZNZ LOOP
INT 21H
CODE ENDS
END START
RESULT:
Thus the word is found and replaced from the string successfully.
16 BIT ADDITION USING MASM
AIM:
To write a program for performing addition using MASM.
ALGORITHM:
1. start the program.
2. Get input data from memory function
3.Add the data
3. Store content of accumulator to memory location
4. Stop the program.
PROGRAM:
ASSUME CS: CODE, DS: DATA
DATA SEGMENT
SUM DW 2H DUP(0)
DATA ENDS
CODE SEGMENT
MOV DS, AX
MOV AX,LIST
ADD AX,LIST+2
JNC LOOP
INC BX
MOV SUM+2,BX
INT 21H
CODE ENDS
END START
RESULT:
Thus the program for Addition is implemented successfully.
16 BIT SUBTRACTION USING MASM
AIM:
To write a program for performing subtraction using MASM.
ALGORITHM:
1. start the program.
2. Get input data from memory function
3.Sub the data
3. Store content of accumulator to memory location
4. Stop the program.
PROGRAM:
ASSUME CS: CODE, DS: DATA
DATA SEGMENT
SUB DW 2H DUP(0)
DATA ENDS
CODE SEGMENT
MOV DS, AX
MOV AX,LIST
SUB AX,LIST+2
JNC LOOP
INC BX
MOV SUB+2,BX
INT 21H
CODE ENDS
END START
RESULT:
Thus the program for subtraction is implemented successfully.
16 BIT MULTIPLICATION USING MASM
AIM:
To write a program for performing multiplication using MASM.
ALGORITHM:
1. start the program.
2. Get input data from memory function
3.Multiply the data
3. Store lower order bit to memory location through accumulator.
4.Store higher order bit to memory location through DX
5. Stop the program.
PROGRAM:
ASSUME CS: CODE, DS: DATA
DATA SEGMENT
DATA ENDS
CODE SEGMENT
MOV DS, AX
MOV AX,LIST
MUL BX
MOV MULTIPLY, AX
MOV MULTIPLY+2,DX
INT 21H
CODE ENDS
END START
RESULT:
Thus the program for Multiplication is implemented successfully.
16 BIT DIVISION USING MASM
AIM:
To write a program for performing division using MASM.
ALGORITHM:
1. start the program.
2. Get input data from memory function
3.Divide the data
3. Store quotient bit to memory location through accumulator.
4.Store remainder bit to memory location through DX
5. Stop the program.
PROGRAM:
ASSUME CS: CODE, DS: DATA
DATA SEGMENT
QUO DW 2H DUP(0)
REM DW 2H DUP(0)
DATA ENDS
CODE SEGMENT
MOV DS, AX
MOV AX,LIST
DIV BX
MOV QUO, AX
MOV REM,DX
INT 21H
CODE ENDS
END START
RESULT:
Thus the program for division is implemented successfully.
3X3 MATRIX USING MASM
AIM:
To write a program form 3x3 matrix using MASM.
ALGORITHM:
1. start the program.
2. Get 9 input data from memory function
3.Arrange the data in rows and columns
4. Stop the program.
PROGRAM
ASSUME DS:DATA , CS:CODE, SS:STACK
DATA SEGMENT
MATRIX DB 1, 2, 3, 4, 5, 6, 7, 8, 9
DATA ENDS
STACK SEGMENT
DW 128 DUP(0)
STACK ENDS
CODE SEGMENT
JE ROW2
ROW2: DEC BX
MOV DL, [BX]
ADD DL, 30H
MOV AH, 02H
INT 21H
JMP MIDDLE
MIDDLE: ADD BX, 3
MOV DL, [BX]
ADD DL, 30H
MOV AH, 02H
INT 21H
JMP END
END:
RESULT:
Thus the program for 3X3 matrix is implemented successfully.