Created
May 9, 2016 08:44
Program for arranging a given array in ascending order.The length of array is stored at memory location 5000H and the array starts from 5001H.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;<Program for arranging a given array in ascending order.The length of array | |
;is stored at memory location 5000H and the array starts from 5001H> | |
jmp start | |
;code | |
start: lxi h, 5000H | |
mov b,m | |
dcr b | |
loop1: mov c,b | |
lxi h, 5001H | |
loop2: mov a,m | |
inx h | |
cmp m | |
jc skip | |
mov d,m | |
mov m,a | |
dcx h | |
mov m,d | |
inx h | |
skip: dcr c | |
jnz loop2 | |
dcr b | |
jnz loop1 | |
hlt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment