Google Search

Wednesday, October 27, 2010

MICROPROCESSOR 8086 LAB MANUAL SORTING THE NUMBERS IN DESCENDING ORDER

AIM:
To write an assembly language program for the sorting in ascending order using 8086 microprocessor.
ALGORITHM: (ASCENDING ORDER)
1. Start the program.
2. Move data to CX register and move CX data to D1 register
3. Move 2200 to the BX register and move the content of 2200 to memory
of AX.
4. Compare the content of AX with 2202
5. Jump on borrow to rep
6. Move the data in memory to AX and move Data from AX to AI
7. Add Data to BX register and go to loop2
8. Perform no operation and move data & D1 to CX
9. Go to the loop
10. Stop the program
PROGRAM:
ADDRESS LABEL OPCODE MNEMONICS OPERAND COMMENTS
2000 B9, 07, 00 MOV CX, 07 Move data to CX reg
2003 LOOP1 89 CF MOV DI, CX Move CX data to direg
2005 BB, 00, 22 MOV BX, 2200 Move 2200 to the BX reg
2008 LOOP2 8B, 07 MOV AX, AI [BX] Move the content of 2200 to memory of AX
200A 3B, 47, 02 CMP AX,AI[BX+2] Compare the content `of ax with 2202
200D 72, 05 JB REP jump on borrow to rep
200F 87, 47, 02 XCHG AX,AI[BX+2] Move the data in memory to AX
2012 89, 07 MOV AI[BX],AX Move data from AX to AI
201A REP 83, C3, 02 ADD BX,2 Add data to BX register
2017 F2, EF LOOP LOOP2 Go to loop2
2019 90 NOP No operation
201A 89, F9 MOV CX, DI Move data of DI to CX
201C E2, E5 LOOP LOOP1 Go to loop1
201E F4 HLT Stop the process
INPUT:
1200 – 0007 1208 – 0003
1202 – 0006 120A – 0002
1204 – 0005 120C – 0001
1206 – 0004
OUTPUT:
1200 – 0001 1208 – 0005
1202 – 0002 120A – 0006
1204 – 0003 120C - 0007
1206 – 0004

0 comments:

Post a Comment