主题:[讨论]紧急情况,帮忙看一下程序,急等着用
实验内容:
从键盘输入一组十进制数据,按从小到大的顺序排列,并以十进制的形式输出。
要求:输入过程有键盘锁;输入、输出有提示;输入和输出之间换行。
data segment
count dw 5
nozero db 0
data ends
stack segment
db 11 dup(0)
stack ends
code segment
assume cs:code,ds:data,ss:stack
start:
mov ax,data
mov ds,ax
mov cx,count
repeat:
call ind
call crlf
call outd
call crlf
loop repeat
mov ah,4ch
int 21h
ind proc ; shi jin zhi de shu ru han shu
push cx
push ax
indstart:
mov bx,0
accept:
mov ah,1
int 21h
cmp al,30h
jl indexit
sub al,0
xchg ax,bx
mov cx,10
mul cx
add bx,ax ; shu fang ru bx zhong
jmp accept
indexit:
pop cx
ret
ind endp
outd proc ;shi jin zhi de shu chu han shu
push cx
mov nozero,0 ;like a boolean variable
mov cx,10000
call decdiv
mov cx,100
call decdiv
mov cx,10
call decdiv
mov cx,1
call decdiv
cmp nozero,0
jne outdexit
mov dl,30h
mov ah,2
int 21h
outdexit:
pop cx
ret
decdiv proc
mov ax,bx
mov dx,0
div cx
mov bx,dx
mov dl,al
cmp dl,0
jne dispdigit
cmp nozero,0
jne dispdigit
jmp decdivexit
dispdigit:
mov nozero,1
add dl,30h
mov ah,2
int 21h
decdivexit:
ret
decdiv endp
outd endp
crlf proc ;hui che huan hang fu han shu
mov dl,0dh
mov ah,2
int 21h
mov dl,0ah
mov ah,2
int 21h
ret
crlf endp
code ends
end start
这个程序运行时没有结束标志。好像也没有排序
从键盘输入一组十进制数据,按从小到大的顺序排列,并以十进制的形式输出。
要求:输入过程有键盘锁;输入、输出有提示;输入和输出之间换行。
data segment
count dw 5
nozero db 0
data ends
stack segment
db 11 dup(0)
stack ends
code segment
assume cs:code,ds:data,ss:stack
start:
mov ax,data
mov ds,ax
mov cx,count
repeat:
call ind
call crlf
call outd
call crlf
loop repeat
mov ah,4ch
int 21h
ind proc ; shi jin zhi de shu ru han shu
push cx
push ax
indstart:
mov bx,0
accept:
mov ah,1
int 21h
cmp al,30h
jl indexit
sub al,0
xchg ax,bx
mov cx,10
mul cx
add bx,ax ; shu fang ru bx zhong
jmp accept
indexit:
pop cx
ret
ind endp
outd proc ;shi jin zhi de shu chu han shu
push cx
mov nozero,0 ;like a boolean variable
mov cx,10000
call decdiv
mov cx,100
call decdiv
mov cx,10
call decdiv
mov cx,1
call decdiv
cmp nozero,0
jne outdexit
mov dl,30h
mov ah,2
int 21h
outdexit:
pop cx
ret
decdiv proc
mov ax,bx
mov dx,0
div cx
mov bx,dx
mov dl,al
cmp dl,0
jne dispdigit
cmp nozero,0
jne dispdigit
jmp decdivexit
dispdigit:
mov nozero,1
add dl,30h
mov ah,2
int 21h
decdivexit:
ret
decdiv endp
outd endp
crlf proc ;hui che huan hang fu han shu
mov dl,0dh
mov ah,2
int 21h
mov dl,0ah
mov ah,2
int 21h
ret
crlf endp
code ends
end start
这个程序运行时没有结束标志。好像也没有排序