匯編:統(tǒng)計(jì)字符串內(nèi)各種字符的數(shù)目
;輸出num
mov ax,0
mov al,num
mov bl,10
div bl
mov dx,ax
add dx,3030h
cmp dl,30h
jne wuling3
mov dl,32
wuling3:
push dx
lea dx,result1
mov ah,09h
int 21h
pop dx
mov ah,02h
int 21h
mov dl,dh
mov ah,02h
int 21h
LEA DX,kongzi
MOV AH,09H
INT 21H
;輸出CAPITAL
MOV AX,0
MOV AL,CAPITAL
sub al,04h
MOV BL,10
DIV BL
MOV DX,AX
ADD DX,3030H
CMP Dl,30H
JNE WULING2
MOV Dl,32
WULING2:push dx
lea dx,result2
mov ah,09h
int 21h
pop dx
MOV AH,02h
INT 21H
MOV DL,DH
MOV AH,2
INT 21H
mov al,sum
sub al,capital
add al,04h
sub al,num
mov small,al
;輸出small capital
MOV AX,0
MOV AL,small
MOV BL,10
DIV BL
MOV DX,AX
ADD DX,3020H
CMP Dl,30H
JNE WULING4
MOV Dl,32 ;空格
WULING4: push dx
LEA DX,kongzi
MOV AH,09H
INT 21H
lea dx,result3
mov ah,09h
int 21h
pop dx
MOV AH,02h
INT 21H
MOV DL,DH
MOV AH,2
INT 21H
lea dx,kongzi
mov ah,09h
int 21h
lea dx,tip
mov ah,09h
int 21h
mov ah,01h
int 21h
cmp al,y
je lop
lea dx,kongzi
mov ah,09h
int 21h
lea dx,tip1
mov ah,09h
int 21h
over:
MOV AH,4CH
INT 21H
k2:inc capital
jmp main
k1: inc num
jmp main
lop:
lea dx,kongzi
mov ah,09h
int 21h
jmp start
CODE ENDS
END START
評(píng)論