Advertisement
Latkoski

број на парни цифри

Nov 17th, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. ; multi-segment executable file template.
  2.  
  3. data segment
  4. ; add your data here!
  5. pkey db "press any key...$"
  6. num db ?
  7. brojac db ?
  8. array dw 230d,908d,112d,202d,234d
  9. ends
  10.  
  11. stack segment
  12. dw 128 dup(0)
  13. ends
  14.  
  15. code segment
  16. proc presmetaj
  17. pop bx
  18. pop ax
  19. ciklus2:
  20. cmp ax, 0d
  21. je zavrsi
  22.  
  23. mov dl, 10d
  24. div dl
  25.  
  26. mov cl, al
  27. mov al, ah
  28. mov ah, 0
  29. mov dl, 2d
  30. div dl
  31.  
  32. cmp ah, 0
  33. je parna
  34.  
  35. neparna:
  36. mov al, cl
  37. mov ah, 0
  38. jmp ciklus2
  39.  
  40. parna:
  41. inc num
  42. mov al, cl
  43. mov ah, 0
  44. jmp ciklus2
  45.  
  46.  
  47.  
  48. zavrsi:
  49. push bx
  50. ret
  51. endp presmetaj
  52.  
  53. start:
  54. ; set segment registers:
  55. mov ax, data
  56. mov ds, ax
  57. mov es, ax
  58.  
  59. mov bx, 0d
  60.  
  61. ciklus:
  62. cmp bx, 10d
  63. je kraj
  64. mov ax, array[bx]
  65. push ax
  66. call presmetaj
  67.  
  68. add brojac, 2d
  69. mov bl, brojac
  70. mov bh, 0
  71. jmp ciklus
  72.  
  73. kraj:
  74. mov dl, num
  75. mov ah,02h
  76. int 21h
  77.  
  78. mov ax, 4c00h ; exit to operating system.
  79. int 21h
  80. ends
  81.  
  82. end start ; set entry point and stop the assembler.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement