hello world

This commit is contained in:
2025-02-03 21:32:00 +00:00
parent 5e28619330
commit 534a7ca677
6 changed files with 58 additions and 1 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
/bin/
/out/

6
.vscode/extensions.json vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"recommendations": [
"maziac.asm-code-lens",
"vadimcn.vscode-lldb"
]
}

13
.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,13 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "GDB64",
"program": "bin/game",
"stopOnEntry": false,
"preLaunchTask": "asm64"
}
]
}

14
.vscode/tasks.json vendored Normal file
View File

@@ -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
}
}
]
}

View File

@@ -1 +1,5 @@
Making a game for linux terminal using pure asm 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)

18
game.s Normal file
View File

@@ -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