hello world
This commit is contained in:
parent
f15e3f33c2
commit
1f0adc0a69
2 changed files with 35 additions and 0 deletions
27
hello.s
Normal file
27
hello.s
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
global _start
|
||||||
|
|
||||||
|
; constants
|
||||||
|
SYS_WRITE equ 1
|
||||||
|
SYS_EXIT equ 60
|
||||||
|
STDOUT equ 1
|
||||||
|
|
||||||
|
SECTION .data
|
||||||
|
hello db "Hello world!", 0x0a
|
||||||
|
hello_len equ $ - hello
|
||||||
|
|
||||||
|
SECTION .text
|
||||||
|
|
||||||
|
_start:
|
||||||
|
; syscall(SYS_WRITE, STDOUT, hello, hello_len);
|
||||||
|
mov rax, SYS_WRITE
|
||||||
|
mov rdi, STDOUT
|
||||||
|
mov rsi, hello
|
||||||
|
mov rdx, hello_len
|
||||||
|
syscall
|
||||||
|
push rax
|
||||||
|
|
||||||
|
; syscall(SYS_EXIT, <sys_write return value> - hello_len);
|
||||||
|
mov rax, SYS_EXIT
|
||||||
|
pop rdi
|
||||||
|
sub rdi, hello_len
|
||||||
|
syscall
|
8
readme.md
Normal file
8
readme.md
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# x86_64 assembly
|
||||||
|
|
||||||
|
https://userpages.cs.umbc.edu/tsimo1/CMSC313/nasmdoc/html/nasmdoc3.html
|
||||||
|
https://x64.syscall.sh/
|
||||||
|
|
||||||
|
https://web.stanford.edu/class/cs107/resources/x86-64-reference.pdf
|
||||||
|
https://ggbaker.ca/295/x86.html
|
||||||
|
https://josemariasola.github.io/reference/assembler/Stanford%20CS107%20Guide%20to%20x86-64.pdf
|
Loading…
Add table
Add a link
Reference in a new issue