?? input.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 + -