Advertisement
Guest User

arr

a guest
Mar 25th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. org 100h
  2. Start:
  3.         mov     bl, [array]
  4.         mov     cx, 4;[length]
  5.         mov     si, 1
  6.         mov     di, 0
  7.         mov     dl, 0
  8.  
  9. max:
  10.         mov     cl, [array + si]
  11.         cmp     cl, bl
  12.         inc     si
  13.         jbe     NotMax
  14.  
  15.         mov     bl, cl
  16.         mov     di, si
  17.  
  18.         NotMax:
  19.         loop max
  20.  
  21.  
  22.         mov     cx, 4;[length]
  23.         dec     di
  24.         sub     cx, di
  25. sum:
  26.         add     dl, [array+di+1]
  27.         inc     di
  28.         loop    sum
  29.  
  30.         ; mov     dx, di
  31.  
  32. output:
  33.         mov     ah, 02h
  34.         add     dl, '0'
  35.         int     21h
  36. exit:
  37.         mov     ah, 08h
  38.         int     21h
  39.         ret
  40.  
  41.  
  42. array db 3,4,2,3,2
  43. ;length dw 4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement