assume cs:codesg,ds:data
data segment
number db -19,28,37,-46,55,61,-74,0;结尾用0结束数据块
sum db 0;记录负数的个数
data ends
codesg segment
start:
mov ax,data
mov ds,ax
mov cx,0
mov bx,0
mov sum,0;初始化负数计数器
s:
cmp number[bx],0
je ok
inc cx
cmp number[bx],10000000b
jb ok1
inc sum
ok1:
inc bx;指向下一个数据单元
jmp short s
ok:
mov ax,4c00h
int 21h
codesg ends
end start
data segment
number db -19,28,37,-46,55,61,-74,0;结尾用0结束数据块
sum db 0;记录负数的个数
data ends
codesg segment
start:
mov ax,data
mov ds,ax
mov cx,0
mov bx,0
mov sum,0;初始化负数计数器
s:
cmp number[bx],0
je ok
inc cx
cmp number[bx],10000000b
jb ok1
inc sum
ok1:
inc bx;指向下一个数据单元
jmp short s
ok:
mov ax,4c00h
int 21h
codesg ends
end start