feat: get input
This commit is contained in:
parent
8e772907f5
commit
3d14cbf731
3 changed files with 41 additions and 2 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,3 +1,2 @@
|
||||||
*.o
|
*.o
|
||||||
main
|
main*
|
||||||
derle
|
|
36
004-get_input.s
Normal file
36
004-get_input.s
Normal 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
4
compile
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/bash
|
||||||
|
as main.s -o main.o
|
||||||
|
gcc main.o -o main -nostdlib -static
|
||||||
|
./main
|
Loading…
Add table
Add a link
Reference in a new issue