feat: get input

This commit is contained in:
Ahmet Kaan GÜMÜŞ 2024-01-04 02:31:13 +03:00
parent 8e772907f5
commit 3d14cbf731
3 changed files with 41 additions and 2 deletions

3
.gitignore vendored
View file

@ -1,3 +1,2 @@
*.o
main
derle
main*

36
004-get_input.s Normal file
View file

@ -0,0 +1,36 @@
.global _start
.intel_syntax noprefix
.data
buffer:
.byte 0x00
.text
_start:
//hello world
mov rax, 1
mov rdi, 1
lea rsi, [hello_world]
mov rdx, 13
syscall
//get intput
mov rax, 0
mov rdi, 0
lea rsi, [buffer]
mov rdx, 1
syscall
//print input
mov rax, 1
mov rdi, 1
lea rsi, [buffer]
mov rdx, 3
syscall
//exit
mov rax, 60
syscall
hello_world:
.asciz "Hello World\n"

4
compile Executable file
View file

@ -0,0 +1,4 @@
#!/bin/bash
as main.s -o main.o
gcc main.o -o main -nostdlib -static
./main