Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- section .data
- msg db "overflow"
- len equ $- msg
- minus db '-'
- section .bss
- num1 resb 4
- num2 resb 4
- res2 resb 4
- section .text
- global _start
- _start:
- xor esi, esi
- xor edi, edi
- A:
- mov eax, 3
- mov ebx, 0
- mov ecx, num1
- mov edx, 1
- int 0x80
- mov eax, [num1]
- cmp eax, 45
- je minn
- cmp eax, '9'
- jg p1
- cmp eax, '0'
- jl p1
- sub eax, '0'
- push eax
- inc esi
- cmp esi, 8
- jg err
- jmp A
- minn:
- mov edi, 1
- jmp A
- p1:
- xor eax, eax
- xor ecx, ecx
- conl:
- pop edx
- mov ebx, ecx
- cmp ecx, 0
- je n1
- C:
- imul edx, 10
- dec ebx
- cmp ebx, 0
- jg C
- n1:
- add eax, edx
- inc ecx
- cmp ecx, esi
- jl conl
- mov [num1], eax
- xor esi, esi
- B:
- mov eax, 3
- mov ebx, 0
- mov ecx, num2
- mov edx, 1
- int 0x80
- mov eax, [num2]
- cmp eax, '0'
- jl p2
- cmp eax, '9'
- jg p2
- sub eax, '0'
- push eax
- inc esi
- cmp esi, 8
- jg err
- jmp B
- p2:
- xor eax, eax
- xor ecx, ecx
- conll:
- pop edx
- mov ebx, ecx
- cmp ecx, 0
- je n2
- D:
- imul edx, 10
- dec ebx
- cmp ebx, 0
- jg D
- n2:
- add eax, edx
- inc ecx
- cmp ecx, esi
- jl conll
- mov [num2], eax
- mov edx, 1
- mov ecx, [num2]
- mov eax, 1
- cmp ecx, 0
- je Y
- L1:
- mov ebx, [num1]
- cmp ebx, 0
- je z
- cmp ebx, 1
- je Y
- L2:
- add edx, eax
- jo err
- dec ebx
- cmp ebx, 1
- jg L2
- mov eax, edx
- dec ecx
- cmp ecx, 0
- jg L1
- jmp E
- z:
- mov eax, 0
- jmp E
- Y:
- mov eax, 1
- E:
- xor esi, esi
- d:
- xor edx, edx
- mov ecx, 10
- div ecx
- push edx
- inc esi
- cmp eax, 0
- jne d
- cmp edi, 1
- jne drw
- mov eax, [num2]
- xor edx, edx
- mov ecx, 2
- div ecx
- cmp edx, 0
- je drw
- mov eax, 4
- mov ebx, 1
- mov ecx, minus
- mov edx, 1
- int 0x80
- drw:
- pop edx
- add edx, '0'
- mov [res2], edx
- mov eax, 4
- mov ebx, 1
- mov ecx, res2
- mov edx, 1
- int 0x80
- dec esi
- cmp esi, 0
- jg drw
- jmp aminb
- err:
- mov eax, 4
- mov ebx, 1
- mov ecx, msg
- mov edx, len
- int 0x80
- aminb:
- mov eax, 1
- mov ebx, 0
- int 0x80
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement