Advertisement
shabbyheart

micro lab 6

Jan 14th, 2020
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. array macro digit
  2.  
  3. MOV SI,OFFSET digit
  4. CALL search;
  5.  
  6. endm
  7.  
  8.  
  9. org 100h
  10. .data
  11. insert db 'insert value$'
  12. value db 'how many value you want to insert?$'
  13. message db 'Enter 5 value $'
  14. msg2 db 'Enter a value for search$'
  15. y db 'found$'
  16. n db 'not found$'
  17.  
  18. dd db 'Digit$'
  19.  
  20. arr dw '?'
  21. .code
  22. main proc
  23. mov ax,@data
  24. mov ds,ax
  25.  
  26.  
  27.  
  28. mov dx,offset value
  29. mov ah,09h
  30. int 21h
  31.  
  32.  
  33.  
  34. mov ah,01h
  35. int 21h
  36. mov dl,al
  37. sub dl,48
  38.  
  39.  
  40. mov si,offset arr
  41. mov cl,dl
  42. loop1:
  43. MOV AH,01H
  44. INT 21H
  45. MOV BL,AL
  46. mov [si],bl
  47. inc si
  48. loop loop1
  49.  
  50. mov ah,02;
  51. mov dl,10
  52. int 21h
  53. mov dl,13
  54. int 21h
  55.  
  56.  
  57.  
  58. mov cl,dl
  59. array arr
  60.  
  61. ret
  62.  
  63. main endp
  64.  
  65. search proc
  66. mov ah,02;
  67. mov dl,10
  68. int 21h
  69. mov dl,13
  70. int 21h
  71.  
  72. mov dx,offset msg2
  73. mov ah,09h
  74. int 21h
  75.  
  76. MOV AH,01H
  77. INT 21H
  78. MOV BL,AL
  79. loop2:
  80. cmp bl,[si]
  81. je show
  82.  
  83. inc si
  84. loop loop2
  85.  
  86.  
  87. jmp no_found
  88.  
  89. show:
  90.  
  91. mov ah,02;
  92. mov dl,10
  93. int 21h
  94. mov dl,13
  95. int 21h
  96.  
  97. mov ah,02
  98. mov dl,[si]
  99. int 21h
  100.  
  101. mov dx,offset y
  102. mov ah,09h;
  103. int 21h
  104. ret
  105. no_found:
  106.  
  107. mov ah,02;
  108. mov dl,10
  109. int 21h
  110. mov dl,13
  111. int 21h
  112.  
  113. mov ah,02
  114. mov dl,bl
  115. int 21h
  116.  
  117. mov dx,offset n
  118. mov ah,09h
  119. int 21h
  120. ret
  121.  
  122.  
  123.  
  124.  
  125. search endp
  126.  
  127.  
  128.  
  129. end main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement