NEXTB: ADD DI , 6 JMP LOOPB
NEXTA: MOV [SI+4],DX;名次填入登记表中相应位置
ADD _______ , 6 JMP _________
NEXT:MOV AX , _______
INT 21H CODE ENDS
END START
DATAS SEGMENT
ENGLI DW 01H,188H ,0,02H,175H,0,03H,195H,0,04H,163H,0,05H,198H,0 DW 06,178H,0,07H,187H,0,08H,173H,0,09H,190H,0,0AH,160H,0,-1,-1 ;此处输入数据段代码 DATAS ENDS
STACKS SEGMENT
STA DB 200 DUP (20H) TOP EQU $ - STA
;此处输入堆栈段代码 STACKS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS,SS:STACKS START:
MOV AX,DATAS MOV DS,AX
MOV AX , STACKS MOV SS , AX MOV SP , TOP LEA SI, ENGLI MOV BX , 0
LOOPA : MOV DX , 1
CMP [SI],WORD PTR -1;检查所有学生的名次处理完否 JE NEXT
MOV CX,[SI+2] ;欲求名次考生的分数送CX LEA DI,ENGLI+2
LOOPB: CMP [DI],WORD PTR -1;检查表查完否 JE NEXTA CMP CX , [DI] JAE NEXTB
INC DX;名次加1 NEXTB: ADD DI , 6 JMP LOOPB
41
NEXTA: MOV [SI+4],DX;名次填入登记表中相应位置 ADD SI, 6
JMP LOOPA;显示学号和名次 NEXT: LEA SI, ENGLI
p1: mov ax,[si]
CMP [SI],WORD PTR -1 JE NEXT123 mov bx,ax MOV CL,4 and al,0f0h SHR AL,CL cmp al,0AH jb p2
add al,7 p2:
or al,30h mov dl,al mov ah,2 int 21h and bl,0fh cmp bl,0AH jB p3
add bl,7 p3:
or bl,30h mov dl,bl mov ah,2 int 21h add si,4 mov dl,' ' mov ah,2 int 21h mov ax,[si]
CMP [SI],WORD PTR -1 JE NEXT123 mov bl,10 div bl; mov bh,ah or al,30h mov dl,al mov ah,2
42
int 21h or bh,30h