真是痛苦,运行了多遍,发现[SI]的值总是错的,后来才看到少了
MOV AX,DATA
MOV DS,AX
另外好像不能显示中文,总之我也是初学者.
STACK SEGMENT USE16 STACK
DB 200 DUP(0)
STACK ENDS
DATA SEGMENT
R1 DB 4CH,45H,54H,5AH,49H,58H,63H,3FH,64H,50H
A1 DB '60~69: ',0AH,0DH
A2 DB '70~79: ',0AH,0DH
A3 DB '80~89: ',0AH,0DH
A4 DB '90~99: ',0AH,0DH
A5 DB '100: ',0AH,0DH,'$'
C1 DB 0
C2 DB 0
C3 DB 0
C4 DB 0
C5 DB 0
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START: MOV AX,DATA
MOV DS,AX
MOV CX,10
MOV SI, OFFSET R1
LOP: MOV AL,[SI]
CMP AL,46H
JNL NEXT2
JMP B1
NEXT2: CMP AL,50H
JNL NEXT3
JMP B2
NEXT3: CMP AL,5AH
JNL NEXT4
JMP B3
NEXT4: CMP AL,64H
JZ B5
JMP B4
B1: INC C1
INC SI
LOOP LOP
JMP OVER
B2: INC C2
INC SI
LOOP LOP
JMP OVER
B3: INC C3
INC SI
LOOP LOP
JMP OVER
B4: INC C4
INC SI
LOOP LOP
JMP OVER
B5: INC C5
INC SI
LOOP LOP
OVER: MOV AL,C1
ADD AL,30H
MOV A1+6,AL
MOV AL,C2
ADD AL,30H
MOV A2+6,AL
MOV AL,C3
ADD AL,30H
MOV A3+6,AL
MOV AL,C4
ADD AL,30H
MOV A4+6,AL
MOV AL,C5
ADD AL,30H
MOV A5+6,AL
LEA DX,A1
MOV AH,9
INT 21H
MOV AH,4CH
INT 21H
CODE ENDS
END START