Skip to content

Add a newline to the hello, world! example to avoid confusion#78

Merged
0xAX merged 2 commits into0xAX:masterfrom
thisisnotanorga:asm-1
Mar 9, 2026
Merged

Add a newline to the hello, world! example to avoid confusion#78
0xAX merged 2 commits into0xAX:masterfrom
thisisnotanorga:asm-1

Conversation

@douxxtech
Copy link
Contributor

First of all, thanks for those posts that explain very well the language! I'm new to it and still have a lot to learn, but this is a great introduction.

Description
While trying to run the provided hello world snippet, I ran into an issue: the code compiled correctly, but no hello, world! was displayed when run.

image

I think it might be related to my bash prompt, but I can't confirm that.
Adding a newline character (LF, ASCII 10) at the end of the string fixed the issue:

image

Here are the snippets I edited in this PR:

;; Definition of the `data` section
section .data
        ;; 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 ; <- addition here and in the comment
        ;; Set the third argument of `sys_write` to the length of the `msg` variable's value (14 bytes).
        mov rdx, 14 ; edited the bytes count to match the new one

Changes proposed in this pull request:

  • Add a newline character to the hello, world! example

Additionally, I saw that you're using ;; for comments in all of your code snippets, but the language seems to only require one (;). Is it some sort of convention?

@0xAX
Copy link
Owner

0xAX commented Mar 9, 2026

@douxxtech thank you for PR!

@0xAX 0xAX merged commit 3352c1f into 0xAX:master Mar 9, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants