Advertisement
green1ant

var19-done

Mar 13th, 2019
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         org 100h
  2. Start:
  3.  
  4. Greeting:
  5.         mov     ah, $09
  6.         mov     dx, greeting
  7.         int 21h
  8.  
  9.         xor     si, si
  10.  
  11. PrintArrayLoop:
  12.         xor     bx, bx
  13.         movsx   bx, [array + si]
  14.  
  15.         cmp     bx, 0
  16.         jl      PrintNegative
  17.  
  18.         PrintPositive:
  19.         ;--------------
  20.         add     bx, '0'
  21.         mov     ah, $02
  22.         mov     dx, bx
  23.         int 21h
  24.  
  25.         mov     ah, $02
  26.         mov     dx, ' '
  27.         int 21h
  28.         jmp     Skip
  29.         ;--------------
  30.  
  31.  
  32.         PrintNegative:
  33.         ;--------------
  34.         mov     ah, $02
  35.         mov     dx, '-'
  36.         int 21h
  37.  
  38.         neg     bx
  39.         add     bx, '0'
  40.         mov     ah, $02
  41.         mov     dx, bx
  42.         int 21h
  43.  
  44.         mov     ah, $02
  45.         mov     dx, ' '
  46.         int 21h
  47.         ;--------------
  48.  
  49.         Skip:
  50.         inc     si
  51.         cmp     si, 8
  52.         jb      PrintArrayLoop
  53.  
  54.         xor     si, si
  55.         xor     cx, cx
  56.  
  57. CalculateAnswer:
  58.         xor     bx, bx
  59.         movsx   bx, [array + si]
  60.  
  61.         cmp     bx, 5
  62.         jng     Continue
  63.  
  64.         inc     cx
  65.  
  66.         Continue:
  67.         inc     si
  68.         cmp     si, 8
  69.         jb      CalculateAnswer
  70.  
  71. ShowAnswer:
  72.         mov     ah, $09
  73.         mov     dx, nextLine
  74.         int 21h
  75.  
  76.         add     cx, '0'
  77.         mov     ah, $02
  78.         mov     dx, cx
  79.         int 21h
  80.  
  81.         mov     ah, $02
  82.         mov     dx, ' '
  83.         int 21h
  84.  
  85.         mov     [pattern + 12], cl
  86.         mov     ah, $09
  87.         ;mov     bx, cx
  88.         mov     dx, pattern
  89.  
  90.         int 21h
  91.  
  92. Exit:
  93.         mov     ah, $09
  94.         mov     dx, pak
  95.         int 21h
  96.         mov     ah, $08
  97.         int 21h
  98.         ret
  99.  
  100.  
  101.  
  102. greeting        db "Enter amoumnt of elements", 13, 10, "$"
  103. pak             db 13, 10, "Press any key to continue...$"
  104. pattern         db 13, 10, "There are   numbers > 5", 13, 10, "$"
  105. nextLine        db 13, 10, '$'
  106. array           db 9, -7, -1, 8, 7, 5, 6, 4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement