Where do we use assembly language programming

In times of high-level languages ​​such as C and C ++, programming in machine language seems to be obsolete for many programmers. With blind trust in the optimizations of today's compilers, the clock frequencies of the CPUs and huge memories, performance is consciously wasted in many cases.

Assembler is used wherever

Konstantin Boldyshev

The program 'Hello world' is usually the first C program that you write as a C beginner.

Now in assembler:

Now we implement the same i386 assembler for Linux. In addition to the actual assembler, we also need a linker that makes the object file of the assembler executable.

We don't use that though

section .text; section declaration
global _start; Entry point for the ELF linker / loader
_begin:; Program start
movedx, len ; third argument, text length
movecx, msg ; second argument, address of our text in memory
movebx, 1; first argument, file handle stdout
moveax, 4; System call no.4 = sys_write
int0x80; Call the kernel with the above system call parameters
movebx, 0; first argument for sys_exit (exit program)
moveax, 1; System call no. 1 (sys_exit) program end
int0x80; Call the kernel with the above system call parameters
section .data; section declaration
msgdb'Hello world', 0x0A; our text including line break LF (0x0A)
len equ$ - msg ; Calculate the length of the text (12 bytes)

After we have entered the source text (hello.asm) using a text editor, it must now be translated and assembled.

Linux Assembly HOWTO

List of Linux / i386 system calls - Linux system calls

  • The assembler book (4th edition)
    T. Podschun
    Addison-Wesley-Verlag 1999
    ISBN 3-8273-1413-1
  • Linux kernel programming 6th edition
    Michael Beck
    Addison-Wesley-Verlag 2001
    ISBN 3-8273-1476-3
  • Linux Driver Drivers (2nd edition English)
    Alessandro Rubini / Jonathan Corbet
    O'Reilly Publishing 2001
    ISBN 3-89721-122-X
  • Entrances and exits under control
    Linux-Magazin 10/99 pp. 34-42
    (very nice article about the control
    of I / O ports in Linux)
  • Measuring with Linux (A / D converter)
    Linux-Intern 2/2001 p.79-83