diff --git a/nasm/D.asm b/nasm/D.asm new file mode 100644 index 0000000..be9ed81 --- /dev/null +++ b/nasm/D.asm @@ -0,0 +1,32 @@ +extern printf +extern scanf +global main + +section .text +main: + push y + push x + push nya1 + call scanf + add esp, 12 + + mov eax, [x] + ;mov ebx, [y] + cdq + idiv dword [y] + + push eax + push nya + call printf + add esp, 8 + + xor eax, eax + ret + +section .data +nya db "%d", 10, 0 +nya1 db "%d %d", 0 + +section .bss +x resd 1 +y resd 1 diff --git a/nasm/E.asm b/nasm/E.asm new file mode 100644 index 0000000..7901b20 --- /dev/null +++ b/nasm/E.asm @@ -0,0 +1,32 @@ +extern printf +extern scanf +global main + +section .text +main: + push y + push x + push nya1 + call scanf + add esp, 12 + + mov eax, [x] + ;mov ebx, [y] + cdq + idiv dword [y] + + push edx + push nya + call printf + add esp, 8 + + xor eax, eax + ret + +section .data +nya db "%d", 10, 0 +nya1 db "%d %d", 0 + +section .bss +x resd 1 +y resd 1 diff --git a/nasm/G64.asm b/nasm/G64.asm new file mode 100644 index 0000000..2f31b7b --- /dev/null +++ b/nasm/G64.asm @@ -0,0 +1,44 @@ +global main +extern scanf +extern printf +section .text + +main: + ; scanf + sub rsp, 8 + mov rdi, nya + mov rsi, x + mov rdx, y + call scanf wrt ..plt + add rsp, 8 + + ; comparsion + mov rax, qword [rel x] + add rax, [rel y] + + jb meow + push rbp + mov rdi, no + call printf wrt ..plt + pop rbp + + jmp end + +meow: + push rbp + mov rdi, yes + call printf wrt ..plt + pop rbp + +end: + xor rax, rax + ret + +section .data +nya dq "%llu %llu", 0 +yes db "YES", 10, 0 +no db "NO", 10, 0 + +section .bss +x resq 1 +y resq 1 diff --git a/nasm/N.asm b/nasm/N.asm new file mode 100644 index 0000000..461edfe --- /dev/null +++ b/nasm/N.asm @@ -0,0 +1,68 @@ +global main +extern scanf +extern printf + + +section .text +main: + xor ebx, ebx + +loop1: + cmp ebx, 8 + jge nya1 + inc ebx + + ; read element + lea edx, [a + 1*ebx] + push edx + push template + call scanf + add esp, 8 + + push word [edx] + push output + call printf + add esp, 8 + + jmp loop1 + +nya1: + + +; xor ebx, ebx +; +;loop2: +; cmp ebx, 8 +; jge nya2 +; inc ebx +; +; ; read element +; push b +; push template +; call scanf +; add esp, 8 +; +; jmp loop1 +; +;nya1: + +; xor ebx, ebx +;loop3: + ; output +; push word [a] +; push output +; call printf +; add esp, 8 + + + xor eax, eax + ret + +section .data +template db "%d", 0 +output db "%d", 10, 0 +t db "%d", 10, 0 + +section .bss +a resw 8 +b resw 8 diff --git a/nasm/O.asm b/nasm/O.asm new file mode 100644 index 0000000..690416d --- /dev/null +++ b/nasm/O.asm @@ -0,0 +1,30 @@ +global _start + +section .text +_start: + ; input + mov eax, 3 + xor ebx, ebx + mov ecx, nya + mov edx, 1 + int 0x80 + + ; modification + mov ax, word [nya] + or ax, 0111b + mov [nya], ax + + ; output + mov eax, 4 + mov ebx, 1 + mov ecx, nya + mov edx, 1 + int 0x80 + + ; program exit + mov eax, 1 ; sys_exit = 1 + xor ebx, ebx + int 0x80 + +section .bss +nya resb 1