From 83862fb7bce6764521f256ab25a8b3ea222f7251 Mon Sep 17 00:00:00 2001 From: nihonium Date: Mon, 28 Mar 2022 22:16:10 +0300 Subject: [PATCH] B,C,F --- nasm/B.asm | 28 ++++++++++++++++++++++++++++ nasm/C.asm | 29 +++++++++++++++++++++++++++++ nasm/F.asm | 34 ++++++++++++++++++++++++++++++++++ nasm/notices.md | 4 ++++ 4 files changed, 95 insertions(+) create mode 100644 nasm/B.asm create mode 100644 nasm/C.asm create mode 100644 nasm/F.asm diff --git a/nasm/B.asm b/nasm/B.asm new file mode 100644 index 0000000..0e67c8b --- /dev/null +++ b/nasm/B.asm @@ -0,0 +1,28 @@ +extern printf +extern scanf +global main + +section .text +main: + push x + push nya1 + call scanf + add esp, 8 + + mov eax, [x] + and eax, 0xFFFF + + push eax + push nya + call printf + add esp, 8 + + xor eax, eax + ret + +section .data +nya db "%u", 10, 0 +nya1 db "%u", 0 + +section .bss +x resd 1 diff --git a/nasm/C.asm b/nasm/C.asm new file mode 100644 index 0000000..7f272ca --- /dev/null +++ b/nasm/C.asm @@ -0,0 +1,29 @@ +extern printf +extern scanf +global main + +section .text +main: + push y + push x + push nya1 + call scanf + add esp, 12 + + mov eax, dword [x] + sub eax, 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/F.asm b/nasm/F.asm new file mode 100644 index 0000000..289261f --- /dev/null +++ b/nasm/F.asm @@ -0,0 +1,34 @@ +extern scanf +extern printf + +global main + +section .text +main: + push y + push x + push nya + call scanf + add esp, 12 + + mov eax, [x] + cmp eax, [y] + jle end + mov eax, [y] + +end: + push eax + push nya1 + call printf + add esp, 8 + + xor eax, eax + ret + +section .data +nya db "%d %d", 0 +nya1 db "%d", 10, 0 + +section .bss +x resd 1 +y resd 1 diff --git a/nasm/notices.md b/nasm/notices.md index 4fa4e32..7b5274f 100644 --- a/nasm/notices.md +++ b/nasm/notices.md @@ -3,6 +3,10 @@ * Есть стандартная библиотека, с которой это будет слинковано * return 0 * Очистить стек + +# O + +* int 80h * # Notices