From 3d14cbf731bb2662cc6486faa1886a8e5205f09a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=9CM=C3=9C=C5=9E?= <96421894+Tahinli@users.noreply.github.com> Date: Thu, 4 Jan 2024 02:31:13 +0300 Subject: [PATCH] feat: get input --- .gitignore | 3 +-- 004-get_input.s | 36 ++++++++++++++++++++++++++++++++++++ compile | 4 ++++ 3 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 004-get_input.s create mode 100755 compile diff --git a/.gitignore b/.gitignore index 579ea38..5a20b8d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ *.o -main -derle \ No newline at end of file +main* \ No newline at end of file diff --git a/004-get_input.s b/004-get_input.s new file mode 100644 index 0000000..95bd9ba --- /dev/null +++ b/004-get_input.s @@ -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" diff --git a/compile b/compile new file mode 100755 index 0000000..921ed78 --- /dev/null +++ b/compile @@ -0,0 +1,4 @@ +#!/bin/bash +as main.s -o main.o +gcc main.o -o main -nostdlib -static +./main