< < BACK

Hello World!

01/02/2025 1:31am

This sort of acts as the hello world of this site, given that it's the first blog post and the one I'm using to test out how to write code blocks and everything. It would be instumental to actually write something here, so I thought I'd put a working x86_64 NASM code to write Hello World:

 
            section .data 
              msg     db "Hello World!", 10 
              msg_len equ $-msg
              
            section .text
              gloal _start 
            
            _start: 
              mov rax, 1
              mov rdi, 1
              mov rsi, msg
              mov rdx, msg_len
              syscall 
              
              mov rax, 60
              mov rdi, 1
              syscall
          

For the unitiated into the world of assembly, this short program stores the string into a buffer (using db), and makes two syscalls. The "write" syscall is made by moving the value 1 into the register rax, and standard output (console) is indicated through mov rdi, 1 . Then, the exit syscall is made using mov rax, 60 .

In Java, one could write the same code as such:


          public class Main { 
            public static void(String args[]) { 
              System.out.println("Hello World"); 
              return
            } 
          }
          

Thus, the rough layout of each blog post is established, although there are still some things I would like to fix!

< < BACK