From 95e5aab32da8c07bcffd3b93a7ec43e53f532728 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: Tue, 16 Sep 2025 00:48:22 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=B4=D0=B3=D0=BE=D1=82=D0=BE?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D0=BE=20=D1=80=D0=B0=D0=B1=D0=BE=D1=87?= =?UTF-8?q?=D0=B5=D0=B5=20=D0=BF=D1=80=D0=BE=D1=81=D1=82=D1=80=D0=B0=D0=BD?= =?UTF-8?q?=D1=81=D1=82=D0=B2=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 12 +-------- .vscode/launch.json | 30 +++++++++++++++++++++++ .vscode/settings.json | 3 +++ .vscode/tasks.json | 57 +++++++++++++++++++++++++++++++++++++++++++ minimal/minimal.asm | 16 ++++++++++++ 5 files changed, 107 insertions(+), 11 deletions(-) create mode 100644 .vscode/launch.json create mode 100644 .vscode/settings.json create mode 100644 .vscode/tasks.json create mode 100644 minimal/minimal.asm diff --git a/.gitignore b/.gitignore index 46f42f8..e864704 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1 @@ -CMakeLists.txt.user -CMakeCache.txt -CMakeFiles -CMakeScripts -Testing -Makefile -cmake_install.cmake -install_manifest.txt -compile_commands.json -CTestTestfile.cmake -_deps +**/build/ \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..de603e1 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,30 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "type": "lldb", + "request": "launch", + "name": ": lldb debug x64", + "program": "${fileDirname}/build/${fileBasenameNoExtension}", + "cwd": "${fileDirname}/build", + "preLaunchTask": "asm64" + }, + { + "type": "lldb", + "request": "launch", + "name": ": lldb+GCC debug x64", + "program": "${fileDirname}/build/${fileBasenameNoExtension}", + "cwd": "${fileDirname}/build", + "preLaunchTask": "asm64+gcc" + }, + + { + "type": "lldb", + "request": "launch", + "name": "minimal: lldb debug x64", + "program": "${workspaceFolder}/minimal/build/minimal", + "cwd": "${workspaceFolder}/minimal/build" + // TODO тут требуется ещё указать задачу сборки minimal, но её ещё нет + }, + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..79cacfe --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "debug.allowBreakpointsEverywhere": true +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..d7d2831 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,57 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "asm64", + "type": "shell", + "command": [ + "builddir=${fileDirname}/build;", + "mkdir -p $builddir;", + "rawfilename=$builddir/${fileBasenameNoExtension};", + "nasm -F dwarf -g -f elf64 -i ${fileDirname} -o $rawfilename.o ${file};", + "ld -m elf_x86_64 -o $rawfilename $rawfilename.o;" + ], + "problemMatcher": { + "pattern": { + "regexp": "error" + } + }, + "presentation": { + "focus": true, + "panel": "dedicated", + "reveal": "silent", + "clear": true + }, + "group": { + "kind": "build", + "isDefault": true + } + }, + + { + "label": "asm64+gcc", + "type": "shell", + "command": [ + "builddir=${fileDirname}/build;", + "mkdir -p $builddir;", + "rawfilename=$builddir/${fileBasenameNoExtension};", + "nasm -F dwarf -g -f elf64 -i ${fileDirname} -o $rawfilename.o ${file};", + "gcc -m64 -o $rawfilename $rawfilename.o;" + ], + "problemMatcher": { + "pattern": { + "regexp": "error" + } + }, + "presentation": { + "focus": true, + "panel": "dedicated", + "reveal": "silent", + "clear": true + }, + "group": { + "kind": "build" + } + } + ] +} diff --git a/minimal/minimal.asm b/minimal/minimal.asm new file mode 100644 index 0000000..dc6070c --- /dev/null +++ b/minimal/minimal.asm @@ -0,0 +1,16 @@ +global _start + +section .data +text_message: db "Welcome to NASM!", 0xA + +section .text +_start: + mov rax, 1 ; write + mov rdi, 1 ; stdout + mov rsi, text_message + mov rdx, 17 ; длина строки в байтах + syscall + + mov rax, 60 ; exit + mov rdi, 1 ; код возврата = 0 + syscall \ No newline at end of file