题目是对输入字流统计非数字的个数的统计,必须以十进制显示。
; 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.