act2 db ?
stok2 db 6 dup(?) datasg ends
codesg segment
assume cs:codesg, ds:datasg,es:datasg main proc far push ds sub ax,ax push ax
mov ax,datasg mov ds,ax mov es,ax lea dx,mess1 mov ah,09
int 21h ;qust1? lea dx,st1 mov ah,0ah
int 21h ;ans1
lea dx,mess2 mov ah,09
int 21h ;qust2?
lea dx,st2 mov ah,0ah
int 21h ;ans2 mov cl,act1 mov dl,act2 cmp cl,dl jnz nomatch lea si,stok1 lea di,stok2 inc cl repe cmpsb cmp cl,0 jz match nomatch:
lea dx,mess4 jmp exit match: lea dx,mess3
exit:
mov ah,09
int 21h
sub di,offset stok2 mov dx,di and dx,0fh add dl,30h mov ah,2 int 21h
ret main endp codesg ends
end main
5.6 编写程序,从键盘输入一个个位数N,响铃N次(响铃ASCII码为07H)。 code segment
assume cs:code start: push ds sub ax,ax push ax mov ah,1 int 21h cmp al,31h jb exit cmp al,39h ja exit
sub al,30h mov cl,al mov ch,0 k: mov ah,2
mov dl,7 int 21h loop k
exit:ret code ends
end start
5.7 编写程序,从键盘输入一个字符串到BUFF,再输入一个字符到AL,在字
符串BUFF中查找是否存在该字符,如果找到,显示发现的字符位置。 ;search
datasg segment para'data'
mess1 db 13,10, 'input string:$' mess2 db 13,10, 'input a char:$' mess3 db 13,10, 'found at $' mess4 db 13,10, 'no found !$'