Files
Operating-System/Experiment/asm-exp/实验三/code/EX3_5_CharClassification.asm
2026-06-25 00:09:09 +08:00

41 lines
710 B
NASM
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
; 实验三-5字符分类程序
; 功能:判断大写/小写字母或其他字符
; 结果1=大写字母2=小写字母3=其他字符
DATA SEGMENT
CH DB 'A'
RESULT DB ?
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START:
MOV AX, DATA
MOV DS, AX
MOV AL, CH
CMP AL, 'A'
JNB NL_CHECK
JMP OTHER
NL_CHECK:
CMP AL, 'Z'
JNA UPLETTER
CMP AL, 'a'
JNB LL_CHECK
JMP OTHER
LL_CHECK:
CMP AL, 'z'
JNA LOWLETTER
JMP OTHER
UPLETTER:
MOV RESULT, 1 ;大写字母
JMP EXIT
LOWLETTER:
MOV RESULT, 2 ;小写字母
JMP EXIT
OTHER:
MOV RESULT, 3 ;其他字符
EXIT:
MOV AH, 4CH
INT 21H
CODE ENDS
END START