#2
oped022022-10-21 20:46
|
程序代码:
data segment
num db -9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10
fu db 20 dup(?) ;存放负数
zheng db 20 dup(?) ;存放正数
noff db 0 ;负数数目
nofz db 0 ;正数数目
data ends
code segment
assume cs:code,ds:data,es:data
codestart proc far
push ds
xor ax,ax
push ax
mov ax,data
mov ds,ax
mov es,ax
start:
lea si,fu
lea di,zheng
lea bx,num
mov cx,20
compare:
mov al,[bx]
inc bx
cmp al,0
jg positive
inc noff
mov [si],al
inc si
jmp transfer
positive:
inc nofz
mov [di],al
inc di
transfer:
loop compare
exit:
ret
code ends
end start