mov bh, 0
mov ah, cl
begin:
cmp ch, ah ; if ah > ch jump to lower
jg lower
mov al, ah
mov ah, ch
mov ch, al
lower:
cmp bh, ch ; if ch < bh jump to finish
jg finish
mov bh, ch
finish:
mov ch, dl
mov dl, dh
mov dh, 0
cmp ch, 0
je the_end ; if ch == 0 jump to the_end
jmp begin
the_end: