菜鸟求助高手 帮解答~~

2024-12-28 17:35:33
推荐回答(2个)
回答1:

3. SCORE缓冲区中有10个无符号WORD数,求它们的平均值,送
入AVERAGE字单元

xor si,si
mov cx,10
xor ax,ax
xor dx,dx
Addition:
add ax,SCORE[si]
adc dx,0
inc si
inc si
loop Addition
mov cx,10
div cx
mov AVERAGE,ax

回答2:

第一题:
Data segment
ARRAY db 12,35,100,03,200,66,75,65,124,180
UP db 00h
DOWN db 00h
Data ends
Code segment
assume cs:Code,ds:Data
Start:
mov ax,Data
mov ds,ax

mov si,offset ARRAY;偏移地址送给si
mov cx,10
next:mov bl,[si]
cmp bl,42h
jz Jump_loop
ja a001
inc DOWN
jmp Jump_loop
a001:inc UP
Jump_loop:inc si
loop next

mov ah,01h
int 16h
mov ah,4ch
int 21h
Code ends
end Start

第二题:
Data segment
ARRAY dw 0012h,35h,100h,03h,200h,66h,75h,65h

Data ends
Code segment
assume cs:Code,ds:Data
Start:
mov ax,Data
mov ds,ax
mov si,offset ARRAY
mov cx,8
next:add word ptr [si],1
inc si
inc si
loop next

mov ah,01h
int 16h
mov ah,4ch
int 21h
Code ends
end Start

第三题:

Data segment
SCORE dw 0012h,35h,100h,03h,200h,66h,75h,65h,3204h,1200h
AVERAGE dw ?
Data ends
Code segment
assume cs:Code,ds:Data
Start:
mov ax,Data
mov ds,ax
mov si,offset SCORE
mov cx,10
xor ax,ax
xor dx,dx
next:add ax,[si]
adc dx,0
inc si
inc si
loop next
mov bx,10
div bx
mov AVERAGE,ax

mov ah,01h
int 16h
mov ah,4ch
int 21h
Code ends
end Start

第四题:
Code segment
assume cs:Code
Start:
mov ax,Data
mov ds,ax
xor bx,bx
sub cx,cx
call sum
mov ax,cx

mov ah,4ch
int 21h

sum proc
inc bx
cmp bx,50
ja a001
add cx,bx
call sum
a001: ret
sum endp
Code ends
end Start