⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 2-2.asm

📁 几个汇编小程序。能实现电话号码本的管理
💻 ASM
字号:
dataseg segment
  buffer1 db 20
  size1 db ?
  store1 db 20 dup(?)                       ;define the buffer of key word
  buffer2 db 100
  size2 db ?
  store2 db 100 dup(?)                     ;define the buffer of sentense
  message1 db 'Enter keyword:','$'
  message2 db 0ah,0dh,'Enter sentence:','$'
  message3 db 0ah,0dh,'Match at location:','$'
  message4 db ' H of the sentence.',0ah,0dh,'$'
  message5 db 0ah,0dh,'No match.',0ah,0dh,'$'
dataseg ends
;-----------------------------code program--------------------------------
search segment
main proc far
   assume cs:search,ds:dataseg,es:dataseg
start:
  push ds
  sub ax,ax
  push ax
  mov ax,dataseg
  mov ds,ax
  mov es,ax
  lea dx,message1
  mov ah,09h
  int 21h
  mov dx,offset buffer1
  mov ah,0ah
  int 21h
  mov al,0ah
  mov ah,02h
  int 21h
  mov al,0dh
  mov ah,02h
  int 21h
next:
  mov dx,offset message2
  mov ah,09h
  int 21h
  mov dx,offset buffer2
  mov ah,0ah
  int 21h
  mov al,size1
  mov bl,size2
  cmp al,bl
  ja exit
  inc bl
  mov dx,offset store2
scmp:
  mov si,offset store1
  mov di,dx
  mov cl,size1
stricm:
  cmpsb                                 ;find the key word in the sentense
  jne next1
  dec cl
  je success
  jmp stricm
next1:
  inc dx
  dec bl
  je exit
  jmp scmp
  
exit: 
  mov dx,offset message5
  mov ah,09h
  int 21h
  jmp exit1
success:
  mov ax,offset store2
  sub dx,ax
  mov bx,dx
  lea dx,message3
  mov ah,09h
  int 21h
  mov al,bl
  and al,0fh
  add al,30h
  cmp al,3ah
  jl printit
  add al,7h
printit:
  mov dl,al
  mov ah,2
  int 21h
  lea dx,message4
  mov ah,09h
  int 21h
exit1:
  ret
  main endp
  search ends
end start

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -