<< x86_assembly

x86 Assembly Basic

File Extension

Captial extension .S represents the assembly language file that still needs to be passed into a preprocessor, i.e. contains include command, denoted as .sx also, while .s represnts the pure assembly code that can be complied into object file (.o file) directly.

Register

Register is the variable of CPU, but other than variable in the programming language, register used specific name to play specific function.

ax, bx, cx, dx and their extention are the most common-used register, which are assigned as the special function respectically:

ax, bx, cx, dx represent 16-bit register, each of them can be devided to the low bits parts (0~7 bits) and high bits part (8~15 bits), called al and ah for ax and similarly for the rest. The extended 32-bit eax, ebx, ecx, edx are most famous register in modern 32-bit machine, and 64-bit rax, rbx, rcx, rdx.

Instruction

mov

Four types of mov instruction included: movb, movw, movl, movq.

Four typical usage of mov:

Unittest For x86 Assembly Basic

  1. What’s the difference between .S file and .s file?
  2. Explain the usage of following register: ax, bx, cx, dx.
  3. Explain the difference among ax, eax, rax.
  4. Give the four types of mov instruction.