📄 student.asm
字号:
stack segment para stack 'stack'
db 80 dup (?)
stack ends
;-----------------------------------------
dseg segment para 'data'
crlf db 13,10,'$'
prompt db ' , ','$'
outputmsg db ' The last score is: ','$'
highmsg db ' The highest score is: ','$'
lowmsg db ' The lowest score is: ','$'
startmsg db ' Pleae input score: ','$'
dismsg db ' The Scores is : ','$'
score db 0,0,0,0,0,0,0,0,0,0,0,0,0,0
dsc db 0,0,0,0,0,0,0
dseg ends
;------------------------------------------
cseg segment para 'code'
begin proc far
assume cs:cseg,ds:dseg,ss:stack
push ds
sub ax,ax
push ax
mov ax,dseg
mov ds,ax
;========start
lea dx,startmsg
mov ah,09h
int 21h
lea dx,crlf
int 21h
;=====input 1
mov ah,9
lea dx,prompt1
int 21h
mov ah,01h
int 21h
mov score[1],al
int 21h
mov score[0],al
lea dx,crlf
mov ah,09h
int 21h
;=====input 2
mov ah,9
lea dx,prompt2
int 21h
mov ah,01h
int 21h
mov score[3],al
int 21h
mov score[2],al
lea dx,crlf
mov ah,09h
int 21h
;=====input 3
mov ah,9
lea dx,prompt3
int 21h
mov ah,01h
int 21h
mov score[5],al
int 21h
mov score[4],al
lea dx,crlf
mov ah,09h
int 21h
;=====input 4
mov ah,9
lea dx,prompt4
int 21h
mov ah,01h
int 21h
mov score[7],al
int 21h
mov score[6],al
lea dx,crlf
mov ah,09h
int 21h
;=====input 5
mov ah,9
lea dx,prompt5
int 21h
mov ah,01h
int 21h
mov score[9],al
int 21h
mov score[8],al
lea dx,crlf
mov ah,09h
int 21h
;=====input 6
mov ah,9
lea dx,prompt6
int 21h
mov ah,01h
int 21h
mov score[11],al
int 21h
mov score[10],al
lea dx,crlf
mov ah,09h
int 21h
;=====input 7
mov ah,9
lea dx,prompt7
int 21h
mov ah,01h
int 21h
mov score[13],al
int 21h
mov score[12],al
lea dx,crlf
mov ah,09h
int 21h
;=====display input data......
mov ah,9
lea dx,dismsg
int 21h
mov ah,02h
mov dl,score[1]
int 21h
mov dl,score[0]
int 21h
mov dl,' '
int 21h
mov dl,score[3]
int 21h
mov dl,score[2]
int 21h
mov dl,' '
int 21h
mov dl,score[5]
int 21h
mov dl,score[4]
int 21h
mov dl,' '
int 21h
mov dl,score[7]
int 21h
mov dl,score[6]
int 21h
mov dl,' '
int 21h
mov dl,score[9]
int 21h
mov dl,score[8]
int 21h
mov dl,' '
int 21h
mov dl,score[11]
int 21h
mov dl,score[10]
int 21h
mov dl,' '
int 21h
mov dl,score[13]
int 21h
mov dl,score[12]
int 21h
mov dl,' '
int 21h
lea dx,crlf
mov ah,09h
int 21h
;========max=score[12]
cmp score[1],'2'
jne nochang1
mov bl,score[1]
mov cl,score[13]
mov score[1],cl
mov score[13],bl
mov dh,score[0]
mov dl,score[12]
mov score[0],cl
mov score[12],bl
jmp find1
nochang1:
cmp score[3],'2'
jne nochang2
mov bl,score[3]
mov cl,score[13]
mov score[3],cl
mov score[13],bl
mov dh,score[2]
mov dl,score[12]
mov score[2],dl
mov score[12],dh
jmp find1
nochang2:
cmp score[5],'2'
jne nochang3
mov bl,score[5]
mov cl,score[13]
mov score[5],cl
mov score[13],bl
mov dh,score[4]
mov dl,score[12]
mov score[4],dl
mov score[12],dh
jmp find1
nochang3:
cmp score[7],'2'
jne nochang4
mov bl,score[7]
mov cl,score[13]
mov score[7],cl
mov score[13],bl
mov dh,score[6]
mov dl,score[12]
mov score[6],dl
mov score[12],dh
jmp find1
nochang4:
cmp score[9],'2'
jne nochang5
mov bl,score[9]
mov cl,score[13]
mov score[9],cl
mov score[13],bl
mov dh,score[8]
mov dl,score[12]
mov score[8],dl
mov score[12],dh
jmp find1
nochang5:
cmp score[11],'2'
jne nochang6
mov bl,score[11]
mov cl,score[13]
mov score[11],cl
mov score[13],bl
mov dh,score[10]
mov dl,score[12]
mov score[10],dl
mov score[12],dh
jmp find1
nochang6:
cmp score[13],'2'
je find1
nochang:
mov bl,score[12]
cmp score[0],bl
jle next00
mov bh,score[0]
mov score[0],bl
mov bl,bh
next00:
cmp score[4],bl
jle next7
mov bh,score[4]
mov score[4],bl
mov bl,bh
next7:
cmp score[6],bl
jle next8
mov bh,score[6]
mov score[6],bl
mov bl,bh
next8:
cmp score[8],bl
jle next9
mov bh,score[8]
mov score[8],bl
mov bl,bh
next9:
cmp score[10],bl
jle next10
mov bh,score[10]
mov score[10],bl
mov bl,bh
next10:
cmp score[2],bl
jle next11
mov bh,score[2]
mov score[2],bl
mov bl,bh
next11:
mov score[12],bl
find1:
;=====min=score
mov bl,score
cmp score[2],bl
jge next1
mov bh,score[2]
mov score[2],bl
mov bl,bh
next1:
cmp score[4],bl
jge next2
mov bh,score[4]
mov score[4],bl
mov bl,bh
next2:
cmp score[6],bl
jge next3
mov bh,score[6]
mov score[6],bl
mov bl,bh
next3:
cmp score[8],bl
jge next4
mov bh,score[8]
mov score[8],bl
mov bl,bh
next4:
cmp score[10],bl
jge next5
mov bh,score[10]
mov score[10],bl
mov bl,bh
next5:
mov score,bl
;=========display
mov ah,9
lea dx,lowmsg
int 21h
mov ah,02h
mov dl,score[1]
int 21h
mov dl,score
int 21h
lea dx,crlf
mov ah,09h
int 21h
;=====
mov ah,9
lea dx,highmsg
int 21h
mov ah,02h
mov dl,score[13]
int 21h
mov dl,score[12]
int 21h
lea dx,crlf
mov ah,09h
int 21h
;======
lea dx,outputmsg
mov ah,09h
int 21h
sub bl,bl
mov ah,score[3]
mov al,score[2]
call bcdtoasc
add bl,al
mov ah,score[5]
mov al,score[4]
call bcdtoasc
adc bl,al
mov ah,score[7]
mov al,score[6]
call bcdtoasc
adc bl,al
mov ah,score[9]
mov al,score[8]
call bcdtoasc
adc bl,al
mov ah,score[11]
mov al,score[10]
call bcdtoasc
adc bl,al
;=====
mov al,bl
mov bh,5
div bh
;----
mov dl,al
and al,0f0h
mov cl,04
ror al,cl
mov cl,al
mov al,dl
and al,0fh
cmp al,09
jbe hda
add al,06
inc cl
hda:
and al,0fh
and cl,0f0h
add cl,30h
add al,30h
mov ah,02h
mov dl,cl
int 21h
mov dl,al
int 21h
lea dx,crlf
mov ah,09h
int 21h
ret
begin endp
bcdtoasc proc near
and ax,0f0fh
mov bl,al
mov cl,3
shl al,cl
mov cl,1
shl al,cl
add al,bl
add al,ah
ret
bcdtoasc endp
cseg ends
end begin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -