汇编 选择排序
程序代码:
;有一个首地址为A的N字无序数组,编制程序采用选择排序法使该数组中的数按照从大到小的次序排序输出 DATAS SEGMENT a dw 1,7,2,9,4,8,7,6,3 mess1 db 'the array preinstalled is:12,7,22,19,14,48,37,33,66,31$' mess2 db 0ah,0dh,'Already sorted array is:','$' DATAS ENDS CODES SEGMENT ASSUME CS:CODES,DS:DATAS START: MOV AX,DATAS MOV DS,AX lea dx,mess1 mov ah,09h int 21h lea dx,mess2 mov ah,09h int 21h mov ax,mess1-a mov dl,2 div dl cbw xor ah,ah mov cx,ax mov si,0 loop1: mov di,cx inc si sub si,1 push si mov bx,si loop2: mov ax,a[si+2] cmp ax,a[bx] jb continue add si,2 mov bx,si continue: add si,2 loop loop2 pop si mov ax,a[si] xchg ax,a[bx] mov a[si],ax mov dx,a[si] add dx,30h mov ah,02h int 21h sub di,1 mov cx,di add si,2 loop loop1 MOV AH,4CH INT 21H CODES ENDS END START求教 为什么会错误