题目是对输入字流统计非数字的个数的统计,必须以十进制显示。
; multi-segment executable file template.
data segment
; add your data here!
pkey db "Count the udigtal string ,Please input the word!$"
BACK db "input over,the count is:$"
ends
stack segment
dw 128 dup(0)
ends
code segment
start:
; set segment registers:
mov ax, data
mov ds, ax
mov es, ax
; add your code here
mov dX, OFFSET pkey ;输出字符串!
mov ah, 9
int 21h ; output string at ds:dx
MOV CL,0
MOV AL,0
REPT: MOV AH,1
INT 21H
CMP AL,1BH
JZ RT
CMP AL,30H
JB COUNT
CMP AL,39H
JA COUNT
JMP REPT
COUNT:INC CL
JMP REPT
RT: MOV DX ,OFFSET BACK
MOV AH, 9
INT 21H
CALL TURN10
MOV AH,4CH
INT 21H
ends
TURN10 PROC NEAR
PUSH AX
PUSH BX
PUSH CX
PUSH DX
MOV DL,-1
SUB1: SUB CL,100
INC DL
JNC SUB1
ADD CL,100
OR DL,30H
MOV AH,2
INT 21H
MOV DL,-1
SUB2: SUB CL,10
INC DL
JNC SUB2
ADD CL,10
OR DL,30H
MOV AH,2
INT 21H
MOV DL,CL
OR DL,30H
MOV AH,2
INT 21H
POP DX
POP CX
POP BX
POP AX
RET
ENDP
end start ; set entry point and stop the assembler.
本博客分享了使用汇编语言进行上机实践的经验,具体介绍了如何统计输入字符串中非数字字符的数量,并以十进制形式显示结果。文章包含代码实现和操作流程说明。
15万+

被折叠的 条评论
为什么被折叠?



