【正确答案】①完成AAA指令功能的子程序为:
subprog segment
push bx
push cx
push dx
pushf
pop bx
and bl,10h
jnz lab1
and al,0fh
cmp al,9
jle lab2
lab1: add al,6
inc ah
pushf
pop bx
or bx,10h
push bx
popf
lab2:and al,0fh
pushf
pop bx
mov dx,bx
and dx,10h
mov cl,4
shr dx,cl
and bx,0feh
or bx,dx
push bx
popf
pop dx
pop cx
pop bx
ret
subprog endp
②完成DAA指令功能的子程序为:
subprog segment
push bx
push dx
pushf
pop bx
and bl,10h
jnz lab1
mov bl,al
and bl,0fh
cmp bl,9
jle lab2
lab1: add al,6
pushf
pop bx
or bx,10h
push bx
popf
lab2:jc lab3
mov bl,al
and bl,0f0h
cmp bl,90h
jle lab4
lab3: add al,60h
stc
lab4: pop dx
pop bx
ret
subprog endp
【答案解析】