This project is an array manipulation that accepts an array of 15 single digit numbers and arranges it ascending and descending order. Also displays in even- odd and odd-even format

jmp start
mess1 db 10,13," Enter an array of 15 (0-9) : $"
mess2 db 10,13," Array content: $"
mess3 db 10,13," Enter Choice: $"
mess4 db 10,13," Original Array: $"
evenodd db 10,13," Even-odd sequence: $"
oddeven db 10,13," Odd-even sequence: $"
ascend db 10,13," Ascending order: $"
descend db 10,13," Descending order: $"
menu0 db 10,13," €€€€€€€€€€€€€€ menu €€€€€€€€€€€€€$"
twoline db 10,13," €€ €€$"
menu1 db 10,13," €€ (1) Ascending order €€$"
menu2 db 10,13," €€ (2) Descending order €€$"
menu3 db 10,13," €€ (3) Even-odd format €€$"
menu4 db 10,13," €€ (4) Odd-even fomrat €€$"
menu5 db 10,13," €€ (5) Enter new array €€$"
menu6 db 10,13," €€ (6) Quit €€$"
menu7 db 10,13," €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€$"
cont_mess db 10,13," Do you want to continue (y/n): $"
newline db 10,13,"$"
space db " $"
arrayNum db 15 dup 0
origNum db 15 dup 0
even_num db 15 dup 0
odd_num db 15 dup 0
choice db 0
temp db 0
count_even db 0
count_odd db 0
start:
xor ax,ax
xor bx,bx
xor cx,cx
xor dx,dx
mov arrayNum,0
mov origNum,0
mov even_num,0
mov odd_num,0
mov choice,0
mov temp,0
mov count_even,0
mov count_odd,0
mov ax,3
int 10h
lea dx,mess1
mov ah,9
int 21h
mov bx,0
mov cx,15
mov ah,0
fillArray:
lea dx,space
mov ah,9
int 21h
mov ah,1
int 21h
sub al,30h
cmp al,0
jl start
cmp al,9
jg start
mov arrayNum[bx],al
mov origNum[bx],al
inc bx
loop fillArray
call new_Line
;----------------------------sorting---------------------------
sorter:
call clear
mov di,15
mov ah,0
mov bx,0
outerloop:
mov si,0
mov cx,15
innerloop:
mov al,arrayNum[bx]
mov ah,arrayNum[si]
cmp al,ah
jg skip
mov al,arrayNum[bx]
mov ah,arrayNum[si]
mov temp,al
mov al,ah
mov ah,temp
mov arrayNum[bx],al
mov arrayNum[si],ah
skip:
inc si
loop innerloop
safety:
inc bx
dec di
cmp di,0
jg outerloop
cmp di,0
jl safetyzone
safetyzone:
;-------------------sorting even------------------------
call clear
mov cx,15
mov si,0
mov di,0
sorteven:
xor ax,ax
mov al,arrayNum[si]
xor bx,bx
mov bl,2
div bl
call even_numbers
inc si
loop sorteven
;-------------------------- Sorting odd --------------------------
call clear
mov cx,15
mov si,0
mov di,0
oddsorter:
xor ax,ax
mov al,arrayNum[si]
xor bx,bx
mov bl,2
div bl
call odd_numbers
inc si
loop oddsorter
;------------------------- menu ------------------------------
menu:
mov ax,3
int 10h
;--------------------- shows the original array --------------
lea dx,mess4
mov ah,9
int 21h
mov cx,15
mov bx,0
showArray:
mov dl,origNum[bx]
or dl,30h
mov ah,2
int 21h
lea dx,space
mov ah,9
int 21h
inc bx
loop showArray
;------------------------------ end of show -----------------------
call new_Line
lea dx,menu0
mov ah,9
int 21h
lea dx,twoline
mov ah,9
int 21h
lea dx,menu1
mov ah,9
int 21h
lea dx,menu2
mov ah,9
int 21h
lea dx,menu3
mov ah,9
int 21h
lea dx,menu4
mov ah,9
int 21h
lea dx,menu5
mov ah,9
int 21h
lea dx,menu6
mov ah,9
int 21h
lea dx,twoline
mov ah,9
int 21h
lea dx,menu7
mov ah,9
int 21h
call new_Line
lea dx,mess3
mov ah,9
int 21h
mov ah,1
int 21h
sub al,30h
cmp al,1
jl menu_bridge
cmp al,6
jg menu_bridge
mov choice,al
cmp al,1
je ascend1
cmp al,2
je descend1
cmp al,3
je even_odd1
cmp al,4
je odd_even1
cmp al,5
je new
cmp al,6
je quit
menu_bridge:
call menu
new:
call start
ascend1:
call ascending
descend1:
call descending
even_odd1:
call even_odd
odd_even1:
call odd_even
quit:
int 20h
new_Line:
lea dx,newline
mov ah,9
int 21h
ret
clear:
xor ax,ax
xor bx,bx
xor cx,cx
xor dx,dx
ret
display_array:
lea dx,ascend
mov ah,9
int 21h
mov cx,15
mov bx,0
dispArray:
mov dl,arrayNum[bx]
or dl,30h
mov ah,2
int 21h
lea dx,space
mov ah,9
int 21h
inc bx
loop dispArray
ret
even_numbers:
cmp ah,0
jne odd_counter
mov al,arrayNum[si]
mov even_num[di],al
inc di
inc count_even
jmp return
odd_counter:
inc count_odd
return:
ret
showEven:
call clear
xor ax,ax
mov si,0
mov cl,count_even
cmp cl,0
je evenNumbers
dispEven:
mov dl,even_num[si]
or dl,30h
mov ah,2
int 21h
lea dx,space
mov ah,9
int 21h
inc si
dec cl
cmp cl,0
jg dispEven
cmp cl,0
jl evenNumbers
evenNumbers:
ret
odd_numbers:
cmp ah,0
je oddreturn
mov al,arrayNum[si]
mov odd_num[di],al
inc di
oddreturn:
ret
showOdd:
call clear
xor ax,ax
mov si,0
mov cl,count_odd
cmp cl,0
je oddNumbers
dispOdd:
mov dl,odd_num[si]
or dl,30h
mov ah,2
int 21h
lea dx,space
mov ah,9
int 21h
inc si
dec cl
cmp cl,0
jg dispOdd
cmp cl,0
jl oddNumbers
oddNumbers:
ret
ascending:
call display_array
call continue
descending:
lea dx,descend
mov ah,9
int 21h
mov cx,15
mov bx,14
dispdescend:
mov dl,arrayNum[bx]
or dl,30h
mov ah,2
int 21h
lea dx,space
mov ah,9
int 21h
dec bx
loop dispdescend
call continue
even_odd:
lea dx,evenodd
mov ah,9
int 21h
call showEven
call showOdd
call continue
odd_even:
lea dx,oddeven
mov ah,9
int 21h
call showOdd
call showEven
call continue
continue:
call new_Line
xor dx,dx
lea dx,cont_mess
mov ah,9
int 21h
mov ah,1
int 21h
cmp al,'y'
je start_bridge
cmp al,'n'
je quit2
jmp continue
start_bridge:
call menu
quit2:
int 20h