From 534a7ca677744d55959cc6868029880635530fdc Mon Sep 17 00:00:00 2001 From: AlexLemminG Date: Mon, 3 Feb 2025 21:32:00 +0000 Subject: [PATCH] hello world --- .gitignore | 2 ++ .vscode/extensions.json | 6 ++++++ .vscode/launch.json | 13 +++++++++++++ .vscode/tasks.json | 14 ++++++++++++++ README.md | 6 +++++- game.s | 18 ++++++++++++++++++ 6 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 .vscode/extensions.json create mode 100644 .vscode/launch.json create mode 100644 .vscode/tasks.json create mode 100644 game.s diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..477cbe2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/bin/ +/out/ \ No newline at end of file diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..af3525c --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,6 @@ +{ + "recommendations": [ + "maziac.asm-code-lens", + "vadimcn.vscode-lldb" + ] +} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..8429b97 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,13 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "type": "lldb", + "request": "launch", + "name": "GDB64", + "program": "bin/game", + "stopOnEntry": false, + "preLaunchTask": "asm64" + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..0b49d62 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,14 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "asm64", + "type": "shell", + "command": "mkdir -p out; mkdir -p bin; nasm -F dwarf -g -f elf64 game.s -o out/game.o; ld -m elf_x86_64 -o bin/game out/game.o;", + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} \ No newline at end of file diff --git a/README.md b/README.md index fb6e211..55b3aa5 100644 --- a/README.md +++ b/README.md @@ -1 +1,5 @@ -Making a game for linux terminal using pure asm \ No newline at end of file +Making a game for linux terminal using pure asm + +# References: +[Computer Enhance Course](https://www.computerenhance.com) +[Linux syscalls reference table](https://syscalls.mebeim.net/?table=x86/64/x64/v6.12) \ No newline at end of file diff --git a/game.s b/game.s new file mode 100644 index 0000000..62864d0 --- /dev/null +++ b/game.s @@ -0,0 +1,18 @@ +global _start + +section .text + +_start: + mov rax, 1 ; sys_write + mov rdi, 1 ; out + mov rsi, helloThere ; str + mov rdx, helloThereLen ; size + syscall ; + + mov rax, 60 ; sys_exit + mov rdi, 0 ; code + syscall ; + +section .rodata + helloThere: db "Hello there ;)", 0xA, "General Kenobi!!!", 0xA + helloThereLen: equ $ - helloThere \ No newline at end of file