STACKS SEGNMENT STACK
DW 100H DUP(?)
TOP LEABL WORD
STACKS ENDS
CODES SEGMENT
ASSUME CS:CODES,SS:STACKS
MOV AX,STACKS
MOV SS,AX
LEA SP,TOP
XOR BX,BX
L1: MOV AH,1
INT 21H
CMP AL,24H --判断是否为‘$’,是则结束
JZ FOUT
CMP AL,41H --判断是否大于A,否则判断下一字符
JB L1
CMP AL,7AH --判断是否小于z,否则判断下一字符
JZ L1
CMP AL,61H --判断是否大于a,是则跳转使得BX自加1
JA FADD
CMP AL,5AH --判断是否小于Z,是则跳转使得BX自加1
JB FADD
JMP L1
FADD: INC BX
JMP L1
FOUT: MOV AH,4CH
INT 21H
MAIN ENDP
CODES ENDS
END MAIN