[求助]帮忙调试下程序,结果输出乱码。【已解决】
这是我写的一个冒泡排序后输出的程序,请大家指正。最后,多少对汇编版有点失望……
程序代码:data segment
buf dw 64,25,72,136,42,221,16,9,'$'
res dw 26 dup(?),'$'
count equ ($-buf-1)/8
data ends
code segment
assume cs:code,ds:data
begin: mov ax,data
mov ds,ax
call paixu
call zhuan
mov dx,offset res
mov ah,09h
int 21h
mov ah,4ch
int 21h
paixu proc near
push ax
push cx
push dx
push si
push di
mov cx,count
sub cx,1
lp1: mov dx,cx
lea si,buf
lea di,buf+2
lp2: mov ax,[si]
cmp ax,[di]
jbe xh
xchg [di],ax
xh: mov [si],ax
add si,2
add di,2
dec dx
jnz lp2
loop lp1
pop di
pop si
pop dx
pop cx
pop ax
ret
paixu endp
zhuan proc near
push ax
push bx
push cx
push dx
push di
push si
lea di,buf
lea si,res
mov cx,8
l0: push cx
mov ax,[di]
mov bx,0ah
mov cx,0
l1: mov dx,0
div bx
push dx
inc cx
cmp ax,0
jnz l1
l2: pop dx
add dl,30h
mov [si],dl
add si,2
loop l2
pop cx
cmp cx,1
jbe l3
push ax
mov ax,2ch
mov [si],ax
pop ax
add si,2
add di,2
l3: loop l0
pop si
pop di
pop dx
pop cx
pop bx
pop ax
ret
zhuan endp
code ends
end begin
[ 本帖最后由 dydsdyds 于 2010-6-18 18:40 编辑 ]





其实我也是不会。我只会点win32汇编。对DOS带功能号的我是很迷茫。