求帮助,代码有问题,来看一下
代码怎么改啊,代码是输入几个两位数,用空格隔开,最后enter,进行排序输出,但是不能实现,请指教DATAS SEGMENT
buffer db 20 dup (?)
DATAS ENDS
STACKS SEGMENT
;此处输入堆栈段代码
STACKS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS,SS:STACKS
START:
MOV AX,DATAS
MOV DS,AX
mov si,0
mov cx,20
loop1:mov ah,1
int 21h
cmp al,32
jz loop2
cmp al,13
jz loop3
sub al,30h
mov bl,10
mov ah,0
mul bl
mov bl,al
mov ah,1
int 21h
sub al,30h
add al,bl
mov buffer[si],al
inc si
loop loop1
loop2:jmp loop1
mov cx,20
loop3:
mov di,0
loop4:mov al,buffer[di]
cmp al,buffer[di+2]
jge L
xchg al,buffer[di+2]
mov buffer[di],al
L: add di,2
loop loop4
;mov cx,dx
mov cx,3
mov di,0
loop5:push cx
mov al,buffer[di]
cbw
mov cl,10
idiv cl
mov bl,ah
mov dl,al
add dl,30h
mov ah,2
int 21h
mov dl,bl
add dl,30h
mov ah,2
int 21h
inc di
pop cx
loop loop5
MOV AH,4CH
INT 21H
CODES ENDS
END START