in out
This commit is contained in:
parent
0593429e8c
commit
63ba3e6da3
Binary file not shown.
|
@ -4,8 +4,22 @@ segment readable executable
|
||||||
|
|
||||||
entry $
|
entry $
|
||||||
; read from stdin
|
; read from stdin
|
||||||
xor rax, rax
|
xor rax, rax ; is rax and rax equal to itself? yes? rax is set to 0 (for sys_read)
|
||||||
|
xor rdi, rdi ; same thing but rdi (for stdin)
|
||||||
|
mov rsi, buf ; direct addressing - move address of buf to rsi (buffer address)
|
||||||
|
mov rdx, 80 ; buffer size
|
||||||
|
syscall
|
||||||
|
|
||||||
|
; write to stdout
|
||||||
|
mov rax, 1 ; sys_write
|
||||||
|
mov rdi, 1 ; stdout
|
||||||
|
mov rdx, 80
|
||||||
|
syscall
|
||||||
|
|
||||||
|
; exit program
|
||||||
|
xor rdi, rdi ; exit code 0
|
||||||
|
mov rax, 60 ; sys_exit
|
||||||
|
syscall
|
||||||
|
|
||||||
segment readable writable
|
segment readable writable
|
||||||
buf rb 80
|
buf rb 80
|
||||||
|
|
Loading…
Reference in New Issue