-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelloWorldAsm.s
More file actions
25 lines (22 loc) · 793 Bytes
/
helloWorldAsm.s
File metadata and controls
25 lines (22 loc) · 793 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
.global _start
.text
_start:
# write(1, message, 13)
mov $1, %rax # system call 1 is write
mov $1, %rdi # file handle 1 is stdout
mov $message, %rsi # address of string to output
mov $13, %rdx # number of bytes
syscall # invoke operating system to do the write
mov $1, %rax
mov $1, %rdi
mov $message2, %rsi
mov $13, %rdx
syscall
# exit(0)
mov $60, %rax # system call 60 is exit
xor %rdi, %rdi # we want return code 0
syscall # invoke operating system to exit
message:
.ascii "Hello, world\n"
message2:
.ascii "Hello, Again\n"