Advertisement
Guest User

Untitled

a guest
Jun 7th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         org 100h
  2.         use16
  3.  
  4. Start:
  5.         push    array
  6.         push    eleme
  7.  
  8.         call    Counter
  9.  
  10.         ; count of elms in AX
  11.  
  12.         ret
  13.  
  14. Counter:
  15.         push    BP
  16.         mov     BP, SP
  17.  
  18.         mov     DI, [BP + 6]
  19.         mov     BX, [BP + 4]
  20.         mov     DX, [BX]
  21.  
  22.         mov     AX, 0
  23.         mov     CX, length
  24. Searching:
  25.         cmp     DL, byte[DI]
  26.         jbe     CheckNext
  27.  
  28.         inc     AX
  29. CheckNext:
  30.         inc     DI
  31.         loop    Searching
  32.  
  33.         pop     BP
  34.         ret     4
  35.  
  36. array   db      2, 5, 6, 2, 8, 12, 45, 0, 1, 4, 7, 2
  37. length  = $ - array
  38. eleme   db      5
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement