Advertisement
berinkaq

Untitled

Mar 22nd, 2021
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. %include "io.inc"
  2.  
  3. section .bss
  4. a resd 10000
  5. b resd 10000
  6. c resd 10000
  7. n resd 1
  8. m resd 1
  9. k resd 1
  10. t resd 1
  11. section .text
  12.  
  13. GLOBAL CMAIN
  14. CMAIN:
  15. GET_UDEC 4, n
  16. GET_UDEC 4, m
  17. GET_UDEC 4, k
  18. ;get matrix a
  19. xor ecx, ecx
  20. xor ebx, ebx
  21. .get_loop1:
  22. cmp ecx, [n]
  23. jae .end1
  24. xor ebx, ebx
  25. .get_loop_row1:
  26. cmp ebx, [m]
  27. inc ecx
  28. jae .get_loop1
  29. mov eax, ecx
  30. mul dword[m]
  31. add eax, ebx
  32. add eax, a
  33. GET_DEC 4, eax
  34. inc ebx
  35. jmp .get_loop_row1
  36.  
  37. .end1:
  38. ;get matrix b
  39. xor ecx, ecx
  40. xor ebx, ebx
  41. .get_loop2:
  42. cmp ecx, [m]
  43. jae .end2
  44. xor ebx, ebx
  45. .get_loop_row2:
  46. cmp ebx, [k]
  47. inc ecx
  48. jae .get_loop2
  49. mov eax, ecx
  50. mul dword[m]
  51. add eax, ebx
  52. add eax, b
  53. GET_DEC 4, eax
  54. inc ebx
  55. jmp .get_loop_row2
  56.  
  57. .end2:
  58. ; c = a * b
  59. xor ecx, ecx
  60. xor ebx, ebx
  61. .loop1:
  62. cmp ecx, [n]
  63. jae .end2
  64. xor ebx, ebx
  65. .loop2:
  66. cmp ebx, [k]
  67. inc ecx
  68. jae .loop1
  69. mov eax, ecx
  70. mul dword[m]
  71. add eax, ebx
  72. add eax, c
  73. mov [eax], 0
  74. .loop3:
  75.  
  76. mov edx, 1
  77. imul edx,
  78. add [eax],
  79. inc ebx
  80. jmp .get_loop_row2
  81.  
  82.  
  83.  
  84.  
  85. NEWLINE
  86. xor eax, eax
  87. ret
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement