题目已在12月28号的发在博客里了。经过一个星期的奋斗,终于写得有点模样了,实现了题目中要求的所有功能。程序中各个子程序的功能及入口参数和出口参数,以后贴出。。。
源码:
STACK SEGMENT STACK
DB 200 DUP(0)
STACK ENDS
DATA SEGMENT PARA PUBLIC 'DATA'
BUF1 DB 'IS ILLEGAL DIGIT,INPUT AGAIN. ',0AH,0DH,'$'
BUF2 DB 'PLEASE INPUT THE NUMBER OF THE STUDENTS(N<=5):$'
BUF3 DB 'YOUR CHOICE(1-6):$'
BUF4 DB ' main menu $'
BUF5 DB '1 modify the pupillary grade 4 stat curricular average grade $'
BUF6 DB '2 demand the pupillary grade 5 stat mark segment information $'
BUF7 DB '3 stat pupillary average grade 6 exit the administrant system $'
BUF8 DB 'PLEASE INPUT THE GRADE OF THE STUDENT:$'
BUF DB 50 DUP(0)
BUF9 DD ?
BUF10 DB 7 DUP(?)
BUF11 DB 'NUM 1Eng 2Phy 3Mat 4Che 5Bio',0AH,0DH,'$'
BUF12 DB ' $'
BUF13 DB 'INPUT THE STUDENT NUMBER:$'
BUF14 DB 'INPUT THE SUBJECT NUMBER:$'
BUF15 DB 'INPUT THE NEW GRADE($'
BUF16 DB '):$'
BUF17 DB 'MODIFY SUCCESSFULLY!',0AH,0DH,'$'
BUF19 DB 'SEARCH SUCCESSFULLY!',0AH,0DH,'$'
BUF20 DB 'DO NOT FIND SUCH A STUDENT!',0AH,0DH,'$'
BUF21 DB 'NUM AVERAGE',0AH,0DH,'$'
BUF22 DB 'THE AVERAGE OF THE NO.$'
BUF23 DB ' SUBJECT:$'
BUF24 DB '>=90 >=80 >=70 >=60 <=59',0AH,0DH,'$'
BUF25 DB 10 DUP (0)
BUF26 DB 'MODIFY UNSUCCESSFULLY!',0AH,0DH,'$'
BUF27 DB 'DEMAND UNSUCCESSFULLY!',0AH,0DH,'$'
BUF28 DB 'STAT UNSUCCESSFULLY!',0AH,0DH,'$'
BUF18 DB 10
DB ?
DB 10 DUP(0)
DAT DW 0AH
SIGN DB ?
NUM DW 301
DATA ENDS
CODE SEGMENT PARA PUBLIC 'CODE'
ASSUME CS:CODE,DS:DATA,SS:STACK
BEGIN: MOV AX,DATA
MOV DS,AX
WRITE MACRO A
PUSH AX
PUSH DX
LEA DX,A
MOV AH,9
INT 21H
POP DX
POP AX
ENDM
MOV BL,0
INNUM: WRITE BUF2
MOV AH,1
INT 21H
CMP AL,0DH
JZ NEXT1
CMP AL,30H
JB ERROR
CMP AL,35H
JA ERROR
SUB AL,30H
MOV BL,AL
JMP NEXT1
ERROR: CALL CRLF
WRITE BUF1
CALL CRLF
JMP INNUM
NEXT1: CALL CRLF
CMP BL,0
JZ ERROR
MOV BH,5
CALL INPUT
CONTROL: CALL SHOW
CALL SHOWMENU
WRITE BUF3
MOV AH,1
INT 21H
CALL CRLF
CMP AL,31H
JZ MODI
CMP AL,32H
JZ SEAR
CMP AL,33H
JZ STA1
CMP AL,34H
JZ STA2
CMP AL,35H
JZ STA3
CMP AL,36H
JZ EXIT
WRITE BUF1
JMP CONTROL
MODI: CALL MODIFY
JMP CONTROL
SEAR: CALL SEARCH
JMP CONTROL
STA1: CALL STAT1
JMP CONTROL
STA2: CALL STAT2
JMP CONTROL
STA3: CALL STAT3
JMP CONTROL
EXIT: MOV AH,4CH
INT 21H
SHOWMENU PROC
PUSH DX
PUSH AX
WRITE BUF4
WRITE BUF5
WRITE BUF6
WRITE BUF7
POP AX
POP DX
RET
SHOWMENU ENDP
CRLF PROC
PUSH AX
PUSH DX
MOV AH,2
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H
POP DX
POP AX
RET
CRLF ENDP
INPUT PROC
PUSH BX
PUSH AX
PUSH SI
PUSH DI
PUSH CX
LEA DI,BUF
START: CMP BL,0
JZ EXIT1
AA: WRITE BUF8
MOV CX,0
LEA SI,BUF9
AB: MOV AH,1
INT 21H
CMP AL,0DH
JZ AC
INC CX
MOV [SI],AL
INC SI
JMP AB
AC: LEA SI,BUF9
CALL F10T2
MOV WORD PTR BUF9,0
CMP SI,-1
JNZ NEXT3
CALL CRLF
WRITE BUF1
JMP AA
NEXT3: CMP AX,100
JLE AK
CALL CRLF
WRITE BUF1
JMP AA
AK: MOV [DI],AX
INC DI
INC DI
DEC BH
CALL CRLF
CMP BH,0
JNZ AA
CALL CRLF
MOV BH,5
DEC BL
JMP START
EXIT1: POP CX
POP DI
POP SI
POP AX
POP BX
RET
INPUT ENDP
F10T2 PROC
PUSH DX
PUSH BX
MOV AX,0
MOV SIGN,0
MOV BL,[SI]
CMP BL,'+'
JZ A
CMP BL,'-'
JNZ NEXT5
MOV SIGN,1
A: DEC CX
NEXT4: INC SI
MOV BL,[SI]
NEXT5: CMP BL,30H
JB D1
CMP BL,39H
JA D1
SUB BL,30H
MOV BH,0
MUL DAT
JO D1
ADD AX,BX
JC D1
DEC CX
JNE NEXT4
CMP SIGN,1
JNE QQ
NEG AX
QQ: POP BX
POP DX
RET
D1: MOV SI,-1
JMP QQ
F10T2 ENDP
SHOW PROC
PUSH SI
PUSH AX
PUSH BX
PUSH NUM
WRITE BUF11
LEA SI,BUF
AE: CMP BL,0
JZ EXIT2
MOV AX,NUM
CALL F2T10
AD: WRITE BUF12
MOV AX,[SI]
CALL F2T10
INC SI
INC SI
DEC BH
CMP BH,0
JNZ AD
CALL CRLF
MOV BH,5
INC NUM
DEC BL
JMP AE
EXIT2: POP NUM
POP BX
POP AX
POP SI
RET
SHOW ENDP
F2T10 PROC
PUSH BX
PUSH DX
PUSH SI
LEA SI,BUF10
OR AX,AX
JNS PLUS
NEG AX
MOV [SI],BYTE PTR '-'
INC SI
PLUS: MOV BX,10
CALL RADIX
MOV [SI],BYTE PTR '$'
MOV DX,OFFSET BUF10
MOV AH,9
INT 21H
POP SI
POP DX
POP BX
RET
F2T10 ENDP
RADIX PROC
PUSH CX
PUSH DX
MOV CX,0
LOP1: MOV DX,0
DIV BX
PUSH DX
INC CX
OR AX,AX
JNE LOP1
LOP2: POP AX
CMP AL,10
JB L1
ADD AL,7
L1: ADD AL,30H
MOV [SI],AL
INC SI
DEC CX
JNE LOP2
POP DX
POP CX
RET
RADIX ENDP
CA10 PROC
PUSH DX
LEA SI,BUF18
LEA DX,BUF18
MOV AH,10
INT 21H
INC SI
INC SI
MOV CH,0
MOV CL,[SI-1]
CALL F10T2
CALL CRLF
POP DX
RET
CA10 ENDP
MODIFY PROC
PUSH SI
PUSH AX
PUSH DI
PUSH BX
PUSH DX
PUSH CX
CALL SEAR1
CMP AX,0
JZ NEXTK
MOV DI,SI
AG: WRITE BUF14
CALL CA10
CMP SI,-1
JZ ERROR2
CMP AX,1
JL ERROR2
CMP AX,5
JG ERROR2
JMP NEXT8
ERROR2: WRITE BUF1
JMP AG
NEXT8: MOV SI,DI
DEC AX
MOV DL,2
MUL DL
ADD SI,AX
MOV AX,[SI]
PUSH SI
JMP AI
NEXTK: WRITE BUF26
JMP NEXTL1
AI: MOV DX,AX
WRITE BUF15
CALL F2T10
WRITE BUF16
CALL CA10
CMP SI,-1
JZ ERROR3
CMP AX,100
JG ERROR3
JMP NEXT9
ERROR3: MOV AX,DX
WRITE BUF1
JMP AI
NEXT9: POP SI
MOV [SI],AX
WRITE BUF17
NEXTL1: POP CX
POP DX
POP BX
POP DI
POP AX
POP SI
RET
MODIFY ENDP
SHOWONE PROC
PUSH CX
PUSH AX
PUSH SI
MOV CX,5
AM: CMP CX,0
JZ EXIT11
MOV AX,[SI]
CALL F2T10
WRITE BUF12
DEC CX
INC SI
INC SI
JMP AM
EXIT11: CALL CRLF
POP SI
POP AX
POP CX
RET
SHOWONE ENDP
SEAR1 PROC
PUSH BX
PUSH DX
JN: WRITE BUF13
CALL CA10
CMP SI,-1
JZ ERROR12
PUSH AX
SUB AX,300
CMP AX,0
JL EXITB
MOV BH,0
CMP AX,BX
JG EXITB
JMP NEXT10
ERROR12: WRITE BUF1
JMP JN
NEXT10: LEA SI,BUF
DEC AX
MOV DL,10
MUL DL
ADD SI,AX
POP AX
JMP EXITA
EXITB: POP AX
XOR AX,AX
WRITE BUF20
EXITA: POP DX
POP BX
RET
SEAR1 ENDP
SEARCH PROC
PUSH AX
PUSH SI
CALL SEAR1
CMP AX,0
JZ EXITC1
JMP NEXT11
NEXT11: WRITE BUF11
CALL F2T10
WRITE BUF12
CALL SHOWONE
JMP EXITC
EXITC1: WRITE BUF27
EXITC: POP SI
POP AX
RET
SEARCH ENDP
STAT1 PROC
PUSH AX
PUSH DX
PUSH SI
PUSH CX
CALL SEAR1
CMP AX,0
JZ EXITD1
PUSH AX
MOV CX,4
MOV DX,[SI]
AW: CMP CX,0
JZ NEXT12
INC SI
INC SI
ADD DX,[SI]
DEC CX
JMP AW
NEXT12: MOV AX,DX
MOV DX,0
MOV CX,5
DIV CX
MOV DX,AX
WRITE BUF21
POP AX
CALL F2T10
WRITE BUF12
MOV AX,DX
CALL F2T10
CALL CRLF
JMP EXITD
EXITD1: WRITE BUF28
EXITD: POP CX
POP SI
POP DX
POP AX
RET
STAT1 ENDP
STAT2 PROC
PUSH BX
PUSH CX
PUSH DX
PUSH SI
PUSH AX
AR: WRITE BUF14
MOV AH,1
INT 21H
CMP AL,31H
JB ERROR13
CMP AL,35H
JA ERROR13
JMP NEXTE
ERROR13: WRITE BUF1
JMP AR
NEXTE: CALL CRLF
SUB AL,30H
MOV AH,0
PUSH AX
LEA SI,BUF
DEC AX
MOV DL,2
MUL DL
PUSH BX
MOV BX,AX
MOV DX,[SI+BX]
ADD SI,BX
POP BX
MOV CL,BL
MOV CH,0
DEC BL
AA1: CMP BL,0
JZ NEXTF
REPT 10
INC SI
ENDM
ADD DX,[SI]
DEC BL
JMP AA1
NEXTF: MOV AX,DX
MOV DX,0
DIV CX
WRITE BUF22
MOV DX,AX
POP AX
CALL F2T10
WRITE BUF23
MOV AX,DX
CALL F2T10
CALL CRLF
POP AX
POP SI
POP DX
POP CX
POP BX
RET
STAT2 ENDP
STAT3 PROC
PUSH AX
PUSH BX
PUSH SI
PUSH DI
ARR: WRITE BUF14
MOV AH,1
INT 21H
CMP AL,31H
JB ERROR14
CMP AL,35H
JA ERROR14
JMP NEXTL
ERROR14: CALL CRLF
WRITE BUF1
JMP ARR
NEXTL: CALL CRLF
SUB AL,30H
MOV AH,0
LEA SI,BUF
DEC AX
MOV DL,2
MUL DL
ADD SI,AX
LEA DI,BUF25
A0: CMP BL,0
JZ NEXTP
CMP WORD PTR [SI],90
JB A1
ADD WORD PTR [DI],1
JMP NEXTO
A1: CMP WORD PTR [SI],80
JB A2
ADD WORD PTR [DI+2],1
JMP NEXTO
A2: CMP WORD PTR [SI],70
JB A3
ADD WORD PTR [DI+4],1
JMP NEXTO
A3: CMP WORD PTR [SI],60
JB A4
ADD WORD PTR [DI+6],1
JMP NEXTO
A4: ADD WORD PTR [DI+8],1
NEXTO: REPT 10
INC SI
ENDM
DEC BL
JMP A0
NEXTP: LEA SI,BUF25
WRITE BUF24
CALL SHOWONE
CALL CRLF
PUSH SI
LEA SI,BUF25
REPT 5
MOV WORD PTR [SI],0
INC SI
INC SI
ENDM
POP SI
POP DI
POP SI
POP BX
POP AX
RET
STAT3 ENDP
CODE ENDS
END BEGIN
生成的可执行文件,上传在下面。。。
|
文件: |
main.rar |
大小: |
1KB |
下载: |
下载 | |