stack segment stack 'stack'
dw 32 dup(0)
stack ends
data segment
SCORE DB 78,80,95,98,99,91,90,88,85,87,87,89,70,73,74
DB 72,78,74,77,71,70,60,65,68,62,66,55,50,48,30
COUNT DB 0AH,0DH,'>=90 :$'
DB 0AH,0DH,'80~89:$'
DB 0AH,0DH,'70~79:$'
DB 0AH,0DH,'60~69:$'
DB 0AH,0DH,'<60 :$'
TAB DW 5 DUP(0)
data ends
code segment
begin proc far
assume ss: stack, cs: code, ds: data
push ds
sub ax, ax
push ax
mov ax, data
mov ds, ax
MOV BX, 0
MOV CH, 10
MOV DI, 0
AGAIN: CMP BX, 30
JZ OBJ
MOV AL, SCORE[BX]
INC BX
CMP AL, 90
JNC P0
CMP AL, 80
JNC P1
CMP AL, 70
JNC P2
CMP AL, 60
JNC P3
JMP P4
OBJ: CMP DI, 10
JC NS
MOV CH, 0
NA: MOV AX,0
MOV AL, 9
MUL CH
MOV BX, AX
MOV DX, OFFSET COUNT[BX]
MOV AH, 9
INT 21H
MOV AX,0
MOV AL,2
MUL CH
MOV BX, AX
MOV AH, 2
MOV DL, BYTE PTR TAB[BX]
INT 21H
MOV DL, BYTE PTR TAB[BX+1]
MOV AH,2
INT 21H
INC CH
CMP CH, 5
JNZ NA
RET
NS: MOV AL, BYTE PTR TAB[DI]
MOV AH,0
DIV CH
XCHG AH, AL
OR AX, 3030H
MOV TAB[DI], AX
ADD DI, 2
JMP OBJ
P0: INC BYTE PTR TAB
JMP AGAIN
P1: INC BYTE PTR TAB+2
JMP AGAIN
P2: INC BYTE PTR TAB+4
JMP AGAIN
P3: INC BYTE PTR TAB+6
JMP AGAIN
P4: INC BYTE PTR TAB+8
JMP AGAIN
ret
begin endp
code ends
end begin
在masm下编译正常,但在输出结果中不理想输出乱码 |