第一题 刚好做了这个。。。汇编好累的啊。。。
最重要的是代码贴过来要重新排版~
PRINT MACRO X,Y
LEA DX,X
MOV AH,9
INT 21H
MOV BX,Y
CALL DCB3
ENDM
DATA SEGMENT
TAB DB 32 DUP(0)
NUM1 DW 0
NUM2 DW 0
NUM3 DW 0
NUM4 DW 0
NUM5 DW 0
SPA DB' ','$' ;插入空格
HEHE DB'Student Score:',10,'$'
HEHE1 DB10,13,'SCORE 0~59:','$'
HEHE2 DB10,13,'SCORE 60~69:','$'
HEHE3 DB10,13,'SCORE 70~79:','$'
HEHE4 DB10,13,'SCORE 80~89:','$'
HEHE5 DB10,13,'SCORE 90~100:','$'
DATA ENDS
STACK SEGMENT
DB 512 DUP(?)
STACK ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA,SS:STACK
START:
MOV AX,DATA
MOV DS,AX
MOV AX,STACK
MOV SS,AX
LEA DX,HEHE;输入提示
MOV AH,9
INT 21H
LEA SI,TAB;将TAB缓冲区的首地址送SI寄存器
MOV DI,0
L:
CALL DCB1;入口参数键盘,出口BX
CALL DCB2;入口BX,出口BL
MOV [SI],BL
CMP BL,60H
JB ONE
CMP BL,70H
JB TWO
CMP BL,80H
JB THREE
CMP BL,90H
JB FOUR
CMP BL,99H
JBE FIVE
ONE:
MOV DI,NUM1
INC NUM1
JMP NEW
TWO:
MOV DI,NUM2
INC NUM2
JMP NEW
THREE:
MOV DI,NUM3
INC NUM3
JMP NEW
FOUR:
MOV DI,NUM4
INC NUM4
JMP NEW
FIVE:
MOV DI,NUM5
INC NUM5
JMP NEW
NEW:
INC SI
CMP SI,1EH;计数30个数
JB L
PRINT HEHE1,NUM1;SCORE 0~59:
PRINT HEHE2,NUM2;SCORE 60~69:
PRINT HEHE3,NUM3;SCORE 70~79:
PRINT HEHE4,NUM4;SCORE 80~89:
PRINT HEHE5,NUM5;SCORE 90~100:
MOV AH,4CH
INT 21H
DCB1 PROC;输入一个字符
MOV AH,1
INT 21H
MOV BH,AL
MOV AH,1
INT 21H
MOV BL,AL
LEA DX,SPA;插入空格
MOV AH,9
INT 21H
RET
DCB1 ENDP;出口参数BX
DCB2 PROC;压缩为一字节BCD码
MOV CL,4
SUB BX,3030H
SHL BH,CL
ADD BL,BH
RET
DCB2 ENDP;出口参数BL
DCB3 PROC;入口AX,将BCD数转化为ASCII,并输出
MOV AL,BL
MOV CL,4
MOV BH,BL
SHR BH,CL
AND BL,0FH
ADD BX,3030H
MOV DL,BH
MOV AH,2
INT 21H
MOV DL,BL
MOV AH,2
INT 21H
RET
DCB3 ENDP
CODE ENDS
END START
温馨提示:内容为网友见解,仅供参考