⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 function.asm

📁 学分管理系统的分析
💻 ASM
📖 第 1 页 / 共 3 页
字号:
	update	 292,540,382,558,flag3,<getnums  297,540,[SI].student.study_num,9>,next3
next3:
	update	 432,540,525,558,flag4,< gets	440,540,[SI].student.student_name,10>,next4
next4:
	update	 570,540,590,558,flag5,< getchar	574,540,[SI].student.sex>,next5
next5:
	update	 633,540,660,558,flag6,< getgrade	635,540,[SI].student.chinese,4> ,next6
next6:
	update	 710,540,740,558,flag7,<getgrade	715,540,[SI].student.maths,4>,next7
next7:
	button	 750,535,798,560,flag8,<mov  STOP ,1>,next8
next8:  
	button	 670,500,770,520,	flag9,<finish_input>, next9
next9:	
	mov   ah,1
	int   16h
	jz    next11
	mov   ah,0
	int   16h
	cmp   al, ENTERKEY
	jne   next10
	mov  STOP ,1
	
next10:	cmp   al, ESCKEY
	jne   next11
G_exit:	background  670,500,770,520,<RGB 0,0,0>
	mov   STOP ,1
	mov  finishflag,1
next11: 	
	.UNTIL	STOP == 1
	
	mov  si, store_si
	mov  ax, 0
	mov  al, [SI].student.chinese
	add  al, [SI].student.maths

	mov  [SI].student.total, al
	mov  cx, 10
	mul  cx
	shr  ax, 1
	div  cl
	mov  word  ptr [SI].student.average,ax


	background  170,540,237,558 ,<RGB 0,0,0>
	background  292,540,382,558 ,<RGB 0,0,0>
	background  432,540,525,558 ,<RGB 0,0,0>
	background  570,540,590,558 ,<RGB 0,0,0>
	background  633,540,660,558 ,<RGB 0,0,0>
	background  710,540,740,558 ,<RGB 0,0,0>
	mov   STOP ,0
	pop  es
	pop  ds
	popa
	ret
get_one_record  endp	
;=========================================================================
;修改一个记录
modify_one_record  proc  far
	pusha
	push  ds
	push  es
	mov  ax, data
	mov  ds, ax
	lea  si, one
	background  100,575,700,595,<RGB 0,0,0>
	getnums  172,540,[SI].student.department_num,4
	jc  continue1
	mov no_last, 1
	jmp G_exit
continue1:
	getnums  297,540,[SI].student.study_num,9
	jc  continue2
	mov no_last, 1
	jmp G_exit
continue2:
	gets  440,540,[SI].student.student_name, 10
	jc continue3
	mov no_last, 1
	jmp G_exit
continue3:
	getchar	574,540,[SI].student.sex
	jc continue4
	mov no_last, 1
	jmp G_exit
continue4:
	getgrade	635,540,[SI].student.chinese,4
	getgrade	715,540,[SI].student.maths,4
	.REPEAT
	button	 150,535,165,560,flag1,<mov  STOP ,1>,next1
next1: 
	update	 170,540,237,558,flag2,<getnums  172,540,[SI].student.department_num,4>,next2
next2:  
	update	 292,540,382,558,flag3,<getnums  297,540,[SI].student.study_num,9>,next3
next3:
	update	 432,540,525,558,flag4,< gets	440,540,[SI].student.student_name,10>,next4
next4:
	update	 570,540,590,558,flag5,< getchar	574,540,[SI].student.sex>,next5
next5:
	update	 633,540,660,558,flag6,< getgrade	635,540,[SI].student.chinese,4> ,next6
next6:
	update	 710,540,740,558,flag7,<getgrade	715,540,[SI].student.maths,4>,next7
next7:
	button	 750,535,798,560,flag8,<finish_input>,next8
next8:	
	mov   ah,1
	int   16h
	jz    next11
	mov   ah,0
	int   16h
	cmp   al, ENTERKEY
	jne   next10
	mov  STOP ,1
	
next10:	cmp   al, ESCKEY
	jne   next11
G_exit:	background  670,500,770,520,<RGB 0,0,0>
	mov   STOP ,1
	mov  finishflag,1
next11: 	
	.UNTIL	STOP == 1
	
	cmp  finishflag, 1
	je   exit
	lea  si, one
	mov  ax, 0
	mov  al, [SI].student.chinese
	add  al, [SI].student.maths

	mov  [SI].student.total, al
	mov  cx, 10
	mul  cx
	shr  ax, 1
	div  cl
	mov  word  ptr [SI].student.average,ax
	mov  byte  ptr [si].student.rank, 0
	lea  di, records
	add  di, page_position
	mov  ax, num_scroll
	mov  bl, 30
	mul  bl
	add  di, ax
	call swap_record
	deleteline  num_scroll
	call restore_line
	
	mov  ax, num_scroll
	mov  bl, 20
	mul  bl
	add  ax, 102
	mov  bx, ax
	mov  busy ,1
	call restore_m
	call write_one_record
	highlightground num_scroll,<RGB 0,200,100>
	call store_m
	mov  busy, 0
exit:
	background  170,540,237,558 ,<RGB 0,0,0>
	background  292,540,382,558 ,<RGB 0,0,0>
	background  432,540,525,558 ,<RGB 0,0,0>
	background  570,540,590,558 ,<RGB 0,0,0>
	background  633,540,660,558 ,<RGB 0,0,0>
	background  710,540,740,558 ,<RGB 0,0,0>
	mov   STOP ,0
	mov   finishflag, 0
	pop  es
	pop  ds
	popa
	ret
modify_one_record  endp	
;=========================================================================

;输入原始学生记录
input_records  proc  far
	pusha
	push  ds
	mov   ax, data
	mov   ds, ax
	
	setxy 120,100,780,500
	call  clearscreen_in
	box_jiao   200,150,600,450,<RGB 128,128,128>
	box_jiao   203,153,597,447,<RGB 232,23, 23>
	out_hz	   220,180,resume_records,<RGB 0,255,0>
	box_jiao   210,400,395,425,<RGB 125,0,32>
	out_hz	   290,405,yes,<RGB 0,0,255>
	box_jiao   410,400,595,425,<RGB 125,0,32>
	out_hz	   490,405,cancle,<RGB 0,0,255>
        
	.WHILE	1
	submenu    210,400,395,425,flag2,yes,yeshelp,queding ,next1,BACKFLAG1
next1:
	submenu    410,400,595,425,flag3,cancle,canclehelp,quxiao ,next2,BACKFLAG1
next2:
	.ENDW

	mov   busy,  1
	call  restore_m
	setxy 120,70,750,500
	call  clearscreen_in
	call  store_m
	mov   busy,0
	
	cmp   value ,1
	jne   next4
	
	call   draw_table
	background   670,500,770,520,<RGB 0,119,213>
	out_hz	700,502,finish_input_string,<RGB 255,0,0>
	lea   SI,records
	mov   cx,20
	mov   bx,82
	mov   ax,0
	.REPEAT  
	call   get_one_record
	mov   [si].student.rank ,byte ptr 0

	or     cx, cx
	jnz    next0
	push   ax
	setxy  120,100,730,500
	call   clearscreen_rl
	call   draw_ge
	pop    ax
	mov    bx, 82
	mov    cx, 20
		
next0:
	cmp   no_last , 1
	je   mmm
	add   bx,20
	MOV   DI,SI
	call  write_one_record
	dec   cx
	inc   ax
	add   SI,30
	jmp   next000
mmm:	mov   no_last, 0
next000:
	.UNTIL  finishflag == 1
	mov   num_records,   ax
	mov   dx, 30                 ;计算记录文件长度
	mul   dx
	mov   length_records,ax	
        mov   wei_records, offset records
        add   wei_records,  ax
	call  get_rank
	box_jiao   200,150,600,450,<RGB 128,128,128>
	box_jiao   203,153,597,447,<RGB 232,23, 23>
	out_hz	   220,180,browse_string,<RGB 0,255,0>
	;box_jiao   220,220,580,250,<RGB	232,23,23>
	box_jiao   210,400,395,425,<RGB 125,0,32>
	out_hz	   290,405,yes,<RGB 0,0,255>
	box_jiao   410,400,595,425,<RGB 125,0,32>
	out_hz	   490,405,cancle,<RGB 0,0,255>
        
	.WHILE	1
	submenu    210,400,395,425,flag2,yes,yeshelp,queding ,q_next1,BACKFLAG1

q_next1:
	submenu    410,400,595,425,flag3,cancle,canclehelp,quxiao ,q_next2,BACKFLAG1
q_next2:
	.ENDW

	setxy 120,70,750,500
	call  clearscreen_in
	
	cmp   value ,1
	jne   next4
	mov   busy,  1
	box_jiao  500,40,700,70,<RGB 125,0,32>
	out_hz    580,45,r_back,  <RGB 32,50,180>
	call      show_onepage
	showpagebutton 740,430,758,460,uparrow
	showpagebutton 740,462,758,492,downarrow
	mov   busy,0
	
	.WHILE	 1
	submenu  500,40,700,70,flag1,r_back,helpr_back,queding,next1_b,BACKFLAG1
next1_b:	
	submenu_p  740,430,758,460,flag2,uparrow,uparrowhelp,pageup,next2_b
next2_b:
	submenu_p  740,462,758,492,flag3,downarrow,downarrowhelp,pagedown,next3_b
next3_b:		
	.ENDW   
	
next4:
	mov    finishflag ,0
	mov    STOP ,0
	mov    BACKFLAG1, 1
	mov    BACKFLAG2, 1
	mov    BACKFLAG3, 1

	setxy  120,40,780,520
	mov    busy,1
	call   clearscreen_rdw
	call   store_m
	mov    busy,0

	mov    finishflag ,0
	mov    STOP ,0
	pop  ds
	popa
	ret

input_records  endp
;==============================================================
;添加学生记录
add_records   proc  far
	pusha
	push  ds
	mov   ax, data
	mov   ds, ax
	mov   busy, 1
	call  restore_m
	setxy 120,100,780,500
	call  clearscreen_in
	call  store_m
	mov   busy, 0
	call   draw_table
	background   670,500,770,520,<RGB 0,119,213>
	out_hz	700, 502,finish_input_string,<RGB 255,0,0>
	
	mov   SI, wei_records
	mov   cx,20
	mov   bx,82
	.REPEAT  
	call   get_one_record
	mov   [si].student.rank ,byte ptr 0
	
	or    cx, cx
	jnz    next0
	push   ax
	mov    busy, 1
	call   restore_m
	setxy  120,100,730,500
	call   clearscreen_rl
	call   store_m
	mov    busy, 0
	call   draw_ge
	pop    ax
	mov    bx, 82
	mov    cx, 20
next0:   	
	cmp   no_last, 1
	je    lost_last
	add   bx,20
	MOV   DI,SI
	call  write_one_record
	dec   cx
	inc   num_records
	add  length_records, 30
	add   SI,30
	jmp   gotonext
lost_last:
	mov  no_last, 0
gotonext:		
	.UNTIL  finishflag == 1
	
	
	mov   ax, length_records
	lea   DI, records

	add   DI, ax
	mov   wei_records,  DI
	call   get_rank

	box_jiao   200,150,600,450,<RGB 128,128,128>
	box_jiao   203,153,597,447,<RGB 232,23, 23>
	out_hz	   220,180,browse_string,<RGB 0,255,0>
	box_jiao   210,400,395,425,<RGB 125,0,32>
	out_hz	   290,405,yes,<RGB 0,0,255>
	box_jiao   410,400,595,425,<RGB 125,0,32>
	out_hz	   490,405,cancle,<RGB 0,0,255>
        
	.WHILE	1
	submenu    210,400,395,425,flag2,yes,yeshelp,queding ,next1,BACKFLAG1
next1:
	submenu    410,400,595,425,flag3,cancle,canclehelp,quxiao ,next2,BACKFLAG1
next2:
	.ENDW

	mov   busy,  1
	call  restore_m
	setxy 120,70,750,500
	call  clearscreen_in
	call  store_m
	mov   busy,0
	
	cmp   value ,1
	jne   next4
	mov   busy,  1
	box_jiao  500,40,700,70,<RGB 125,0,32>
	out_hz    580,45,r_back,  <RGB 32,50,180>
	call      show_onepage
	showpagebutton 740,430,758,460,uparrow
	showpagebutton 740,462,758,492,downarrow
	mov   busy,0
	
	.WHILE	 1
	submenu  500,40,700,70,flag1,r_back,helpr_back,queding,next1_b,BACKFLAG1
next1_b:	
	submenu_p  740,430,758,460,flag2,uparrow,uparrowhelp,pageup,next2_b
next2_b:
	submenu_p  740,462,758,492,flag3,downarrow,downarrowhelp,pagedown,next3_b
next3_b:		
	.ENDW   
	
next4:
	mov    finishflag ,0
	mov    STOP ,0
	mov    BACKFLAG1, 1
	mov    BACKFLAG2, 1
	mov    BACKFLAG3, 1

	setxy  120,40,780,520
	mov    busy,1
	call   clearscreen_rdw
	call   store_m
	mov    busy,0
	
	pop  ds
	popa
	ret
add_records  endp
;=====================================================================
;计算名次
;入口参数:无
;出口参数:学生名次
get_rank   proc  far
	pusha
	push   ds
	mov    ax,  data
	mov    ds,  ax
	
	mov    cx,  num_records
	lea    di,  records	
lopa:
	mov    dl,  0                   ;名次计数器
	mov    al,  byte ptr [di].student.total
	mov    bp,  num_records
	lea    si,  records
lopb:
	mov    ah,  byte  ptr [si].student.total
	cmp    ah,  al		  ;比较整数部分
	jbe     next
	inc    dl                ;比它大计数器加一
next:	jne    last
	mov    bx, bp
	cmp    visitedflag[bx],1
	jne    last
	inc    dl
last:   
 	add    si,  30
 	dec    bp
	jnz    lopb
	inc    dl
 	mov    [di].student.rank,  dl  ;为名次赋值
 	mov    bx,  cx
 	mov    visitedflag[bx], byte ptr 1
 	add    di,  30
 	loop   lopa
	mov    bx, 0
back:
 	mov    visitedflag[bx],0
 	inc    bx
 	cmp    bx, 300
 	jne    back
 	pop    ds
 	popa
 	ret
get_rank  endp 	
	
;==============================================================

;将文件存盘并退出
save_exit   proc   far
        pusha
        push  ds
        mov   ax, data
        mov   ds, ax
        
        openfile  datafile, 1
        jc   error
        mov  num_filecode, ax
        mov  bx, ax
        mov  ah, 40h
        mov  cx, length_records
        lea  dx, records
        int  21h
        jc   error
	closefile  num_filecode
	mov   busy, 1
	call  restore_m
	setxy 300,100,500,500
	call  clearscreen_out
	call  store_m
	mov   busy, 0
	message_box 300,200,600,300,success_save,<RGB  0,255,0>,<clearscreen_in>
        cli
        res_oldintr oldintr

	setxy  0,0,799,599
	call   clearscreen_rdw
	mov ax,store_ax
        mov bx,store_bx
    	mov ah,	0
    	int 10h
	
    	mov ah,	4ch
    	int 21h
        
error:	mov  num_filecode, ax
	message_box 300,200,600,300,fail_save,<RGB 255,0,0>,<clearscreen_rdw>
exit:
	mov    BACKFLAG1, 1
	mov    BACKFLAG2, 1
	mov    BACKFLAG3, 1
 	pop  ds
	popa
	ret
save_exit  endp		        
;==================================================================        
init_records    proc  far
	pusha
	push  ds
	mov   ax, data
	mov   ds, ax
	mov   length_records,0
	openfile   datafile,0
	jc    error  
	mov   num_filecode, ax    
	mov   bx,  ax
	mov   cx,  30*100
	lea   dx,  records
again:	mov   ah,  3fh
	int   21h
	add   length_records, ax       ;AX为每次实际读入的字节数
	cmp   cx,  ax
	jne   next
	jmp   again
next:	mov   ax, length_records
	mov   dx, 0
	mov   cx, 30
	div   cx
	mov   num_records,  ax
	mul   cx
	mov   length_records, ax
   
        mov   wei_records,offset records
	add   wei_records, ax
	jmp   exit	
	
error:   message_box 300,200,500,300,readfail,<RGB 255,0,0>,<clearscreen_rdw>
exit: 
        closefile  num_filecode
	mov    BACKFLAG1, 1
	mov    BACKFLAG2, 1
	mov    BACKFLAG3, 1
	pop  ds
	popa
	ret
init_records    endp		
;=======================================================================
;入口参数:无
output_records  proc  far
	pusha
	push  ds
	mov   ax, data
	mov   ds, ax
	mov   busy, 1
	call  restore_m
	setxy 120,100,780,500
	call  clearscreen_in
	call  store_m
	mov   busy, 0
	call   draw_table
	
	lea   SI,records
	mov   cx,20
	mov   bx,82
loop_f:
	add   bx,20
	mov   DI, SI
	call  write_one_record
	add   SI,30
	loop  loop_f	

	pop	ds
	popa
	ret

output_records	endp
;=======================================================================
;=======================================================================
;向上翻一页
pageup  proc   far
	pusha
	cmp   page_position,0
	je    exit
	setxy  120,100,730,500
	call   clearscreen_ud
	call   draw_ge
	
	sub   page_position, 30*20
	mov   bx,  page_position
	lea   si,  records
	add   si,  bx

	mov   cx,20
	mov   bx,82
loop_f:
	add   bx,20
	mov   DI, SI
	call  write_one_record
	add   SI,30
	loop  loop_f	
	mov   no_scroll,     1
	mov   stop_downpage,  0
exit:   
	popa
	ret
pageup  endp
;=======================================================================
;向下翻一页
pagedown proc   far
	pusha
	cmp   stop_downpage,  1
	je    exit

	mov    no_scroll,     1
	setxy  120,100,730,500

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -