Advertisement
Guest User

Untitled

a guest
Dec 13th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. Comment &
  2. Atrast katra kolonna videjo aritmetisko para skaitliem
  3. &
  4. .model tiny
  5. .code
  6. .startup
  7. Org 100h
  8. Jmp Short Start
  9. N Equ 2
  10. M Equ 3
  11. Matrix Dw 1, 2, 4
  12. Dw 4, 5, 6
  13. Vector DW M Dup (?)
  14. S Equ Type Matrix
  15.  
  16. FormVector Proc
  17. Push Bp
  18. Mov Bp, Sp
  19.  
  20. Push Cx
  21. Push Bx
  22. Push Dx
  23. Push Di
  24. Push Ax
  25.  
  26. Mov Ax, S
  27. Mul Word Ptr [Bp+6]
  28. Mov Si, Ax
  29.  
  30. Mov Cx, [Bp + 6]
  31. Mov Bx, [Bp + 8]
  32. Mov Di, [Bp + 10]
  33. Rows: Push Cx
  34. Mov Cx, [Bp + 4]
  35. Xor Ax, Ax
  36. Xor Dl, Dl
  37.  
  38. Push Bx ;my
  39.  
  40. Cols:
  41. Test [Bx], Word Ptr 00000001B ;Test Ax, 1
  42. Jnz False ;if odd
  43. ;if even
  44. Inc Dl
  45. Add Ax, [Bx] ;Ax = Ax + Bx
  46. False:
  47. Add Bx, Si ;original
  48.  
  49.  
  50.  
  51. Loop Cols
  52.  
  53.  
  54. Pop Bx ;my
  55. Add Bx, S ;my
  56.  
  57. Div Dl ;Ax = Ax/Dl
  58.  
  59. Mov [Di], Ax
  60.  
  61.  
  62. Pop Cx
  63. Add Di, S
  64. Loop Rows
  65.  
  66. Pop Ax
  67. Pop Di
  68. Pop Dx
  69. Pop Bx
  70. Pop Cx
  71.  
  72. Pop Bp
  73. Ret 2*4
  74. FormVector EndP
  75.  
  76. Print Proc
  77. Push Bp
  78. Mov Bp, Sp
  79.  
  80. Push Cx
  81. Push Bx
  82. Push Ax
  83.  
  84. Mov Cx, [Bp + 4]
  85. Mov Bx, [Bp + 6]
  86. Pr: Mov Ax, [Bx]
  87. Add Bx, S
  88. Loop Pr
  89.  
  90. Pop Ax
  91. Pop Bx
  92. Pop Cx
  93.  
  94. Pop Bp
  95. Ret 2*2
  96. Print EndP
  97.  
  98. Start:
  99. Lea Ax, Vector
  100. Push Ax
  101. Lea Ax, Matrix
  102. Push Ax
  103. Mov Ax, M
  104. Push Ax
  105. Mov Ax, N
  106. Push Ax
  107. Call FormVector
  108.  
  109. Lea Ax, Vector
  110. Push Ax
  111. Mov Ax, M
  112. Push Ax
  113. Call Print
  114. ;.exit 0
  115. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement