8051 Programs for Sorting
by
eees.in
·
Programs for Sorting
THEORY:
- The sorting technique used here is relatively simple. First consider the first two numbers of the array.
INPUT:
- 8600 05H, 08H, 07H, 06H, 04H
OUTPUT:
- 8600 04H, 05H, 06H, 07H, 08H
PROGRAM:
ADDRESS | OPCODE | MNEMONICS | COMMENDS |
8500 | 78 05 | MOV R0,#05 | |
8502 | E8 | LOOP3: MOV A,R0 | |
8503 | F9 | MOV R1,A | |
8504 | 90 86 00 | MOV DPTR,#8600 | |
8507 | C0 83 | LOOP2: PUSH DPH | |
8509 | C0 82 | PUSH DPL | |
850B | E0 | MOVX A,@DPTR | |
850C | F5 F0 | MOV F0,A | |
850E | A3 | INC DPTR | |
850F | E0 | MOVX A,@DPTR | |
8510 | B5 F0 00 | CJNE A,F0,LOOP1 | |
8513 | 50 09 | LOOP1: JNC LOOP | |
8515 | D0 82 | POP DPL | |
8517 | D0 83 | POP DPH | |
8519 | F0 | MOVX @DPTR,A | |
851A | A3 | INC DPTR | |
851B | E5 F0 | MOV A,F0 | |
851D | F0 | MOVX @DPTR,A | |
851E | D9 E7 | LOOP: DJNZ R1,LOOP2 | |
8520 | D8 E0 | DJNZ R0,LOOP3 | |
8522 | 80 FE | HERE: SJMP HERE | |
Recent Comments