?? 52-7.asm
字號(hào):
.model small
.data
handle1 dw ?
handle2 dw ?
pathname db 'c:\xueji.txt',00
pathtotal db 'c:\total.txt',00
n db 0
total db 0
flag1 db 0
flag2 db 0
score db 0
addr dw 0
yu db 0
position db 0
up db 24d
len_up equ $-up
down db 25d
len_down equ $-down
star db '**************************'
len_star equ $-star
disp1 db 'STUDENT MANAGEMENT SYSTEM'
len_str1 equ $-disp1
disp2 db '|increase|'
len_str2 equ $-disp2
disp3 db '| edit |'
len_str3 equ $-disp3
disp4 db '| search |'
len_str4 equ $-disp4
disp5 db '| count |'
len_str5 equ $-disp5
disp7 db 'please use or to select'
len_str7 equ $-disp7
disp8 db 'PLEASE ENTER THE INFORMATION'
len_str8 equ $-disp8
disp9 db 'NUMBER:'
len_str9 equ $-disp9
disp10 db 'NAME:'
len_str10 equ $-disp10
disp11 db 'CHINESE:'
len_str11 equ $-disp11
disp12 db 'MATHS:'
len_str12 equ $-disp12
disp13 db 'ENGLISH:'
len_str13 equ $-disp13
disp14 db 'SEARCH BY NUMBER(X) OR NAME(M)'
len_str14 equ $-disp14
disp15 db 'CAN NOT FIND THE STUDENT!'
len_str15 equ $-disp15
disp16 db 'THE STUDENT ORIGINAL INFORMATION---'
len_str16 equ $-disp16
disp17 db 'AVERAGE:'
len_str17 equ $-disp17
disp18 db 'RANK:'
len_str18 equ $-disp18
disp19 db 'PLEASE ENTER THE NEW INFORMATION---'
len_str19 equ $-disp19
disp20 db 'GIVE YOUR CHOICE:'
len_str20 equ $-disp20
disp21 db 'WHICH COURSE TO COUNT?'
len_str21 equ $-disp21
disp22 db 'CHINESE AVERAGE SCORE:'
len_str22 equ $-disp22
disp23 db 'MATHS AVERAGE SCORE:'
len_str23 equ $-disp23
disp24 db 'ENGLISH AVERAGE SCORE:'
len_str24 equ $-disp24
disp25 db '100 90-99 80-89 70-79 60-69 BELOW60'
len_str25 equ $-disp25
disp26 db 'enter the number:'
len_str26 equ $-disp26
disp27 db 'enter the name:'
len_str27 equ $-disp27
disp28 db 'FIND THE STUDENT!'
len_str28 equ $-disp28
stud struc
id DB 4 dup(' '),'$'
xm DB 10 dup(' '),'$'
chinese Db 100d
maths Db 100d
english Db 100d
aver db 100d
stud ends
stud_reg stud 20 dup(<>)
inbuff0 db 4,?,4 dup(' ')
inbuff1 db 10,?,10 dup(' ')
input1 db 4,?,4 dup(' ')
input2 db 10,?,10 dup(' ')
ty db 0
len db 0
shi db 10d
san db 3d
base dw 0
.code
clear macro
mov ah,6
mov al,0
mov bh,7
mov ch,0
mov cl,0
mov dh,24
mov dl,39
int 10h
endm
locate macro p1,p2,p3
push bx
push dx
mov bh,p3
mov dh,p1
mov dl,p2
mov ah,2
int 10h
pop dx
pop bx
endm
none macro p1
mov ch,p1
mov cl,0
mov ah,1
int 10h
endm
show macro vpage
mov al,vpage
mov ah,5
int 10h
endm
disp macro p1,p2,x,y,p3,c1
none 10h
push bx
push dx
mov bp,seg p1
mov es,bp
mov bp,offset p1
mov cx,p2
mov dh,x
mov dl,y
mov bh,p3
mov bl,c1
mov al,1
mov ah,13h
int 10h
pop dx
pop bx
endm
deliver macro s,d,long
lea si,s
lea di,d
cld
mov cl,long
xor ch,ch
rep movsb
endm
openh macro path
mov ah,3dh
mov al,02
lea dx,path
int 21h
endm
creath macro path,hand
mov cx,0
lea dx,path
mov hand,ax
mov ah,3ch
int 21h
endm
closeh macro hand
xor bx,bx
mov bx,hand
mov ah,3eh
int 21h
endm
main proc far
start:
mov ax,@data
mov ds,ax
mov es,ax
mov ty,type stud_reg
mov len,length stud_reg
mov bx,offset stud_reg
mov base,bx
xor bx,bx
openh pathtotal
jnc read2
creath pathtotal,handle2
oo:
openh pathname
jnc read1
creath pathname,handle1
jmp kaishi
read2: mov handle2,ax
call readh2
closeh handle2
jmp oo
read1: mov handle1,ax
call readh1
closeh handle1
jmp kaishi
kaishi: clear
call type1
call menu
xor ax,ax
openh pathname
mov handle1,ax
call writh1
closeh handle1
xor ax,ax
openh pathtotal
mov handle2,ax
call writh2
closeh handle2
call exit
main endp
writh1 proc near
xor cx,cx
xor bx,bx
xor dx,dx
mov bx,handle1
lea dx,stud_reg
mov al,total
mul ty
mov cx,ax
xor ax,ax
mov ah,40h
int 21h
ret
writh1 endp
readh1 proc near
xor ax,ax
xor cx,cx
mov bx,handle1
lea dx,stud_reg
mov al,total
mul ty
mov cx,ax
xor ax,ax
mov ah,3fh
int 21h
ret
readh1 endp
writh2 proc near
xor cx,cx
xor bx,bx
xor dx,dx
mov bx,handle2
lea dx,total
mov cx,1
xor ax,ax
mov ah,40h
int 21h
ret
writh2 endp
readh2 proc near
xor cx,cx
mov bx,handle2
lea dx,total
mov cx,1
xor ax,ax
mov ah,3fh
int 21h
ret
readh2 endp
type1 proc near
mov al,1
mov ah,0
int 10h
ret
type1 endp
getchar proc near
mov ah,1
int 21h
ret
getchar endp
getchar1 proc near
mov ah,7
int 21h
ret
getchar1 endp
getchar2 proc near
mov ah,0
int 16h
ret
getchar2 endp
exit proc near
mov ax,4c00h
int 21h
ret
exit endp
bindec proc near
mov dx,0
a10: cmp ax,bx
jl a20
inc dl
sub ax,bx
jmp a10
a20: push ax
or dl,30h
mov ah,2
int 21h
pop ax
ret
bindec endp
page1 proc near
clear
disp star,len_star,6,6,0,8ah
disp disp1,len_str1,7,6,0,05h
disp disp2,len_str2,8,14,0,2eh
disp disp3,len_str3,9,14,0,0fh
disp disp4,len_str4,10,14,0,0fh
disp disp5,len_str5,11,14,0,0fh
disp disp7,len_str7,14,5,0,0fh
disp up,len_up,14,16,0,0eh
disp down,len_down,14,21,0,0eh
disp star,len_star,13,6,0,8ah
ret
page1 endp
page2 proc near
clear
disp star,len_star,6,6,1,8ah
disp disp1,len_str1,7,6,1,05h
disp disp2,len_str2,8,14,1,0fh
disp disp3,len_str3,9,14,1,2eh
disp disp4,len_str4,10,14,1,0fh
disp disp5,len_str5,11,14,1,0fh
disp disp7,len_str7,14,5,1,0fh
disp up,len_up,14,16,1,0eh
disp down,len_down,14,21,1,0eh
disp star,len_star,13,6,1,8ah
ret
page2 endp
page3 proc near
clear
disp star,len_star,6,6,2,8ah
disp disp1,len_str1,7,6,2,05h
disp disp2,len_str2,8,14,2,0fh
disp disp3,len_str3,9,14,2,0fh
disp disp4,len_str4,10,14,2,2eh
disp disp5,len_str5,11,14,2,0fh
disp disp7,len_str7,14,5,2,0fh
disp up,len_up,14,16,2,0eh
disp down,len_down,14,21,2,0eh
disp star,len_star,13,6,2,8ah
ret
page3 endp
page4 proc near
clear
disp star,len_star,6,6,3,8ah
disp disp1,len_str1,7,6,3,05h
disp disp2,len_str2,8,14,3,0fh
disp disp3,len_str3,9,14,3,0fh
disp disp4,len_str4,10,14,3,0fh
disp disp5,len_str5,11,14,3,2eh
disp disp7,len_str7,14,5,3,0fh
disp up,len_up,14,16,3,0eh
disp down,len_down,14,21,3,0eh
disp star,len_star,13,6,3,8ah
ret
page4 endp
page6 proc near
clear
disp disp8,len_str8,2,2,4,02h
disp disp9,len_str9,4,2,4,0fh
disp disp10,len_str10,6,2,4,0fh
disp disp11,len_str11,8,2,4,0fh
disp disp12,len_str12,10,2,4,0fh
disp disp13,len_str13,12,2,4,0fh
locate 4,10,4
ret
page6 endp
page7 proc near
mov flag2,0
disp disp14,len_str14,2,2,5,02h
disp disp20,len_str20,4,2,5,02h
none 0
locate 4,21,5
call getchar
cmp al,120d
jz next12
cmp al,109d
jz next13
next12: disp disp26,len_str26,5,2,5,02h
none 0
locate 5,19,5
mov bl,total
mov n,bl
xor bx,bx
mov bx,offset stud_reg
bbs1:
mov dx,offset input1
mov ah,0ah
int 21h
tiao1: lea si,[bx].id
lea di,input1+2
mov cl,input1+1
xor ch,ch
cld
repe cmpsb
jz out1
add bl,ty
dec n
jz guodu12
jmp tiao1
guodu12:jmp e1
out1: mov addr,bx
mov flag2,1
jmp e1
next13: disp disp27,len_str27,5,2,5,02h
none 0
locate 5,17,5
mov bl,total
mov n,bl
xor bx,bx
mov bx,offset stud_reg
bbs2:
mov dx,offset input2
mov ah,0ah
int 21h
tiao2: lea si,[bx].xm
lea di,input2+2
mov cl,input2+1
xor ch,ch
cld
repe cmpsb
jz out2
add bl,ty
dec n
jz e1
jmp tiao2
out2: mov addr,bx
mov flag2,1
jmp e1
e1: ret
page7 endp
page8 proc near
mov flag2,0
disp disp14,len_str14,2,2,6,02h
disp disp20,len_str20,4,2,6,02h
none 0
locate 4,21,6
call getchar
cmp al,120d
jz next17
cmp al,109d
jz next18
next17: disp disp26,len_str26,5,2,6,02h
none 0
locate 5,19,6
mov bl,total
mov n,bl
xor bx,bx
mov bx,offset stud_reg
bbs1s:
mov dx,offset input1
mov ah,0ah
int 21h
tiao1s: lea si,[bx].id
lea di,input1+2
mov cl,input1+1
xor ch,ch
cld
repe cmpsb
jz out1s
add bl,ty
dec n
jz guodu12s
jmp tiao1s
guodu12s:jmp e1s
out1s: mov addr,bx
mov flag2,1
jmp e1s
next18: disp disp27,len_str27,5,2,6,02h
none 0
locate 5,17,6
mov bl,total
mov n,bl
xor bx,bx
mov bx,offset stud_reg
bbs2s:
mov dx,offset input2
mov ah,0ah
int 21h
tiao2s: lea si,[bx].xm
lea di,input2+2
mov cl,input2+1
xor ch,ch
cld
repe cmpsb
jz out2s
add bl,ty
dec n
jz e1s
jmp tiao2s
out2s: mov addr,bx
mov flag2,1
jmp e1s
e1s: ret
page8 endp
page9 proc near
clear
disp disp21,len_str21,2,2,7,02h
disp disp20,len_str20,4,2,7,02h
none 0
locate 4,21,7
call getchar
cmp al,99d
jz next9
cmp al,109d
jz jianjie
cmp al,101d
jz d0
jianjie:jmp next10
d0: jmp next11
next9: none 10h
disp disp22,len_str22,6,2,7,02h
xor bx,bx
xor ax,ax
xor dx,dx
xor cx,cx
mov cl,total
mov bx,base
jia1:
add dl,[bx].chinese
add bl,type stud_reg
loop jia1
mov al,dl
div total
xor ah,ah
div shi
cmp al,0
jz shuchu1sss
cmp al,10d
jz shuchu2sss
add al,30h
mov yu,ah
mov dl,al
mov ah,2
int 21h
xor ax,ax
mov al,yu
add al,30h
mov dl,al
mov ah,2
int 21h
jmp qq4ss
shuchu1sss:add ah,30h
mov dl,ah
mov ah,2
int 21h
jmp qq4ss
shuchu2sss:mov dl,49d
mov ah,2
int 21h
mov dl,48d
mov ah,2
int 21h
mov dl,48d
mov ah,2
int 21h
qq4ss:disp disp25,len_str25,8,2,7,0eh
jmp gate
next10: none 10h
disp disp23,len_str23,6,2,7,02h
xor bx,bx
xor ax,ax
xor dx,dx
xor cx,cx
mov cl,total
mov bx,base
jia2:
add dl,[bx].maths
add bl,type stud_reg
loop jia2
mov al,dl
div total
xor ah,ah
div shi
cmp al,0
jz shuchu1ssss
cmp al,10d
jz shuchu2ssss
add al,30h
mov yu,ah
mov dl,al
mov ah,2
int 21h
xor ax,ax
mov al,yu
add al,30h
mov dl,al
mov ah,2
int 21h
jmp qq4sss
shuchu1ssss:add ah,30h
mov dl,ah
mov ah,2
int 21h
jmp qq4sss
shuchu2ssss:mov dl,49d
mov ah,2
int 21h
mov dl,48d
mov ah,2
int 21h
mov dl,48d
mov ah,2
int 21h
qq4sss: disp disp25,len_str25,8,2,7,0eh
jmp gate
next11: none 10h
disp disp24,len_str24,6,2,7,02h
xor bx,bx
xor ax,ax
xor dx,dx
xor cx,cx
mov cl,total
mov bx,base
jia3:
add dl,[bx].english
add bl,type stud_reg
loop jia3
mov al,dl
div total
xor ah,ah
div shi
cmp al,0
jz shuchu1sssss
cmp al,10d
jz shuchu2sssss
add al,30h
mov yu,ah
mov dl,al
mov ah,2
int 21h
xor ax,ax
mov al,yu
add al,30h
mov dl,al
mov ah,2
int 21h
jmp qq4ssss
shuchu1sssss:add ah,30h
mov dl,ah
mov ah,2
int 21h
jmp qq4ssss
shuchu2sssss:mov dl,49d
mov ah,2
int 21h
mov dl,48d
mov ah,2
int 21h
mov dl,48d
mov ah,2
int 21h
qq4ssss: disp disp25,len_str25,8,2,7,0eh
jmp gate
gate: ret
page9 endp
menu proc near
l0: call page1
show 0
call getchar2
cmp ah,50h
jz l1
cmp ah,48h
jz l3
cmp ah,1ch
jz increase
cmp ah,01h
jz gu1
gu1:jmp stop
l1: call page2
show 1
call getchar2
cmp ah,50h
jz l2
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -