mercredi 25 février 2015

How to sort characters in string by ascii codes in assembly

I am new in assembly and I don't understand, how to sort characters in string. I can only input and output string. I find bubble sort in assembly for arrays, but how to use it for strings?



mov bx, offset array
mov cx, n
for_i:
dec cx
xor dx, dx
for_j:
cmp dx, cx
jae exit_for_j
jbe no_swap
mov ah, byte ptr bx[di]
mov byte ptr bx[di], al
mov byte ptr bx[si], ah
no_swap:
inc dx
jmp for_j
exit_for_j:
loop for_i


I need your help. Thanks


Aucun commentaire:

Enregistrer un commentaire