Search
 
SCRIPT & CODE EXAMPLE
 

C

Write a 64-bit program in assembly that prints Hello, world in .asm

; ----------------------------------------------------------------------------------------; Writes "Hello, World" to the console using only system calls. Runs on 64-bit Linux only.; To assemble and run:;;     nasm -felf64 hello.asm && ld hello.o && ./a.out; ----------------------------------------------------------------------------------------          global    _start          section   .text_start:   mov       rax, 1                  ; system call for write          mov       rdi, 1                  ; file handle 1 is stdout          mov       rsi, message            ; address of string to output          mov       rdx, 13                 ; number of bytes          syscall                           ; invoke operating system to do the write          mov       rax, 60                 ; system call for exit          xor       rdi, rdi                ; exit code 0          syscall                           ; invoke operating system to exit          section   .datamessage:  db        "Hello, World", 10      ; note the newline at the end
Comment

PREVIOUS NEXT
Code Example
C :: form controls in bootsrap 
C :: malloc contiguous 2d array 
C :: typedef vs #define 
C :: C (ANSI) 
C :: check if pid exists c 
C :: syntax 
C :: concatenate two strings without standard library in C 
C :: highest common factor algorithm in c 
C :: malloc 
C :: Rounding Floating Point Number To two Decimal Places in C 
C :: turn a char array into double C 
C :: maximo comun divisor 
C :: include ‘<stdlib.h’ or provide a declaration of ‘exit’ 
C :: pyinstaller hidden import tensorflow not found 
C :: how to free memory in c 
C :: command line arguments c 
C :: tuples in c 
C :: c command line arguments parser 
C :: rust unit test display 
C :: declare an array 
C :: deleting a word with copy fuction c code 
C :: arduino internal pull up resistor 
C :: arduino vscode upload choosing sketch 
C :: Tensorflow: What are the "output_node_names" for freeze_graph.py in the model_with_buckets model? 
C :: reset c array to zero 
C :: C Program to Maintain an Inventory of items in Online Store 
C :: unigine 
C :: c program boilerplate code 
C :: variadic macros c 
C :: manasa loves maths solution IN C 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =