mpi lab record
DESCRIPTION
Gives the complete reference of MPI record of JNTU SyllabusTRANSCRIPT
![Page 1: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/1.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
MICROPROCESSORS AND INTERFACING LAB
I. Microprocessor 8086 : - 1. Introduction to TASM.2. Arithmetic operation – Multi byte Addition and Subtraction, Multiplication and Division –
Signed and unsigned Arithmetic operation, ASCII – arithmetic operation.3. Logic operations – Shift and rotate – Converting packed BCD to unpacked BCD, BCD to
ASCII conversion.4. By using string operation and Instruction prefix: Move Block, Reverse string, Sorting,
Inserting, Deleting, Length of the string, String comparison.5. DOS/BIOS programming: Reading keyboard (Buffered with and without echo) – Display
characters, Strings.
II. Interfacing : -
1. 8259 – Interrupt Controller : Generate an interrupt using 8259 timer.2. 8279 – Keyboard Display : Write a small program to display a string of characters.3. 8255 – PPI : Write ALP to generate sinusoidal wave using PPI.4. 8251 – USART : Write a program in ALP to establish Communication between two processors.
III. Microcontroller 8051:-
1. Reading and Writing on a parallel port.2. Timer in different modes.
3. Serial communication implementation.
Equipment required for Laboratories:-
1. 8086 µP Kits2. 8051 Micro Controller kits3. Interfaces/peripheral subsystems
i) 8259 PICii) 8279-KB/Displayiii) 8255 PPIiv) 8251 USART
4. ADC Interface5. DAC Interface6. Traffic Controller Interface7. Elevator Interface
![Page 2: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/2.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
INTRODUCTION TO TASM
EDITOR:
An editor is a program, which allows you to create a file containing the assembly language statements for your program. As you type in your program, the editor stores the ASCII codes for the letters and numbers in successive RAM locations. When you have typed in all of your programs, you then save the file on a floppy of hard disk. This file is called source file. The next step is to process the source file with an assembler. In the TASM assembler, you should give your source file name the extension, .ASM
ASSEMBLER:
An assembler program is used to translate the assembly language mnemonics for instructionsto the corresponding binary codes. When you run the assembler, it reads the source file of your program the disk, where you saved it after editing on the first pass through the source program theassembler determines the displacement of named data items, the offset of labels and pails thisinformation in a symbol table. On the second pass through the source program, the assemblerproduces the binary code for each instruction and inserts the offset etc that is calculated during the first pass. The assembler generates two files on floppy or hard disk. The first file called the object file is given the extension. OBJ. The object file contains the binary codes for the instructions andinformation about the addresses of the instructions. The second file generated by the assembler iscalled assembler list file. The list file contains your assembly language statements, the binary codes for each instructions and the offset for each instruction. In TASM assembler, TASM source file name ASM is used to assemble the file. Edit source file name LST is used to view the list file, which is generated, when you assemble the file.
LINKER:
A linker is a program used to join several object files into one large object file and convert toan exe file. The linker produces a link file, which contains the binary codes for all the combined modules. The linker however doesn’t assign absolute addresses to the program, it assigns is said to be relocatable because it can be put anywhere in memory to be run. In TASM, TLINK sourcefilename is used to link the file.
DEBUGGER:
A debugger is a program which allows you to load your object code program into systemmemory, execute the program and troubleshoot are debug it the debugger allows you to look at the contents of registers and memory locations after your program runs. It allows you to change the contents of register and memory locations and return the program. A debugger also allows you to set a break point at any point in the program. If you inset a breakpoint the debugger will run the
![Page 3: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/3.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
program upto the instruction where the breakpoint is set and stop execution. You can then examine register and memory contents to see whether the results are correct at that point. In TASM, td filename is issued to debug the file.
DEBUGGER FUNCTIONS:
1. Debugger allows to look at the contents of registers and memory locations.2. We can extend 8-bit register to 16-bit register which the help of extended register option.3. Debugger allows to set breakpoints at any point with the program.4. The debugger will run the program upto the instruction where the breakpoint is set and then
stop execution of program. At this point, we can examine registry and memory contents at that point.
5. With the help of dump we can view register contents.6. we can trace the program step by step with the help of F7.7. We can execute the program completely at a time using F8.
DEBUGGER COMMANDS:
ASSEMBLE:To write assembly language program from the given addressA starting address <cr>Eg: a 100 <cr>Starts program at an offset of 100.
DUMP:To see the specified memory contentsD memory location first address last address(While displays the set of values stored in the specified range, which is given above)Eg: d 0100 0105 <cr>Display the contents of memory locations from 100 to 105(including).
ENTER:To enter data into the specified memory locations(s).E memory location data data data data data …<cr>Eg: e 1200 10 20 30 40 ….Enters the above values starting from memory locations 1200 to 1203, by loading 10 into 1200,20 into 1201 and soon.
GO:To execute the programG: one instruction executes (address specified by IP)G address <cr>: executes from current IP to the address specifiedG first address last addresses <cr>: executes a set of instructions specified between the given addresses
MOVE:Moves a set of data from source location to destination location
![Page 4: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/4.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
M first address last address destination addressEg: m100 104 200Transfers block of data (from 100 to 104) to destination address 200.
QUIT:To exit from the debugger.Q <cr>
REGISTER:Shows the contents of RegistersR register nameEg: r axShows the contents of register.
TRACE:To trace the program instruction by instruction.T = 0100 <cr>: traces only the current instruction. (Instruction specified by IP)T = 0100 02 <cr>: Traces instructions from 100 to 101, here the second argument specifies the number of instructions to be traced.
UNASSEMBLE:To unassembled the program.Shows the opcodes along with the assembly language program.U 100 <cr>: unassembled 32 instructions starting from 100th locationU 0100 0109 <cr>: unassebles the lines from 100 to 104
![Page 5: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/5.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
PROGRAM FOR MULTI BYTE ADDITION
AIM: To write an assembly language program to perform multi byte addition of two numbers.
REGISTERS USED: AX, DS, AL
FLAGS AFFECTED:
PROGRAM: ASSUME CS:CODE,DS:DATACODE SEGMENTMOV AX,DATAMOV DS,AXLEA SI,ARR1LEA DI,ARR2LEA BX,ARR3MOV CX,COUNTMOV AX,0000HSAHFBACK: MOV AL,[DI]ADC AL,[SI]MOV [BX],ALINC SIINC DIINC BXLOOP BACKHLTCODE ENDSDATA SEGMENTARR1 DB 12H,06H,45HARR2 DB 12H,07H,09HARR3 DB ?COUNT EQU 03HDATA ENDSEND
![Page 6: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/6.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
FLOW CHART:
![Page 7: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/7.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
RESULT:
INPUT:- OPR1= 12h,06h,45hOPR2=12h,07h,09h
OUTPUT:RES=24,0D,4E
![Page 8: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/8.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
PROGRAM FOR MULTI BYTE SUBTRACTION
AIM: To write an assembly language program to perform multi byte subtraction of two numbers.
REGISTERS USED: AX, DS, AL
FLAGS AFFECTED:
PROGRAM: ASSUME CS:CODE,DS:DATACODE SEGMENTMOV AX,DATAMOV DS,AXLEA SI,ARR1LEA DI,ARR2LEA BX,ARR3MOV CX,COUNTMOV AX,0000HSAHFBACK: MOV AL,[DI]SBB AL,[SI]MOV [BX],ALINC SIINC DIINC BXLOOP BACKHLTCODE ENDSDATA SEGMENTARR1 DB 12HARR2 DB 13HARR3 DB ?COUNT EQU 01H
![Page 9: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/9.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
DATA ENDSEND
FLOW CHART:
![Page 10: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/10.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
RESULT:
![Page 11: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/11.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
PROGRAM FOR ADDITION OF TWO 8 BIT NUMBERS
AIM: To write an assembly language program to perform addition of two 8-bit signed and unsigned numbers.
REGISTERS USED: AX, DS, AL
FLAGS AFFECTED: AF, CF, OF, PF, SF, ZF
PROGRAM: ASSUME CS:CODE,DS:DATACODE SEGMENTMOV AX,DATAMOV DS,AXMOV AL,OPR1ADD AL,OPR2MOV RES,ALHLTCODE ENDSDATA SEGMENTOPR1 DB 69HOPR2 DB 10HRES DB ?DATA ENDSEND
![Page 12: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/12.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
FLOW CHART:
RESULT:
START
INITIALIZATION OF DATA SEGMENT
ALOPR1
ALAL+OPR2RESAL
STOP
![Page 13: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/13.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
UNSIGNED NUMBERSINPUT: OPR1 = 69H
OPR2 = 10HOUTPUT: RES = 79H
SIGNED NUMBERSINPUT: OPR1 = 97H
OPR2 = A9HOUTPUT: RES = 40H, CF = 1
ADDITION OF TWO 16-BIT NUMBERS
AIM: To write an assembly language program to perform addition of two 16-bit signed and unsigned numbers.
REGISTERS USED: AX, DS
FLAGS AFFECTED: AF, CF, OF, PF, SF, ZF
PROGRAM: ASSUME CS:CODE,DS:DATACODE SEGMENTMOV AX,DATAMOV DS,AXMOV AX,OPR1ADD AX,OPR2MOV RES,AXHLTCODE ENDSDATA SEGMENTOPR1 DW 4269HOPR2 DW 1000HRES DW ?DATA ENDSEND
![Page 14: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/14.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
FLOW CHART:
START
INITIALIZATION OF DATA SEGMENT
AXOPR1
AXAX+OPR2RESAX
STOP
![Page 15: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/15.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
RESULT:UNSIGNED NUMBERSINPUT: OPR1 = 4269H
OPR2 = 1000HOUTPUT: RES = 5269H
SIGNED NUMBERSINPUT: OPR1 = 9763H
OPR2 = A973HOUTPUT: RES = 40D6H , CF = 1
SUBTRACTION OF TWO 8-BIT NUMBERS
AIM: To write an assembly language program to perform subtraction of two 16-bit signed and unsigned numbers.
REGISTERS USED: AX, DS, AL
FLAGS AFFECTED: AF, CF, OF, PF, SF, ZF
PROGRAM: ASSUME CS:CODE,DS:DATACODE SEGMENTMOV AX,DATAMOV DS,AXMOV AL,OPR1SUB AL,OPR2MOV RES,ALHLTCODE ENDSDATA SEGMENTOPR1 DB 69HOPR2 DB 10HRES DB ?DATA ENDSEND
![Page 16: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/16.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
FLOW CHART:
START
INITIALIZATION OF DATA SEGMENT
ALOPR1
ALAL-OPR2RESAL
STOP
![Page 17: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/17.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
RESULT:UNSIGNED NUMBERSINPUT: OPR1 = 69H
OPR2 = 10HOUTPUT: RES = 59H
SIGNED NUMBERSINPUT: OPR1 = 97H
OPR2 = 89HOUTPUT: RES = 0DH
SUBTRACTION OF TWO 16-BIT NUMBERS
AIM: To write an assembly language program to perform subtraction of two 16-bit signed and unsigned numbers.
REGISTERS USED: AX, DS
FLAGS AFFECTED: AF, CF, OF, PF, SF, ZF
PROGRAM: ASSUME CS:CODE,DS:DATACODE SEGMENTMOV AX,DATAMOV DS,AXMOV AX,OPR1SUB AX,OPR2MOV RES,AXHLTCODE ENDSDATA SEGMENTOPR1 DW 4269HOPR2 DW 1000HRES DW ?DATA ENDSEND
![Page 18: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/18.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
FLOW CHART:
START
INITIALIZATION OF DATA SEGMENT
AXOPR1
AXAX-OPR2RESAX
STOP
![Page 19: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/19.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
RESULT:UNSIGNED NUMBERSINPUT: OPR1 = 4269H
OPR2 = 1000HOUTPUT: RES = 3269H
SIGNED NUMBERSINPUT: OPR1 = 9763H
OPR2 = 8973HOUTPUT: RES = 0DF0H
MULTIPLICATION OF TWO 16-BIT UNSIGNED NUMBERS
AIM: To write an assembly language program to perform multiplication of two 16-bit unsigned numbers.
REGISTERS USED: AX,DS
FLAGS AFFECTED: OF,CF
PROGRAM: ASSUME CS:CODE,DS:DATACODE SEGMENTMOV AX,DATAMOV DS,AXMOV AX,OPR1MUL OPR2MOV RESLW,AXMOV RESHW,DXHLTCODE ENDSDATA SEGMENTOPR1 DW 2000HOPR2 DW 4000HRESLW DW ?
![Page 20: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/20.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
RESHW DW ?DATA ENDSEND
FLOW CHART:
START
INITIALIZATION OF DATA SEGMENT
AXOPR1
AXAX*OPR2RESLWAXRESHWDX
STOP
![Page 21: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/21.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
RESULT:INPUT: OPR1 = 2000H
OPR2 = 4000HOUTPUT: RESLW = 0000H (AX)
RESHW = 0800H (DX)
MULTIPLICATION OF TWO 16-BIT SIGNED NUMBERS
AIM: To write an assembly language program to perform multiplication of two 16-bit signed numbers.
REGISTERS USED: AX,DS
FLAGS AFFECTED: OF,CF
PROGRAM: ASSUME CS:CODE,DS:DATACODE SEGMENTMOV AX,DATAMOV DS,AXMOV AX,OPR1IMUL OPR2MOV RESLW,AXMOV RESHW,DXHLTCODE ENDSDATA SEGMENTOPR1 DW 7593H
![Page 22: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/22.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
OPR2 DW 6845HRESLW DW ?RESHW DW ?DATA ENDSEND
FLOW CHART:
START
INITIALIZATION OF DATA SEGMENT
AXOPR1
AXAX*OPR2RESLWAXRESHWDX
STOP
![Page 23: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/23.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
RESULT:CASE I: Two positive numbersINPUT: OPR1 = 7593H
OPR2 = 6845HOUTPUT: RESLW = 689FH (AX)
RESHW = 2FE3H (DX)CASE II: one positive number & one negative numberINPUT: OPR1 = 8A6DH 2’s Complement of (-7593H)
OPR2 = 6845HOUTPUT: RESLW = 9761H (AX) 2’s Complement
RESHW = D01CH (DX) of (- 2FE3689FH)CASE III: two negative numbersINPUT: OPR1 = 8A6DH 2’s Complement of (-7593H)
OPR2 = 97BBH 2’s Complement of (-6845H)OUTPUT: RESLW = 689FH (AX)
RESHW = 2FE3H (DX)
![Page 24: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/24.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
DIVISION OF UNSIGNED NUMBERS
AIM: To write an assembly language program to perform division of 16-bit unsigned number by 8-bit unsigned number.
REGISTERS USED: AX, DS
FLAGS AFFECTED: IF
PROGRAM: ASSUME CS:CODE,DS:DATACODE SEGMENTMOV AX,DATAMOV DS,AXMOV AX,OPR1DIV OPR2MOV RESQ,ALMOV RESR,AHHLT
![Page 25: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/25.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
CODE ENDSDATA SEGMENTOPR1 DW 2C58HOPR2 DB 56HRESQ DB ?RESR DB ?DATA ENDSEND
FLOW CHART:
START
INITIALIZATION OF DATA SEGMENT
AXOPR1
AXAX/OPR2RESQALRESRAH
STOP
![Page 26: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/26.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
RESULT:INPUT: OPR1 = 2C58H (DIVIDEND)
OPR2 = 56H (DIVISOR)OUTPUT: RESQ = 84H (AL)
RESR = 00H (AH)
DIVISION OF SIGNED NUMBERS
AIM: To write an assembly language program to perform division of 16-bit signed number by 8-bit signed number.
REGISTERS USED: AX, DS
FLAGS AFFECTED: IF
PROGRAM: ASSUME CS:CODE,DS:DATACODE SEGMENTMOV AX,DATAMOV DS,AXMOV AX,OPR1IDIV OPR2MOV RESQ,AL
![Page 27: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/27.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
MOV RESR,AHHLTCODE ENDSDATA SEGMENTOPR1 DW 26F8HOPR2 DB 0AAHRESQ DW ?RESR DW ?DATA ENDSEND
FLOW CHART:
START
INITIALIZATION OF DATA SEGMENT
AXOPR1
AXAX/OPR2RESQALRESRAH
STOP
![Page 28: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/28.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
RESULT:CASE I: two positive numbersINPUT: OPR1 = 26F8H (DIVIDEND)
OPR2 = 56H (DIVISOR)OUTPUT: RESQ = 74H (AL)
RESR = 00H (AH)CASE II: one positive number & one negative numberINPUT: OPR1 = D908H 2’s Complement of (-26F8H)
OPR2 = 56HOUTPUT: RESQ = 8CH (AL) 2’s Complement of (- 74H)
RESR = 00H (AH) CASE III: one positive number & one negative number INPUT: OPR1 = 26F8H
OPR2 = AAH 2’s Complement of (-56H)OUTPUT: RESQ = 8CH (AL) 2’s Complement of (- 74H)
RESR = 00H (AH)
![Page 29: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/29.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
ASCII ADDITION
AIM: To write an ALP to perform the addition of two ASCII bytes.
REGISTERS USED: AX,DS
FLAGS AFFECTED: AF,CF
PROGRAM: ASSUME CS:CODE,DS:DATACODE SEGMENTMOV AX,DATAMOV DS,AXMOV AH,00H
![Page 30: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/30.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
MOV AL,CHARADD AL,CHAR1AAAMOV RES,AXHLTCODE ENDSDATA SEGMENTCHAR DB '8'CHAR1 DB '6'RES DW ?DATA ENDSEND
FLOW CHART:
START
INITIALIZATION OF DATA SEGMENT
AH00AlCHAR
ALAL+CHAR1 ASCII adjust for addition
RESAX
STOP
![Page 31: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/31.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
RESULT:INPUT: CHAR = ‘8’
CHAR1 = ‘6’OUTPUT: RES = 0104 (AX) unpacked BCD of 14
ASCII SUBTRACTION
AIM: To write an ALP to perform the subtraction of two ASCII bytes.
REGISTERS USED: AX, DS
FLAGS AFFECTED: AF, CF
PROGRAM: ASSUME CS:CODE,DS:DATACODE SEGMENTMOV AX,DATAMOV DS,AX
![Page 32: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/32.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
MOV AH,00HMOV AL,CHARSUB AL,CHAR1AASMOV RES,AXHLTCODE ENDSDATA SEGMENTCHAR DB 9CHAR1 DB 5RES DW ?DATA ENDSEND
FLOW CHART:
START
INITIALIZATION OF DATA SEGMENT
AH00ALCHAR
ALAL-CHAR1 ASCII adjust for subtraction
RESAX
STOP
![Page 33: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/33.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
RESULT:CASE I:INPUT: CHAR = ‘9’
CHAR1 = ‘5’OUTPUT: RES = 0004 (AX) CASE II:INPUT: CHAR = ‘5’
CHAR1 = ‘9’OUTPUT: RES = 00FC (AX) 2’s Complement of (-4)
ASCII MULTIPLICATION
AIM: To write an ALP to perform the multiplication of two ASCII bytes.
REGISTERS USED: AX, DS
FLAGS AFFECTED: PF, SF, ZF
PROGRAM: ASSUME CS:CODE,DS:DATACODE SEGMENT
![Page 34: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/34.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
MOV AX,DATAMOV DS,AXMOV AH,00MOV AL,NUM1MUL NUM2AAMMOV RES,AXHLTCODE ENDSDATA SEGMENTNUM1 DB 09NUM2 DB 05RES DW ?DATA ENDSEND
FLOW CHART:
START
INITIALIZATION OF DATA SEGMENT
AH00ALNUM1
ALAL*NUM2ASCII adjust for multiplication
RESAX
STOP
![Page 35: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/35.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
RESULT:INPUT: NUM1 = 09
NUM2 = 05OUTPUT: RES = 0405 (AX) unpacked BCD of 45
ASCII DIVISION
AIM: To write an ALP to perform the multiplication of two ASCII numbers.
REGISTERS USED: AX, DS
FLAGS AFFECTED: PF, SF, ZF
PROGRAM:
![Page 36: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/36.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
ASSUME CS:CODE,DS:DATACODE SEGMENTMOV AX,DATAMOV DS,AXMOV AX,DIVIDENDAADMOV CH,DIVISORDIV CHMOV RESQ,ALMOV RESR,AHHLTCODE ENDSDATA SEGMENTDIVIDEND DW 0607HDIVISOR DB 09HRESQ DB ?RESR DB ?DATA ENDSEND
FLOW CHART:
START
INITIALIZATION OF DATA SEGMENT
AXDIVIDEND ASCII Adjust for Division
CHDIVISOR
AXAX/CHRESQAL, RESRAH
STOP
![Page 37: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/37.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
RESULT:INPUT: DIVIDEND = 0607H unpacked BCD of 67
DIVISOR = 09HOUTPUT: RESQ = 07 (AL)
RESR = 04 (AH)
ASCENDING ORDER
AIM: To write an assembly language program to arrange the given numbers in ascending order.
REGISTERS USED: AX,DS,ES,SI,DI
![Page 38: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/38.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
FLAGS AFFECTED: AX,DS,SI,CX,DX
PROGRAM: ASSUME CS:CODE,DS:DATACODE SEGMENTMOV AX,DATAMOV DS,AXMOV DX,COUNT-1BACK:MOV CX,DXMOV SI,OFFSET LISTAGAIN:MOV AX,[SI]CMP AX,[SI+2]JC GOXCHG AX,[SI+2]XCHG AX,[SI]GO:INC SIINC SILOOP AGAINDEC DXJNZ BACKHLTCODE ENDSDATA SEGMENTLIST DW 05H,04H,01H,03H,02HCOUNT EQU 05HDATA ENDSEND
FLOW CHART:
START
INITIALIZATION OF DATA SEGMENT
DXCOUNT-1
BACK : CXDX
SIOFFSET ADDRESS OF LIST
IF AX < [SI+2]
AGAIN: AX[SI]
TRUE
EXCHANGE [SI] &[SI+2]
INCREMENT SI BY 2
DECREMENT DX
IF CX=0
IF DX=0
STOP
FALSE
TRUE
TRUE
FALSE
FALSE
![Page 39: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/39.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
RESULT:INPUT: LIST (DS: 0000H) = 05H,04H,01H,03H,02H
OUTPUT: LIST (DS: 0000H) = 01H,02H,03H,04H,05H
![Page 40: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/40.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
DESCENDING ORDER
![Page 41: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/41.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
AIM: To write an assembly language program to arrange the given numbers in descending order.
REGISTERS USED: AX,DS,SI,CX,DX
FLAGS AFFECTED: CF,AF,
PROGRAM: ASSUME CS:CODE,DS:DATACODE SEGMENTMOV AX,DATAMOV DS,AXMOV DX,COUNT-1BACK:MOV CX,DXMOV SI,OFFSET LISTAGAIN:MOV AX,[SI]CMP AX,[SI+2]JNC GOXCHG AX,[SI+2]XCHG AX,[SI]GO:INC SIINC SILOOP AGAINDEC DXJNZ BACKHLTCODE ENDSDATA SEGMENTLIST DW 03H,04H,01H,05H,02HCOUNT EQU 05HDATA ENDSEND
FLOW CHART:
START
INITIALIZATION OF DATA SEGMENT
DXCOUNT-1
BACK : CXDX
SIOFFSET ADDRESS OF LIST
IF AX > [SI+2]
AGAIN: AX[SI]
TRUE
EXCHANGE [SI] &[SI+2]
INCREMENT SI BY 2
DECREMENT DX
IF CX=0
IF DX=0
STOP
FALSE
TRUE
TRUE
FALSE
FALSE
![Page 42: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/42.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
![Page 43: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/43.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
RESULT:INPUT: LIST (DS: 0000H) = 03H,04H,01H,05H,02H
OUTPUT: LIST (DS: 0000H) = 05H,04H,03H,02H,01H
![Page 44: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/44.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
LOGICAL AND OPERATION
AIM: To write an Assembly language program to perform the Logical AND operation.
REGISTERS USED: AX, DS
FLAGS AFFECTED: PF, SF, ZF
PROGRAM:ASSUME CS:CODE,DS:DATACODE SEGMENTMOV AX,DATAMOV DS,AXMOV AX,OPR1AND AX,OPR2MOV RES,AXHLTCODE ENDS DATA SEGMENTOPR1 DW 6493HOPR2 DW 1936HRES DW ?DATA ENDSEND
![Page 45: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/45.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
FLOW CHART:
RESULT:INPUT: OPR1 = 6493H
OPR2 = 1936HOUTPUT: RES = 0012H
START
INITIALIZATION OF DATA SEGMENT
AXOPR1
AXAX AND OPR2RESAX
STOP
![Page 46: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/46.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
LOGICAL OR OPERATION
AIM: To write an Assembly language program to perform the Logical OR operation.
REGISTERS USED: AX, DS
FLAGS AFFECTED: PF, SF, ZF
PROGRAM:ASSUME CS:CODE,DS:DATACODE SEGMENTMOV AX,DATAMOV DS,AXMOV AX,OPR1OR AX,OPR2MOV RES,AXHLTCODE ENDS DATA SEGMENTOPR1 DW 6493HOPR2 DW 1936HRES DW ?DATA ENDSEND
![Page 47: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/47.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
FLOW CHART:
RESULT:INPUT: OPR1 = 6493H
OPR2 = 1936HOUTPUT: RES = 7DB7H
START
INITIALIZATION OF DATA SEGMENT
AXOPR1
AXAX OR OPR2RESAX
STOP
![Page 48: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/48.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
LOGICAL XOR OPERATION
AIM: To write an Assembly language program to perform the Logical XOR operation.
REGISTERS USED: AX, DS
FLAGS AFFECTED: PF, SF, ZF
PROGRAM:ASSUME CS:CODE,DS:DATACODE SEGMENTMOV AX,DATAMOV DS,AXMOV AX,OPR1XOR AX,OPR2MOV RES,AXHLTCODE ENDS DATA SEGMENTOPR1 DW 6493HOPR2 DW 1936HRES DW ?DATA ENDSEND
![Page 49: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/49.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
FLOW CHART:
RESULT:
INPUT: OPR1 = 6493H OPR2 = 1936H
OUTPUT: RES = 7DA5H
START
INITIALIZATION OF DATA SEGMENT
AXOPR1
AXAX XOR OPR2RESAX
STOP
![Page 50: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/50.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
LOGICAL NOT OPERATION
AIM: To write an Assembly language program to perform the Logical Invert operation.
REGISTERS USED: AX,DS
FLAGS AFFECTED: No flags are affected.
PROGRAM:ASSUME CS:CODE,DS:DATACODE SEGMENTMOV AX,DATAMOV DS,AXMOV AX,OPR1NOT AXMOV RES,AXHLTCODE ENDS DATA SEGMENTOPR1 DW 6493HRES DW ?DATA ENDSEND
![Page 51: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/51.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
FLOW CHART:
RESULT:INPUT: OPR1 = 6493H
OUTPUT: RES = 9B6CH
START
INITIALIZATION OF DATA SEGMENT
AXOPR1
AXNOT AXRESAX
STOP
![Page 52: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/52.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
SHIFT ARITHMETIC / LOGICAL LEFT OPERATION
AIM: To write an Assembly language program to perform the Shift arithmetic / Logicaloperation.
REGISTERS USED: AX, DS
FLAGS AFFECTED: SF, ZF, PF
PROGRAM:ASSUME CS:CODE,DS:DATACODE SEGMENTMOV AX,DATAMOV DS,AXMOV AX,OPR1SAL AX,01H (or) SHL AX,01HMOV RES,AXHLTCODE ENDS DATA SEGMENTOPR1 DW 1639HRES DW ?DATA ENDSEND
![Page 53: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/53.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
FLOW CHART:
RESULT:INPUT: OPR1 = 1639H
OUTPUT: RES = 2C72H
START
INITIALIZATION OF DATA SEGMENT
AXOPR1
Shift AX by 01to leftRESAX
STOP
![Page 54: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/54.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
LOGICAL RIGHT OPERATION
AIM: To write an Assembly language program to perform the Shift Logical Right operation.
REGISTERS USED: AX,DS
FLAGS AFFECTED: SF,ZF,PF
PROGRAM:ASSUME CS:CODE,DS:DATACODE SEGMENTMOV AX,DATAMOV DS,AXMOV AX,OPR1SHR AX,01H MOV RES,AXHLTCODE ENDS DATA SEGMENTOPR1 DW 8639HRES DW ?DATA ENDSEND
![Page 55: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/55.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
FLOW CHART:
RESULT:INPUT: OPR1 = 8639H
START
INITIALIZATION OF DATA SEGMENT
AXOPR1
Shift AX by 01to rightRESAX
STOP
![Page 56: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/56.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
OUTPUT: RES = 431CH
SHIFT ARITHMETIC RIGHT OPERATION
AIM: To write an Assembly language program to perform the Shift Arithmetic Right operation.
REGISTERS USED: AX,DS
FLAGS AFFECTED: SF,ZF,PF
PROGRAM:ASSUME CS:CODE,DS:DATACODE SEGMENTMOV AX,DATAMOV DS,AXMOV AX,OPR1SAR AX,01H MOV RES,AXHLTCODE ENDSDATA SEGMENTOPR1 DW 8639HRES DW ?DATA ENDSEND
![Page 57: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/57.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
FLOW CHART:
RESULT:
START
INITIALIZATION OF DATA SEGMENT
AXOPR1
Shift AX by 01to right, Retain MSB
RESAX
STOP
![Page 58: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/58.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
INPUT: OPR1 = 8639H
OUTPUT: RES = C31CH
ROTATE RIGHT WITHOUT CARRY
AIM: To write an Assembly language program to perform the Rotate Right without carry operation.
REGISTERS USED: AX,DS
FLAGS AFFECTED: CF,OF
PROGRAM:ASSUME CS:CODE,DS:DATACODE SEGMENTMOV AX,DATAMOV DS,AXMOV AX,OPR1ROR AX,01HMOV RES,AXHLTCODE ENDS DATA SEGMENTOPR1 DW 1639HRES DW ?DATA ENDSEND
![Page 59: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/59.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
FLOW CHART:
START
INITIALIZATION OF DATA SEGMENT
AXOPR1
Rotate AX by 01to rightRESAX
STOP
![Page 60: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/60.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
RESULT:INPUT: OPR1 = 1639H
OUTPUT: RES = 8B1CH
ROTATE RIGHT WITH CARRY
AIM: To write an Assembly language program to perform the Rotate Right with carryoperation.
REGISTERS USED: AX,DS
FLAGS AFFECTED: CF,OF
PROGRAM:ASSUME CS:CODE,DS:DATACODE SEGMENTMOV AX,DATAMOV DS,AXMOV AX,OPR1RCR AX,01HMOV RES,AXHLTCODE ENDS DATA SEGMENTOPR1 DW 1639HRES DW ?DATA ENDSEND
![Page 61: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/61.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
FLOW CHART:
START
INITIALIZATION OF DATA SEGMENT
AXOPR1
Rotate with carry AX by 01 to right
RESAX
STOP
![Page 62: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/62.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
RESULT:INPUT: OPR1 = 1639H
OUTPUT: RES = 0B1CH
ROTATE LEFT WITHOUT CARRY
AIM: To write an Assembly language program to perform the Rotate Left without carry operation.
REGISTERS USED: AX,DS
FLAGS AFFECTED: CF,OF
PROGRAM:ASSUME CS:CODE,DS:DATACODE SEGMENTMOV AX,DATAMOV DS,AXMOV AX,OPR1ROL AX,01HMOV RES,AXHLTCODE ENDS DATA SEGMENTOPR1 DW 8097HRES DW ?DATA ENDSEND
![Page 63: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/63.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
FLOW CHART:
START
INITIALIZATION OF DATA SEGMENT
AXOPR1
Rotate AX by 01to leftRESAX
STOP
![Page 64: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/64.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
RESULT:INPUT: OPR1 = 8097H
OUTPUT: RES = 012FH
ROTATE LEFT WITH CARRY
AIM: To write an Assembly language program to perform the Rotate Left with carry operation.
REGISTERS USED: AX,DS
FLAGS AFFECTED: CF,OF
PROGRAM:ASSUME CS:CODE,DS:DATACODE SEGMENTMOV AX,DATAMOV DS,AXMOV AX,OPR1RCL AX,01HMOV RES,AXHLTCODE ENDS DATA SEGMENTOPR1 DW 8097HRES DW ?DATA ENDSEND
![Page 65: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/65.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
FLOW CHART:
START
INITIALIZATION OF DATA SEGMENT
AXOPR1
Rotate with carry AX by 01 to Left
RESAX
STOP
![Page 66: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/66.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
RESULT:INPUT: OPR1 = 8097H
OUTPUT: RES = 012EH
PACKED BCD TO UNPACKED BCD
AIM: To write an assembly language program to perform packed bcd into unpacked bcd conversion.
REGISTERS USED: AX,DS,BL,CL
FLAGS AFFECTED: PF
PROGRAM: ASSUME CS:CODE,DS:DATACODE SEGMENTMOV AX,DATAMOV DS,AXMOV AL,BCDMOV BL,ALAND AL,0FHMOV UBCD1,ALMOV AL,BLAND AL,0F0HMOV CL,COUNTROR AL,CLMOV UBCD2,ALHLTCODE ENDS
![Page 67: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/67.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
DATA SEGMENTBCD DB 49HCOUNT DB 04HUBCD1 DB ?UBCD2 DB ?DATA ENDSEND
FLOW CHART:
START
INITIALIZATION OF DATA SEGMENT
ALBCDBLAL
UBCD2AL
STOP
ALAL ‘AND’ 0FHUBCD1ALALBLALAL ‘AND’ 0FH
Rotate AL to right by count times
![Page 68: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/68.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
RESULT:INPUT: BCD = 49 OUTPUT: UBCD1 = 09
UBCD2 = 04
![Page 69: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/69.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
BCD TO ASCII CONVERSION
AIM: To write an assembly language program to perform BCD to ASCII conversion.
REGISTERS USED: AX,DS,BL,CL
FLAGS AFFECTED: PF
PROGRAM: ASSUME CS: CODE,DS:DATACODE SEGMENTMOV AX,DATAMOV DS,AXMOV AL,BCDMOV BL,ALAND AL,0FHOR AL,30HMOV ASCII1,ALMOV AL,BLAND AL,0F0HMOV CL,COUNT
![Page 70: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/70.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
ROR AL,CLOR AL,30HMOV ASCII2,ALHLTCODE ENDSDATA SEGMENTBCD DB 49HCOUNT DB 04HASCII1 DB ?ASCII2 DB ?DATA ENDSEND
FLOW CHART:
START
INITIALIZATION OF DATA SEGMENT
ALBCDBLAL
ALAL OR 30ASCII2AL
STOP
ALAL AND 0FALAL OR 30ASCII1ALALBLAL AL AND F0CLCOUNT
Rotate AL to right by count times
![Page 71: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/71.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
RESULT:INPUT: BCD = 49
OUTPUT: UBCD1 = 39
UBCD2 = 34
![Page 72: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/72.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
AIM: To write an assembly language program to find the Two’s compliment of the given numbers.
REGISTERS USED: AX,DS,SI,DI
FLAGS AFFECTED:
PROGRAM: ASSUME CS:CODE,DS:DATACODE SEGMENTMOV AX,DATAMOV DS,AXLEA SI,ARR1LEA DI,ARR2MOV CL,03HBACK: MOV AL,[SI]NEG ALMOV [DI],ALINC DI
![Page 73: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/73.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
INC SILOOP BACKHLT CODE ENDSDATA SEGMENTARR1 DB 03H,04H,05HARR2 DB ?DATA ENDSEND
FLOW CHART:
![Page 74: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/74.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
RESULT:
![Page 75: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/75.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
AIM: To write an assembly language program to convert the given number from Binary Code to Gray code.
REGISTERS USED: AX,DS,SI,DI
FLAGS AFFECTED:
PROGRAM:ASSUME CS:CODE,DS:DATACODE SEGMENTMOV AX,DATAMOV DS,AXMOV AL,NUMMOV BL,ALCLCRCR AL,01XOR BL,ALMOV RES,BL
![Page 76: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/76.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
HLTCODE ENDSDATA SEGMENTNUM EQU 33HRES DB ?DATA ENDSEND
FLOW CHART:
![Page 77: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/77.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
RESULT:
![Page 78: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/78.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
MOVE BLOCK
AIM: To write an assembly language program to move the block of data from a source location to the specified destination location.
REGISTERS USED: AX,DS,ES,SI,DI
FLAGS AFFECTED: No flags are affected
PROGRAM: ASSUME CS:CODE,DS:DATACODE SEGMENTMOV AX,DATAMOV DS,AX
![Page 79: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/79.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
MOV AX,DATAMOV ES,AXMOV SI,OFFSET STR1MOV DI,OFFSET STR2MOV CL,COUNTCLDREP MOVSBHLTCODE ENDSDATA SEGMENTSTR1 DB 04H,0F9H,0BCH,98H,40HCOUNT EQU 05HDATA ENDSEXTRA SEGMENTORG 0010HSTR2 DB 0020 ?EXTRA ENDSEND
FLOW CHART:
START
INITIALIZATION OF DATA, EXTRA SEGMENT
INCREMENT POINTER, DECREMENT CL REGISTER
MOVE A BYTE FROM SOURCE TO DESTINATION
STOP
INTIALISATION OF SOURCE, DESTINATION POINTER
MOVE LENGTH OF STRING TO CL REGISTER
CL=0
TRUE
FALSE
![Page 80: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/80.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
RESULT:INPUT: STR1 (DS:0000H) = 04H,F9H,BCH,98H,40H
OUTPUT: STR2 (DS:0010H) = 04H,F9H,BCH,98H,40H
![Page 81: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/81.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
REVERSE STRING
AIM: To write an assembly language program to reverse the given string.
REGISTERS USED: AX,DS,SI,DI,CL
FLAGS AFFECTED: ZF,PF
PROGRAM: ASSUME CS:CODE,DS:DATA CODE SEGMENT
![Page 82: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/82.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
MOV AX,DATA MOV DS,AX MOV CL,COUNT MOV SI,OFFSET STR1 MOV DI,0003H BACK:MOV AL,[SI] XCHG [DI],AL MOV [SI],AL INC SI DEC DI DEC CL JNZ BACK HLT CODE ENDS DATA SEGMENT STR1 DB 01H,02H,03H,04H COUNT EQU 02H DATA ENDS END
FLOW CHART:
INC SI DEC DI DEC CL
IfCL=0
START
INITIALIZATION OF DATA SEGMENT
CLCOUNTSIoffset address of STR1DI0003
Move a byte from SI to DI
STOP
FALSE
TRUE
![Page 83: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/83.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
RESULT:INPUT: STR1 (DS:0000H) = 01H,02H,03H,04H
OUTPUT: STR1 (DS:0000H) = 04H,03H,02H,01H
![Page 84: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/84.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
LENGTH OF THE STRING
AIM: To write an assembly language program to find the length of the given string.
REGISTERS USED: AX,DS,SI,CL
FLAGS AFFECTED: ZF,PF,SF,AF,CF
![Page 85: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/85.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
PROGRAM: ASSUME CS:CODE,DS:DATA CODE SEGMENT MOV AX,DATA MOV DS,AX MOV AL,00H MOV CL,00H MOV SI,OFFSET STR1 BACK:CMP AL,[SI] JNC GO INC CL INC SI JNZ BACK GO:MOV LENGTH,CL HLT CODE ENDS DATA SEGMENT STR1 DB 01H,03H,08H,09H,05H,07H,02H LENGTH DB ? DATA ENDS END
FLOW CHART:
START
INITIALIZATION OF DATA SEGMENT
IfCL=0
AL00H CL00HSI OFFSET ADDRESS OF STR1
Increment CL Increment SI
STOP
AL<[SI]
LENGTHCL
TRUE
FALSE
FALSE
TRUE
![Page 86: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/86.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
RESULT:
INPUT: STR (DS:0000H) = 01H, 03H,08H,09H,05H,07H,02H OUTPUT: LENGTH = 07H (CL)
FALSE
![Page 87: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/87.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
LARGEST NUMBER IN AN ARRAY
AIM: To write an assembly language program to find largest number in the given list.
REGISTERS USED:
![Page 88: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/88.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
FLAGS AFFECTED: ZF,PF
PROGRAM:ASSUME CS:CODE,DS:DATACODE SEGMENTMOV AX,DATAMOV DS,AXMOV CL,COUNTMOV SI,OFFSET LISTAND AL,[SI]DEC CL
BACK: INC SI MOV BL,[SI]
CMP AL,BL JNC AHEAD MOV AL,BL AHEAD: DEC CL JNZ BACK MOV RES,AL
HLTCODE ENDSDATA SEGMENTLIST DB 06H,15H,05HCOUNT DB 03HRES DB ?DATA ENDSEND
FLOW CHART:
![Page 89: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/89.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
RESULT:
![Page 90: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/90.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
SMALLEST NUMBER IN AN ARRAY
![Page 91: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/91.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
AIM: To write an assembly language program to find smallest number in the given list.
REGISTERS USED:
FLAGS AFFECTED: ZF,PF
PROGRAM:ASSUME CS:CODE,DS:DATACODE SEGMENTMOV AX,DATAMOV DS,AXMOV CL,COUNTMOV SI,OFFSET LISTAND AL,[SI]
DEC CL BACK: INC SI MOV BL,[SI] CMP AL,BL JC AHEAD MOV AL,BL AHEAD: DEC CL JNZ BACK MOV RES,AL
HLTCODE ENDSDATA SEGMENTLIST DB 06H,15H,05HCOUNT DB 03RES DB ?DATA ENDSEND
![Page 92: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/92.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
FLOW CHART:
![Page 93: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/93.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
RESULT:
![Page 94: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/94.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
MATRIX ADDITION OF TWO 3X3 MATRICES
AIM: To write an assembly language program matrix addition of two 3X3 matrices.
REGISTERS USED:
FLAGS AFFECTED: ZF,PF
PROGRAM:ASSUME CS:CODE,DS:DATACODE SEGMENTMOV AX,DATAMOV DS,AXMOV CX,COUNTMOV SI,OFFSET MAT1MOV DI,OFFSET MAT3MOV BX,OFFSET MAT2
NEXT: XOR AX,AXMOV AL,[SI]ADD AL,[SI]ADC AH,00HMOV WORD PTR[BX],AXINC SIINC DIADD BX,02HLOOP NEXTHLTCODE ENDSDATA SEGMENTCOUNT EQU 09HMAT1 DB 01H,02H,03H,01H,02H,03H,01H,02H,03HMAT2 DB 01H,02H,03H,01H,02H,03H,01H,02H,03HMAT3 DW ?DATA ENDSEND
![Page 95: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/95.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
FLOW CHART:
![Page 96: Mpi Lab Record](https://reader035.vdocuments.site/reader035/viewer/2022081720/544cd2a9af7959f7138b48d3/html5/thumbnails/96.jpg)
Geethanjali College of Engineering and Technology
Cheeryal (v), Keesara (M), Ranga Reddy District.
RESULT: