mainendp cseg ends end start 5、答案: dseg segment grade dw 30 dup(?) rank dw 30 dup(?) dseg ends cseg segment mainproc far
assume cs:cseg, ds:dseg, es:dseg start:push ds sub ax,ax push ax mov ax,dseg mov ds,ax mov es,ax begin: mov di,0 mov cx,30 loop1: push cx mov cx,30 mov si,0 mov ax,grade[di] mov dx,0 loop2: cmp grade[si],ax jbe go_on inc dx go_on: add si,2 loop loop2 pop cx inc dx mov rank[di],dx sdd di,2 loop loop1 ret mainendp cseg ends end start 6、答案: mov si, 0 mov di, 0
test12: in al, 0024h test al, 08 jnz exit
46
in al,0036h test al, 08 jnz exit dev1: in al, 0024h test al, 01 jz dev2 in al, 0026h mov buffer[si], al inc si dev2: in al, 0036h test al, 01 jz test12 in al, 0038h mov buff2[di],al inc di jmp test12 exit: ret 7、答案:
scode db 7,5,9,1,3,6,8,0,2,4 buffer db 10 dup(?) ; … … mov si,0 mov cx,10 lea bx,scode input: mov ah,01 int 21h cmp al,0ah jz exit and al,0fh xlat mov buffer[si],al inc si loop input exit: ret
47