Advertisement
THOMAS_SHELBY_18

1

May 24th, 2024
14
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. org 100h
  2. Start:
  3. mov ah, 09h
  4. mov dx, TestStr+1
  5. int 21h
  6.  
  7. mov ah, 02h
  8. mov dl, [Char]
  9. int 21h
  10.  
  11. mov ah, 09h
  12. mov dx, EndStr
  13. int 21h
  14.  
  15. push TestStr
  16. xor ax, ax
  17. mov al, [Char]
  18. push ax
  19. call SearchChar
  20.  
  21. mov ah, 02h
  22. mov dl, al
  23. add dl, '0'
  24. int 21h
  25.  
  26. mov ah, 08h
  27. int 21h
  28.  
  29.  
  30. SearchChar:
  31. .prolog:
  32. push bp
  33. mov bp, sp
  34.  
  35. .searching:
  36. mov di, [bp+6]
  37. movzx cx, byte[di]
  38. inc di
  39.  
  40. mov al, [bp+4]
  41. repne scasb
  42.  
  43. test cx, cx
  44. jz .notFound
  45.  
  46.  
  47. mov si, [bp+6]
  48. inc si
  49. sub di, si
  50. mov ax, di
  51. jmp .epilog
  52. .notFound:
  53. xor ax, ax
  54.  
  55. .epilog:
  56. mov sp, bp
  57. pop bp
  58. ret 4
  59.  
  60. TestStr db 8, "aasdasda"
  61. EndStr db 13, 10, '$'
  62. Char db 'q'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement