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

📄 input.asm

📁 学生成绩管理系统
💻 ASM
字号:
;input.asm文件的功能是输入数据获数据修改
extrn	res:byte,line:byte,tot:byte,pri:byte,cur:byte,flag:byte
public	input						;输入(修改)数据模块input
result	struc
nam	db 11,?,11 dup('$')
num	db 7,?,7 dup('$')
asm	db 4,?,4 dup('$')
ct	db 4,?,4 dup('$')
os	db 4,?,4 dup('$')
total	db 4 dup('$')
result	ends
stacksg	segment stack 's'
	dw 32 dup('s')
stacksg	ends
data	segment public
quit	db 0
i1	db 'Enter Student No.:'				;输入学号提示
l1	equ $-i1
i2	db 'Enter Student Name:'			;输入名字提示
l2	equ $-i2
i3	db 'Enter Assembly Result:'			;输入汇编语言成绩提示
l3	equ $-i3
i4	db 'Enter Composing Theory Result:'		;输入组成原理成绩提示
l4	equ $-i4
i5	db 'Enter Operating System Result:'		;输入操作系统成绩提示
l5	equ $-i5
data	ends
code	segment
input	proc far
	assume	cs:code,ds:data,es:data,ss:stacksg
	mov ax,data
	mov ds,ax
	mov es,ax

	mov quit,0					;根据输入位置判断是否允许输入
	lea si,pri					;输入规则:	按照表格从左到右的顺序输入
	mov al,cur					;		只有输入完一条完整的数据(包括五项)才能入数下一条数据
	xor ah,ah					;		已输入的数据可随意修改
	add si,ax
	dec si
	cmp line,25
	jz jnam
	cmp line,36
	jz jnum
	cmp line,43
	jz jasm
	cmp line,47
	jz jct
	cmp line,51
	jz jos

jnam:	cmp byte ptr [si],0				;优先级数组pri判断是否允许输入
	ja ipt						;No.,Name,ASM,CT,OS的优先级从0——4
	cmp byte ptr [si],0				;只有达到或高于相应的优先级,才能在表格中输入或修改
	jb sta
	add byte ptr [si],1
	jmp ipt

jnum:	cmp byte ptr [si],1
	ja ipt
	cmp byte ptr [si],1
	jb sta
	add byte ptr [si],1
	jmp ipt

jasm:	cmp byte ptr [si],2
	ja ipt
	cmp byte ptr [si],2
	jb sta
	add byte ptr [si],1
	jmp ipt

jct:	cmp byte ptr [si],3
	ja ipt
	cmp byte ptr [si],3
	jb sta
	add byte ptr [si],1
	jmp ipt

jos:	cmp byte ptr [si],4
	ja ipt
	cmp byte ptr [si],4
	jb sta
	add byte ptr [si],1
	add tot,1
	jmp ipt

ipt:	mov ah,6					;显示输入窗口
	mov al,0
	mov bh,70h
	mov ch,10
	mov cl,10
	mov dh,12
	mov dl,48
	int 10h

	mov ah,2
	mov bh,0
	mov dh,0
	mov dl,0
	int 10h

	mov ah,2
	mov cx,10
d0:	mov dl,0dh
	int 21h
	mov dl,0ah
	int 21h
	loop d0
	mov cx,11
d1:	mov dl,32
	int 21h
	loop d1
	mov dl,0c9h
	int 21h
	mov cx,35
d2:	mov dl,0cdh
	int 21h
	loop d2
	mov dl,0bbh
	int 21h
	mov dl,0dh
	int 21h
	mov dl,0ah
	int 21h
	mov cx,11
d3:	mov dl,32
	int 21h
	loop d3
	mov dl,0bah
	int 21h
	mov cx,35
d4:	mov dl,32
	int 21h
	loop d4
	mov dl,0bah
	int 21h
	mov dl,0dh
	int 21h
	mov dl,0ah
	int 21h
	mov cx,11
d5:	mov dl,32
	int 21h
	loop d5
	mov dl,0c8h
	int 21h
	mov cx,35
d6:	mov dl,0cdh
	int 21h
	loop d6
	mov dl,0bch
	int 21h
	
	mov ah,13h
	mov al,1
	mov bh,0
	mov bl,70h
	mov dh,11
	mov dl,13

	cmp line,25
	jz inam
	cmp line,36
	jz inum
	cmp line,43
	jz iasm
	cmp line,47
	jz ict
	cmp line,51
	jz ios

inam:	lea si,[bp].nam					;显示输入提示信息
	mov cl,[si]
	xor ch,ch
	sub cx,1
	add si,2
as1:	mov byte ptr [si],' '
	inc si
	loop as1

	push bp
	mov cx,l1
	lea bp,i1
	int 10h
	pop bp

	mov ah,0ah					;数据输入
	lea dx,[bp].nam
	int 21h
	jmp exit

inum:	lea si,[bp].num
	mov cl,[si]
	xor ch,ch
	sub cx,1
	add si,2
as2:	mov byte ptr [si],' '
	inc si
	loop as2

	push bp
	mov cx,l2
	lea bp,i2
	int 10h
	pop bp

	mov ah,0ah
	lea dx,[bp].num
	int 21h
	jmp exit

iasm:	lea si,[bp].asm
	mov cl,[si]
	xor ch,ch
	sub cx,1
	add si,2
as3:	mov byte ptr [si],' '
	inc si
	loop as3

	push bp
	mov cx,l3
	lea bp,i3
	int 10h
	pop bp

	mov ah,0ah
	lea dx,[bp].asm
	int 21h
	jmp exit

ict:	lea si,[bp].ct
	mov cl,[si]
	xor ch,ch
	sub cx,1
	add si,2
as4:	mov byte ptr [si],' '
	inc si
	loop as4

	push bp
	mov cx,l4
	lea bp,i4
	int 10h
	pop bp

	mov ah,0ah
	lea dx,[bp].ct
	int 21h
	jmp exit

ios:	lea si,[bp].os
	mov cl,[si]
	xor ch,ch
	sub cx,1
	add si,2
as5:	mov byte ptr [si],' '
	inc si
	loop as5

	push bp
	mov cx,l5
	lea bp,i5
	int 10h
	pop bp

	mov ah,0ah
	lea dx,[bp].os
	int 21h
	jmp exit

sta:	mov ah,14						;禁止输入警告音
	mov al,7
	mov bh,0
	int 10h
	mov flag,0

exit:	ret
input	endp

code	ends
	end

⌨️ 快捷键说明

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