Advertisement
Guest User

asm

a guest
Mar 26th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         org 100h
  2.  
  3. start:
  4.         mov     ah, $09
  5.         mov     dx, text
  6.         int 21h
  7.  
  8.         mov     ah, $09
  9.         mov     dx, enter_char
  10.         int 21h
  11.  
  12.         xor     si, si
  13.  
  14.         ; input char
  15.         mov     ah, $01
  16.         mov     bl, al
  17.         int 21h
  18.  
  19.         mov     di, text
  20.         mov     cx, 12
  21.  
  22. search:
  23.         repne   scasb
  24.         inc     si
  25.        
  26.         cmp     cx, 0
  27.         jnz     search
  28.         dec     si
  29.  
  30.         mov     ah, $09
  31.         mov     dx, next_line
  32.         int 21h
  33.  
  34.  
  35.         mov     bx, si
  36.         add     bx, '0'
  37.         mov     ah, $02
  38.         mov     dx, bx
  39.         int 21h
  40.  
  41.         mov     ah, $09
  42.         mov     dx, ans
  43.         int 21h
  44.  
  45. exit:
  46.         mov     ah, $09
  47.         mov     dx, pak
  48.         int 21h
  49.         mov     ah, $08
  50.         int 21h
  51.  
  52.         ret    
  53.  
  54. next_line       db 13, 10, "$"
  55. enter_char      db "Enter char to find string:", 13, 10, "$"
  56. pak     db 13, 10, "Press any key to exit...$"
  57. text    db "Hello world$"
  58. ans     db " occurencies$"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement