主题:急!!!一道汇编题,调了半天也不行,请教.....
题目:
设有10个学生的成绩分别是(如程序)。
试编制个程序统计60~69,70~79,80~89,90~99,和100分的人数分别
存放到S6 ,S7,S8,S9,S10的内存单元中。
data segment
scores db 76,69,84,90,73,88,99,63,100,80
count equ $-scores
s db 6 dup(?)
data ends
;--------------------
code segment
assume cs:code,ds:data
main proc far
push ds
xor ax,ax
push ax
mov ax,data
mov ds,ax
start:
mov cx,count
mov ah,0
mov bx,0
mov dx,0
mov si,offset scores
lop:
mov al,[si]
cmp al,60
jb next
cmp al,70
jb bad
cmp al,80
jb soso
cmp al,90
jb good
cmp al,100
jb highly
je best
;---------------------------------
best:
inc ah
jmp next
highly:
inc bh
jmp next
good:
inc bl
jmp next
soso:
inc dh
jmp next
bad:
inc dl
;
next:
inc si
loop lop
;--------------------------
mov di,offset s
mov [di],ah
mov [di+1],bh
mov [di+2],bl
mov [di+3],dh
mov [di+4],dl
;--------------------------
print:
mov dl,[di]
add dl,30h
mov ah,2
int 21h
mov dl,[di+1]
add dl,30h
mov ah,2
int 21h
mov dl,[di+2]
add dl,30h
mov ah,2
int 21h
mov dl,[di+3]
add dl,30h
mov ah,2
int 21h
mov dl,[di+4]
add dl,30h
mov ah,2
int 21h
;
mov ah,4ch
int 21h
;-------------------------
main endp
code ends
end start
不知为什么这个程序不行。
还有,要实现循环打印该怎么做?
设有10个学生的成绩分别是(如程序)。
试编制个程序统计60~69,70~79,80~89,90~99,和100分的人数分别
存放到S6 ,S7,S8,S9,S10的内存单元中。
data segment
scores db 76,69,84,90,73,88,99,63,100,80
count equ $-scores
s db 6 dup(?)
data ends
;--------------------
code segment
assume cs:code,ds:data
main proc far
push ds
xor ax,ax
push ax
mov ax,data
mov ds,ax
start:
mov cx,count
mov ah,0
mov bx,0
mov dx,0
mov si,offset scores
lop:
mov al,[si]
cmp al,60
jb next
cmp al,70
jb bad
cmp al,80
jb soso
cmp al,90
jb good
cmp al,100
jb highly
je best
;---------------------------------
best:
inc ah
jmp next
highly:
inc bh
jmp next
good:
inc bl
jmp next
soso:
inc dh
jmp next
bad:
inc dl
;
next:
inc si
loop lop
;--------------------------
mov di,offset s
mov [di],ah
mov [di+1],bh
mov [di+2],bl
mov [di+3],dh
mov [di+4],dl
;--------------------------
print:
mov dl,[di]
add dl,30h
mov ah,2
int 21h
mov dl,[di+1]
add dl,30h
mov ah,2
int 21h
mov dl,[di+2]
add dl,30h
mov ah,2
int 21h
mov dl,[di+3]
add dl,30h
mov ah,2
int 21h
mov dl,[di+4]
add dl,30h
mov ah,2
int 21h
;
mov ah,4ch
int 21h
;-------------------------
main endp
code ends
end start
不知为什么这个程序不行。
还有,要实现循环打印该怎么做?