File tree Expand file tree Collapse file tree 2 files changed +11
-9
lines changed
Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -142,8 +142,9 @@ Let's write our first assembly program based on this code sample:
142142``` assembly
143143;; Definition of the `data` section
144144section .data
145- ;; String variable with the value `hello world!`
146- msg db "hello, world!"
145+ ;; String variable with the value `hello world!`.
146+ ;; `10` is the ASCII code for the line feed character (LF), i.e., '\n'.
147+ msg db "hello, world!", 10
147148
148149;; Definition of the text section
149150section .text
@@ -158,8 +159,8 @@ _start:
158159 mov rdi, 1
159160 ;; Set the second argument of `sys_write` to the reference of the `msg` variable.
160161 mov rsi, msg
161- ;; Set the third argument of `sys_write` to the length of the `msg` variable's value (13 bytes).
162- mov rdx, 13
162+ ;; Set the third argument of `sys_write` to the length of the `msg` variable's value (14 bytes).
163+ mov rdx, 14
163164 ;; Call the `sys_write` system call.
164165 syscall
165166
Original file line number Diff line number Diff line change 11;; Definition of the `data` section
22section .data
3- ;; String variable with the value `hello world!`
4- msg db "hello, world!"
3+ ;; String variable with the value `hello world!`.
4+ ;; `10` is the ASCII code for the line feed character (LF), i.e., '\n'.
5+ msg db "hello, world!" , 10
56
67;; Definition of the text section
78section .text
@@ -16,8 +17,8 @@ _start:
1617 mov rdi , 1
1718 ;; Set the second argument of `sys_write` to the reference of the `msg` variable.
1819 mov rsi , msg
19- ;; Set the third argument of `sys_write` to the length of the `msg` variable's value (13 bytes).
20- mov rdx , 13
20+ ;; Set the third argument of `sys_write` to the length of the `msg` variable's value (14 bytes).
21+ mov rdx , 14
2122 ;; Call the `sys_write` system call.
2223 syscall
2324
@@ -26,4 +27,4 @@ _start:
2627 ;; Set the first argument of `sys_exit` to 0. The 0 status code is success.
2728 mov rdi , 0
2829 ;; Call the `sys_exit` system call.
29- syscall
30+ syscall
You can’t perform that action at this time.
0 commit comments