Home > other >  Assembly: type string, statistical number of lowercase letters, don't know where the program is
Assembly: type string, statistical number of lowercase letters, don't know where the program is

Time:09-18

1. Statistics of the number of lowercase letters program listing:
; COUNTDC. ASM
The DATA SEGMENT
STRN DB 80 DUP (?)
The DATA ENDS
CODE SEGMENT
ASSUME CS: CODE, DS: DATA
START: MOV AX, DATA
MOV DS, AX
LEA DI, STAN
MOV CL, 0
AGAIN: MOV AH, 1
INT 21 h
CMP AL, 0 dh
JZ DONE
MOV (DI), AL
INC DI
INC CL
JMP AGAIN
DONE: LEA SI, STRN
MOV CH, 0
MOV BL, 0
CLD
CYCLE: LODSB
CMP AL, 61 h
JB NEXT
CMP AL, 7 ah
JA NEXT
INC BL
NEXT: LOOP CYCLE
MOV AL, BL
MOV AH, 0
MOV CL, 10
DIV CL; Ten digits in AL, the single digits in AH
XCHG AH, AL; The following shows two decimal number
MOV DL, AH
The OR DL, 30 h
INT 21 h
MOV DL, AL
The OR DL, 30 h
MOV AH, 2
INT 21 h
MOV DL, AL
The OR DL, 30 h
INT 21 h
MOV DL, AL
The OR DL, 30 h
INT 21 h
MOV AH, 4 ch
INT 21 h
CODE ENDS
END the START

CodePudding user response:

At the beginning of lea di, Stan a slip of the pen, behind the output, should be double digits, so how to use the multiple calls; The first call did not give AH right function, and on mobile phones, other also didn't see it,
  • Related