; multi-segment executable file template. data segment ; add your data here! arr db 10 dup(?) pkey db "press any key...$" ends stack segment dw 128 dup(0) ends code segment start: ; set segment registers: mov ax, data mov ds, ax mov es, ax ; add your code here mov si, 0 while: cmp si, 9 jnle endwhile mov ah, 2 mov dl, '[' int 21h mov ah, 2 mov dx, si add dx, 48 int 21h mov ah, 2 mov dl, ']' int 21h mov ah, 2 mov dl, '=' int 21h mov ah, 1 int 21h mov arr[si], al inc si mov ah, 2 mov dl, 10 int 21h mov ah, 2 mov dl, 13 int 21h jmp while endwhile: mov si, 0; for_i: cmp si, 9 jnle end_for_i mov al, arr[si] mov di, 0 for_j: cmp di, 8 jnle end_for_j cmp arr[di], al jng endif mov bx, di endif: inc di jmp for_j end_for_j: inc si jmp for_i end_for_i: mov ah, 2 mov dl, 10 int 21h mov ah, 2 mov dl, 13 int 21h lea dx, pkey mov ah, 9 int 21h ; output string at ds:dx ; wait for any key.... mov ah, 1 int 21h mov ax, 4c00h ; exit to operating system. int 21h ends end start ; set entry point and stop the assembler.