title: How to create address of string inline in NASM
body: <p>I am a total NASM/ASSEMBLY newbie.</p>
  <p>I am writing a compiler (Just for education purposes), in my compiler I translate the source code into assembly and use NASM to compile it to object file and then use a linker to create a executable file.</p>
  <p>I am using 64 bit ubuntu.</p>
  <p>I want to convert this to assembly</p>
  <pre class="lang-py prettyprint-override"><code>print(&quot;Hello World!&quot;)
  </code></pre>
  <p>One way is to write</p>
  <pre><code>section .data
  
  message db &quot;Hello World!&quot;, 0
  messagel equ $-message-1
  
  section .text
  
  
     mov rax, 1
     mov rdi, 1
     mov rsi, message
     mov rdx, messagel
     syscall
  
     
     mov rax, 60
     mov rdi, 0
     syscall
  </code></pre>
  <p>But I dont want to store &quot;Hello World!&quot; string forever after the syscall I want it to be gone.</p>
  <p>I tried something something like this</p>
  <pre><code>
    mov rax, 1
    mov rdi, 1 
    mov rsi, &quot;Hello World&quot;, 0
    mov rdx, 12
  </code></pre>
  <p>But it did not work since I have to pass <code>address</code> of string in <code>rsi</code> not the <code>string</code> itself.</p>
  <p>So I am wondering is there any way to inline the address of string</p>