Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %include "io.inc"
- section .bss
- a resd 10000
- b resd 10000
- c resd 10000
- n resd 1
- m resd 1
- k resd 1
- t resd 1
- section .text
- GLOBAL CMAIN
- CMAIN:
- GET_UDEC 4, n
- GET_UDEC 4, m
- GET_UDEC 4, k
- ;get matrix a
- xor ecx, ecx
- xor ebx, ebx
- .get_loop1:
- cmp ecx, [n]
- jae .end1
- xor ebx, ebx
- .get_loop_row1:
- cmp ebx, [m]
- inc ecx
- jae .get_loop1
- mov eax, ecx
- mul dword[m]
- add eax, ebx
- add eax, a
- GET_DEC 4, eax
- inc ebx
- jmp .get_loop_row1
- .end1:
- ;get matrix b
- xor ecx, ecx
- xor ebx, ebx
- .get_loop2:
- cmp ecx, [m]
- jae .end2
- xor ebx, ebx
- .get_loop_row2:
- cmp ebx, [k]
- inc ecx
- jae .get_loop2
- mov eax, ecx
- mul dword[m]
- add eax, ebx
- add eax, b
- GET_DEC 4, eax
- inc ebx
- jmp .get_loop_row2
- .end2:
- ; c = a * b
- xor ecx, ecx
- xor ebx, ebx
- .loop1:
- cmp ecx, [n]
- jae .end2
- xor ebx, ebx
- .loop2:
- cmp ebx, [k]
- inc ecx
- jae .loop1
- mov eax, ecx
- mul dword[m]
- add eax, ebx
- add eax, c
- mov [eax], 0
- .loop3:
- mov edx, 1
- imul edx,
- add [eax],
- inc ebx
- jmp .get_loop_row2
- NEWLINE
- xor eax, eax
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement