From 8d019a59d7f983aa9bbeb91d83f4f5619b6a2fb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D1=8B=D1=82=D0=BA=D0=BE=D0=B2=20=D0=A0=D0=BE=D0=BC?= =?UTF-8?q?=D0=B0=D0=BD?= Date: Mon, 22 Sep 2025 00:58:48 +0300 Subject: [PATCH] minimal -> sum --- minimal/.vscode/settings.json | 3 --- nasm.code-workspace | 4 ++-- {minimal => sum}/.vscode/launch.json | 8 ++++---- {minimal => sum}/.vscode/tasks.json | 8 ++++---- minimal/minimal.asm => sum/sum.asm | 9 +++++---- 5 files changed, 15 insertions(+), 17 deletions(-) delete mode 100644 minimal/.vscode/settings.json rename {minimal => sum}/.vscode/launch.json (66%) rename {minimal => sum}/.vscode/tasks.json (90%) rename minimal/minimal.asm => sum/sum.asm (98%) diff --git a/minimal/.vscode/settings.json b/minimal/.vscode/settings.json deleted file mode 100644 index 9ddf6b2..0000000 --- a/minimal/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "cmake.ignoreCMakeListsMissing": true -} \ No newline at end of file diff --git a/nasm.code-workspace b/nasm.code-workspace index 0e9177a..c39e75f 100644 --- a/nasm.code-workspace +++ b/nasm.code-workspace @@ -4,7 +4,7 @@ "path": "casm" }, { - "path": "minimal" + "path": "sum" }, { "path": "docs" @@ -15,4 +15,4 @@ "debug.inlineValues": "on", "editor.codeLens": false, } -} \ No newline at end of file +} diff --git a/minimal/.vscode/launch.json b/sum/.vscode/launch.json similarity index 66% rename from minimal/.vscode/launch.json rename to sum/.vscode/launch.json index cbf498a..a63e4ae 100644 --- a/minimal/.vscode/launch.json +++ b/sum/.vscode/launch.json @@ -2,18 +2,18 @@ "version": "0.2.0", "configurations": [ { - "name": "lldb x64", + "name": "(lldb) Launch x64", "type": "lldb", "request": "launch", - "program": "${workspaceFolder}/build/minimal", + "program": "${workspaceFolder}/build/sum", "cwd": "${workspaceFolder}/build", "preLaunchTask": "asm64", }, { - "name": "cppdbg x64", + "name": "(gdb+gcc) Launch x64", "type": "cppdbg", "request": "launch", - "program": "${workspaceFolder}/build/minimal", + "program": "${workspaceFolder}/build/sum", "cwd": "${workspaceFolder}/build", "preLaunchTask": "asm64+gcc" } diff --git a/minimal/.vscode/tasks.json b/sum/.vscode/tasks.json similarity index 90% rename from minimal/.vscode/tasks.json rename to sum/.vscode/tasks.json index 645fd7a..c3d27ff 100644 --- a/minimal/.vscode/tasks.json +++ b/sum/.vscode/tasks.json @@ -7,8 +7,8 @@ "command": [ "builddir=${workspaceFolder}/build;", "mkdir -p $builddir;", - "rawfilename=$builddir/minimal;", - "nasm -gdwarf -f elf64 -o $rawfilename.o ${workspaceFolder}/minimal.asm;", + "rawfilename=$builddir/sum;", + "nasm -gdwarf -f elf64 -o $rawfilename.o ${workspaceFolder}/sum.asm;", "ld -g -o $rawfilename $rawfilename.o;" ], "problemMatcher": { @@ -33,8 +33,8 @@ "command": [ "builddir=${workspaceFolder}/build;", "mkdir -p $builddir;", - "rawfilename=$builddir/minimal;", - "nasm -gdwarf -f elf64 -o $rawfilename.o ${workspaceFolder}/minimal.asm;", + "rawfilename=$builddir/sum;", + "nasm -gdwarf -f elf64 -o $rawfilename.o ${workspaceFolder}/sum.asm;", "gcc -o $rawfilename $rawfilename.o;" ], "problemMatcher": { diff --git a/minimal/minimal.asm b/sum/sum.asm similarity index 98% rename from minimal/minimal.asm rename to sum/sum.asm index 63163f0..d36404b 100644 --- a/minimal/minimal.asm +++ b/sum/sum.asm @@ -1,4 +1,4 @@ -global main +global _start section .data buff times 256 db 0 @@ -8,7 +8,7 @@ count dq 0 section .text default rel -main: +_start: call read_text lea rsi, [rel buff] ; поставить указатель на начало буфера @@ -25,8 +25,9 @@ main: mov rdx, [count] call write_text - mov rax, 0 - ret + mov rax, 60 + mov rdi, 0 + syscall ; Функция складывает два значения ; In: RDI, RSI