Basics & Sample Programs


Here are some sample programs. System calls are made using the syscall instruction on an x86-64 version of GNU/Linux as opposed to using int 0x80 on an x86 version of GNU/Linux. All the programs are in long mode. The list of system calls can be found in /usr/include/asm-x86_64/unistd.h.

Calling Convention


List of Sample Programs

  1. Get the CPU name using CPUID instruction
  2. A "Hello World!" sample program
  3. The next five programs are samples from Dr. Paul Carter's assembly tutorial . They have been converted from 32-bit to 64-bit long mode.
  4. Sample input output functions
  5. A sample program for multiplication and division operations on an integer
  6. A sample program to find prime numbers demonstrating use of CMP and JMP instructions in programs
  7. A sample program to demonstrate bit shifts
  8. A sample program to print greater of two numbers without using jump or branch instructions
  9. A sample program to demonstrate recursion by calculate factorial of a number
  10. A sample program to calculate the square of a Hilbert's matrix
  11. A sample program to demonstrate working of a doubly linked-list



Tweet


Follow @_vicash_