Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions content/asm_1.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,9 @@ Let's write our first assembly program based on this code sample:
```assembly
;; Definition of the `data` section
section .data
;; String variable with the value `hello world!`
msg db "hello, world!"
;; String variable with the value `hello world!`.
;; `10` is the ASCII code for the line feed character (LF), i.e., '\n'.
msg db "hello, world!", 10

;; Definition of the text section
section .text
Expand All @@ -158,8 +159,8 @@ _start:
mov rdi, 1
;; Set the second argument of `sys_write` to the reference of the `msg` variable.
mov rsi, msg
;; Set the third argument of `sys_write` to the length of the `msg` variable's value (13 bytes).
mov rdx, 13
;; Set the third argument of `sys_write` to the length of the `msg` variable's value (14 bytes).
mov rdx, 14
;; Call the `sys_write` system call.
syscall

Expand Down
11 changes: 6 additions & 5 deletions hello/hello.asm
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
;; Definition of the `data` section
section .data
;; String variable with the value `hello world!`
msg db "hello, world!"
;; String variable with the value `hello world!`.
;; `10` is the ASCII code for the line feed character (LF), i.e., '\n'.
msg db "hello, world!", 10

;; Definition of the text section
section .text
Expand All @@ -16,8 +17,8 @@ _start:
mov rdi, 1
;; Set the second argument of `sys_write` to the reference of the `msg` variable.
mov rsi, msg
;; Set the third argument of `sys_write` to the length of the `msg` variable's value (13 bytes).
mov rdx, 13
;; Set the third argument of `sys_write` to the length of the `msg` variable's value (14 bytes).
mov rdx, 14
;; Call the `sys_write` system call.
syscall

Expand All @@ -26,4 +27,4 @@ _start:
;; Set the first argument of `sys_exit` to 0. The 0 status code is success.
mov rdi, 0
;; Call the `sys_exit` system call.
syscall
syscall
Loading