微机原理,用汇编语言编写一个程序

2024-11-16 09:52:37
推荐回答(1个)
回答1:

统计正数、负数和零数据的个数的程序:

DATA SEGMENT
DATA1 DB 10, 25, 0, -4,... ;此处楼主自己补齐100个数字
ZERO DB 0
PLUS DB 0
NEGT DB 0
DATA ENDS
;----------------------------
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START:
MOV AX, DATA
MOV DS, AX
LEA SI, DATA1
MOV CX, 100
AGAIN:
MOV AL, [SI]
CMP AL, 0
JNZ X1
INC ZERO
JMP NEXT
X1: JNB X2
INC NEGT
JMP NEXT
X2: INC PLUS
NEXT:INC SI
LOOP AGAIN
MOV AH, 4CH
INT 21H
CODE ENDS
END START