Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .386
- .model flat, stdcall
- option casemap : none
- ;Подключаем вспомогательные модули
- include \masm32\include\kernel32.inc
- include \masm32\include\masm32.inc
- include \masm32\include\msvcrt.inc
- includelib \masm32\lib\kernel32.lib
- includelib \masm32\lib\masm32.lib
- includelib \masm32\lib\msvcrt.lib
- include \masm32\macros\macros.asm
- .data
- text_out_sum db "Sum: %lu %lu %lu %lu", 10, 13, 0
- text_out_mul db "Mul: %lu %lu %lu %lu %lu %lu %lu %lu", 10, 13, 0
- text_out_lu db "%lu ", 0
- n dd 4
- a_sum dd 4294967295, 4294967295, 4294967293, 0
- b_sum dd 1, 1, 2, 0
- ;a_mul dd 2147483648, 0, 0, 0
- ;b_mul dd 2, 0, 0, 0
- ;a_mul dd 1, 1, 0, 0
- ;b_mul dd 0, 1, 0, 0
- a_mul dd 2147483648, 2147483648, 2147483648, 2147483648
- b_mul dd 2, 2, 2, 2
- c_mul dd 0, 0, 0, 0, 0, 0, 0, 0
- mul_i dd 0
- mul_j dd 0
- mul_buff1 dd 0
- mul_buff2 dd 0
- mul_add_buff dd 0, 0, 0, 0
- .code
- _ladd proc
- mov ecx, 0
- mov ebx, [ebp]
- lable_next_digit:
- mov eax, [ebx + ecx * 4]
- mov edx, [ebp - 4 * 1]
- add eax, [edx + ecx * 4]
- mov [ebx + ecx * 4], eax
- JNC next
- mov edx, ecx
- lable_offset:
- add edx, 1
- mov eax, [ebx + edx * 4]
- add eax, 1
- mov [ebx + edx * 4], eax
- JC lable_offset
- next:
- inc ecx
- cmp ecx, n
- JNZ lable_next_digit
- ret
- _ladd endp
- start:
- lable_mul:
- mov ecx, mul_i
- mov eax, a_mul[ecx * 4]
- mov ebx, mul_j
- mul b_mul[ebx * 4]
- mov mul_add_buff[0], eax
- mov mul_add_buff[1 * 4], edx
- enter 8, 0
- mov ecx, mul_i
- add ecx, mul_j
- lea eax, c_mul[ecx * 4]
- mov [ebp], eax
- lea eax, mul_add_buff
- mov [ebp - 1 * 4], eax
- call _ladd
- leave
- inc mul_j
- mov eax, mul_j
- cmp eax, n
- JNZ lable_mul
- mov eax, 0
- mov mul_j, eax
- inc mul_i
- mov eax, mul_i
- cmp eax, n
- JNZ lable_mul
- invoke crt_printf, addr text_out_mul, c_mul[7 * 4], c_mul[6 * 4], c_mul[5 * 4], c_mul[4 * 4], c_mul[12], c_mul[8], c_mul[4], c_mul[0]
- enter 8, 0
- lea eax, a_sum
- mov [ebp], eax
- lea eax, b_sum
- mov [ebp - 1 * 4], eax
- call _ladd
- invoke crt_printf, addr text_out_sum, a_sum[12], a_sum[8], a_sum[4], a_sum[0]
- leave
- exit
- end start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement