汇编语言 编制程序将一串字节符号数中的正、负数分别送到变量PLUS和MINUS的数据存储区中去,同时记录0的个数(小于65536)

DATA SEGMENT
STRING DB -2,3,0,21,-1,0
COUNT EQU $-STRING
PLUS DB COUNT DUP(?)
MINUS DB COUNT DUP(?)
ZERO DW 0
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START:MOV AX,DATA
MOV DS,AX
LEA SI,STRING
LEA DI,PLUS
LEA BX,MINUS
MOV CX,COUNT
AGAIN:MOV AL,[SI]
CMP AL,0
JGE ONE
MOV [BX],AL
INC BX
JMP NEXT
ONE:JG TWO
INC ZERO
JMP NEXT
TWO:MOV [DI],AL
INC DI
NEXT:INC SI
LOOP AGAIN
MOV AH,4CH
INT 21H
CODE ENDS
END START

Linches.cn | 林澈思的茶 微信小程序