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

41 lines
663 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.
; 实验三-4成绩分类程序
; 功能根据分数分类为A/B/C/D/E
; 90分以上为A80-89为B70-79为C60-69为D60分以下为E
DATA SEGMENT
SCORE DB 85
GRADE DB ?
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START:
MOV AX, DATA
MOV DS, AX
MOV AL, SCORE
CMP AL, 90
JAE A_GRADE
CMP AL, 80
JAE B_GRADE
CMP AL, 70
JAE C_GRADE
CMP AL, 60
JAE D_GRADE
MOV GRADE, 'E'
JMP EXIT
A_GRADE:
MOV GRADE, 'A'
JMP EXIT
B_GRADE:
MOV GRADE, 'B'
JMP EXIT
C_GRADE:
MOV GRADE, 'C'
JMP EXIT
D_GRADE:
MOV GRADE, 'D'
EXIT:
MOV AH, 4CH
INT 21H
CODE ENDS
END START