Professional Documents
Culture Documents
Appendix A
Explanation :
Algorithm :
Step I
Step II
Step VI : Is count = 0 ? If yes, goto step VIII else goto step IV.
Step VII : Insert the number in proper position.
Step VIII : Increment the elements counter.
Step IX : Is count = N ? If yes, goto step XI else goto step II.
Step X
: Stop.
Microprocessor 8085
Appendix A
Flowchart 18
Microprocessor 8085
Program :
START :
BACK :
SKIP:
Appendix A
Instruction
Comment
MVI
LXI
MVI
MOV
INX
CMP
JNC
JZ
MOV
MOV
DCX
MOV
INX
DCR
JNZ
DCR
JNZ
HLT
; Initialize counter 1
; Initialize memory pointer
; Initialize counter 2
; Get the number in accumulator
; Increment memory pointer
; Compare number with next number
; If more, dont interchange
; If equal, dont interchange
; Otherwise swap the contents
B, 09
H, D000H
C, 09H
A, M
H
M
SKIP
SKIP
D, M
M, A
H
M, D
H
C
BACK
B
START
; Interchange numbers
;
;
;
;