如何编写程序统计由40000H开始的16K个单元中所存放的字符"A”的个数,并将结果存放在DX中?
展开全部
DATA SEGMENT
DATA1 DB ‘DFASFAAAFDFAAFFFA'
COUNT EQU
DATA ENDS
STACK SEGMENT
STA DB 100 DUP (?)
TOP EQU LENGTH STA
STACK ENDS
CODE SEGMENT
ASSUME CS:CODE,SS:STACK,DS:DATA
START: MOV AX,DATA
MOV DS,AX
MOV AX,STACK
MOV SS,AX
MOV AX,TOP
MOV SP,AX
MOV CX,COUNT
MOV DX,0
LEA SI,DATA1
MOV BL,'A'
NEXT: CMP [SI],BL
JNZ OTHER
INC DX
OTHER: INC SI
LOOP NEXT
CODE ENDS
END START
DATA1 DB ‘DFASFAAAFDFAAFFFA'
COUNT EQU
DATA ENDS
STACK SEGMENT
STA DB 100 DUP (?)
TOP EQU LENGTH STA
STACK ENDS
CODE SEGMENT
ASSUME CS:CODE,SS:STACK,DS:DATA
START: MOV AX,DATA
MOV DS,AX
MOV AX,STACK
MOV SS,AX
MOV AX,TOP
MOV SP,AX
MOV CX,COUNT
MOV DX,0
LEA SI,DATA1
MOV BL,'A'
NEXT: CMP [SI],BL
JNZ OTHER
INC DX
OTHER: INC SI
LOOP NEXT
CODE ENDS
END START
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询